/**
 * Theme Definitions
 * Colour schemes for accessibility and user preference.
 * All text/background combinations meet WCAG AA contrast ratio (4.5:1 minimum).
 */

/* ============================================
   GLOBAL BRAND TOKENS
   Match the duty.blue landing page palette.
   Reference these in feature CSS instead of hardcoding
   colour values, so they remain consistent across themes.
   ============================================ */
:root {
    --brand-primary:         #4f46e5;  /* Indigo-600 — landing page CTA colour */
    --brand-primary-hover:   #4338ca;  /* Indigo-700 */
    --brand-secondary:       #06b6d4;  /* Cyan-500 */
    --brand-secondary-hover: #0891b2;  /* Cyan-600 */
    --brand-gradient:        linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    --brand-gradient-hover:  linear-gradient(135deg, #4338ca 0%, #0891b2 100%);

    /* Semantic status colours — Bootstrap 5 values */
    --color-success: #198754;
    --color-warning: #ffc107;
    --color-danger:  #dc3545;
    --color-info:    #0dcaf0;

    /* Legacy alias — prevents undefined var(--primary-color) in dashboard.css */
    --primary-color: var(--brand-primary);
}

/* ============================================
   LIGHT THEME (Default - matches current look)
   ============================================ */
[data-theme="light"],
:root {
    /* Sidebar logo */
    --theme-logo-bg: transparent;

    /* Page backgrounds */
    --theme-bg-primary: #f8f9fa;
    --theme-bg-secondary: #ffffff;
    --theme-bg-tertiary: #f8f9fa;

    /* Text colours */
    --theme-text-primary: #212529;
    --theme-text-secondary: #495057;
    --theme-text-muted: #6c757d;

    /* Borders */
    --theme-border-color: #dee2e6;
    --theme-border-light: #f0f0f0;

    /* Navigation */
    --theme-navbar-bg: #212529;
    --theme-navbar-text: #ffffff;
    --theme-sidebar-bg: #ffffff;
    --theme-sidebar-text: #495057;
    --theme-sidebar-hover-bg: #f8f9fa;
    --theme-sidebar-hover-text: #0d6efd;
    --theme-sidebar-active-bg: #e7f1ff;
    --theme-sidebar-active-text: #0d6efd;
    --theme-sidebar-active-border: #0d6efd;

    /* Cards */
    --theme-card-bg: #ffffff;
    --theme-card-header-bg: #f8f9fa;
    --theme-card-shadow: rgba(0, 0, 0, 0.075);

    /* Interactive elements */
    --theme-link-color: #0d6efd;
    --theme-link-hover: #0a58ca;
    --theme-focus-ring: rgba(13, 110, 253, 0.25);

    /* Hover states */
    --theme-hover-bg: #f8f9fa;
    --theme-table-hover-bg: #f8f9fa;

    /* Footer */
    --theme-footer-bg: #ffffff;
    --theme-footer-border: #dee2e6;

    /* Form elements */
    --theme-input-bg: #ffffff;
    --theme-input-border: #ced4da;
    --theme-input-text: #212529;
    --theme-input-placeholder: #6c757d;

    /* Shadows & overlays */
    --theme-shadow-color: rgba(0, 0, 0, 0.1);
    --theme-shadow-sidebar: rgba(0, 0, 0, 0.05);
    --theme-overlay-bg: rgba(0, 0, 0, 0.5);

    /* Modal */
    --theme-modal-bg: #ffffff;
    --theme-modal-shadow: rgba(0, 0, 0, 0.175);

    /* Dropdown */
    --theme-dropdown-bg: #ffffff;
    --theme-dropdown-border: #dee2e6;
    --theme-dropdown-hover-bg: #f8f9fa;
    --theme-dropdown-text: #212529;

    /* Alerts - keep standard Bootstrap colours in light mode */
    --theme-alert-info-bg: #cff4fc;
    --theme-alert-info-border: #0dcaf0;
    --theme-alert-info-text: #055160;
}

/* ============================================
   DARK THEME
   All combos tested for WCAG AA 4.5:1 ratio
   ============================================ */
[data-theme="dark"] {
    /* Sidebar logo */
    --theme-logo-bg: transparent;

    --theme-bg-primary: #1a1d23;
    --theme-bg-secondary: #22252b;
    --theme-bg-tertiary: #2c2f36;

    --theme-text-primary: #e4e6ea;
    --theme-text-secondary: #b0b3b8;
    --theme-text-muted: #8a8d91;

    --theme-border-color: #3a3d44;
    --theme-border-light: #2e3138;

    --theme-navbar-bg: #13151a;
    --theme-navbar-text: #e4e6ea;
    --theme-sidebar-bg: #22252b;
    --theme-sidebar-text: #b0b3b8;
    --theme-sidebar-hover-bg: #2c2f36;
    --theme-sidebar-hover-text: #6db3f8;
    --theme-sidebar-active-bg: #1a3a5c;
    --theme-sidebar-active-text: #6db3f8;
    --theme-sidebar-active-border: #6db3f8;

    --theme-card-bg: #22252b;
    --theme-card-header-bg: #2c2f36;
    --theme-card-shadow: rgba(0, 0, 0, 0.3);

    --theme-link-color: #6db3f8;
    --theme-link-hover: #90c7ff;
    --theme-focus-ring: rgba(109, 179, 248, 0.25);

    --theme-hover-bg: #2c2f36;
    --theme-table-hover-bg: #2c2f36;

    --theme-footer-bg: #22252b;
    --theme-footer-border: #3a3d44;

    --theme-input-bg: #2c2f36;
    --theme-input-border: #3a3d44;
    --theme-input-text: #e4e6ea;
    --theme-input-placeholder: #8a8d91;

    --theme-shadow-color: rgba(0, 0, 0, 0.4);
    --theme-shadow-sidebar: rgba(0, 0, 0, 0.2);
    --theme-overlay-bg: rgba(0, 0, 0, 0.7);

    --theme-modal-bg: #22252b;
    --theme-modal-shadow: rgba(0, 0, 0, 0.5);

    --theme-dropdown-bg: #22252b;
    --theme-dropdown-border: #3a3d44;
    --theme-dropdown-hover-bg: #2c2f36;
    --theme-dropdown-text: #e4e6ea;

    --theme-alert-info-bg: #1a3040;
    --theme-alert-info-border: #0dcaf0;
    --theme-alert-info-text: #b6effb;
}

/* CRITICAL: Force body and all containers to use theme colors in dark mode */
[data-theme="dark"] body {
    background-color: var(--theme-bg-primary) !important;
    color: var(--theme-text-primary) !important;
}

/* ============================================
   HIGH CONTRAST THEME
   For visual impairments. Min 7:1 ratio (AAA).
   Strong borders, bold visual separation.
   ============================================ */
[data-theme="high-contrast"] {
    /* Sidebar logo */
    --theme-logo-bg: transparent;

    --theme-bg-primary: #ffffff;
    --theme-bg-secondary: #ffffff;
    --theme-bg-tertiary: #f0f0f0;

    --theme-text-primary: #000000;
    --theme-text-secondary: #1a1a1a;
    --theme-text-muted: #333333;

    --theme-border-color: #000000;
    --theme-border-light: #666666;

    --theme-navbar-bg: #000000;
    --theme-navbar-text: #ffffff;
    --theme-sidebar-bg: #ffffff;
    --theme-sidebar-text: #000000;
    --theme-sidebar-hover-bg: #e6e6e6;
    --theme-sidebar-hover-text: #0000cc;
    --theme-sidebar-active-bg: #0000cc;
    --theme-sidebar-active-text: #ffffff;
    --theme-sidebar-active-border: #0000cc;

    --theme-card-bg: #ffffff;
    --theme-card-header-bg: #e6e6e6;
    --theme-card-shadow: rgba(0, 0, 0, 0.2);

    --theme-link-color: #0000cc;
    --theme-link-hover: #000099;
    --theme-focus-ring: rgba(0, 0, 204, 0.5);

    --theme-hover-bg: #e6e6e6;
    --theme-table-hover-bg: #e6e6e6;

    --theme-footer-bg: #ffffff;
    --theme-footer-border: #000000;

    --theme-input-bg: #ffffff;
    --theme-input-border: #000000;
    --theme-input-text: #000000;
    --theme-input-placeholder: #333333;

    --theme-shadow-color: rgba(0, 0, 0, 0.3);
    --theme-shadow-sidebar: rgba(0, 0, 0, 0.15);
    --theme-overlay-bg: rgba(0, 0, 0, 0.7);

    --theme-modal-bg: #ffffff;
    --theme-modal-shadow: rgba(0, 0, 0, 0.4);

    --theme-dropdown-bg: #ffffff;
    --theme-dropdown-border: #000000;
    --theme-dropdown-hover-bg: #e6e6e6;
    --theme-dropdown-text: #000000;

    --theme-alert-info-bg: #cff4fc;
    --theme-alert-info-border: #000000;
    --theme-alert-info-text: #000000;
}

/* ============================================
   WARM / MUTED THEME
   For neurodiverse users (dyslexia, ADHD, autism).
   - Warm cream background (no pure white)
   - Muted, low-saturation colours
   - Reduced visual noise
   - Slightly larger letter-spacing for readability
   ============================================ */
[data-theme="warm-muted"] {
    /* Sidebar logo - remove white background */
    --theme-logo-bg: transparent;
    --theme-bg-primary: #f5f0e8;
    --theme-bg-secondary: #faf6ef;
    --theme-bg-tertiary: #ede8df;

    --theme-text-primary: #3d3630;
    --theme-text-secondary: #5c534b;
    --theme-text-muted: #7a716a;

    --theme-border-color: #d5cec4;
    --theme-border-light: #e5ded5;

    --theme-navbar-bg: #4a423a;
    --theme-navbar-text: #f5f0e8;
    --theme-sidebar-bg: #faf6ef;
    --theme-sidebar-text: #5c534b;
    --theme-sidebar-hover-bg: #ede8df;
    --theme-sidebar-hover-text: #6b5d4f;
    --theme-sidebar-active-bg: #e3ddd3;
    --theme-sidebar-active-text: #4a3c30;
    --theme-sidebar-active-border: #9b8b7a;

    --theme-card-bg: #faf6ef;
    --theme-card-header-bg: #ede8df;
    --theme-card-shadow: rgba(61, 54, 48, 0.08);

    --theme-link-color: #7a6450;
    --theme-link-hover: #5c4a38;
    --theme-focus-ring: rgba(122, 100, 80, 0.25);

    --theme-hover-bg: #ede8df;
    --theme-table-hover-bg: #ede8df;

    --theme-footer-bg: #faf6ef;
    --theme-footer-border: #d5cec4;

    --theme-input-bg: #faf6ef;
    --theme-input-border: #d5cec4;
    --theme-input-text: #3d3630;
    --theme-input-placeholder: #7a716a;

    --theme-shadow-color: rgba(61, 54, 48, 0.1);
    --theme-shadow-sidebar: rgba(61, 54, 48, 0.06);
    --theme-overlay-bg: rgba(61, 54, 48, 0.4);

    --theme-modal-bg: #faf6ef;
    --theme-modal-shadow: rgba(61, 54, 48, 0.2);

    --theme-dropdown-bg: #faf6ef;
    --theme-dropdown-border: #d5cec4;
    --theme-dropdown-hover-bg: #ede8df;
    --theme-dropdown-text: #3d3630;

    --theme-alert-info-bg: #ede8df;
    --theme-alert-info-border: #9b8b7a;
    --theme-alert-info-text: #3d3630;
}

/* ============================================
   SOFT BLUE THEME (Dyslexia-friendly)
   Research shows blue/grey backgrounds can help
   reduce visual stress for many dyslexic readers.
   - Soft blue-grey background
   - Navy text for good contrast
   - Muted blue accents
   ============================================ */
[data-theme="soft-blue"] {
    /* Sidebar logo */
    --theme-logo-bg: transparent;

    /* Page backgrounds */
    --theme-bg-primary: #e8eef4;
    --theme-bg-secondary: #f0f4f8;
    --theme-bg-tertiary: #dce4ed;

    /* Text colours - navy for readability */
    --theme-text-primary: #2c3e50;
    --theme-text-secondary: #4a5d6f;
    --theme-text-muted: #6a7d8f;

    /* Borders */
    --theme-border-color: #c4d0dc;
    --theme-border-light: #d8e2eb;

    /* Navigation */
    --theme-navbar-bg: #34495e;
    --theme-navbar-text: #f0f4f8;
    --theme-sidebar-bg: #f0f4f8;
    --theme-sidebar-text: #4a5d6f;
    --theme-sidebar-hover-bg: #dce4ed;
    --theme-sidebar-hover-text: #2980b9;
    --theme-sidebar-active-bg: #d0dde8;
    --theme-sidebar-active-text: #2471a3;
    --theme-sidebar-active-border: #5dade2;

    /* Cards */
    --theme-card-bg: #f0f4f8;
    --theme-card-header-bg: #dce4ed;
    --theme-card-shadow: rgba(44, 62, 80, 0.08);

    /* Interactive elements */
    --theme-link-color: #2980b9;
    --theme-link-hover: #1f6391;
    --theme-focus-ring: rgba(41, 128, 185, 0.25);

    /* Hover states */
    --theme-hover-bg: #dce4ed;
    --theme-table-hover-bg: #dce4ed;

    /* Footer */
    --theme-footer-bg: #f0f4f8;
    --theme-footer-border: #c4d0dc;

    /* Form elements */
    --theme-input-bg: #f0f4f8;
    --theme-input-border: #c4d0dc;
    --theme-input-text: #2c3e50;
    --theme-input-placeholder: #6a7d8f;

    /* Shadows & overlays */
    --theme-shadow-color: rgba(44, 62, 80, 0.1);
    --theme-shadow-sidebar: rgba(44, 62, 80, 0.06);
    --theme-overlay-bg: rgba(44, 62, 80, 0.4);

    /* Modal */
    --theme-modal-bg: #f0f4f8;
    --theme-modal-shadow: rgba(44, 62, 80, 0.2);

    /* Dropdown */
    --theme-dropdown-bg: #f0f4f8;
    --theme-dropdown-border: #c4d0dc;
    --theme-dropdown-hover-bg: #dce4ed;
    --theme-dropdown-text: #2c3e50;

    /* Alerts */
    --theme-alert-info-bg: #dce4ed;
    --theme-alert-info-border: #5dade2;
    --theme-alert-info-text: #2c3e50;
}

/* ============================================
   MINT GREEN THEME (Dyslexia-friendly)
   Green/mint backgrounds can reduce visual
   stress and improve reading flow for some
   dyslexic users. Also helpful for ADHD.
   - Soft mint green background
   - Dark teal text for contrast
   - Calming green accents
   ============================================ */
[data-theme="mint-green"] {
    /* Sidebar logo */
    --theme-logo-bg: transparent;

    /* Page backgrounds */
    --theme-bg-primary: #e8f5f0;
    --theme-bg-secondary: #f0faf6;
    --theme-bg-tertiary: #d8ebe4;

    /* Text colours - dark teal for readability */
    --theme-text-primary: #2d4a42;
    --theme-text-secondary: #486860;
    --theme-text-muted: #628578;

    /* Borders */
    --theme-border-color: #b8d4ca;
    --theme-border-light: #d0e5dd;

    /* Navigation */
    --theme-navbar-bg: #3d5a50;
    --theme-navbar-text: #f0faf6;
    --theme-sidebar-bg: #f0faf6;
    --theme-sidebar-text: #486860;
    --theme-sidebar-hover-bg: #d8ebe4;
    --theme-sidebar-hover-text: #27ae60;
    --theme-sidebar-active-bg: #c8dfd6;
    --theme-sidebar-active-text: #1e8449;
    --theme-sidebar-active-border: #58d68d;

    /* Cards */
    --theme-card-bg: #f0faf6;
    --theme-card-header-bg: #d8ebe4;
    --theme-card-shadow: rgba(45, 74, 66, 0.08);

    /* Interactive elements */
    --theme-link-color: #27ae60;
    --theme-link-hover: #1e8449;
    --theme-focus-ring: rgba(39, 174, 96, 0.25);

    /* Hover states */
    --theme-hover-bg: #d8ebe4;
    --theme-table-hover-bg: #d8ebe4;

    /* Footer */
    --theme-footer-bg: #f0faf6;
    --theme-footer-border: #b8d4ca;

    /* Form elements */
    --theme-input-bg: #f0faf6;
    --theme-input-border: #b8d4ca;
    --theme-input-text: #2d4a42;
    --theme-input-placeholder: #628578;

    /* Shadows & overlays */
    --theme-shadow-color: rgba(45, 74, 66, 0.1);
    --theme-shadow-sidebar: rgba(45, 74, 66, 0.06);
    --theme-overlay-bg: rgba(45, 74, 66, 0.4);

    /* Modal */
    --theme-modal-bg: #f0faf6;
    --theme-modal-shadow: rgba(45, 74, 66, 0.2);

    /* Dropdown */
    --theme-dropdown-bg: #f0faf6;
    --theme-dropdown-border: #b8d4ca;
    --theme-dropdown-hover-bg: #d8ebe4;
    --theme-dropdown-text: #2d4a42;

    /* Alerts */
    --theme-alert-info-bg: #d8ebe4;
    --theme-alert-info-border: #58d68d;
    --theme-alert-info-text: #2d4a42;
}

/* ============================================
   PEACH / ROSE THEME (Dyslexia-friendly)
   Soft pink/peach backgrounds are recommended
   by some dyslexia research as reducing glare
   and visual stress. Gentle on eyes.
   ============================================ */
[data-theme="peach-rose"] {
    /* Sidebar logo */
    --theme-logo-bg: transparent;

    /* Page backgrounds */
    --theme-bg-primary: #faf0ed;
    --theme-bg-secondary: #fcf5f3;
    --theme-bg-tertiary: #f2e4e0;

    /* Text colours - warm brown for readability */
    --theme-text-primary: #4a3832;
    --theme-text-secondary: #6a534b;
    --theme-text-muted: #8a7068;

    /* Borders */
    --theme-border-color: #e0ccc6;
    --theme-border-light: #edddd8;

    /* Navigation */
    --theme-navbar-bg: #5a4a44;
    --theme-navbar-text: #fcf5f3;
    --theme-sidebar-bg: #fcf5f3;
    --theme-sidebar-text: #6a534b;
    --theme-sidebar-hover-bg: #f2e4e0;
    --theme-sidebar-hover-text: #c0776e;
    --theme-sidebar-active-bg: #e8d6d0;
    --theme-sidebar-active-text: #a05a50;
    --theme-sidebar-active-border: #d4918a;

    /* Cards */
    --theme-card-bg: #fcf5f3;
    --theme-card-header-bg: #f2e4e0;
    --theme-card-shadow: rgba(74, 56, 50, 0.08);

    /* Interactive elements */
    --theme-link-color: #c0776e;
    --theme-link-hover: #a05a50;
    --theme-focus-ring: rgba(192, 119, 110, 0.25);

    /* Hover states */
    --theme-hover-bg: #f2e4e0;
    --theme-table-hover-bg: #f2e4e0;

    /* Footer */
    --theme-footer-bg: #fcf5f3;
    --theme-footer-border: #e0ccc6;

    /* Form elements */
    --theme-input-bg: #fcf5f3;
    --theme-input-border: #e0ccc6;
    --theme-input-text: #4a3832;
    --theme-input-placeholder: #8a7068;

    /* Shadows & overlays */
    --theme-shadow-color: rgba(74, 56, 50, 0.1);
    --theme-shadow-sidebar: rgba(74, 56, 50, 0.06);
    --theme-overlay-bg: rgba(74, 56, 50, 0.4);

    /* Modal */
    --theme-modal-bg: #fcf5f3;
    --theme-modal-shadow: rgba(74, 56, 50, 0.2);

    /* Dropdown */
    --theme-dropdown-bg: #fcf5f3;
    --theme-dropdown-border: #e0ccc6;
    --theme-dropdown-hover-bg: #f2e4e0;
    --theme-dropdown-text: #4a3832;

    /* Alerts */
    --theme-alert-info-bg: #f2e4e0;
    --theme-alert-info-border: #d4918a;
    --theme-alert-info-text: #4a3832;
}


/* ============================================
   THEME-SPECIFIC ELEMENT RULES
   ============================================ */

/* --- Explicit body/html background for all themes --- */
/* These override Bootstrap's default body styles */
[data-theme="dark"],
[data-theme="dark"] body {
    background-color: #1a1d23 !important;
    color: #e4e6ea !important;
}

[data-theme="high-contrast"],
[data-theme="high-contrast"] body {
    background-color: #ffffff !important;
    color: #000000 !important;
}

[data-theme="warm-muted"],
[data-theme="warm-muted"] body {
    background-color: #f5f0e8 !important;
    color: #3d3630 !important;
}

[data-theme="soft-blue"],
[data-theme="soft-blue"] body {
    background-color: #e8eef4 !important;
    color: #2c3e50 !important;
}

[data-theme="mint-green"],
[data-theme="mint-green"] body {
    background-color: #e8f5f0 !important;
    color: #2d4a42 !important;
}

[data-theme="peach-rose"],
[data-theme="peach-rose"] body {
    background-color: #faf0ed !important;
    color: #4a3832 !important;
}

/* Container backgrounds */
[data-theme="dark"] .container,
[data-theme="dark"] .container-fluid,
[data-theme="dark"] .main-content,
[data-theme="warm-muted"] .container,
[data-theme="warm-muted"] .container-fluid,
[data-theme="warm-muted"] .main-content,
[data-theme="soft-blue"] .container,
[data-theme="soft-blue"] .container-fluid,
[data-theme="soft-blue"] .main-content,
[data-theme="mint-green"] .container,
[data-theme="mint-green"] .container-fluid,
[data-theme="mint-green"] .main-content,
[data-theme="peach-rose"] .container,
[data-theme="peach-rose"] .container-fluid,
[data-theme="peach-rose"] .main-content {
    background-color: transparent;
}

/* --- Sidebar logo background fix --- */
/* Remove white background from logo in all themes */
.sidebar-logo-container {
    background-color: var(--theme-logo-bg, transparent) !important;
}

.sidebar-logo {
    background-color: transparent !important;
}

/* --- Navbar overrides --- */
[data-theme="dark"] .navbar.bg-dark,
[data-theme="high-contrast"] .navbar.bg-dark,
[data-theme="warm-muted"] .navbar.bg-dark,
[data-theme="soft-blue"] .navbar.bg-dark,
[data-theme="mint-green"] .navbar.bg-dark,
[data-theme="peach-rose"] .navbar.bg-dark {
    background-color: var(--theme-navbar-bg) !important;
}

/* --- High Contrast extras: thicker borders, underlined links --- */
[data-theme="high-contrast"] .card {
    border: 2px solid var(--theme-border-color) !important;
}

[data-theme="high-contrast"] a:not(.btn):not(.nav-link):not(.dropdown-item) {
    text-decoration: underline;
}

[data-theme="high-contrast"] .sidebar .nav-link {
    border-left-width: 4px;
}

[data-theme="high-contrast"] .form-control,
[data-theme="high-contrast"] .form-select {
    border-width: 2px;
}

[data-theme="high-contrast"] .badge {
    border: 1px solid currentColor;
}

/* --- Dyslexia-friendly extras: readability aids --- */
/* Increased letter/word spacing helps with reading flow */
[data-theme="warm-muted"] body,
[data-theme="soft-blue"] body,
[data-theme="mint-green"] body,
[data-theme="peach-rose"] body {
    letter-spacing: 0.02em;
    word-spacing: 0.05em;
}

/* Softer card shadows for reduced visual noise */
[data-theme="warm-muted"] .card,
[data-theme="soft-blue"] .card,
[data-theme="mint-green"] .card,
[data-theme="peach-rose"] .card {
    box-shadow: none !important;
    border: 1px solid var(--theme-border-color);
}

/* --- Bootstrap utility overrides for all non-light themes --- */
[data-theme="dark"] .bg-white,
[data-theme="dark"] .card-header.bg-white,
[data-theme="dark"] .card-footer.bg-white,
[data-theme="warm-muted"] .bg-white,
[data-theme="warm-muted"] .card-header.bg-white,
[data-theme="warm-muted"] .card-footer.bg-white,
[data-theme="soft-blue"] .bg-white,
[data-theme="soft-blue"] .card-header.bg-white,
[data-theme="soft-blue"] .card-footer.bg-white,
[data-theme="mint-green"] .bg-white,
[data-theme="mint-green"] .card-header.bg-white,
[data-theme="mint-green"] .card-footer.bg-white,
[data-theme="peach-rose"] .bg-white,
[data-theme="peach-rose"] .card-header.bg-white,
[data-theme="peach-rose"] .card-footer.bg-white {
    background-color: var(--theme-card-bg) !important;
    color: var(--theme-text-primary) !important;
}

/* Ensure card headers have visible text */
[data-theme="dark"] .card-header,
[data-theme="dark"] .card-header h1,
[data-theme="dark"] .card-header h2,
[data-theme="dark"] .card-header h3,
[data-theme="dark"] .card-header h4,
[data-theme="dark"] .card-header h5,
[data-theme="dark"] .card-header h6 {
    color: var(--theme-text-primary) !important;
}

[data-theme="dark"] .bg-light,
[data-theme="warm-muted"] .bg-light,
[data-theme="soft-blue"] .bg-light,
[data-theme="mint-green"] .bg-light,
[data-theme="peach-rose"] .bg-light {
    background-color: var(--theme-bg-tertiary) !important;
}

[data-theme="dark"] .text-muted,
[data-theme="warm-muted"] .text-muted,
[data-theme="high-contrast"] .text-muted,
[data-theme="soft-blue"] .text-muted,
[data-theme="mint-green"] .text-muted,
[data-theme="peach-rose"] .text-muted {
    color: var(--theme-text-muted) !important;
}

[data-theme="dark"] .text-dark,
[data-theme="warm-muted"] .text-dark,
[data-theme="high-contrast"] .text-dark,
[data-theme="soft-blue"] .text-dark,
[data-theme="mint-green"] .text-dark,
[data-theme="peach-rose"] .text-dark {
    color: var(--theme-text-primary) !important;
}

[data-theme="dark"] .border-bottom,
[data-theme="warm-muted"] .border-bottom,
[data-theme="high-contrast"] .border-bottom,
[data-theme="soft-blue"] .border-bottom,
[data-theme="mint-green"] .border-bottom,
[data-theme="peach-rose"] .border-bottom {
    border-color: var(--theme-border-color) !important;
}

/* Caret (text cursor) visibility fix - ensures the blinking insertion cursor
   is always visible regardless of Windows system cursor colour settings */
input,
textarea,
[contenteditable] {
    caret-color: auto;
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] [contenteditable],
[data-theme="warm-muted"] input,
[data-theme="warm-muted"] textarea,
[data-theme="warm-muted"] [contenteditable],
[data-theme="high-contrast"] input,
[data-theme="high-contrast"] textarea,
[data-theme="high-contrast"] [contenteditable],
[data-theme="soft-blue"] input,
[data-theme="soft-blue"] textarea,
[data-theme="soft-blue"] [contenteditable],
[data-theme="mint-green"] input,
[data-theme="mint-green"] textarea,
[data-theme="mint-green"] [contenteditable],
[data-theme="peach-rose"] input,
[data-theme="peach-rose"] textarea,
[data-theme="peach-rose"] [contenteditable] {
    caret-color: var(--theme-input-text);
}

/* Form controls */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="warm-muted"] .form-control,
[data-theme="warm-muted"] .form-select,
[data-theme="high-contrast"] .form-control,
[data-theme="high-contrast"] .form-select,
[data-theme="soft-blue"] .form-control,
[data-theme="soft-blue"] .form-select,
[data-theme="mint-green"] .form-control,
[data-theme="mint-green"] .form-select,
[data-theme="peach-rose"] .form-control,
[data-theme="peach-rose"] .form-select {
    background-color: var(--theme-input-bg);
    border-color: var(--theme-input-border);
    color: var(--theme-input-text);
}

[data-theme="dark"] .form-control::placeholder,
[data-theme="warm-muted"] .form-control::placeholder,
[data-theme="soft-blue"] .form-control::placeholder,
[data-theme="mint-green"] .form-control::placeholder,
[data-theme="peach-rose"] .form-control::placeholder {
    color: var(--theme-input-placeholder);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="warm-muted"] .form-control:focus,
[data-theme="warm-muted"] .form-select:focus,
[data-theme="soft-blue"] .form-control:focus,
[data-theme="soft-blue"] .form-select:focus,
[data-theme="mint-green"] .form-control:focus,
[data-theme="mint-green"] .form-select:focus,
[data-theme="peach-rose"] .form-control:focus,
[data-theme="peach-rose"] .form-select:focus {
    background-color: var(--theme-input-bg);
    color: var(--theme-input-text);
    border-color: var(--theme-link-color);
    box-shadow: 0 0 0 0.25rem var(--theme-focus-ring);
}

/* Dropdowns */
[data-theme="dark"] .dropdown-menu,
[data-theme="warm-muted"] .dropdown-menu,
[data-theme="high-contrast"] .dropdown-menu,
[data-theme="soft-blue"] .dropdown-menu,
[data-theme="mint-green"] .dropdown-menu,
[data-theme="peach-rose"] .dropdown-menu {
    background-color: var(--theme-dropdown-bg);
    border-color: var(--theme-dropdown-border);
}

[data-theme="dark"] .dropdown-item,
[data-theme="warm-muted"] .dropdown-item,
[data-theme="high-contrast"] .dropdown-item,
[data-theme="soft-blue"] .dropdown-item,
[data-theme="mint-green"] .dropdown-item,
[data-theme="peach-rose"] .dropdown-item {
    color: var(--theme-dropdown-text);
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus,
[data-theme="warm-muted"] .dropdown-item:hover,
[data-theme="warm-muted"] .dropdown-item:focus,
[data-theme="high-contrast"] .dropdown-item:hover,
[data-theme="high-contrast"] .dropdown-item:focus,
[data-theme="soft-blue"] .dropdown-item:hover,
[data-theme="soft-blue"] .dropdown-item:focus,
[data-theme="mint-green"] .dropdown-item:hover,
[data-theme="mint-green"] .dropdown-item:focus,
[data-theme="peach-rose"] .dropdown-item:hover,
[data-theme="peach-rose"] .dropdown-item:focus {
    background-color: var(--theme-dropdown-hover-bg);
    color: var(--theme-dropdown-text);
}

[data-theme="dark"] .dropdown-divider,
[data-theme="warm-muted"] .dropdown-divider,
[data-theme="soft-blue"] .dropdown-divider,
[data-theme="mint-green"] .dropdown-divider,
[data-theme="peach-rose"] .dropdown-divider {
    border-color: var(--theme-border-color);
}

/* Modals */
[data-theme="dark"] .modal-content,
[data-theme="warm-muted"] .modal-content,
[data-theme="soft-blue"] .modal-content,
[data-theme="mint-green"] .modal-content,
[data-theme="peach-rose"] .modal-content {
    background-color: var(--theme-modal-bg);
    color: var(--theme-text-primary);
}

[data-theme="dark"] .modal-header,
[data-theme="warm-muted"] .modal-header,
[data-theme="soft-blue"] .modal-header,
[data-theme="mint-green"] .modal-header,
[data-theme="peach-rose"] .modal-header {
    border-bottom-color: var(--theme-border-color);
}

[data-theme="dark"] .modal-footer,
[data-theme="warm-muted"] .modal-footer,
[data-theme="soft-blue"] .modal-footer,
[data-theme="mint-green"] .modal-footer,
[data-theme="peach-rose"] .modal-footer {
    border-top-color: var(--theme-border-color);
}

[data-theme="dark"] .modal-title,
[data-theme="warm-muted"] .modal-title,
[data-theme="soft-blue"] .modal-title,
[data-theme="mint-green"] .modal-title,
[data-theme="peach-rose"] .modal-title {
    color: var(--theme-text-primary);
}

[data-theme="dark"] .modal-body,
[data-theme="warm-muted"] .modal-body,
[data-theme="soft-blue"] .modal-body,
[data-theme="mint-green"] .modal-body,
[data-theme="peach-rose"] .modal-body {
    color: var(--theme-text-primary);
}

/* Confirmation modal styling - headers have colored backgrounds, so body text needs theme colors */
[data-theme="dark"] .confirm-modal .modal-body,
[data-theme="warm-muted"] .confirm-modal .modal-body,
[data-theme="soft-blue"] .confirm-modal .modal-body,
[data-theme="mint-green"] .confirm-modal .modal-body,
[data-theme="peach-rose"] .confirm-modal .modal-body {
    background-color: var(--theme-modal-bg);
    color: var(--theme-text-primary);
}

[data-theme="dark"] .confirm-modal .modal-footer,
[data-theme="warm-muted"] .confirm-modal .modal-footer,
[data-theme="soft-blue"] .confirm-modal .modal-footer,
[data-theme="mint-green"] .confirm-modal .modal-footer,
[data-theme="peach-rose"] .confirm-modal .modal-footer {
    background-color: var(--theme-modal-bg);
}

/* Modal backdrop for dark theme */
[data-theme="dark"] .modal-backdrop {
    background-color: #000000;
}

/* Tables */
[data-theme="dark"] .table,
[data-theme="warm-muted"] .table,
[data-theme="soft-blue"] .table,
[data-theme="mint-green"] .table,
[data-theme="peach-rose"] .table {
    color: var(--theme-text-primary);
    border-color: var(--theme-border-color);
}

[data-theme="dark"] .table > :not(caption) > * > *,
[data-theme="warm-muted"] .table > :not(caption) > * > *,
[data-theme="soft-blue"] .table > :not(caption) > * > *,
[data-theme="mint-green"] .table > :not(caption) > * > *,
[data-theme="peach-rose"] .table > :not(caption) > * > * {
    background-color: transparent;
    border-bottom-color: var(--theme-border-color);
    color: var(--theme-text-primary);
}

[data-theme="dark"] .table-hover > tbody > tr:hover > *,
[data-theme="warm-muted"] .table-hover > tbody > tr:hover > *,
[data-theme="soft-blue"] .table-hover > tbody > tr:hover > *,
[data-theme="mint-green"] .table-hover > tbody > tr:hover > *,
[data-theme="peach-rose"] .table-hover > tbody > tr:hover > * {
    background-color: var(--theme-table-hover-bg);
}

/* Alerts - comprehensive styling for all alert types */
[data-theme="dark"] .alert-info,
[data-theme="warm-muted"] .alert-info,
[data-theme="high-contrast"] .alert-info,
[data-theme="soft-blue"] .alert-info,
[data-theme="mint-green"] .alert-info,
[data-theme="peach-rose"] .alert-info {
    background-color: var(--theme-alert-info-bg);
    border-left-color: var(--theme-alert-info-border);
    color: var(--theme-alert-info-text);
}

/* Dark theme alert overrides */
[data-theme="dark"] .alert-success {
    background-color: #1a3d2e;
    border-left-color: #198754;
    color: #b6f5d8;
}

[data-theme="dark"] .alert-danger {
    background-color: #3d1a1a;
    border-left-color: #dc3545;
    color: #f5b6b6;
}

[data-theme="dark"] .alert-warning {
    background-color: #3d3a1a;
    border-left-color: #ffc107;
    color: #f5eab6;
}

[data-theme="dark"] .alert-light,
[data-theme="dark"] .alert-secondary {
    background-color: var(--theme-card-header-bg);
    border-color: var(--theme-border-color);
    color: var(--theme-text-primary);
}

[data-theme="dark"] .alert .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Warm/muted theme alert overrides */
[data-theme="warm-muted"] .alert-success {
    background-color: #e8f0e8;
    border-left-color: #6b8a6b;
    color: #3d4a3d;
}

[data-theme="warm-muted"] .alert-danger {
    background-color: #f0e8e8;
    border-left-color: #8a6b6b;
    color: #4a3d3d;
}

[data-theme="warm-muted"] .alert-warning {
    background-color: #f0ede8;
    border-left-color: #9b8b7a;
    color: #4a463d;
}

/* alert-light / alert-secondary for all non-light themes */
[data-theme="warm-muted"] .alert-light,
[data-theme="warm-muted"] .alert-secondary,
[data-theme="soft-blue"] .alert-light,
[data-theme="soft-blue"] .alert-secondary,
[data-theme="mint-green"] .alert-light,
[data-theme="mint-green"] .alert-secondary,
[data-theme="peach-rose"] .alert-light,
[data-theme="peach-rose"] .alert-secondary {
    background-color: var(--theme-card-header-bg);
    border-color: var(--theme-border-color);
    color: var(--theme-text-primary);
}

/* List groups */
[data-theme="dark"] .list-group-item,
[data-theme="warm-muted"] .list-group-item,
[data-theme="soft-blue"] .list-group-item,
[data-theme="mint-green"] .list-group-item,
[data-theme="peach-rose"] .list-group-item {
    background-color: var(--theme-card-bg);
    border-color: var(--theme-border-color);
    color: var(--theme-text-primary);
}

/* Nav tabs/pills */
[data-theme="dark"] .nav-tabs .nav-link,
[data-theme="warm-muted"] .nav-tabs .nav-link,
[data-theme="soft-blue"] .nav-tabs .nav-link,
[data-theme="mint-green"] .nav-tabs .nav-link,
[data-theme="peach-rose"] .nav-tabs .nav-link {
    color: var(--theme-text-secondary);
}

[data-theme="dark"] .nav-tabs .nav-link.active,
[data-theme="warm-muted"] .nav-tabs .nav-link.active,
[data-theme="soft-blue"] .nav-tabs .nav-link.active,
[data-theme="mint-green"] .nav-tabs .nav-link.active,
[data-theme="peach-rose"] .nav-tabs .nav-link.active {
    background-color: var(--theme-card-bg);
    border-color: var(--theme-border-color);
    color: var(--theme-text-primary);
}

[data-theme="dark"] .nav-tabs,
[data-theme="warm-muted"] .nav-tabs,
[data-theme="soft-blue"] .nav-tabs,
[data-theme="mint-green"] .nav-tabs,
[data-theme="peach-rose"] .nav-tabs {
    border-bottom-color: var(--theme-border-color);
}

/* Form check / switch */
[data-theme="dark"] .form-check-input,
[data-theme="soft-blue"] .form-check-input,
[data-theme="mint-green"] .form-check-input,
[data-theme="peach-rose"] .form-check-input {
    background-color: var(--theme-input-bg);
    border-color: var(--theme-input-border);
}

[data-theme="dark"] .form-check-label,
[data-theme="warm-muted"] .form-check-label,
[data-theme="soft-blue"] .form-check-label,
[data-theme="mint-green"] .form-check-label,
[data-theme="peach-rose"] .form-check-label {
    color: var(--theme-text-primary);
}

/* Page header text */
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3,
[data-theme="dark"] h4, [data-theme="dark"] h5, [data-theme="dark"] h6,
[data-theme="warm-muted"] h1, [data-theme="warm-muted"] h2, [data-theme="warm-muted"] h3,
[data-theme="warm-muted"] h4, [data-theme="warm-muted"] h5, [data-theme="warm-muted"] h6,
[data-theme="soft-blue"] h1, [data-theme="soft-blue"] h2, [data-theme="soft-blue"] h3,
[data-theme="soft-blue"] h4, [data-theme="soft-blue"] h5, [data-theme="soft-blue"] h6,
[data-theme="mint-green"] h1, [data-theme="mint-green"] h2, [data-theme="mint-green"] h3,
[data-theme="mint-green"] h4, [data-theme="mint-green"] h5, [data-theme="mint-green"] h6,
[data-theme="peach-rose"] h1, [data-theme="peach-rose"] h2, [data-theme="peach-rose"] h3,
[data-theme="peach-rose"] h4, [data-theme="peach-rose"] h5, [data-theme="peach-rose"] h6 {
    color: var(--theme-text-primary);
}

/* Breadcrumbs */
[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before,
[data-theme="warm-muted"] .breadcrumb-item + .breadcrumb-item::before,
[data-theme="soft-blue"] .breadcrumb-item + .breadcrumb-item::before,
[data-theme="mint-green"] .breadcrumb-item + .breadcrumb-item::before,
[data-theme="peach-rose"] .breadcrumb-item + .breadcrumb-item::before {
    color: var(--theme-text-muted);
}

[data-theme="dark"] .breadcrumb-item.active,
[data-theme="warm-muted"] .breadcrumb-item.active,
[data-theme="soft-blue"] .breadcrumb-item.active,
[data-theme="mint-green"] .breadcrumb-item.active,
[data-theme="peach-rose"] .breadcrumb-item.active {
    color: var(--theme-text-muted);
}

/* Form plaintext (used in settings page) */
[data-theme="dark"] .form-control-plaintext,
[data-theme="warm-muted"] .form-control-plaintext,
[data-theme="soft-blue"] .form-control-plaintext,
[data-theme="mint-green"] .form-control-plaintext,
[data-theme="peach-rose"] .form-control-plaintext {
    color: var(--theme-text-primary) !important;
}

/* Ensure bold text is visible */
[data-theme="dark"] .fw-bold,
[data-theme="dark"] strong,
[data-theme="dark"] b {
    color: var(--theme-text-primary) !important;
}

/* Warm/Muted button overrides for softer look */
[data-theme="warm-muted"] .btn-primary {
    background: #8b7b6a;
    border-color: #8b7b6a;
}

[data-theme="warm-muted"] .btn-primary:hover {
    background: #7a6b5a;
    border-color: #7a6b5a;
    box-shadow: none;
    transform: none;
}

[data-theme="warm-muted"] .btn-success {
    background: #6b8a6b;
    border-color: #6b8a6b;
}

[data-theme="warm-muted"] .btn-success:hover {
    background: #5a7a5a;
    border-color: #5a7a5a;
}

/* ============================================
   COMPREHENSIVE TEXT COLOR OVERRIDES
   Ensures all text is visible in all themes
   ============================================ */

/* Bootstrap text-dark class override */
[data-theme="dark"] .text-dark,
[data-theme="warm-muted"] .text-dark {
    color: var(--theme-text-primary) !important;
}

/* Bootstrap text-body class override */
[data-theme="dark"] .text-body,
[data-theme="warm-muted"] .text-body {
    color: var(--theme-text-primary) !important;
}

/* Bootstrap text-secondary class override */
[data-theme="dark"] .text-secondary,
[data-theme="warm-muted"] .text-secondary {
    color: var(--theme-text-secondary) !important;
}

/* Strong and bold text */
[data-theme="dark"] strong,
[data-theme="dark"] b,
[data-theme="warm-muted"] strong,
[data-theme="warm-muted"] b {
    color: inherit;
}

/* Labels in forms */
[data-theme="dark"] label,
[data-theme="dark"] .form-label,
[data-theme="warm-muted"] label,
[data-theme="warm-muted"] .form-label {
    color: var(--theme-text-primary);
}

/* Bootstrap fw-bold class text */
[data-theme="dark"] .fw-bold,
[data-theme="warm-muted"] .fw-bold {
    color: inherit;
}

/* Paragraph text */
[data-theme="dark"] p,
[data-theme="warm-muted"] p {
    color: var(--theme-text-primary);
}

/* Small text */
[data-theme="dark"] small,
[data-theme="dark"] .small,
[data-theme="warm-muted"] small,
[data-theme="warm-muted"] .small {
    color: var(--theme-text-secondary);
}

/* Card body text */
[data-theme="dark"] .card-body,
[data-theme="warm-muted"] .card-body {
    color: var(--theme-text-primary);
}

/* Card title text */
[data-theme="dark"] .card-title,
[data-theme="warm-muted"] .card-title {
    color: var(--theme-text-primary);
}

/* Card text */
[data-theme="dark"] .card-text,
[data-theme="warm-muted"] .card-text {
    color: var(--theme-text-primary);
}

/* Alert text for non-info alerts */
[data-theme="dark"] .alert-success,
[data-theme="dark"] .alert-warning,
[data-theme="dark"] .alert-danger {
    color: var(--theme-text-primary);
}

/* Badge text (ensure readable) */
[data-theme="dark"] .badge.bg-light,
[data-theme="warm-muted"] .badge.bg-light {
    background-color: var(--theme-bg-tertiary) !important;
    color: var(--theme-text-primary) !important;
}

[data-theme="dark"] .badge.bg-secondary,
[data-theme="warm-muted"] .badge.bg-secondary {
    color: #ffffff !important;
}

/* Input group text */
[data-theme="dark"] .input-group-text,
[data-theme="warm-muted"] .input-group-text {
    background-color: var(--theme-bg-tertiary);
    border-color: var(--theme-input-border);
    color: var(--theme-text-primary);
}

/* Page content wrapper */
[data-theme="dark"] .main-content,
[data-theme="warm-muted"] .main-content {
    color: var(--theme-text-primary) !important;
    background-color: var(--theme-bg-primary) !important;
}

/* Ensure ALL text elements are visible in dark theme */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: var(--theme-text-primary) !important;
}

[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] div,
[data-theme="dark"] label,
[data-theme="dark"] small {
    color: var(--theme-text-primary);
}

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

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

[data-theme="dark"] .card-body {
    color: var(--theme-text-primary);
    background-color: var(--theme-card-bg);
}

/* Ensure all links are visible */
[data-theme="dark"] a,
[data-theme="warm-muted"] a {
    color: var(--theme-link-color) !important;
}

[data-theme="dark"] a:hover,
[data-theme="warm-muted"] a:hover {
    color: var(--theme-link-hover) !important;
}

/* Container elements */
[data-theme="dark"] .container,
[data-theme="dark"] .container-fluid {
    color: var(--theme-text-primary);
}

/* Row and column elements */
[data-theme="dark"] .row,
[data-theme="dark"] [class*="col-"] {
    color: inherit;
}

/* Buttons with outline styles */
[data-theme="dark"] .btn-outline-secondary {
    color: var(--theme-text-secondary);
    border-color: var(--theme-border-color);
}

[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--theme-hover-bg);
    color: var(--theme-text-primary);
    border-color: var(--theme-border-color);
}

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

[data-theme="warm-muted"] .btn-outline-secondary {
    color: var(--theme-text-secondary);
    border-color: var(--theme-border-color);
}

[data-theme="warm-muted"] .btn-outline-secondary:hover {
    background-color: var(--theme-hover-bg);
    color: var(--theme-text-primary);
}

/* Icon colors */
[data-theme="dark"] .bi,
[data-theme="warm-muted"] .bi {
    color: inherit;
}

/* Horizontal rules */
[data-theme="dark"] hr,
[data-theme="warm-muted"] hr {
    border-color: var(--theme-border-color);
    opacity: 1;
}

/* Code/pre elements */
[data-theme="dark"] code,
[data-theme="dark"] pre {
    color: #f78da7;
    background-color: var(--theme-bg-tertiary);
}

[data-theme="warm-muted"] code,
[data-theme="warm-muted"] pre {
    color: #8b6b4a;
    background-color: var(--theme-bg-tertiary);
}

/* Accordion items */
[data-theme="dark"] .accordion-item,
[data-theme="warm-muted"] .accordion-item {
    background-color: var(--theme-card-bg);
    border-color: var(--theme-border-color);
}

[data-theme="dark"] .accordion-button,
[data-theme="warm-muted"] .accordion-button {
    background-color: var(--theme-card-bg);
    color: var(--theme-text-primary);
}

[data-theme="dark"] .accordion-button:not(.collapsed),
[data-theme="warm-muted"] .accordion-button:not(.collapsed) {
    background-color: var(--theme-sidebar-active-bg);
    color: var(--theme-text-primary);
}

[data-theme="dark"] .accordion-body,
[data-theme="warm-muted"] .accordion-body {
    background-color: var(--theme-card-bg);
    color: var(--theme-text-primary);
}

/* Toast notifications - Bootstrap colored toasts maintain their colors for visibility */
[data-theme="dark"] .toast:not(.bg-success):not(.bg-danger):not(.bg-warning):not(.bg-info),
[data-theme="warm-muted"] .toast:not(.bg-success):not(.bg-danger):not(.bg-warning):not(.bg-info) {
    background-color: var(--theme-card-bg);
    color: var(--theme-text-primary);
    border-color: var(--theme-border-color);
}

[data-theme="dark"] .toast-header,
[data-theme="warm-muted"] .toast-header {
    background-color: var(--theme-card-header-bg);
    color: var(--theme-text-primary);
    border-bottom-color: var(--theme-border-color);
}

/* Toast close button visibility in dark theme for colored toasts */
[data-theme="dark"] .toast.bg-warning .btn-close,
[data-theme="dark"] .toast.bg-info .btn-close {
    filter: none; /* These have dark text, so normal close button */
}

[data-theme="dark"] .toast.bg-success .btn-close,
[data-theme="dark"] .toast.bg-danger .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%); /* White close button */
}

/* Pagination */
[data-theme="dark"] .page-link,
[data-theme="warm-muted"] .page-link {
    background-color: var(--theme-card-bg);
    border-color: var(--theme-border-color);
    color: var(--theme-text-primary);
}

[data-theme="dark"] .page-link:hover,
[data-theme="warm-muted"] .page-link:hover {
    background-color: var(--theme-hover-bg);
    color: var(--theme-text-primary);
}

[data-theme="dark"] .page-item.disabled .page-link,
[data-theme="warm-muted"] .page-item.disabled .page-link {
    background-color: var(--theme-bg-tertiary);
    color: var(--theme-text-muted);
}

/* Progress bars container */
[data-theme="dark"] .progress,
[data-theme="warm-muted"] .progress {
    background-color: var(--theme-bg-tertiary);
}

/* Offcanvas */
[data-theme="dark"] .offcanvas,
[data-theme="warm-muted"] .offcanvas {
    background-color: var(--theme-card-bg);
    color: var(--theme-text-primary);
}

[data-theme="dark"] .offcanvas-header,
[data-theme="warm-muted"] .offcanvas-header {
    border-bottom-color: var(--theme-border-color);
}

/* Popover */
[data-theme="dark"] .popover,
[data-theme="warm-muted"] .popover {
    background-color: var(--theme-card-bg);
    border-color: var(--theme-border-color);
}

[data-theme="dark"] .popover-header,
[data-theme="warm-muted"] .popover-header {
    background-color: var(--theme-card-header-bg);
    border-bottom-color: var(--theme-border-color);
    color: var(--theme-text-primary);
}

[data-theme="dark"] .popover-body,
[data-theme="warm-muted"] .popover-body {
    color: var(--theme-text-primary);
}

/* ============================================
   DUTY BLUE THEME
   Dark navy — matches duty.blue landing page.
   bg-primary: #0f172a (slate-900 hero)
   Accents:    #4f46e5 indigo / #06b6d4 cyan
   'peelpot' kept as an alias selector below for any user with the
   old theme value already stored in their DB row/session.
   ============================================ */
[data-theme="duty-blue"],
[data-theme="peelpot"] {
    --theme-logo-bg: transparent;

    /* Page backgrounds — same dark palette as landing page */
    --theme-bg-primary:   #0f172a;  /* slate-900 */
    --theme-bg-secondary: #1e293b;  /* slate-800 */
    --theme-bg-tertiary:  #0d1b2e;  /* slightly deeper */

    /* Light text on dark backgrounds */
    --theme-text-primary:   #f1f5f9;  /* slate-100 */
    --theme-text-secondary: #cbd5e1;  /* slate-300 */
    --theme-text-muted:     #94a3b8;  /* slate-400 */

    /* Borders — subtle white-alpha */
    --theme-border-color: rgba(255, 255, 255, 0.10);
    --theme-border-light:  rgba(255, 255, 255, 0.05);

    /* Navbar — seamlessly dark, no visual break */
    --theme-navbar-bg:   #0f172a;
    --theme-navbar-text: #f1f5f9;

    /* Sidebar — slightly lighter dark with indigo accents */
    --theme-sidebar-bg:            #1e293b;  /* slate-800 */
    --theme-sidebar-text:          #cbd5e1;  /* slate-300 */
    --theme-sidebar-hover-bg:      rgba(79, 70, 229, 0.18);
    --theme-sidebar-hover-text:    #a5b4fc;  /* indigo-300 */
    --theme-sidebar-active-bg:     rgba(79, 70, 229, 0.30);
    --theme-sidebar-active-text:   #c7d2fe;  /* indigo-200 */
    --theme-sidebar-active-border: #4f46e5;  /* indigo-600 */

    /* Cards — dark card on dark page */
    --theme-card-bg:        #1e293b;  /* slate-800 */
    --theme-card-header-bg: #0d1b2e;
    --theme-card-shadow:    rgba(0, 0, 0, 0.40);

    /* Interactive — indigo accent */
    --theme-link-color: #818cf8;  /* indigo-400 */
    --theme-link-hover: #a5b4fc;  /* indigo-300 */
    --theme-focus-ring: rgba(79, 70, 229, 0.40);

    /* Hover states */
    --theme-hover-bg:       rgba(79, 70, 229, 0.12);
    --theme-table-hover-bg: rgba(79, 70, 229, 0.12);

    /* Footer */
    --theme-footer-bg:     #1e293b;
    --theme-footer-border: rgba(255, 255, 255, 0.08);

    /* Form elements */
    --theme-input-bg:          #0f172a;
    --theme-input-border:      rgba(255, 255, 255, 0.15);
    --theme-input-text:        #f1f5f9;
    --theme-input-placeholder: #64748b;  /* slate-500 */

    /* Shadows */
    --theme-shadow-color:   rgba(0, 0, 0, 0.50);
    --theme-shadow-sidebar: rgba(0, 0, 0, 0.30);
    --theme-overlay-bg:     rgba(0, 0, 0, 0.70);

    /* Modal */
    --theme-modal-bg:     #1e293b;
    --theme-modal-shadow: rgba(0, 0, 0, 0.60);

    /* Dropdown */
    --theme-dropdown-bg:       #1e293b;
    --theme-dropdown-border:   rgba(255, 255, 255, 0.10);
    --theme-dropdown-hover-bg: rgba(79, 70, 229, 0.18);
    --theme-dropdown-text:     #f1f5f9;

    /* Info alerts */
    --theme-alert-info-bg:     rgba(79, 70, 229, 0.18);
    --theme-alert-info-border: #4f46e5;
    --theme-alert-info-text:   #c7d2fe;  /* indigo-200 */
}

/* Force body/page background for Duty Blue dark theme */
[data-theme="duty-blue"],
[data-theme="duty-blue"] body,
[data-theme="peelpot"],
[data-theme="peelpot"] body {
    background-color: #0f172a !important;
    color: #f1f5f9 !important;
}
