/* Shared responsive layout for the student and teacher dashboards.
   Colours read the student theme tokens (styles/student.css) and fall back to the original
   dark palette, which is what the teacher dashboard always uses.
   Wide screens: fixed sidebar + scrolling main area.
   1024px and below: the sidebar becomes a slide-out drawer opened from the header. */

/* Header breadcrumb trail: every part but the current page is a link */
.breadcrumbs .crumb-link {
  font: inherit; color: inherit; text-decoration: none; background: none; border: 0; cursor: pointer;
  padding: 3px 6px; margin: -3px -6px; border-radius: 7px; transition: color 0.15s ease, background 0.15s ease;
}
.breadcrumbs .crumb-link:hover { color: var(--text-main); background: var(--nf-hover, #17171b); }
.breadcrumbs .crumb-link:focus-visible { outline: 2px solid var(--accent, #00d9ff); outline-offset: 1px; }
.breadcrumbs .crumb-sep { opacity: 0.6; }
.breadcrumbs .crumb-current { color: var(--text-main); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

/* The sidebar brand links back to the home page */
a.brand-box { color: inherit; text-decoration: none; border-radius: 8px 8px 0 0; transition: background 0.15s ease; }
a.brand-box:hover { background: var(--nf-hover, #17171b); }

/* ---------- Sidebar parts both dashboards share ----------
   Counts and badges on the links, the "Your classes" list (one colour per class, the same as the
   teacher Home's class switcher; .cs-badge is in styles/home.css), and the footer with the guided
   tour card (scripts/shared/tour.js) and the profile card. */
.nav-count { margin-left: auto; font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; background: var(--surface-hover); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; }
.nav-count:empty { display: none; }
.nav-count.nav-alert { color: #3a2300; background: var(--amber); border-color: transparent; font-weight: 700; }
.nav-live { margin-left: auto; display: inline-flex; }
.nav-online { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 650; color: var(--success-text); font-variant-numeric: tabular-nums; }
.nav-online::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.nav-live-now { color: var(--danger-text); }
.nav-live-now .icon { color: var(--red); }
.nav-live-now:hover { color: var(--danger-text); background: color-mix(in srgb, var(--red) 8%, transparent); }
.nav-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nav-add {
  width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border-strong); background: transparent; flex: none;
  color: var(--text-soft); display: grid; place-items: center; cursor: pointer; font-size: 15px; line-height: 1;
}
.nav-add:hover { background: var(--surface-hover); color: var(--text-main); }
.sidebar-classes { display: flex; flex-direction: column; gap: 2px; }
.sidebar-class .name, .nav-live-now .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-class .cs-badge { width: 22px; height: 22px; border-radius: 7px; font-size: 11px; }
.sidebar-class[aria-current] .cs-badge { box-shadow: 0 0 0 2px var(--surface-hover), 0 0 0 3px hsl(var(--hue) 70% 60% / 0.6); }
.sidebar-empty { font-size: 12.5px; color: var(--text-muted); padding: 2px 10px 6px; }
.sidebar-foot { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; }
.sidebar-foot .user-card {
  display: flex; align-items: center; gap: 10px; width: 100%; margin: 0; padding: 10px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); font: inherit; color: inherit; text-align: left; text-decoration: none; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.sidebar-foot .user-card:hover { border-color: var(--border-hover); background: var(--surface-raised); }
.sidebar-foot .user-card[aria-current] { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.sidebar-foot .user-card > div { flex: 1; min-width: 0; }
.sidebar-foot .user-card b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .user-card small { display: block; font-size: 11.5px; color: var(--text-muted); }
.sidebar-foot .user-card > .icon { width: 15px; height: 15px; color: var(--text-muted); }
.tour-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 12px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  background: radial-gradient(ellipse 80% 90% at 0% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%), var(--surface-2);
}
.tour-card .chip-icon { width: 30px; height: 30px; border-radius: 9px; }
.tour-card .chip-icon svg { width: 15px; height: 15px; }
.tour-card b { display: block; font-size: 13px; font-weight: 650; }
.tour-card small { display: block; font-size: 11.5px; color: var(--text-muted); line-height: 1.4; margin-top: 1px; }
.tour-card .btn-action { grid-column: 1 / -1; width: 100%; }

.nav-toggle {
  display: none; align-items: center; justify-content: center; width: 34px; height: 34px; flex: none;
  background: var(--nf-hover, #1c1c20); color: var(--text-main); border: 1px solid var(--border); border-radius: 7px;
  font-size: 17px; line-height: 1; cursor: pointer;
}
.nav-toggle:hover { background: var(--border-strong, #27272a); }
.header-lead { display: flex; align-items: center; gap: 12px; min-width: 0; }
.label-short { display: none; }
.nav-backdrop { display: none; }

@media (max-width: 1024px) {
  body { display: block; height: auto; overflow: auto; }
  main { overflow: visible; min-height: 100vh; }

  aside {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60; width: 264px; max-width: 85vw;
    overflow-y: auto; transform: translateX(-100%); transition: transform 0.22s ease;
    box-shadow: 0 0 40px var(--shadow-color, rgba(0, 0, 0, 0.6));
  }
  body.nav-open aside { transform: none; }
  body.nav-open { overflow: hidden; }
  .nav-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, 0.55); }
  body.nav-open .nav-backdrop { display: block; }

  .nav-toggle { display: inline-flex; }
  header { padding: 0 16px; }
  .portal-main { padding: 20px 16px 32px; }
}

@media (max-width: 640px) {
  /* Phones: just the way up one level and the current page ("Biology / Posts"). */
  .breadcrumbs { min-width: 0; overflow: hidden; }
  .breadcrumbs > :nth-last-child(n+4) { display: none; }
  .breadcrumbs .crumb-link { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; }
  .header-actions { gap: 6px; }
  .header-actions .btn-action { padding: 7px 9px; }
  .label-long { display: none; }
  .label-short { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  aside { transition: none; }
}

/* ---------- Dialogs (class-live.js confirmAction + page dialogs) ---------- */
.nf-dialog {
  margin: auto; width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--nf-dialog-border, #2e2e34); border-radius: 14px;
  background: var(--nf-dialog-bg, #141417); color: var(--text-main); box-shadow: 0 24px 60px var(--shadow-color, rgba(0, 0, 0, 0.6));
}
.nf-dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px); }
.nf-dialog form { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.nf-dialog h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.2px; }
.nf-dialog p { font-size: 13px; color: var(--nf-dialog-text, #b4b4bc); line-height: 1.55; }
.nf-dialog-label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; }
.nf-dialog-input {
  background: var(--nf-input-bg, #101013); border: 1px solid var(--border); border-radius: 6px; padding: 9px 12px;
  color: var(--text-main); font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 400; outline: none;
}
.nf-dialog-input:focus { border-color: var(--border-hover, #383842); }
.nf-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.nf-dialog-message { font-size: 12.5px; color: var(--text-muted); min-height: 18px; }
.nf-dialog-message[data-state="error"] { color: var(--danger-text, #fca5a5); }
.nf-btn-danger {
  background: #3b1416; color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.45); border-radius: 6px;
  padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.nf-btn-danger:hover { background: #4a1a1d; }
.nf-btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Notices ---------- */
.nf-notices {
  position: fixed; top: 68px; right: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px;
  width: min(340px, calc(100vw - 32px)); pointer-events: none;
}
.nf-notice {
  position: relative; pointer-events: auto; background: var(--nf-notice-bg, #17171b); border: 1px solid var(--nf-dialog-border, #2e2e34); border-left: 3px solid var(--cyan);
  border-radius: 10px; padding: 12px 34px 12px 14px; box-shadow: 0 12px 30px var(--shadow-color, rgba(0, 0, 0, 0.5)); animation: nf-notice-in 0.2s ease;
}
.nf-notice[data-kind="success"] { border-left-color: var(--green); }
.nf-notice[data-kind="live"] { border-left-color: var(--red, #ef4444); }
.nf-notice[data-kind="error"] { border-left-color: var(--red, #ef4444); }
.nf-notice strong { display: block; font-size: 13.5px; }
.nf-notice p { font-size: 12.5px; color: var(--nf-dialog-text, #b4b4bc); margin-top: 3px; line-height: 1.45; }
.nf-notice-actions { display: flex; gap: 8px; margin-top: 10px; }
.nf-notice-actions .btn-primary, .nf-notice-actions .btn-action { padding: 6px 11px; font-size: 12px; }
.nf-notice-close {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border: 0; border-radius: 5px;
  background: transparent; color: var(--text-muted); font-size: 16px; cursor: pointer;
}
.nf-notice-close:hover { background: var(--nf-hover, #222227); color: var(--text-main); }
@keyframes nf-notice-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .nf-notice { animation: none; } }

/* ---------- Live badge ---------- */
.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red, #ef4444);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); animation: live-pulse 1.8s infinite; flex: none;
}
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); } 70% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ---------- Database setup banner (class-live.js) ---------- */
.nf-setup {
  border: 1px solid rgba(245, 183, 72, 0.4); background: rgba(245, 183, 72, 0.08); border-radius: 12px;
  padding: 16px 18px; color: var(--nf-setup-text, #fde68a); font-size: 13px; line-height: 1.55;
}
.nf-setup strong { display: block; font-size: 14.5px; color: var(--nf-setup-title, #fef3c7); margin-bottom: 4px; }
.nf-setup ol { margin: 8px 0 8px 20px; display: flex; flex-direction: column; gap: 4px; }
.nf-setup code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--nf-setup-title, #fef3c7);
  background: rgba(0, 0, 0, 0.3); border-radius: 5px; padding: 2px 6px; overflow-wrap: anywhere;
}

/* ---------- Neuro-Focus wordmark (sidebar, top left) ---------- */
/* Sora (SIL Open Font License, assets/fonts/OFL.txt), kept in the project so no font is fetched from elsewhere. */
@font-face {
  font-family: "Sora"; font-style: normal; font-weight: 500 800; font-display: swap;
  src: url("../assets/fonts/sora-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
.brand-box { gap: 12px; padding: 8px 10px 18px; }
.brand-box .brand-mark { width: 38px; height: 38px; border-radius: 11px; }
.brand-box .brand-mark svg { width: 24px; height: 24px; }
.brand-box .brand-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.brand-text .wordmark { display: block; font-family: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 21px; font-weight: 700; line-height: 1.05; letter-spacing: -0.04em; color: var(--text-main); white-space: nowrap; }
.brand-text .wordmark-tail { font-weight: 600; color: color-mix(in srgb, var(--text-main) 68%, transparent); }
.brand-box .brand-text small { font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
a.brand-box:hover .brand-mark svg { filter: drop-shadow(0 0 2px rgba(255, 255, 255, 1)) drop-shadow(0 0 10px rgba(255, 255, 255, 0.8)); }
