:root {
    /* Default light palette (sane fallbacks in case main stylesheet :root fails) */
    --primary-color: #1f3a5f;
    --primary-color-rgb: 31, 58, 95;
    --primary-dark: #162d4a;
    --secondary-color: #475569;
    --accent-color: #0ea5a5;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --card-bg-color: #ffffff;

    /* Spacing and radii (subset) */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --border-radius-md: 0.375rem;
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);

    /* Navbar offset fallback */
    --navbar-offset: 7.5rem;
}

/* Light theme polish (scoped to body[data-theme="light"]) */
body[data-theme="light"] {
    /* Slightly softer app background and clearer separations */
    --light-color: #f5f7fb; /* page bg */
    --card-bg-color: #ffffff; /* cards stay white */
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
}

/* Cards and surfaces */
body[data-theme="light"] .card,
body[data-theme="light"] .maestras-card {
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, .06));
}

body[data-theme="light"] .card:hover,
body[data-theme="light"] .maestras-card:hover {
    box-shadow: var(--shadow-md, 0 4px 10px rgba(15, 23, 42, .08));
}

/* Footer styling for light theme */
body[data-theme="light"] .footer {
    background: #f1f5f9;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

/* Tables - subtle zebra and hover for light theme */
body[data-theme="light"] .table > :not(caption) > * > * {
    border-color: var(--border-color);
}

body[data-theme="light"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(15, 23, 42, 0.015);
}

body[data-theme="light"] .table-hover > tbody > tr:hover > * {
    background-color: rgba(15, 23, 42, 0.035);
}

/* Forms */
body[data-theme="light"] .form-control,
body[data-theme="light"] .form-select,
body[data-theme="light"] .input-group-text {
    background-color: #ffffff;
    color: var(--text-color);
    border-color: var(--border-color);
}

body[data-theme="light"] .form-control:focus,
body[data-theme="light"] .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-color-rgb, 31, 58, 95), 0.15);
}

/* Buttons */
body[data-theme="light"] .btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

body[data-theme="light"] .btn-primary:hover,
body[data-theme="light"] .btn-primary:focus {
    filter: brightness(0.95);
}

/* Badges/pills */
body[data-theme="light"] .badge.bg-light,
body[data-theme="light"] .badge.bg-secondary {
    background-color: #e5eaf1 !important;
    color: #334155 !important;
    border: 1px solid var(--border-color);
}

/* Navbar dropdowns - light theme contrast fixes */
body[data-theme="light"] .navbar .dropdown-menu {
    background: #ffffff;
    border: 1px solid var(--border-color);
}

body[data-theme="light"] .navbar .dropdown-item {
    color: var(--text-color);
}

body[data-theme="light"] .navbar .dropdown-item:hover {
    background-color: rgba(var(--primary-color-rgb, 31, 58, 95), 0.08);
    color: var(--text-color);
}

/* Adaptive overrides for Bootstrap text utilities to respect theme */
/* In light theme, anything marked as text-white should not be white; force readable dark text */
body[data-theme="light"] .text-white {
    color: var(--text-color, #111111) !important;
}

/* Ensure icons within also inherit the readable color */
body[data-theme="light"] .text-white i {
    color: inherit !important;
}

/* In dark theme, text-dark can become too low-contrast; elevate to light color */
body[data-theme="dark"] .text-dark {
    color: rgba(255, 255, 255, 0.92) !important;
}

body[data-theme="dark"] .text-dark i {
    color: inherit !important;
}

@media (max-width: 991.98px) {
    :root {
        --navbar-offset: 8.25rem;
    }
}