/**
 * ExamExplore – design tokens + shared shell.
 * Load BEFORE app-panel-common.css + student-layout.css so panel variables can reference --ee-* tokens.
 */
:root {
    --ee-font-sans: 'Noto Sans', 'Noto Sans Devanagari', ui-sans-serif, system-ui, sans-serif;
    --ee-font-size-menu: calc(0.9375rem + 1px);
    --ee-font-size-menu-sub: calc(0.8125rem + 1px);
    --ee-font-size-table: calc(0.8125rem + 1px);
    --ee-font-size-table-head: calc(0.625rem + 1px);
    --bs-font-sans-serif: var(--ee-font-sans);
    --bs-body-font-family: var(--ee-font-sans);
    --ee-radius: 5px;
    --ee-control-height: 42px;
    --ee-control-radius: 5px;
    --ee-card-padding: 1.25rem;
    --ee-icon-box: 2.5rem;
    --ee-accent: #4f46e5;
    --ee-accent-hover: #4338ca;
    --ee-accent-soft: #6366f1;
    --ee-ink: #111827;
    --ee-ink-muted: #6b7280;
    --ee-surface: #ffffff;
    --ee-surface-muted: #f8fafc;
    --ee-border: #e5e7eb;
    --app-content-max: 1600px;
    --app-space-y: clamp(0.875rem, 1.8vw, 1.5rem);
    --app-space-x: clamp(0.75rem, 2vw, 1.75rem);
    --app-focus: var(--ee-accent-soft);
    --app-focus-offset: #fff;
}

.dark {
    --ee-ink: #f9fafb;
    --ee-ink-muted: #9ca3af;
    --ee-surface: #1e293b;
    --ee-surface-muted: #0f172a;
    --ee-border: #334155;
    --app-focus: #a5b4fc;
    --app-focus-offset: #0f172a;
}

html {
    font-family: var(--ee-font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html,
body,
button,
input,
select,
textarea,
table,
th,
td {
    font-family: var(--ee-font-sans);
}

/**
 * Keep Font Awesome glyphs visible when the app sets a global sans-serif on html/body.
 */
.fa-solid,
.fa-regular,
.fa-brands,
.fas,
.far,
.fab,
.fal,
.fad,
.fa {
    font-family: var(--fa-style-family, "Font Awesome 6 Free") !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1;
    display: inline-block;
}

.fab,
.fa-brands {
    font-family: "Font Awesome 6 Brands" !important;
    font-weight: 400 !important;
}

.fas,
.fa-solid {
    font-weight: 900 !important;
}

.far,
.fa-regular {
    font-weight: 400 !important;
}

#admin-body,
#student-body,
.ee-auth-body,
#app {
    font-family: var(--ee-font-sans);
}

/* When dark theme is on, body text must not stay browser-default (panels use utility classes) */
html.dark #admin-body,
html.dark #student-body {
    color: var(--ee-ink);
}

html.ee-main-nav-drawer-open,
body.ee-main-nav-drawer-open {
    overflow: hidden;
}

/* Consistent alignment inside main app areas */
.student-content,
.student-content .app-content-container,
#app {
    text-align: left;
}

/**
 * One border-radius scale for UI surfaces & controls (excludes circles).
 * Applies to admin/student panels and public #app routes.
 */
.student-content :where(
    button:not(.rounded-full):not(.ee-stu-btn),
    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="hidden"]):not([type="image"]),
    select,
    textarea
),
.student-content :where(.rounded-sm, .rounded, .rounded-md, .rounded-lg, .rounded-xl, .rounded-2xl, .rounded-3xl):not(.rounded-full):not([class*="rounded-full"]),
#admin-body :where(
    button:not(.rounded-full):not(.ee-stu-btn),
    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="hidden"]):not([type="image"]),
    select,
    textarea
),
#student-body :where(
    button:not(.rounded-full):not(.ee-stu-btn),
    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="hidden"]):not([type="image"]),
    select,
    textarea
),
#app :where(
    button:not(.rounded-full):not(.ee-stu-btn),
    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="hidden"]):not([type="image"]),
    select,
    textarea
),
#app :where(.rounded-sm, .rounded, .rounded-md, .rounded-lg, .rounded-xl, .rounded-2xl, .rounded-3xl):not(.rounded-full):not([class*="rounded-full"]),
#app :where(.category-card, .stat-box, .category-badge, .subcategory-item, .subcategory-card, .subcategory-card-stat, .subcategory-card-link, .subcategory-card-feature):not(.rounded-full),
.ee-auth-body :where(
    button:not(.rounded-full):not(.ee-auth-toggle):not(.ee-field-icon-btn),
    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="hidden"]):not([type="image"]),
    select,
    textarea
) {
    border-radius: var(--ee-radius, 5px) !important;
}

/* Select2 trigger (often next to the native select; dropdown can attach to body) */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border-radius: var(--ee-radius, 5px) !important;
}

.app-main-scroll {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

@media (prefers-reduced-motion: reduce) {
    .app-main-scroll {
        scroll-behavior: auto;
    }
}

.app-content-container {
    width: 100%;
    max-width: var(--app-content-max);
    margin-left: auto;
    margin-right: auto;
    padding: var(--app-space-y) var(--app-space-x);
    padding-bottom: max(var(--app-space-y), env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

/* Keyboard focus – consistent across panels (not on form fields or inline icon buttons) */
.student-content a:focus-visible,
.student-content button:focus-visible:not(.ee-field-icon-btn):not(.ee-topnav-btn),
.student-content [role="button"]:focus-visible,
.student-content summary:focus-visible {
    outline: 2px solid var(--app-focus);
    outline-offset: 2px;
}

/* Table scan lines */
.student-content table tbody tr {
    transition: background-color 0.14s ease;
}

.student-content table tbody tr:hover {
    background-color: rgb(99 102 241 / 0.06);
}

.dark .student-content table tbody tr:hover {
    background-color: rgb(129 140 248 / 0.09);
}

/* Page title rows (dashboard, list pages) */
.app-page-toolbar,
.roles-mgmt-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: clamp(0.875rem, 1.6vw, 1.35rem);
}

.app-page-toolbar h1,
.roles-mgmt-header h1 {
    font-size: clamp(1.2rem, 2vw, 1.55rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--ee-ink);
}

.app-page-toolbar p,
.roles-mgmt-header p {
    font-size: 0.875rem;
    line-height: 1.45;
    margin-top: 0.125rem;
    color: var(--ee-ink-muted);
}

/* Primary actions – subtle lift on hover (stat cards: hover motion lives in student-layout.css) */
.student-content .student-stat-card {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
    .student-content .student-stat-card {
        transition: none;
    }

    .student-content .student-stat-card:hover {
        transform: none;
    }
}

/* Public + auth: focus rings (layouts without .student-content; not on form fields or inline icon buttons) */
#app a:focus-visible,
#app button:focus-visible:not(.ee-field-icon-btn):not(.ee-topnav-btn),
#app [role="button"]:focus-visible,
#app summary:focus-visible {
    outline: 2px solid var(--app-focus);
    outline-offset: 2px;
}

/* ----- Admin / student panel: mobile shell ----- */
#admin-body,
#student-body {
    overflow-x: hidden;
    max-width: 100vw;
}

#admin-body > .flex.pt-16,
#student-body > .flex.pt-16 {
    min-width: 0;
}

@media (max-width: 1023px) {
    body#student-body.ee-panel-mobile-drawer-open,
    body#admin-body.ee-panel-mobile-drawer-open {
        overflow: hidden;
        touch-action: pan-y pinch-zoom;
    }
}

.student-content .overflow-x-auto,
#admin-body .student-content .overflow-x-auto,
#student-body .student-content .overflow-x-auto {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.student-topnav {
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
}

.student-topnav > div {
    min-width: 0;
}

.student-topnav [data-ee-dropdown-panel] {
    max-width: min(22rem, calc(100vw - 1rem));
    width: min(22rem, calc(100vw - 1rem));
    box-sizing: border-box;
}

.student-topnav #student-profile-dropdown,
.student-topnav #admin-profile-dropdown {
    max-width: min(14rem, calc(100vw - 1rem));
    width: min(14rem, calc(100vw - 1rem));
    box-sizing: border-box;
}

/**
 * Global UI contract: 5px corners on every surface + one height for all fields.
 */
:is(#admin-body, #student-body, .ee-auth-body, #app) :where(
    [class*="rounded"]:not(.rounded-full):not([class*="rounded-full"]),
    .card,
    .custom-modal,
    .admin-list-card,
    .student-panel-card,
    .student-stat-card,
    .swal2-popup,
    .select2-dropdown,
    div[id$="Modal"] > div:first-child,
    [data-ee-dropdown-panel],
    .ee-auth-card,
    .ee-auth-alert,
    .ee-auth-note,
    .stat-box,
    .category-card,
    .subcategory-card
) {
    border-radius: var(--ee-radius, 5px) !important;
}

:is(#admin-body, #student-body, .ee-auth-body, #app) :where(
    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="hidden"]):not([type="image"]):not([type="color"]),
    select,
    .form-input:not(textarea),
    .form-control:not(textarea),
    .select2-container--default .select2-selection--single
) {
    height: var(--ee-control-height, 42px) !important;
    min-height: var(--ee-control-height, 42px) !important;
    box-sizing: border-box !important;
}

:is(#admin-body, #student-body, .ee-auth-body, #app) input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

:is(#admin-body, #student-body, .ee-auth-body, #app) input[type="number"]::-webkit-outer-spin-button,
:is(#admin-body, #student-body, .ee-auth-body, #app) input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

:is(#admin-body, #student-body, .ee-auth-body, #app) textarea,
:is(#admin-body, #student-body, .ee-auth-body, #app) textarea.form-input,
:is(#admin-body, #student-body, .ee-auth-body, #app) textarea.form-control {
    height: auto !important;
    min-height: calc(var(--ee-control-height, 42px) * 2);
}

:is(#admin-body, #student-body, .ee-auth-body, #app) .select2-container--default .select2-selection--multiple {
    min-height: var(--ee-control-height, 42px) !important;
    height: auto !important;
}
