/* Design tokens shared by every SmartAttend layout (public + admin/lecturer/student portals). */

:root {
    /* AAMUC brand palette (navy + red, from the official crest). Primary brand identity —
       used for the admin portal accent, primary buttons/links, and public marketing pages. */
    --brand-navy: #16305C;
    --brand-navy-dark: #0D1F3D;
    --brand-navy-darker: #081326;
    --brand-red: #C8202F;
    --brand-red-dark: #9A1622;

    /* Reusable focus ring, derived from the existing --status-info blue rather than a new hue —
       one consistent "you are here" color across every input/button/link in the app instead of
       every page inventing its own box-shadow value (was ad hoc: e.g. LogIn previously hardcoded
       rgba(22,48,92,.15) inline). */
    --focus-ring: rgba(21, 101, 192, 0.28);

    /* Light theme (default) */
    --color-bg: #f4f6f9;
    --color-surface: #ffffff;
    --color-surface-alt: #f8fafc;
    --color-text: #1f2937;
    --color-text-muted: #6b7280;
    --color-border: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 1px 8px rgba(0, 0, 0, 0.07);

    --radius-sm: 0.4rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;

    /* Semantic status colors — used consistently for state (paid/approved/pending/rejected/
       overdue), always paired with an icon and a text label, never color alone (spec: "Do not
       rely on Red = bad, Green = good alone"). Kept separate from portal accent colors on purpose
       — a portal's identity color must never double as a status signal, or the two meanings
       collide (e.g. a green-accented portal making every card look "successful").
       Contrast verified against white text: 5.6:1 / 5.5:1 / 5.4:1 / 5.7:1 — all pass WCAG AA. */
    --status-success: #15803D;
    --status-success-bg: #DCFCE7;
    --status-warning: #B45309;
    --status-warning-bg: #FEF3C7;
    --status-danger: #B91C1C;
    --status-danger-bg: #FEE2E2;
    --status-info: #1565C0;
    --status-info-bg: #EAF3FF;

    /* Per-role sidebar accent gradients. AAMUC 2026 palette: every pair below is a two-stop navy/
       blue-family gradient verified >=4.5:1 white-text contrast at BOTH stops (see the repo's UI
       audit for the exact ratios) — portals differ in hue, never in the underlying navy/blue
       family, per the "one AAMUC design system, controlled accent identity" rule. */
    --accent-admin-start: var(--brand-navy);
    --accent-admin-end: var(--brand-navy-dark);

    /* Teacher/Lecturer — Blue/Indigo (2026 palette; replaces the earlier green, which read as a
       generic "success" color rather than a portal identity and collided with status-success). */
    --accent-lecturer-start: #1E3A8A;
    --accent-lecturer-end: #2563EB;

    /* Student — Blue/Sky Blue (2026 palette; replaces the earlier purple, off-family from the
       rest of the navy/blue system). */
    --accent-student-start: #0D47A1;
    --accent-student-end: #1565C0;

    /* Deep navy, replacing an earlier gold accent whose white-on-gold contrast measured ~3.36:1
       (fails WCAG AA's 4.5:1 for body text) — this pairing measures >14:1. */
    --accent-headofexams-start: #0B1F3A;
    --accent-headofexams-end: #07152A;
    --headofexams-primary-blue: #1565C0;
    --headofexams-light-blue: #EAF3FF;

    /* Academic Dean — same navy/blue family as Head of Exams (matches the exact palette given for
       both roles), kept as its own token set so the two portals can diverge later without a
       cross-role edit. */
    --accent-academicdean-start: #0B1F3A;
    --accent-academicdean-end: #07152A;
    --academicdean-primary-blue: #1565C0;
    --academicdean-light-blue: #EAF3FF;

    /* Finance — Navy foundation (2026 palette calls for a Navy sidebar, distinguishing itself via
       the Emerald/Green semantic accent used throughout the portal for collection/paid/approved
       states — see --status-success above, already applied on every Finance page). Was entirely
       missing until this pass: with no data-role rule to match, `var(--accent-start)` resolved to
       nothing, which made the whole `background` shorthand on .sidebar invalid — the Finance
       Portal sidebar had been rendering unstyled since it shipped. */
    --accent-financemanager-start: #0B1F3A;
    --accent-financemanager-end: #07152A;
    --accent-financeofficer-start: #0B1F3A;
    --accent-financeofficer-end: #07152A;
    --finance-primary-emerald: #15803D;
    --finance-light-emerald: #E9F7EE;
}

:root[data-theme="dark"] {
    --color-bg: #0f1115;
    --color-surface: #171a21;
    --color-surface-alt: #1c1f27;
    --color-text: #e5e7eb;
    --color-text-muted: #9ca3af;
    --color-border: #2a2e37;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 1px 8px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-bg: #0f1115;
        --color-surface: #171a21;
        --color-surface-alt: #1c1f27;
        --color-text: #e5e7eb;
        --color-text-muted: #9ca3af;
        --color-border: #2a2e37;
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 1px 8px rgba(0, 0, 0, 0.5);
    }
}

html[data-role="admin"] {
    --accent-start: var(--accent-admin-start);
    --accent-end: var(--accent-admin-end);
}

html[data-role="lecturer"] {
    --accent-start: var(--accent-lecturer-start);
    --accent-end: var(--accent-lecturer-end);
}

html[data-role="student"] {
    --accent-start: var(--accent-student-start);
    --accent-end: var(--accent-student-end);
}

html[data-role="headofexams"] {
    --accent-start: var(--accent-headofexams-start);
    --accent-end: var(--accent-headofexams-end);
}

html[data-role="academicdean"] {
    --accent-start: var(--accent-academicdean-start);
    --accent-end: var(--accent-academicdean-end);
}

html[data-role="financemanager"] {
    --accent-start: var(--accent-financemanager-start);
    --accent-end: var(--accent-financemanager-end);
}

html[data-role="financeofficer"] {
    --accent-start: var(--accent-financeofficer-start);
    --accent-end: var(--accent-financeofficer-end);
}
