/* Shared light/dark theme layer for public, student, instructor, and admin pages. */
:root {
    color-scheme: light;
    --surface-0: #f6f7fb;
    --surface-1: #ffffff;
    --surface-2: #eef1f6;
    --theme-text: #242938;
    --theme-muted: #687084;
    --theme-border: #dde2ea;
    --theme-shadow: 0 12px 32px rgba(31, 36, 50, .08);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --surface-0: #0f121a;
    --surface-1: #171b25;
    --surface-2: #202633;
    --theme-text: #eef1f7;
    --theme-muted: #aab2c3;
    --theme-border: #303746;
    --theme-shadow: 0 14px 36px rgba(0, 0, 0, .28);
    --white: #171b25;
    --off-white: #0f121a;
    --light-gray: #202633;
    --dark-gray: #eef1f7;
    --black: #f7f8fb;
    --gray: #aab2c3;
    --admin-topbar-bg: #171b25;
    --admin-body-bg: #0f121a;
    --admin-card-bg: #171b25;
    --admin-text: #eef1f7;
    --admin-text-muted: #aab2c3;
    --admin-border: #303746;
    --admin-sidebar-bg: #0b0e15;
    --admin-sidebar-hover: #202633;
    --dash-topbar-bg: #171b25;
    --dash-body-bg: #0f121a;
    --dash-card-bg: #171b25;
    --dash-text: #eef1f7;
    --dash-text-muted: #aab2c3;
    --dash-border: #303746;
    --dash-sidebar-bg: #0b0e15;
    --dash-sidebar-hover: #202633;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: 1px solid var(--theme-border);
    border-radius: 12px;
    background: var(--surface-1);
    color: var(--theme-text);
    cursor: pointer;
    transition: transform .2s ease, background .2s ease, border-color .2s ease;
}

.theme-toggle:hover { transform: translateY(-1px); background: var(--surface-2); }
.theme-toggle:focus-visible { outline: 3px solid rgba(201, 162, 39, .35); outline-offset: 2px; }

html[data-theme="dark"] body,
html[data-theme="dark"] .auth-section,
html[data-theme="dark"] .verify-page { background-color: var(--surface-0); color: var(--theme-text); }

html[data-theme="dark"] .header { background: rgba(23, 27, 37, .97); border-bottom: 1px solid var(--theme-border); }
html[data-theme="dark"] .logo-text .name,
html[data-theme="dark"] .nav-menu a { color: var(--theme-text); }
html[data-theme="dark"] .nav-dropdown { background: var(--surface-1); border: 1px solid var(--theme-border); }
html[data-theme="dark"] .nav-dropdown li a:hover { background: var(--surface-2); }
html[data-theme="dark"] .header .btn-outline { border-color: var(--gold); color: var(--theme-text); }
html[data-theme="dark"] .header .btn-outline:hover { background: var(--gold); color: #241344; }

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6 { color: var(--theme-text); }

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .form-control {
    background: var(--surface-2) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .verify-card,
html[data-theme="dark"] .admin-card,
html[data-theme="dark"] .dashboard-card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .content-card,
html[data-theme="dark"] .notification-dropdown,
html[data-theme="dark"] .user-dropdown,
html[data-theme="dark"] .modal-content {
    background: var(--surface-1) !important;
    color: var(--theme-text);
    border-color: var(--theme-border) !important;
    box-shadow: var(--theme-shadow);
}

html[data-theme="dark"] table,
html[data-theme="dark"] th,
html[data-theme="dark"] td { color: var(--theme-text); border-color: var(--theme-border) !important; }
html[data-theme="dark"] th { background: var(--surface-2) !important; }
html[data-theme="dark"] tr:hover td { background: rgba(255,255,255,.025); }
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] p { color: var(--theme-muted); }

.auth-choice {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.auth-choice label {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 14px;
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    background: var(--surface-1);
    cursor: pointer;
}

/* Shared authentication layout used by recovery and provider screens. */
.auth-section {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    padding: 72px 0;
    background: var(--surface-0);
}
.auth-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, .82fr);
    max-width: 980px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid var(--theme-border);
    border-radius: 20px;
    background: var(--surface-1);
    box-shadow: var(--theme-shadow);
}
.auth-card { padding: clamp(28px, 5vw, 54px); }
.auth-header { margin-bottom: 28px; }
.auth-header h2 { margin-bottom: 8px; }
.auth-header p { color: var(--theme-muted); }
.auth-form .form-group { margin-bottom: 18px; }
.auth-banner {
    position: relative;
    min-height: 500px;
    display: grid;
    place-items: center;
    padding: 44px;
    color: #fff;
}
.auth-banner-content { position: relative; z-index: 1; max-width: 360px; text-align: center; }
.auth-banner h3 { color: #fff; margin-bottom: 14px; }
.auth-banner p { color: rgba(255,255,255,.82); }
.auth-footer { margin-top: 22px; text-align: center; }

/* Stronger visual hierarchy for long sidebars. */
.admin-sidebar .nav-section + .nav-section,
.dashboard-sidebar .nav-section + .nav-section { border-top: 1px solid rgba(255,255,255,.055); padding-top: 10px; }
.admin-sidebar .nav-section-title,
.dashboard-sidebar .nav-section-title { letter-spacing: .11em; }

@media (max-width: 640px) {
    .auth-choice { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .auth-container { grid-template-columns: 1fr; }
    .auth-banner { display: none; }
    .auth-section { padding: 40px 16px; }
}

@media (max-width: 640px) {
    .header .nav-wrapper { min-height: 74px; }
    .header .logo img { width: 48px; height: 48px; }
    .header .logo-text .name { font-size: .96rem; }
    .header .logo-text .tagline { font-size: .65rem; }
    .header .nav-actions { gap: 8px; }
    .header .search-toggle,
    .header .nav-actions > a.btn { display: none; }
    .header .theme-toggle { width: 38px; height: 38px; }
    .header .mobile-toggle { display: block; }
}
