/* 
 * Aula Virtual - Main Stylesheet
 * --------------------------------
 * Responsive, Agile, Corporate Identity
 */

:root {
    /* Corporate Colors - Policia Local Castilla la Mancha */
    --color-blue: #002654;
    /* Pantone 280 C */
    --color-blue-dark: #001a3d;
    --color-blue-light: #1e4b8a;

    --color-yellow: #f4d03f;
    /* Corporate Yellow */
    --color-yellow-hover: #eac124;

    --color-accent: #3498db;
    /* Light Blue Accent */
    --color-red: #c0392b;
    /* Alert/Danger */
    --color-green: #27ae60;
    /* Success/Pass */

    /* Functional Mappings */
    --primary: var(--color-blue);
    --primary-hover: var(--color-blue-dark);
    --secondary: var(--color-yellow);
    --accent: var(--color-accent);
    --text-main: #2c3e50;
    --text-light: #64748b;
    --text-muted: #64748b;
    --text-white: #ffffff;
    --primary-dark: #1e293b;

    --bg-body: #f1f5f9;
    /* Light Gray Background */
    --bg-white: #ffffff;
    --bg-sidebar: var(--color-blue);

    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius: 0.5rem;
}

/* Base & Reset */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5 {
    color: var(--primary);
    margin-top: 0;
    font-weight: 700;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: 0.2s;
}

a:hover {
    color: var(--color-accent);
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.text-center {
    text-align: center;
}

.d-flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.align-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.w-100 {
    width: 100%;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

/* Components */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-white);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--color-blue-dark);
}

.btn-secondary:hover {
    background-color: var(--color-yellow-hover);
}

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    border: 1px solid var(--border);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: #f8fafc;
    transition: 0.2s border-color, 0.2s box-shadow;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1);
}

/* Layout: Authentication (Login) */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-blue) 0%, var(--color-blue-dark) 100%);
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-top: 5px solid var(--secondary);
}

.auth-logo {
    width: 100px;
    height: 100px;
    background: #fff;
    border-radius: 50%;
    padding: 5px;
    margin: -70px auto 1rem;
    box-shadow: var(--shadow-md);
    border: 3px solid var(--secondary);
    object-fit: contain;
}

/* Dashboard Cards (Backend Style Port) */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* Mobile: 1 col */
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        /* Tablet: 2 cols */
    }
}

@media (min-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
        /* Desktop: 3 cols */
    }
}

.dash-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    height: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    /* For when used as anchor */
    color: inherit;
}

.dash-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.dash-header {
    padding: 1rem 1.25rem;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dash-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-body {
    flex: 1;
    padding: 1.25rem;
    color: var(--text-light);
    font-size: 0.95rem;
}

.dash-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    background: #fff;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Responsive Grid */
.grid {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Mobile Optimizations */
@media (max-width: 640px) {
    .container {
        padding: 0 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.75rem;
    }
}

/* ============================================
   DARK MODE
   ============================================ */

[data-theme="dark"] {
    /* Core Colors - Dark Palette */
    --bg-body: #0f172a;
    --bg-white: #1e293b;
    --text-main: #e2e8f0;
    --text-light: #94a3b8;
    --text-white: #f1f5f9;
    --border: #334155;

    /* Primary stays recognizable but slightly lighter for contrast */
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-dark: #93c5fd;
    --secondary: #f4d03f;
    --accent: #60a5fa;
    --text-muted: #94a3b8;

    /* Shadows for dark - more subtle */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);

    color-scheme: dark;
}

/* --- Dark Mode Component Overrides --- */

/* Body */
[data-theme="dark"] body {
    background-color: var(--bg-body) !important;
    color: var(--text-main);
}

/* Headings */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5 {
    color: #93c5fd;
}

/* Links */
[data-theme="dark"] a {
    color: #60a5fa;
}

[data-theme="dark"] a:hover {
    color: #93c5fd;
}

/* Cards */
[data-theme="dark"] .card {
    background: var(--bg-white);
    border-color: var(--border);
}

/* Dashboard Cards */
[data-theme="dark"] .dash-card {
    background: var(--bg-white) !important;
    border-color: var(--border) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .dash-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .dash-header {
    background: #162032 !important;
    border-bottom-color: var(--border) !important;
}

[data-theme="dark"] .dash-title {
    color: var(--text-main) !important;
}

[data-theme="dark"] .dash-body {
    color: var(--text-light);
}

[data-theme="dark"] .dash-footer {
    background: var(--bg-white) !important;
    border-top-color: var(--border) !important;
    color: #60a5fa !important;
}

/* Form Inputs */
[data-theme="dark"] .form-input {
    background: #162032 !important;
    border-color: var(--border) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .form-input:focus {
    background: var(--bg-white) !important;
    border-color: var(--accent) !important;
}

[data-theme="dark"] .form-label {
    color: var(--text-main) !important;
}

/* Buttons - Force white text on colored buttons */
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] a.btn-primary,
[data-theme="dark"] a.btn {
    color: white !important;
}

[data-theme="dark"] .btn-primary {
    background-color: var(--primary);
}

[data-theme="dark"] .btn-secondary {
    background-color: var(--secondary);
    color: #1a1a2e;
}

/* --- Sidebar Dark Mode --- */
[data-theme="dark"] .sidebar-menu {
    background: #1e293b !important;
    border-right-color: var(--border) !important;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .sidebar-header {
    border-bottom-color: var(--border) !important;
}

[data-theme="dark"] .sidebar-header div {
    color: #60a5fa !important;
}

[data-theme="dark"] .nav-link {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .nav-link.active {
    background-color: #334155 !important;
}

[data-theme="dark"] .nav-link:hover>span,
[data-theme="dark"] .nav-link.active>span {
    color: #93c5fd !important;
}

/* Sidebar mobile user info */
[data-theme="dark"] .user-info-sidebar small {
    color: #94a3b8 !important;
}

[data-theme="dark"] .user-info-sidebar div[style*="color:#334155"],
[data-theme="dark"] .user-info-sidebar span[style*="color:#334155"] {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .user-info-sidebar div[style*="border-top"] {
    border-top-color: var(--border) !important;
}

/* Sidebar section labels */
[data-theme="dark"] .nav-list>li[style*="color:#94a3b8"] {
    color: #64748b !important;
}

/* Sidebar submenu */
[data-theme="dark"] .nav-item details ul {
    background: rgba(255, 255, 255, 0.03) !important;
}

/* Sidebar footer / logout */
[data-theme="dark"] .sidebar-menu>div[style*="border-top"] {
    border-top-color: var(--border) !important;
}

/* --- Footer Dark Mode --- */
[data-theme="dark"] footer[style*="border-top"] {
    border-top-color: var(--border) !important;
    color: #64748b !important;
}

/* --- Sidebar Overlay Dark Mode --- */
[data-theme="dark"] .sidebar-overlay {
    background: rgba(0, 0, 0, 0.7) !important;
}

/* --- Tables Dark Mode --- */
[data-theme="dark"] table {
    color: var(--text-main);
}

[data-theme="dark"] th {
    background: #162032 !important;
    color: var(--text-main) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] td {
    border-color: var(--border) !important;
}

[data-theme="dark"] tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* --- Alerts / Badges Dark Mode --- */
[data-theme="dark"] .alert,
[data-theme="dark"] [class*="alert-"] {
    border-color: var(--border) !important;
}

/* --- Select / Dropdowns --- */
[data-theme="dark"] select {
    background: #162032 !important;
    border-color: var(--border) !important;
    color: var(--text-main) !important;
}

/* --- Generic overrides for inline bg-white --- */
[data-theme="dark"] [style*="background:#fff"],
[data-theme="dark"] [style*="background: #fff"],
[data-theme="dark"] [style*="background-color:#fff"],
[data-theme="dark"] [style*="background-color: #fff"],
[data-theme="dark"] [style*="background:#ffffff"],
[data-theme="dark"] [style*="background: #ffffff"],
[data-theme="dark"] [style*="background-color:#ffffff"],
[data-theme="dark"] [style*="background-color: #ffffff"],
[data-theme="dark"] [style*="background: white"],
[data-theme="dark"] [style*="background:white"] {
    background: var(--bg-white) !important;
    color: var(--text-main) !important;
}

/* Generic overrides for inline text colors */
[data-theme="dark"] [style*="color:#2c3e50"],
[data-theme="dark"] [style*="color: #2c3e50"],
[data-theme="dark"] [style*="color:#334155"],
[data-theme="dark"] [style*="color: #334155"],
[data-theme="dark"] [style*="color:#1e293b"],
[data-theme="dark"] [style*="color: #1e293b"],
[data-theme="dark"] [style*="color:#0f172a"],
[data-theme="dark"] [style*="color: #0f172a"] {
    color: var(--text-main) !important;
}

[data-theme="dark"] [style*="color:#475569"],
[data-theme="dark"] [style*="color: #475569"],
[data-theme="dark"] [style*="color:#64748b"],
[data-theme="dark"] [style*="color: #64748b"] {
    color: var(--text-light) !important;
}

/* Generic border overrides */
[data-theme="dark"] [style*="border-color:#e2e8f0"],
[data-theme="dark"] [style*="border-color: #e2e8f0"],
[data-theme="dark"] [style*="border-top:1px solid #e2e8f0"],
[data-theme="dark"] [style*="border-top:1px solid #f1f5f9"],
[data-theme="dark"] [style*="border-bottom:1px solid #f1f5f9"],
[data-theme="dark"] [style*="border: 1px solid #e2e8f0"] {
    border-color: var(--border) !important;
}

/* Light gray backgrounds → dark */
[data-theme="dark"] [style*="background:#f8f9fa"],
[data-theme="dark"] [style*="background: #f8f9fa"],
[data-theme="dark"] [style*="background-color:#f8f9fa"],
[data-theme="dark"] [style*="background-color: #f8f9fa"],
[data-theme="dark"] [style*="background:#f1f5f9"],
[data-theme="dark"] [style*="background: #f1f5f9"],
[data-theme="dark"] [style*="background-color:#f1f5f9"],
[data-theme="dark"] [style*="background-color: #f1f5f9"],
[data-theme="dark"] [style*="background:#f8fafc"],
[data-theme="dark"] [style*="background: #f8fafc"],
[data-theme="dark"] [style*="background-color: #f8fafc"] {
    background: #162032 !important;
}

/* Tinted light backgrounds → dark equivalents */
[data-theme="dark"] [style*="background: linear-gradient"] {
    background: var(--bg-white) !important;
}

[data-theme="dark"] [style*="background:#f0f9ff"],
[data-theme="dark"] [style*="background: #f0f9ff"],
[data-theme="dark"] [style*="background:#ecfdf5"],
[data-theme="dark"] [style*="background: #ecfdf5"],
[data-theme="dark"] [style*="background:#eff6ff"],
[data-theme="dark"] [style*="background: #eff6ff"],
[data-theme="dark"] [style*="background:#fff7ed"],
[data-theme="dark"] [style*="background: #fff7ed"] {
    background: #162032 !important;
}

/* More tinted backgrounds (flashcards, icon circles) */
[data-theme="dark"] [style*="background:#d1fae5"],
[data-theme="dark"] [style*="background: #d1fae5"],
[data-theme="dark"] [style*="background:#f3e8ff"],
[data-theme="dark"] [style*="background: #f3e8ff"],
[data-theme="dark"] [style*="background:#dbeafe"],
[data-theme="dark"] [style*="background: #dbeafe"],
[data-theme="dark"] [style*="background:#ecfccb"],
[data-theme="dark"] [style*="background: #ecfccb"] {
    background: #1e293b !important;
}

/* Blue info boxes (SRS info, alerts with blue text) */
[data-theme="dark"] [style*="color:#1e40af"],
[data-theme="dark"] [style*="color: #1e40af"] {
    color: #93c5fd !important;
}

[data-theme="dark"] [style*="color:#365314"],
[data-theme="dark"] [style*="color: #365314"],
[data-theme="dark"] [style*="color:#9a3412"],
[data-theme="dark"] [style*="color: #9a3412"] {
    color: #e2e8f0 !important;
}

/* var(--primary-dark) fallback */
[data-theme="dark"] [style*="var(--primary-dark)"] {
    color: #93c5fd !important;
}

/* var(--text-muted) fallback */
[data-theme="dark"] [style*="var(--text-muted)"] {
    color: var(--text-light) !important;
}

/* Red tinted backgrounds (error banners, alert cards) */
[data-theme="dark"] [style*="background:#fef2f2"],
[data-theme="dark"] [style*="background: #fef2f2"],
[data-theme="dark"] [style*="background:#fee2e2"],
[data-theme="dark"] [style*="background: #fee2e2"] {
    background: #2a1215 !important;
}

[data-theme="dark"] [style*="border: 1px solid #fecaca"],
[data-theme="dark"] [style*="border:1px solid #fecaca"] {
    border-color: #7f1d1d !important;
}

/* White lock overlays → dark */
[data-theme="dark"] [style*="background: rgba(255,255,255,0.7)"],
[data-theme="dark"] [style*="background: rgba(255,255,255,0.85)"],
[data-theme="dark"] [style*="background:rgba(255,255,255,0.7)"],
[data-theme="dark"] [style*="background:rgba(255,255,255,0.85)"] {
    background: rgba(15, 23, 42, 0.85) !important;
}

/* .bg-light, .bg-white in dark */
[data-theme="dark"] .bg-light,
[data-theme="dark"] .bg-white {
    background: var(--bg-white) !important;
}

/* .card-header border */
[data-theme="dark"] .card-header {
    border-bottom-color: var(--border) !important;
}

/* .text-muted */
[data-theme="dark"] .text-muted {
    color: var(--text-light) !important;
}

/* Option cards (flashcards new draw) */
[data-theme="dark"] .option-card {
    background: var(--bg-white) !important;
    border-color: var(--border) !important;
    color: var(--text-light) !important;
}

[data-theme="dark"] .option-card:hover {
    background: #334155 !important;
    border-color: #3b82f6 !important;
    color: var(--text-main) !important;
}

/* Forecast grid */
[data-theme="dark"] .forecast-grid {
    background: #162032 !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] .forecast-item .label {
    color: var(--text-light) !important;
}

[data-theme="dark"] .forecast-item .count {
    color: var(--text-main) !important;
}

/* Progress bars */
[data-theme="dark"] .progress {
    background: #334155 !important;
}

/* Lock overlay dark */
[data-theme="dark"] .lock-overlay {
    background: rgba(15, 23, 42, 0.9) !important;
}

/* Inline border overrides for #dbeafe */
[data-theme="dark"] [style*="border: 1px solid #dbeafe"],
[data-theme="dark"] [style*="border:1px solid #dbeafe"] {
    border-color: var(--border) !important;
}

/* --- 3x5 Test Page Dark Mode --- */
[data-theme="dark"] .q3x5-stats {
    background: var(--bg-white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .q3x5-question-card {
    background: var(--bg-white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .q3x5-question-text {
    color: var(--text-main);
}

[data-theme="dark"] .q3x5-badge {
    background: #334155;
    color: #94a3b8;
}

[data-theme="dark"] .q3x5-option {
    background: var(--bg-white);
    border-color: var(--border);
    color: var(--text-main);
}

[data-theme="dark"] .q3x5-option:hover:not(.disabled) {
    border-color: #f97316;
    background: #2a1f0f;
}

[data-theme="dark"] .q3x5-option .letter {
    background: #334155;
    color: #94a3b8;
}

[data-theme="dark"] .q3x5-option.correct {
    border-color: #22c55e;
    background: #0a2617;
    color: #4ade80;
}

[data-theme="dark"] .q3x5-option.wrong {
    border-color: #ef4444;
    background: #2a1215;
    color: #f87171;
}

[data-theme="dark"] .q3x5-option.was-correct {
    border-color: #22c55e;
    background: #0a2617;
}

[data-theme="dark"] .q3x5-nav {
    background: var(--bg-white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .q3x5-nav-dot {
    border-color: var(--border);
    color: #94a3b8;
    background: #162032;
}

[data-theme="dark"] .q3x5-nav-dot.current {
    border-color: #f97316;
    color: #f97316;
    background: #2a1f0f;
}

[data-theme="dark"] .q3x5-feedback.correct {
    background: #0a2617;
    border-color: #166534;
    color: #4ade80;
}

[data-theme="dark"] .q3x5-feedback.wrong {
    background: #2a1215;
    border-color: #7f1d1d;
    color: #fca5a5;
}

/* --- Dark Mode Toggle Button --- */
.theme-toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    padding: 0.35rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    transition: background 0.3s ease;
    -webkit-user-select: none;
    user-select: none;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.theme-toggle .toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    transition: opacity 0.3s ease;
}

/* Hide/show sun/moon based on theme */
.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle .icon-moon {
    display: flex;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: flex;
}

[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

/* Smooth transition for theme change */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* --- Specific Modules Dark Mode Overrides --- */

/* Flashcards Dark Mode (modules/flashcards/jugar.php) */
[data-theme="dark"] .flashcard-header {
    background: rgba(30, 41, 59, 0.95) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] .flashcard-header h2 {
    color: var(--text-main) !important;
}

[data-theme="dark"] .flashcard-card {
    background: var(--bg-white) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] .card-meta {
    border-bottom-color: var(--border) !important;
}

[data-theme="dark"] .card-content {
    color: var(--text-main) !important;
}

[data-theme="dark"] .confirm-box {
    background: var(--bg-white) !important;
}

[data-theme="dark"] .btn-grade.btn-incorrect {
    background: var(--bg-white) !important;
}

[data-theme="dark"] .btn-grade.btn-correct {
    background: var(--bg-white) !important;
}

/* Finalizar Test Dark Mode (modules/test/finalizar.php) */
[data-theme="dark"] .correction-card {
    background: var(--bg-white) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] .correction-opt.default {
    background: #162032 !important;
    color: var(--text-light) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] .ayto-warning {
    background: #2a1f0f !important;
    border-color: #78350f !important;
    color: #fcd34d !important;
}

[data-theme="dark"] .nav-review-btn {
    border-color: var(--border) !important;
}

[data-theme="dark"] .impugnar-form textarea {
    background: #162032 !important;
    color: var(--text-main) !important;
    border-color: var(--border) !important;
}

/* Eventos / FullCalendar Dark Mode (modules/eventos/index.php) */
[data-theme="dark"] #calendar {
    background: var(--bg-white) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] .fc-theme-standard td,
[data-theme="dark"] .fc-theme-standard th {
    border-color: var(--border) !important;
}

[data-theme="dark"] .fc-day-today {
    background: rgba(255, 255, 255, 0.05) !important;
}

[data-theme="dark"] .fc-list-day-cushion {
    background: #162032 !important;
}

[data-theme="dark"] .fc-list-event:hover td {
    background: rgba(255, 255, 255, 0.05) !important;
}

[data-theme="dark"] .fc-col-header-cell-cushion,
[data-theme="dark"] .fc-daygrid-day-number {
    color: var(--text-main) !important;
}

[data-theme="dark"] .fc-list-event-title a {
    color: var(--text-main) !important;
}

[data-theme="dark"] .fc-popover {
    background: var(--bg-white) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] .fc-popover-header {
    background: #162032 !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .fc-button-primary {
    color: white !important;
}

[data-theme="dark"] .fc-button-primary:disabled {
    opacity: 0.6;
}

/* Overrides for specific inline styles in these modules */
[data-theme="dark"] [style*="background: #f0fdf4"],
[data-theme="dark"] [style*="background:#f0fdf4"] {
    background: #0a2617 !important;
    border-color: #166534 !important;
}

[data-theme="dark"] [style*="color: #166534"],
[data-theme="dark"] [style*="color:#166534"] {
    color: #4ade80 !important;
}

[data-theme="dark"] [style*="color: #15803d"],
[data-theme="dark"] [style*="color:#15803d"] {
    color: #4ade80 !important;
}

[data-theme="dark"] [style*="color: #b91c1c"],
[data-theme="dark"] [style*="color:#b91c1c"] {
    color: #f87171 !important;
}

[data-theme="dark"] [style*="color: #ef4444"],
[data-theme="dark"] [style*="color:#ef4444"] {
    color: #fca5a5 !important;
}

[data-theme="dark"] [style*="background: #e0f2fe"],
[data-theme="dark"] [style*="background:#e0f2fe"] {
    background: #0f172a !important;
    border-color: #1e3a8a !important;
    color: #38bdf8 !important;
}

[data-theme="dark"] [style*="color: #0369a1"],
[data-theme="dark"] [style*="color:#0369a1"] {
    color: #38bdf8 !important;
}