/* Settings: the sidebar entry (avatar, name, gear) and the settings page it opens. */

/* Sidebar entry. Selection stays blue like the nav links. */
.student { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 8px 10px; border-radius: 11px; color: var(--ink); text-decoration: none; }
.student:hover { background: var(--surface-soft); }
.student.active { background: var(--blue-pale); color: var(--blue-deep); }
.student:focus-visible { outline: 2px solid var(--blue-line); outline-offset: 2px; }
.student .avatar { flex-shrink: 0; box-shadow: 0 0 0 1px var(--blue-line); }
.student-identity { min-width: 0; flex: 1; }
.student-identity strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.student-gear { flex-shrink: 0; width: 17px; height: 17px; fill: none; stroke: var(--nav-neutral); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.student.active .student-gear { stroke: currentColor; }
@media (max-width: 900px) {
  .student { justify-content: center; padding: 8px 0; }
  .student-identity, .student-gear { display: none; }
}
@media (max-width: 650px) {
  .sidebar.mobile-open .student { justify-content: flex-start; padding: 8px 10px; }
  .sidebar.mobile-open .student-identity, .sidebar.mobile-open .student-gear { display: block; }
}

/* Page: a profile header, then one list per group of settings, as wide as other pages. */

.settings-profile { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 6px 4px 4px; }
.avatar-button { position: relative; flex-shrink: 0; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.avatar-button .avatar { box-shadow: 0 0 0 1px var(--blue-line); }
.avatar-button:hover .avatar { box-shadow: 0 0 0 3px var(--blue-pale), 0 0 0 4px var(--blue-line); }
.avatar-button:focus-visible { outline: 2px solid var(--blue-line); outline-offset: 3px; }
.avatar-button:disabled { opacity: .6; cursor: wait; }
.avatar-badge { position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--muted); }
.avatar-badge svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.avatar-button:hover .avatar-badge { color: var(--blue-deep); }
.settings-identity { min-width: 0; }
.settings-name { margin: 0; font-size: 19px; line-height: 1.3; overflow-wrap: anywhere; }
.spark-record-summary { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.settings-profile #accountSwitch { height: 34px; font-size: 12px; }

.settings-group { margin-top: 26px; }
.settings-group > h3 { margin: 0 0 8px 4px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.settings-list { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 4px 14px color-mix(in srgb, var(--shadow-color) 2.5%, transparent); }
.settings-row { position: relative; display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 11px 18px; font-size: 13px; }
.settings-row + .settings-row { border-top: 1px solid var(--line); }
label.settings-row:has(.switch) { cursor: pointer; }
.settings-label { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.settings-title { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; }
.settings-title label { cursor: pointer; }
.settings-label small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.settings-control { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.settings-value { color: var(--ink); }
.settings-row select { flex: 0 1 220px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.settings-row select:focus-visible { outline: 2px solid var(--blue-line); outline-offset: 1px; }
.settings-row .secondary-button { height: 34px; font-size: 12px; }
.settings-link { padding: 4px 0; border: 0; background: none; color: var(--blue-ink); font: inherit; font-size: 12px; cursor: pointer; }
.settings-link:focus-visible { outline: 2px solid var(--blue-line); outline-offset: 2px; border-radius: 4px; }
.settings-identity .settings-link { margin-top: 6px; }

/* On/off switch drawn on the checkbox itself, so labels, tests and assistive tech keep the native control. */
.switch { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 38px; height: 22px; margin: 0; border-radius: 999px; background: color-mix(in srgb, var(--muted) 38%, var(--paper)); cursor: pointer; transition: background-color .18s; }
.switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px color-mix(in srgb, #000 22%, transparent); transition: transform .18s; }
.switch:checked { background: var(--blue); }
.switch:checked::before { transform: translateX(16px); }
.switch:focus-visible { outline: 2px solid var(--blue-line); outline-offset: 2px; }
.switch:disabled { opacity: .55; cursor: wait; }

/* Circled-i explanations: hover or focus shows the tip, a tap toggles it. */
.settings-info { display: inline-flex; }
.settings-info-button { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; border: 1px solid currentColor; border-radius: 50%; background: transparent; color: var(--muted); font: 600 12px Georgia, serif; cursor: pointer; }
.settings-info-button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.settings-info-tip { display: none; position: absolute; z-index: 10; top: calc(100% + 6px); left: 0; width: min(340px, 100%); box-sizing: border-box; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); box-shadow: 0 8px 24px #0002; font-size: 13px; font-weight: 400; line-height: 1.6; }
.settings-info:hover .settings-info-tip, .settings-info:focus-within .settings-info-tip, .settings-info-button[aria-expanded="true"] + .settings-info-tip { display: block; }
.settings-row .settings-info-tip { left: 18px; top: calc(100% - 6px); }

@media (max-width: 600px) {
  .settings-profile { grid-template-columns: auto minmax(0, 1fr); gap: 14px; }
  .settings-profile #accountSwitch { grid-column: 2; justify-self: start; }
  .settings-row { flex-wrap: wrap; gap: 8px 12px; padding: 11px 14px; }
  .settings-row select { flex: 1 1 100%; }
  .settings-row .settings-info-tip { left: 14px; width: calc(100% - 28px); }
}
