/* Dashboard shell — same base as the StudyFRCEM dashboard (Inter, 10% UI zoom, navy sidebar,
   64px bars, 12/24px paddings). Scoped to body.dashboard-shell so the public site is unaffected. */

/* FRCEM scales its whole UI by 10% (html { zoom: 1.1 }); here only the dashboard. */
body.dashboard-shell { zoom: 1.1; }

/* Theme tokens (FRCEM tailwind.config values) and type. */
body.dashboard-shell {
    --primary: 214 84% 42%; --secondary: 216 75% 22%; --background: 210 33% 98%; --foreground: 0 0% 10%;
    --card: 0 0% 100%; --muted: 210 33% 96%; --muted-foreground: 0 0% 40%; --border: 210 20% 90%;
    --accent: 203 89% 59%; --success: 158 61% 49%; --destructive: 355 77% 56%; --warning: 45 93% 58%; --ring: 214 84% 42%;
    margin: 0; background: #fff; color: hsl(var(--foreground));
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 16px; line-height: 1.6;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
.dashboard-shell :is(h1, h2, h3, h4, h5, h6) { font-family: Inter, sans-serif; letter-spacing: -.025em; }
.dashboard-shell a { text-decoration: none; }
.dashboard-shell button { font-family: inherit; cursor: pointer; }
.dashboard-shell :is(svg.lucide, i[data-lucide]) { flex-shrink: 0; }

/* Tailwind utilities are compiled with the marketing palette; inside the dashboard they take FRCEM's values. */
.dashboard-shell .bg-primary { background-color: hsl(var(--primary)); }
.dashboard-shell .hover\:bg-primary\/90:hover { background-color: hsl(var(--primary) / .9); }
.dashboard-shell .bg-primary\/5 { background-color: hsl(var(--primary) / .05); }
.dashboard-shell .bg-primary\/10 { background-color: hsl(var(--primary) / .1); }
.dashboard-shell .bg-primary\/20 { background-color: hsl(var(--primary) / .2); }
.dashboard-shell .hover\:bg-primary\/20:hover { background-color: hsl(var(--primary) / .2); }
.dashboard-shell .text-primary { color: hsl(var(--primary)); }
.dashboard-shell .border-primary { border-color: hsl(var(--primary)); }
.dashboard-shell .border-primary\/20 { border-color: hsl(var(--primary) / .2); }
.dashboard-shell .border-primary\/30 { border-color: hsl(var(--primary) / .3); }
.dashboard-shell .border-primary\/40 { border-color: hsl(var(--primary) / .4); }
.dashboard-shell .border-primary\/50, .dashboard-shell .hover\:border-primary\/50:hover { border-color: hsl(var(--primary) / .5); }
.dashboard-shell .focus\:border-primary:focus { border-color: hsl(var(--primary)); }
.dashboard-shell .ring-primary, .dashboard-shell .focus\:ring-primary:focus { --tw-ring-color: hsl(var(--primary)); }
.dashboard-shell .ring-primary\/20, .dashboard-shell .focus\:ring-primary\/20:focus { --tw-ring-color: hsl(var(--primary) / .2); }
.dashboard-shell .from-primary { --tw-gradient-from: hsl(var(--primary)) var(--tw-gradient-from-position); --tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); }
.dashboard-shell .from-primary\/5 { --tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position); --tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); }
.dashboard-shell .to-primary\/80 { --tw-gradient-to: hsl(var(--primary) / .8) var(--tw-gradient-to-position); }
.dashboard-shell .to-primary\/90 { --tw-gradient-to: hsl(var(--primary) / .9) var(--tw-gradient-to-position); }
.dashboard-shell .shadow-primary\/20 { --tw-shadow-color: hsl(var(--primary) / .2); --tw-shadow: var(--tw-shadow-colored); }
.dashboard-shell .shadow-primary\/30 { --tw-shadow-color: hsl(var(--primary) / .3); --tw-shadow: var(--tw-shadow-colored); }
.dashboard-shell .bg-secondary { background-color: hsl(var(--secondary)); }
.dashboard-shell .bg-background { background-color: hsl(var(--background)); }
.dashboard-shell .bg-card { background-color: hsl(var(--card)); }
.dashboard-shell .bg-muted { background-color: hsl(var(--muted)); }
.dashboard-shell .bg-muted\/50 { background-color: hsl(var(--muted) / .5); }
.dashboard-shell .hover\:bg-muted:hover { background-color: hsl(var(--muted)); }
.dashboard-shell .hover\:bg-muted\/50:hover { background-color: hsl(var(--muted) / .5); }
.dashboard-shell .text-foreground { color: hsl(var(--foreground)); }
.dashboard-shell .text-muted-foreground { color: hsl(var(--muted-foreground)); }
.dashboard-shell .hover\:text-foreground:hover { color: hsl(var(--foreground)); }
.dashboard-shell .border-border { border-color: hsl(var(--border)); }
.dashboard-shell .divide-border > :not([hidden]) ~ :not([hidden]) { border-color: hsl(var(--border)); }
.dashboard-shell .text-success { color: hsl(var(--success)); }
.dashboard-shell .bg-destructive { background-color: hsl(var(--destructive)); }
.dashboard-shell .hover\:bg-destructive\/90:hover { background-color: hsl(var(--destructive) / .9); }
.dashboard-shell .text-destructive { color: hsl(var(--destructive)); }
/* FRCEM type scale: text-sm is 0.935rem/1.35rem; the rest are Tailwind defaults. */
.dashboard-shell .text-xs:not([class*=":text-"]) { font-size: .75rem; line-height: 1rem; }
.dashboard-shell .text-sm:not([class*=":text-"]) { font-size: .935rem; line-height: 1.35rem; }
.dashboard-shell .text-base:not([class*=":text-"]) { font-size: 1rem; line-height: 1.5rem; }
.dashboard-shell .text-lg:not([class*=":text-"]) { font-size: 1.125rem; line-height: 1.75rem; }
.dashboard-shell .text-xl:not([class*=":text-"]) { font-size: 1.25rem; line-height: 1.75rem; }
/* Page titles ("Question bank", "Performance", ...) sit a step below Tailwind's 2xl. */
.dashboard-shell h1.text-2xl { font-size: 1.4375rem; line-height: 1.75rem; }
@media (min-width: 640px) { .dashboard-shell h1.sm\:text-2xl { font-size: 1.4375rem; line-height: 1.75rem; } }
/* Tailwind default radii (the marketing theme redefines them). */
.dashboard-shell .rounded-sm { border-radius: .125rem; }
.dashboard-shell .rounded { border-radius: .25rem; }
.dashboard-shell .rounded-md { border-radius: .375rem; }
.dashboard-shell .rounded-lg { border-radius: .5rem; }
.dashboard-shell .rounded-xl { border-radius: .75rem; }
.dashboard-shell .rounded-2xl { border-radius: 1rem; }
.dashboard-shell .rounded-3xl { border-radius: 1.5rem; }
.dashboard-shell .rounded-full { border-radius: 9999px; }
/* Tailwind default shadows (the marketing theme redefines them). */
.dashboard-shell .shadow-sm { --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05); --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color); box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); }
.dashboard-shell .shadow-md { --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1); --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color); box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); }
.dashboard-shell .shadow-lg { --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1); --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color); box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); }

/* Layout: min-h-screen bg-white flex-col › flex flex-1 overflow-hidden › sidebar + (header + main). */
.dashboard-root { display: flex; flex-direction: column; min-height: 100vh; background: #fff; }
.dashboard-frame { display: flex; flex: 1 1 0%; overflow: hidden; }
.dashboard-stage { display: flex; flex: 1 1 0%; flex-direction: column; min-width: 0; }
.dashboard-content { flex: 1 1 0%; padding: 1rem; overflow-y: auto; }
.dashboard-skip-link { position: fixed; top: 12px; left: 12px; z-index: 100; transform: translateY(-160%); padding: 12px 20px; border-radius: 8px; background: #fff; color: hsl(var(--foreground)); }
.dashboard-skip-link:focus { transform: none; }

/* Sidebar: fixed inset-y-0 left-0 z-50 w-64 (14.5rem to compensate the zoom) bg-secondary, static on lg. */
#sidebar-overlay { position: fixed; inset: 0; z-index: 40; border: 0; padding: 0; background: rgb(0 0 0 / .5); }
#sidebar-overlay[hidden] { display: none; }
.dashboard-sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; display: flex; flex-direction: column; width: 14.5rem; min-width: 14.5rem; background: hsl(var(--secondary)); color: #fff; transform: translateX(-100%); transition: transform .3s ease; }
.dashboard-sidebar.open { transform: translateX(0); }
.dashboard-brand-row { display: flex; align-items: center; justify-content: space-between; height: 4rem; padding: 0 1rem; border-bottom: 1px solid rgb(255 255 255 / .1); flex-shrink: 0; }
.dashboard-brand { display: flex; align-items: center; gap: .5rem; color: #fff; font-size: 1.1875rem; line-height: 1.75rem; font-weight: 700; letter-spacing: -.01em; }
.dashboard-brand-mark { position: relative; width: 2.3125rem; height: 2.3125rem; overflow: hidden; flex-shrink: 0; }
.dashboard-brand-mark img { position: absolute; top: 50%; left: 50%; width: 5.1rem; height: auto; max-width: none; transform: translate(-50%, -50%); filter: brightness(0) invert(1); }
.dashboard-sidebar-close { display: flex; padding: 0; border: 0; background: transparent; color: rgb(255 255 255 / .7); }
.dashboard-sidebar-close:hover { color: #fff; }
.dashboard-sidebar-close svg { width: 1.25rem; height: 1.25rem; }
.dashboard-navigation { flex: 1 1 0%; padding: .75rem; overflow-y: auto; }
.dashboard-navigation > * + * { margin-top: .25rem; }
.dashboard-nav-link { display: flex; align-items: center; gap: .75rem; padding: .625rem .75rem; border-radius: .5rem; color: rgb(255 255 255 / .7); font-size: .935rem; line-height: 1.35rem; font-weight: 500; transition: all .15s cubic-bezier(.4, 0, .2, 1); }
.dashboard-nav-link svg { width: 1.25rem; height: 1.25rem; color: rgb(255 255 255 / .6); }
.dashboard-nav-link:hover { color: #fff; background: rgb(255 255 255 / .1); }
.dashboard-nav-link.is-active { color: #fff; background: hsl(var(--primary)); box-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1); }
.dashboard-nav-link.is-active svg { color: #fff; }
.dashboard-nav-link .dashboard-nav-end { width: 1rem; height: 1rem; margin-left: auto; }
.dashboard-nav-link .dashboard-nav-lock { color: #fbbf24; }
.dashboard-sidebar-bottom { padding: .75rem; border-top: 1px solid rgb(255 255 255 / .1); }
.dashboard-user-card { display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem; border-radius: .5rem; background: rgb(255 255 255 / .05); }
.dashboard-user-avatar { display: flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; flex-shrink: 0; border: 1px solid hsl(var(--primary) / .3); border-radius: 9999px; background: hsl(var(--primary) / .2); color: #fff; font-size: .935rem; line-height: 1.35rem; font-weight: 600; object-fit: cover; }
img.dashboard-user-avatar { border: 0; }
.dashboard-user-text { flex: 1 1 0%; min-width: 0; }
.dashboard-user-text p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-user-name { color: #fff; font-size: .935rem; line-height: 1.35rem; font-weight: 500; }
.dashboard-user-plan { font-size: .75rem; line-height: 1rem; color: hsl(var(--success)); }
.dashboard-user-plan.is-none { color: #fbbf24; }
.dashboard-user-plan.is-role { color: rgb(255 255 255 / .68); }
.dashboard-logout { display: flex; align-items: center; gap: .75rem; width: 100%; margin-top: .5rem; padding: .625rem .75rem; border: 0; border-radius: .5rem; background: transparent; color: rgb(255 255 255 / .7); font-size: .935rem; line-height: 1.35rem; font-weight: 500; text-align: left; transition: all .15s cubic-bezier(.4, 0, .2, 1); }
.dashboard-logout:hover { color: #fff; background: rgb(255 255 255 / .1); }
.dashboard-logout svg { width: 1.25rem; height: 1.25rem; }

/* Exam switcher (top of the sidebar): the exam is the context for every page. */
.exam-switcher { position: relative; padding: .75rem .75rem 0; }
.exam-switcher__menu { position: relative; }
.exam-switcher__current { display: flex; align-items: center; gap: .625rem; width: 100%; padding: .5rem .625rem; border: 1px solid rgb(255 255 255 / .12); border-radius: .625rem; background: rgb(255 255 255 / .06); color: #fff; cursor: pointer; list-style: none; transition: background .15s, border-color .15s; }
.exam-switcher__current::-webkit-details-marker { display: none; }
.exam-switcher__current:hover, .exam-switcher__menu[open] > .exam-switcher__current { background: rgb(255 255 255 / .1); border-color: rgb(255 255 255 / .2); }
.exam-switcher__current.is-static { cursor: default; }
.exam-switcher__current.is-static:hover { background: rgb(255 255 255 / .06); border-color: rgb(255 255 255 / .12); }
.exam-switcher__icon { display: grid; place-items: center; width: 2rem; height: 2rem; flex-shrink: 0; border-radius: .5rem; background: hsl(var(--primary)); color: #fff; }
.exam-switcher__icon svg { width: 1rem; height: 1rem; }
.exam-switcher__text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.exam-switcher__text small { color: rgb(255 255 255 / .55); font-size: .6875rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.exam-switcher__text strong { margin-top: .125rem; overflow: hidden; color: #fff; font-size: .9rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.exam-switcher__caret { width: 1rem; height: 1rem; color: rgb(255 255 255 / .6); }
.exam-switcher__current.is-empty .exam-switcher__text small { color: #fbbf24; text-transform: none; letter-spacing: 0; font-size: .75rem; }
.exam-switcher__panel { position: absolute; left: 0; right: 0; top: calc(100% + .375rem); z-index: 60; padding: .375rem; border: 1px solid hsl(var(--border)); border-radius: .625rem; background: #fff; color: hsl(var(--foreground)); box-shadow: 0 16px 32px -12px rgb(15 23 42 / .35); }
.exam-switcher__heading { margin: 0; padding: .375rem .625rem .25rem; color: hsl(var(--muted-foreground)); font-size: .6875rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.exam-switcher__panel ul { margin: 0; padding: 0; list-style: none; }
.exam-switcher__option { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .5rem .625rem; border-radius: .375rem; color: hsl(var(--foreground)); font-size: .9rem; font-weight: 500; }
.exam-switcher__option > span { display: flex; flex-direction: column; min-width: 0; }
.exam-switcher__option small { color: hsl(var(--muted-foreground)); font-size: .75rem; font-weight: 400; }
.exam-switcher__option svg { width: 1rem; height: 1rem; color: hsl(var(--primary)); }
a.exam-switcher__option:hover { background: hsl(var(--muted)); }
.exam-switcher__option.is-active { color: hsl(var(--primary)); background: hsl(var(--primary) / .06); }
.exam-switcher__option.is-disabled { color: hsl(var(--muted-foreground)); cursor: not-allowed; }

/* Header: h-16 bg-background border-b, sticky, menu toggle on small screens, breadcrumb text-sm. */
.dashboard-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; height: 4rem; padding: 0 1rem; background: hsl(var(--background)); border-bottom: 1px solid hsl(var(--border)); }
.dashboard-menu-toggle { display: flex; margin-left: -.5rem; padding: .5rem; border: 0; background: transparent; color: hsl(var(--muted-foreground)); }
.dashboard-menu-toggle:hover { color: hsl(var(--foreground)); }
.dashboard-menu-toggle svg { width: 1.25rem; height: 1.25rem; }
.dashboard-breadcrumb { display: flex; align-items: center; gap: .5rem; margin-left: .5rem; font-size: .935rem; line-height: 1.35rem; }
.dashboard-breadcrumb svg { width: 1rem; height: 1rem; }

.dashboard-shell :is(a, button, input, select, textarea, summary):focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.workspace-menu-open { overflow: hidden; }

@media (min-width: 1024px) {
    .dashboard-sidebar { position: static; z-index: auto; transform: none; align-self: stretch; }
    .dashboard-sidebar-close, .dashboard-menu-toggle, #sidebar-overlay { display: none; }
    .dashboard-content { padding: 1.5rem; }
    .dashboard-header { padding: 0 1.5rem; }
    .dashboard-breadcrumb { margin-left: 0; }
}
/* Collapse control: small round toggle on the sidebar's outer edge, level with the logo row (desktop only). */
.dashboard-collapse { display: none; }

/* Collapsed rail (desktop): 4.5rem wide, icons only, labels as tooltips. */
@media (min-width: 1024px) {
    .dashboard-sidebar { position: relative; transition: width .2s ease, min-width .2s ease; }
    .dashboard-collapse { position: absolute; top: 1.25rem; right: -.75rem; z-index: 40; display: flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; padding: 0; border: 1px solid hsl(var(--border)); border-radius: 9999px; background: #fff; color: hsl(var(--muted-foreground)); box-shadow: 0 1px 2px 0 rgb(0 0 0 / .05); transition: color .15s, border-color .15s, background .15s; }
    .dashboard-collapse:hover { color: #fff; border-color: hsl(var(--primary)); background: hsl(var(--primary)); }
    .dashboard-collapse svg { width: .875rem; height: .875rem; transition: transform .2s ease; }
    .sidebar-collapsed .dashboard-collapse svg { transform: rotate(180deg); }
    .sidebar-collapsed .dashboard-sidebar { width: 4.5rem; min-width: 4.5rem; }
    .sidebar-collapsed .dashboard-brand-row { justify-content: center; padding: 0; }
    .sidebar-collapsed .dashboard-brand > span:last-child { display: none; }
    .sidebar-collapsed .dashboard-nav-text, .sidebar-collapsed .dashboard-nav-end, .sidebar-collapsed .dashboard-user-text { display: none; }
    .sidebar-collapsed .dashboard-navigation { overflow: visible; }
    .sidebar-collapsed .dashboard-nav-link, .sidebar-collapsed .dashboard-logout { justify-content: center; padding: .625rem; }
    .sidebar-collapsed .dashboard-user-card { justify-content: center; padding: .5rem; }
    /* Tooltip to the right of the item, on hover or keyboard focus. */
    .sidebar-collapsed [data-label] { position: relative; }
    .sidebar-collapsed [data-label]::after { content: attr(data-label); position: absolute; left: calc(100% + .75rem); top: 50%; z-index: 60; padding: .375rem .625rem; border-radius: .375rem; background: hsl(var(--foreground)); color: #fff; font-size: .8125rem; line-height: 1.25rem; font-weight: 500; white-space: nowrap; box-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1); opacity: 0; transform: translate(-4px, -50%); pointer-events: none; transition: opacity .12s ease, transform .12s ease; }
    .sidebar-collapsed [data-label]:is(:hover, :focus-visible)::after { opacity: 1; transform: translate(0, -50%); }
    .sidebar-collapsed .dashboard-sidebar-bottom { overflow: visible; }
    .sidebar-collapsed .exam-switcher { padding: .75rem .75rem 0; }
    .sidebar-collapsed .exam-switcher__current { justify-content: center; padding: .375rem; }
    .sidebar-collapsed .exam-switcher__text, .sidebar-collapsed .exam-switcher__caret { display: none; }
    .sidebar-collapsed .exam-switcher__panel { left: calc(100% + .5rem); right: auto; top: 0; width: 15rem; }
    .sidebar-collapsed .exam-switcher__menu[open] + *, .sidebar-collapsed .exam-switcher[data-label]:has(details[open])::after { display: none; }
}
@media (prefers-reduced-motion: reduce) { .dashboard-shell * { transition: none !important; animation: none !important; } }

/* Quiz: flagged state (flag button + navigator square) */
.quiz-flag-btn.is-flagged { background: #fffbeb; box-shadow: inset 0 0 0 1px #fde68a; }
.quiz-flag-btn.is-flagged:hover { background: #fef3c7; }
.quiz-flag-btn.is-flagged svg { color: #f59e0b; fill: #fcd34d; }
.question-nav-btn[class*="bg-warning"] { background: #fffbeb; border-color: #fcd34d; color: #d97706; }
.question-nav-btn[class*="bg-warning"]:hover { background: #fef3c7; }
