/*
 * Brand light theme (approved 2026-11-10; mock "Light" + "Brand dark" sidebar)
 *
 * Light-mode counterpart to the Brand Slate dark palette in
 * dark-theme-fixes.css. Every rule is scoped to [data-bs-theme="light"] so
 * dark mode is untouched; dark-theme-fixes.css stays the single home for dark.
 * Loaded in base.html AFTER dark-theme-fixes.css.
 *
 * Page #f4f5f8 / surface #fff / raised #f7f8fa / borders #e4e6ec.
 * Primary = brand teal #0a7ea4. Sidebar + top header = brand dark #1b1d23
 * (the header stays dark because its logo is the white mark that overhangs
 * the bar; on a light header it would vanish).
 */
:root[data-bs-theme="light"],
[data-bs-theme="light"] {
    --cs-page: #f4f5f8;
    --cs-surface: #ffffff;
    --cs-raised: #f7f8fa;
    --cs-line: #e4e6ec;
    --cs-input-line: #d5d8e0;
    --cs-teal: #0a7ea4;
    --cs-teal-rgb: 10, 126, 164;
    --cs-teal-dark: #086a8a;
    --cs-chrome: #1b1d23;
    --cs-chrome-text: #c3c7d1;
    --cs-chrome-muted: #838a9c;      /* 4.9:1 on the chrome (was #727889, 3.8:1) */
    --cs-chrome-line: rgba(255, 255, 255, 0.06);

    /* Body / surfaces */
    --bs-body-bg: #f4f5f8;
    --bs-body-bg-rgb: 244, 245, 248;
    --bs-body-color: #1d2027;
    --bs-body-color-rgb: 29, 32, 39;
    --bs-emphasis-color: #0f1115;
    --bs-emphasis-color-rgb: 15, 17, 21;
    --bs-secondary-color: #646b7a;
    --bs-secondary-color-rgb: 100, 107, 122;
    --bs-secondary-bg: #eef0f4;
    --bs-secondary-bg-rgb: 238, 240, 244;
    --bs-tertiary-color: rgba(29, 32, 39, 0.5);
    --bs-tertiary-color-rgb: 29, 32, 39;
    --bs-tertiary-bg: #f7f8fa;
    --bs-tertiary-bg-rgb: 247, 248, 250;

    /* Borders */
    --bs-border-color: #e4e6ec;
    --bs-border-color-translucent: rgba(20, 24, 35, 0.1);

    /* Links */
    --bs-link-color: #086a8a;
    --bs-link-color-rgb: 8, 106, 138;
    --bs-link-hover-color: #065570;
    --bs-link-hover-color-rgb: 6, 85, 112;

    /* Theme colors */
    --bs-primary: #0a7ea4;
    --bs-primary-rgb: 10, 126, 164;
    --bs-info: #0a7ea4;
    --bs-info-rgb: 10, 126, 164;
    --bs-success: #1a7f4b;
    --bs-success-rgb: 26, 127, 75;
    --bs-warning: #d68a18;
    --bs-warning-rgb: 214, 138, 24;
    --bs-danger: #c4373b;
    --bs-danger-rgb: 196, 55, 59;
    --bs-secondary: #646b7a;
    --bs-secondary-rgb: 100, 107, 122;

    /* -emphasis text */
    --bs-primary-text-emphasis: #086a8a;
    --bs-info-text-emphasis: #086a8a;
    --bs-success-text-emphasis: #1a7f4b;
    --bs-warning-text-emphasis: #a35f00;
    --bs-danger-text-emphasis: #c4373b;
    --bs-secondary-text-emphasis: #4a505d;

    /* -subtle backgrounds (~9-13%) */
    --bs-primary-bg-subtle: rgba(10, 126, 164, 0.10);
    --bs-info-bg-subtle: rgba(10, 126, 164, 0.10);
    --bs-success-bg-subtle: rgba(26, 127, 75, 0.11);
    --bs-warning-bg-subtle: rgba(214, 138, 24, 0.13);
    --bs-danger-bg-subtle: rgba(196, 55, 59, 0.10);
    --bs-secondary-bg-subtle: rgba(100, 107, 122, 0.10);

    /* -subtle borders (~25%) */
    --bs-primary-border-subtle: rgba(10, 126, 164, 0.25);
    --bs-info-border-subtle: rgba(10, 126, 164, 0.25);
    --bs-success-border-subtle: rgba(26, 127, 75, 0.25);
    --bs-warning-border-subtle: rgba(214, 138, 24, 0.30);
    --bs-danger-border-subtle: rgba(196, 55, 59, 0.25);
    --bs-secondary-border-subtle: rgba(100, 107, 122, 0.25);

    /* Forms + focus */
    --bs-form-valid-color: #1a7f4b;
    --bs-form-valid-border-color: #1a7f4b;
    --bs-form-invalid-color: #c4373b;
    --bs-form-invalid-border-color: #c4373b;
    --bs-focus-ring-color: rgba(10, 126, 164, 0.25);
}

/* ── Chrome: sidebar + top header in brand dark ─────────────────────────── */
[data-bs-theme="light"] .navbar.bg-dark,
[data-bs-theme="light"] nav.sidebar-nav.bg-dark,
[data-bs-theme="light"] #mobileSidebar.bg-dark {
    background-color: var(--cs-chrome) !important;
    color-scheme: dark;              /* dark scrollbars inside the sidebar */
}
[data-bs-theme="light"] .navbar.bg-dark {
    border-bottom: 1px solid var(--cs-chrome-line);
}
[data-bs-theme="light"] nav.sidebar-nav {
    border-right: 1px solid var(--cs-chrome-line);
}
[data-bs-theme="light"] #mobileSidebar .offcanvas-header,
[data-bs-theme="light"] .sidebar-nav hr,
[data-bs-theme="light"] #mobileSidebar hr {
    border-color: var(--cs-chrome-line) !important;
    opacity: 1;
}

/* Header: search well + muted icon buttons */
[data-bs-theme="light"] .navbar .input-group > .bg-dark {
    background-color: #262830 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}
[data-bs-theme="light"] .navbar #global-search::placeholder {
    color: var(--cs-chrome-muted);
}
[data-bs-theme="light"] .navbar #global-search:focus {
    border-color: rgba(81, 195, 225, 0.5) !important;
    box-shadow: 0 0 0 0.2rem rgba(81, 195, 225, 0.2);
}
[data-bs-theme="light"] .navbar .text-white-50 {
    color: var(--cs-chrome-text) !important;
}
[data-bs-theme="light"] .navbar .btn-link.text-white-50:hover {
    color: #ffffff !important;
}

/* Sidebar items: light-grey text, muted icons/labels, cyan active tint */
[data-bs-theme="light"] .sidebar-nav .nav-link.text-white-50,
[data-bs-theme="light"] #mobileSidebar .nav-link.text-white-50 {
    color: var(--cs-chrome-text) !important;
}
[data-bs-theme="light"] .sidebar-nav .nav-link .bi,
[data-bs-theme="light"] #mobileSidebar .nav-link .bi {
    color: var(--cs-chrome-muted);
}
[data-bs-theme="light"] .sidebar-nav .text-white-50:not(.nav-link),
[data-bs-theme="light"] #mobileSidebar .text-white-50:not(.nav-link) {
    color: var(--cs-chrome-muted) !important;
}
[data-bs-theme="light"] .sidebar-nav .nav-link:not(.active):hover,
[data-bs-theme="light"] #mobileSidebar .nav-link:not(.active):hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff !important;
}
[data-bs-theme="light"] .sidebar-nav .nav-link:not(.active):hover .bi,
[data-bs-theme="light"] #mobileSidebar .nav-link:not(.active):hover .bi {
    color: var(--cs-chrome-text);
}
[data-bs-theme="light"] .sidebar-nav .nav-link.active,
[data-bs-theme="light"] #mobileSidebar .nav-link.active {
    background-color: rgba(81, 195, 225, 0.14) !important;
    color: #8fdcef !important;
}
[data-bs-theme="light"] .sidebar-nav .nav-link.active .bi,
[data-bs-theme="light"] #mobileSidebar .nav-link.active .bi {
    color: #8fdcef;
}
[data-bs-theme="light"] .sidebar-filter-input {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* ── Cards: white, no grey border, hairline ring + soft shadow ──────────── */
[data-bs-theme="light"] .card {
    --bs-card-bg: #ffffff;
    --bs-card-border-color: var(--cs-line);       /* header/footer separators */
    --bs-card-border-radius: 10px;
    --bs-card-cap-bg: transparent;
}
[data-bs-theme="light"] .card:not(.border-0) {
    border-color: transparent;
    box-shadow: 0 1px 2px rgba(20, 24, 35, 0.05), 0 0 0 1px var(--cs-line);
}
/* Cards that ask for a Bootstrap shadow utility get the same edge instead:
   the dashboard widget cards are `card shadow` (whose !important 1rem drop
   shadow otherwise beats the ring above) and a few pages use
   `card border-0 shadow-sm`, which the :not(.border-0) rule skips. One card
   edge everywhere (UI polish pack). */
[data-bs-theme="light"] .card.shadow,
[data-bs-theme="light"] .card.shadow-sm {
    border-color: transparent;
    box-shadow: 0 1px 2px rgba(20, 24, 35, 0.05), 0 0 0 1px var(--cs-line) !important;
}

/* ── White surfaces for floating UI (default would be the grey page bg) ── */
[data-bs-theme="light"] .dropdown-menu {
    --bs-dropdown-bg: #ffffff;
    --bs-dropdown-border-color: var(--cs-line);
    --bs-dropdown-link-hover-bg: var(--cs-raised);
    --bs-dropdown-link-active-bg: rgba(10, 126, 164, 0.10);
    --bs-dropdown-link-active-color: var(--cs-teal-dark);
    --bs-dropdown-divider-bg: var(--cs-line);
}
[data-bs-theme="light"] .modal {
    --bs-modal-bg: #ffffff;
    --bs-modal-border-color: var(--cs-line);
    --bs-modal-header-border-color: var(--cs-line);
    --bs-modal-footer-border-color: var(--cs-line);
}
[data-bs-theme="light"] .offcanvas:not(.bg-dark) { --bs-offcanvas-bg: #ffffff; }
[data-bs-theme="light"] .popover { --bs-popover-bg: #ffffff; }
[data-bs-theme="light"] .toast { --bs-toast-bg: rgba(255, 255, 255, 0.97); }
[data-bs-theme="light"] .list-group {
    --bs-list-group-bg: #ffffff;
    --bs-list-group-border-color: var(--cs-line);
    --bs-list-group-action-hover-bg: var(--cs-raised);
    --bs-list-group-active-bg: rgba(10, 126, 164, 0.10);
    --bs-list-group-active-color: var(--cs-teal-dark);
    --bs-list-group-active-border-color: rgba(10, 126, 164, 0.25);
}
[data-bs-theme="light"] .nav-pills {
    --bs-nav-pills-link-active-bg: var(--cs-teal);
    --bs-nav-pills-link-active-color: #ffffff;
}
[data-bs-theme="light"] .nav-link:focus-visible {
    box-shadow: 0 0 0 0.25rem rgba(10, 126, 164, 0.25);
}
[data-bs-theme="light"] .pagination {
    --bs-pagination-bg: #ffffff;
    --bs-pagination-border-color: var(--cs-line);
    --bs-pagination-hover-bg: var(--cs-raised);
    --bs-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(10, 126, 164, 0.25);
    --bs-pagination-active-bg: var(--cs-teal);
    --bs-pagination-active-border-color: var(--cs-teal);
}
[data-bs-theme="light"] .progress { --bs-progress-bar-bg: var(--cs-teal); }
[data-bs-theme="light"] .accordion {
    --bs-accordion-bg: #ffffff;
    --bs-accordion-btn-focus-border-color: rgba(10, 126, 164, 0.5);
    --bs-accordion-btn-focus-box-shadow: 0 0 0 0.25rem rgba(10, 126, 164, 0.25);
}
[data-bs-theme="light"] .btn-close {
    --bs-btn-close-focus-shadow: 0 0 0 0.25rem rgba(10, 126, 164, 0.25);
}

/* ── Tables: transparent on the white card, faint striping ── */
[data-bs-theme="light"] .table {
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--cs-line);
    --bs-table-striped-bg: rgba(20, 24, 35, 0.025);
    --bs-table-hover-bg: rgba(20, 24, 35, 0.035);
    --bs-table-active-bg: var(--cs-raised);
}
[data-bs-theme="light"] .table-light {
    --bs-table-bg: var(--cs-raised);
    --bs-table-border-color: var(--cs-line);
}

/* ── Forms: white fill, visible border, teal focus ring ──
   (excludes the dark-chrome inputs: header search + sidebar filter) */
[data-bs-theme="light"] .form-control:not(#global-search):not(.sidebar-filter-input),
[data-bs-theme="light"] .form-select {
    background-color: #ffffff;
    border-color: var(--cs-input-line);
}
[data-bs-theme="light"] .form-control:not(#global-search):not(.sidebar-filter-input):disabled,
[data-bs-theme="light"] .form-select:disabled {
    background-color: var(--bs-secondary-bg);
}
[data-bs-theme="light"] .form-control:not(#global-search):not(.sidebar-filter-input):focus,
[data-bs-theme="light"] .form-select:focus,
[data-bs-theme="light"] .form-check-input:focus {
    border-color: rgba(10, 126, 164, 0.55);
    box-shadow: 0 0 0 0.25rem rgba(10, 126, 164, 0.25);
}
[data-bs-theme="light"] .form-check-input {
    border-color: #c4c8d2;
}
[data-bs-theme="light"] .form-check-input:checked,
[data-bs-theme="light"] .form-check-input[type=checkbox]:indeterminate {
    background-color: var(--cs-teal);
    border-color: var(--cs-teal);
}
[data-bs-theme="light"] .input-group-text:not(.bg-dark) {
    background-color: var(--cs-raised);
    border-color: var(--cs-input-line);
}
[data-bs-theme="light"] .form-range::-webkit-slider-thumb { background-color: var(--cs-teal); }
[data-bs-theme="light"] .form-range::-moz-range-thumb { background-color: var(--cs-teal); }

/* ── Buttons ── */
[data-bs-theme="light"] .btn-primary,
[data-bs-theme="light"] .btn-info {
    --bs-btn-color: #ffffff;
    --bs-btn-bg: #0a7ea4;
    --bs-btn-border-color: #0a7ea4;
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: #086a8a;
    --bs-btn-hover-border-color: #086a8a;
    --bs-btn-active-color: #ffffff;
    --bs-btn-active-bg: #075d79;
    --bs-btn-active-border-color: #075d79;
    --bs-btn-disabled-color: #ffffff;
    --bs-btn-disabled-bg: #0a7ea4;
    --bs-btn-disabled-border-color: #0a7ea4;
    --bs-btn-focus-shadow-rgb: 10, 126, 164;
}
/* One accent, one job (seven checks, 2026-11-10): teal means "the main
   action / focus / link". btn-outline-primary (the secondary action, ~275
   uses) is therefore a NEUTRAL button: white surface, hairline border, body
   ink, raised-grey hover. It still outranks btn-outline-secondary (utility /
   Cancel: transparent, softer ink). The pressed / .active / checked state
   (toggle groups) keeps a faint teal tint so a selected option is visible. */
[data-bs-theme="light"] .btn-outline-primary,
[data-bs-theme="light"] .btn-outline-info {
    --bs-btn-color: #1d2027;
    --bs-btn-bg: #ffffff;
    --bs-btn-border-color: #d5d8e0;
    --bs-btn-hover-color: #0f1115;
    --bs-btn-hover-bg: #eef0f4;
    --bs-btn-hover-border-color: #c4c8d2;
    --bs-btn-active-color: #086a8a;
    --bs-btn-active-bg: rgba(10, 126, 164, 0.10);
    --bs-btn-active-border-color: rgba(10, 126, 164, 0.40);
    --bs-btn-disabled-color: #8a909c;
    --bs-btn-disabled-bg: #ffffff;
    --bs-btn-disabled-border-color: #e4e6ec;
    --bs-btn-focus-shadow-rgb: 10, 126, 164;
}
[data-bs-theme="light"] .btn-outline-secondary {
    --bs-btn-color: #4a505d;
    --bs-btn-border-color: #d0d4dc;
    --bs-btn-hover-color: #1d2027;
    --bs-btn-hover-bg: #eef0f4;
    --bs-btn-hover-border-color: #c4c8d2;
    --bs-btn-active-color: #1d2027;
    --bs-btn-active-bg: #e4e6ec;
    --bs-btn-active-border-color: #c4c8d2;
}
[data-bs-theme="light"] .btn-success {
    --bs-btn-bg: #1a7f4b;
    --bs-btn-border-color: #1a7f4b;
    --bs-btn-hover-bg: #156a3e;
    --bs-btn-hover-border-color: #156a3e;
    --bs-btn-active-bg: #125c36;
    --bs-btn-active-border-color: #125c36;
    --bs-btn-disabled-bg: #1a7f4b;
    --bs-btn-disabled-border-color: #1a7f4b;
    --bs-btn-focus-shadow-rgb: 26, 127, 75;
}
[data-bs-theme="light"] .btn-danger {
    --bs-btn-bg: #c4373b;
    --bs-btn-border-color: #c4373b;
    --bs-btn-hover-bg: #a92e32;
    --bs-btn-hover-border-color: #a92e32;
    --bs-btn-active-bg: #942a2d;
    --bs-btn-active-border-color: #942a2d;
    --bs-btn-disabled-bg: #c4373b;
    --bs-btn-disabled-border-color: #c4373b;
    --bs-btn-focus-shadow-rgb: 196, 55, 59;
}
[data-bs-theme="light"] .btn-outline-success {
    --bs-btn-color: #1a7f4b;
    --bs-btn-border-color: rgba(26, 127, 75, 0.55);
    --bs-btn-hover-bg: #1a7f4b;
    --bs-btn-hover-border-color: #1a7f4b;
    --bs-btn-active-bg: #156a3e;
    --bs-btn-active-border-color: #156a3e;
}
[data-bs-theme="light"] .btn-outline-danger {
    --bs-btn-color: #c4373b;
    --bs-btn-border-color: rgba(196, 55, 59, 0.55);
    --bs-btn-hover-bg: #c4373b;
    --bs-btn-hover-border-color: #c4373b;
    --bs-btn-active-bg: #a92e32;
    --bs-btn-active-border-color: #a92e32;
}
[data-bs-theme="light"] .btn-outline-warning {
    --bs-btn-color: #a35f00;
    --bs-btn-border-color: rgba(214, 138, 24, 0.6);
    --bs-btn-hover-color: #2a1a05;
    --bs-btn-hover-bg: #d68a18;
    --bs-btn-hover-border-color: #d68a18;
    --bs-btn-active-color: #2a1a05;
    --bs-btn-active-bg: #d68a18;
    --bs-btn-active-border-color: #d68a18;
}

/* ── Solid text-bg-* utilities (Bootstrap hardcodes their fills) ── */
[data-bs-theme="light"] .text-bg-primary,
[data-bs-theme="light"] .text-bg-info {
    background-color: rgba(10, 126, 164, var(--bs-bg-opacity, 1)) !important;
    color: #ffffff !important;
}
[data-bs-theme="light"] .text-bg-success {
    background-color: rgba(26, 127, 75, var(--bs-bg-opacity, 1)) !important;
}
[data-bs-theme="light"] .text-bg-danger {
    background-color: rgba(196, 55, 59, var(--bs-bg-opacity, 1)) !important;
}
[data-bs-theme="light"] .text-bg-warning {
    background-color: rgba(214, 138, 24, var(--bs-bg-opacity, 1)) !important;
    color: #2a1a05 !important;
}
[data-bs-theme="light"] .text-bg-secondary {
    background-color: rgba(100, 107, 122, var(--bs-bg-opacity, 1)) !important;
}

/* ── Badges: legacy solid `badge bg-*` become soft tints ──
   (sidebar count badges use text-bg-danger and stay solid) */
[data-bs-theme="light"] .badge.bg-primary,
[data-bs-theme="light"] .badge.bg-info {
    background-color: rgba(10, 126, 164, 0.10) !important;
    color: #086a8a !important;
}
[data-bs-theme="light"] .badge.bg-success {
    background-color: rgba(26, 127, 75, 0.11) !important;
    color: #1a7f4b !important;
}
[data-bs-theme="light"] .badge.bg-danger {
    background-color: rgba(196, 55, 59, 0.10) !important;
    color: #c4373b !important;
}
[data-bs-theme="light"] .badge.bg-warning {
    background-color: rgba(214, 138, 24, 0.13) !important;
    color: #a35f00 !important;
}
[data-bs-theme="light"] .badge.bg-secondary {
    background-color: rgba(100, 107, 122, 0.10) !important;
    color: #4a505d !important;
}

/* ── Alerts: subtle borders ── */
[data-bs-theme="light"] .alert-primary,
[data-bs-theme="light"] .alert-info { --bs-alert-border-color: rgba(10, 126, 164, 0.25); }
[data-bs-theme="light"] .alert-success { --bs-alert-border-color: rgba(26, 127, 75, 0.25); }
[data-bs-theme="light"] .alert-warning { --bs-alert-border-color: rgba(214, 138, 24, 0.30); }
[data-bs-theme="light"] .alert-danger { --bs-alert-border-color: rgba(196, 55, 59, 0.25); }

/* ── Form action bar ── */
[data-bs-theme="light"] .form-action-bar {
    background-color: rgba(255, 255, 255, 0.96);
    border-top-color: var(--cs-line);
    box-shadow: 0 -1px 3px rgba(20, 24, 35, 0.06);
}
