/* ==========================================================================
   ADCC THEME  -  "Midnight Gold" (default) + 4 switchable palettes
   --------------------------------------------------------------------------
   * ONE override layer. Loaded LAST in layout/master.blade.php.
     Remove that single <link> line and the old look comes back.
   * Every colour comes from the variables just below. To change the brand
     colour, change the numbers in :root (default) - nothing else.
   * Palettes are chosen with <html data-theme="gold|emerald|royal|crimson|ocean">
     (see public/assets/js/adcc-theme.js, the palette button in the navbar).
   ========================================================================== */

/* -------------------------------------------------------------------------
   1. PALETTES
   ------------------------------------------------------------------------- */
:root,
html[data-theme='gold'] {
    --t-name: 'Midnight Gold';
    /* header / hero gradient (dark) */
    --t-nav-1: #080d1c;
    --t-nav-2: #101a38;
    --t-nav-3: #1b2b5a;
    /* main action colour (buttons, active menu) and the text colour on it */
    --t-primary: #f5b800;
    --t-primary-rgb: 245, 184, 0;
    --t-primary-hover: #ffc933;
    --t-primary-active: #dca200;
    --t-on-primary: #1b1400;
    /* accent for links / icons on light surfaces (dark enough to read) */
    --t-accent: #8a5a00;
    --t-accent-rgb: 138, 90, 0;
    --t-soft: #fff7dc;
    --t-ring: rgba(245, 184, 0, 0.38);
    /* surfaces */
    --t-bg: #f5f2ea;
    --t-surface: #ffffff;
    --t-ink: #1a2133;
    --t-muted: #667088;
    --t-line: #e7e1d2;
    /* charts / dashboard */
    --t-chart: #1b2b5a;
    --t-chart-2: #f5b800;
}

html[data-theme='emerald'] {
    --t-name: 'Emerald Forest';
    --t-nav-1: #04100d;
    --t-nav-2: #08241e;
    --t-nav-3: #0f4a3c;
    --t-primary: #14b886;
    --t-primary-rgb: 20, 184, 134;
    --t-primary-hover: #26d09c;
    --t-primary-active: #0e9a70;
    --t-on-primary: #02201a;
    --t-accent: #047857;
    --t-accent-rgb: 4, 120, 87;
    --t-soft: #e6f8f1;
    --t-ring: rgba(20, 184, 134, 0.35);
    --t-bg: #f0f5f3;
    --t-line: #dce6e1;
    --t-chart: #0f766e;
    --t-chart-2: #14b886;
}

html[data-theme='royal'] {
    --t-name: 'Royal Indigo';
    --t-nav-1: #0b0722;
    --t-nav-2: #1a1448;
    --t-nav-3: #3a2fa0;
    --t-primary: #6d5efc;
    --t-primary-rgb: 109, 94, 252;
    --t-primary-hover: #8478ff;
    --t-primary-active: #5547e0;
    --t-on-primary: #ffffff;
    --t-accent: #4f3fd6;
    --t-accent-rgb: 79, 63, 214;
    --t-soft: #efecff;
    --t-ring: rgba(109, 94, 252, 0.35);
    --t-bg: #f3f2fa;
    --t-line: #e2e0f1;
    --t-chart: #4f3fd6;
    --t-chart-2: #a78bfa;
}

html[data-theme='crimson'] {
    --t-name: 'Crimson Executive';
    --t-nav-1: #12060a;
    --t-nav-2: #2b0d16;
    --t-nav-3: #6b1428;
    --t-primary: #e11d48;
    --t-primary-rgb: 225, 29, 72;
    --t-primary-hover: #f43f65;
    --t-primary-active: #be123c;
    --t-on-primary: #ffffff;
    --t-accent: #be123c;
    --t-accent-rgb: 190, 18, 60;
    --t-soft: #ffeef1;
    --t-ring: rgba(225, 29, 72, 0.3);
    --t-bg: #f8f3f4;
    --t-line: #ece0e3;
    --t-chart: #9f1239;
    --t-chart-2: #f59e0b;
}

html[data-theme='ocean'] {
    --t-name: 'Classic Blue';
    --t-nav-1: #091224;
    --t-nav-2: #0f1f3d;
    --t-nav-3: #1e3a8a;
    --t-primary: #2563eb;
    --t-primary-rgb: 37, 99, 235;
    --t-primary-hover: #3b82f6;
    --t-primary-active: #1d4ed8;
    --t-on-primary: #ffffff;
    --t-accent: #1d4ed8;
    --t-accent-rgb: 29, 78, 216;
    --t-soft: #eaf1ff;
    --t-ring: rgba(37, 99, 235, 0.3);
    --t-bg: #f1f5f9;
    --t-line: #e2e8f0;
    --t-chart: #1e3a8a;
    --t-chart-2: #38bdf8;
}

/* shared (not palette specific) */
:root {
    --t-radius: 14px;
    --t-radius-sm: 10px;
    --t-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px -8px rgba(16, 24, 40, 0.1);
    --t-shadow-hover: 0 2px 4px rgba(16, 24, 40, 0.05), 0 18px 40px -12px rgba(16, 24, 40, 0.18);
    --t-nav-gradient: linear-gradient(120deg, var(--t-nav-1) 0%, var(--t-nav-2) 45%, var(--t-nav-3) 100%);
}

/* -------------------------------------------------------------------------
   2. BOOTSTRAP 5.3 VARIABLES  (links, utilities, focus rings follow the palette)
   ------------------------------------------------------------------------- */
html body {
    --bs-primary: var(--t-primary);
    --bs-primary-rgb: var(--t-primary-rgb);
    --bs-link-color: var(--t-accent);
    --bs-link-color-rgb: var(--t-accent-rgb);
    --bs-link-hover-color: var(--t-ink);
    --bs-body-color: var(--t-ink);
    --bs-body-bg: var(--t-bg);
    --bs-border-color: var(--t-line);
    --bs-focus-ring-color: var(--t-ring);
    background: var(--t-bg);
    color: var(--t-ink);
}
html body a:not(.btn):not(.dropdown-item):not(.nav-link):not(.page-link):not(.sidebar-link) {
    color: var(--t-accent);
}
html body .text-primary {
    color: var(--t-accent) !important;
}
html body .bg-primary {
    background-color: var(--t-primary) !important;
    color: var(--t-on-primary) !important;
}
html body .border-primary {
    border-color: var(--t-primary) !important;
}

/* the coloured band behind the page title (was flat blue in modern.css) */
html body .wrapper::before {
    background:
        radial-gradient(520px 220px at 88% 0, rgba(var(--t-primary-rgb), 0.28), transparent 70%),
        var(--t-nav-gradient);
    height: 200px;
}
html body .main { background: var(--t-bg); }

/* table text was hard-coded blue in modern.css */
html body tbody, html body td, html body tfoot, html body th, html body thead, html body tr {
    color: var(--t-ink);
}

/* -------------------------------------------------------------------------
   3. NAVBAR  (the dark header with the menus)
   ------------------------------------------------------------------------- */
html body .navbar-theme {
    background: var(--t-nav-gradient) !important;
    border-bottom: 1px solid rgba(var(--t-primary-rgb), 0.35);
    box-shadow:
        0 12px 32px -10px rgba(5, 8, 20, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}
/* thin accent line under the bar */
html body .navbar-theme::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--t-primary), transparent);
    opacity: 0.85;
    pointer-events: none;
}
html body .navbar-theme .nav-link {
    color: rgba(255, 255, 255, 0.88) !important;
    border-radius: 10px;
}
html body .navbar-theme .nav-link i {
    color: rgba(var(--t-primary-rgb), 0.95);
}
html body .navbar-theme .nav-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
    box-shadow: inset 0 0 0 1px rgba(var(--t-primary-rgb), 0.35);
}
html body .navbar-theme .nav-link.active,
html body .navbar-theme .nav-link.show {
    color: var(--t-on-primary) !important;
    background: linear-gradient(135deg, var(--t-primary-hover), var(--t-primary)) !important;
    box-shadow:
        0 6px 18px -4px rgba(var(--t-primary-rgb), 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.45) !important;
}
html body .navbar-theme .nav-link.active i,
html body .navbar-theme .nav-link.show i {
    color: var(--t-on-primary);
}

/* dropdown panels */
html body .navbar-theme .dropdown-menu {
    background: rgba(255, 255, 255, 0.99);
    border: 1px solid var(--t-line);
    border-top: 3px solid var(--t-primary);
    border-radius: 14px;
    box-shadow: 0 24px 50px -14px rgba(8, 13, 28, 0.35);
}
html body .navbar-theme .dropdown-item {
    color: var(--t-ink);
    border-left-color: transparent;
}
html body .navbar-theme .dropdown-item i {
    color: var(--t-accent);
    filter: none;
}
html body .navbar-theme .dropdown-item:hover {
    background: linear-gradient(90deg, var(--t-soft), #fff);
    color: var(--t-ink);
    border-left-color: var(--t-primary);
}
html body .navbar-theme .dropdown-item.active,
html body .navbar-theme .dropdown-item:active {
    background: linear-gradient(135deg, var(--t-primary-hover), var(--t-primary)) !important;
    color: var(--t-on-primary) !important;
    box-shadow: 0 6px 16px -6px rgba(var(--t-primary-rgb), 0.6);
}
html body .navbar-theme .dropdown-item.active i {
    color: var(--t-on-primary);
}
html body .navbar-theme .dropdown-divider {
    border-top-color: var(--t-line);
}
html body .navbar-theme .user-avatar {
    background: linear-gradient(135deg, var(--t-primary-hover), var(--t-primary));
    color: var(--t-on-primary);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}
html body .navbar-theme .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.35);
}

/* -------------------------------------------------------------------------
   4. PAGE HEADER + CARDS
   ------------------------------------------------------------------------- */
html body .header-title {
    color: #fff;
    font-weight: 800;
    letter-spacing: -0.02em;
}
html body .header-subtitle {
    color: rgba(255, 255, 255, 0.78);
}
html body .card {
    background: var(--t-surface);
    border: 1px solid var(--t-line);
    border-radius: var(--t-radius);
    box-shadow: var(--t-shadow);
    transition:
        box-shadow 0.25s ease,
        transform 0.25s ease;
}
html body .card:hover {
    box-shadow: var(--t-shadow-hover);
}
html body .card-header {
    background: transparent;
    border-bottom: 1px solid var(--t-line);
}
html body .card-header .card-title,
html body .card-title {
    color: var(--t-ink);
    font-weight: 700;
}
html body .card-header.custom-header,
html body .pro-card-header {
    background: var(--t-nav-gradient) !important;
    color: #fff !important;
    border-bottom: 2px solid var(--t-primary);
}
html body .card-header.custom-header *,
html body .pro-card-header * {
    color: inherit;
}
html body .stat-card-pro {
    border-radius: var(--t-radius);
    border: 1px solid var(--t-line);
    box-shadow: var(--t-shadow);
}
html body .footer {
    background: transparent;
    border-top: 1px solid var(--t-line);
}

/* -------------------------------------------------------------------------
   5. BUTTONS
   ------------------------------------------------------------------------- */
html body .btn {
    border-radius: var(--t-radius-sm);
    font-weight: 600;
    letter-spacing: 0.01em;
}
html body .btn-primary,
html body .btn-gradient-save {
    --bs-btn-color: var(--t-on-primary);
    --bs-btn-bg: var(--t-primary);
    --bs-btn-border-color: var(--t-primary);
    --bs-btn-hover-color: var(--t-on-primary);
    --bs-btn-hover-bg: var(--t-primary-hover);
    --bs-btn-hover-border-color: var(--t-primary-hover);
    --bs-btn-active-color: var(--t-on-primary);
    --bs-btn-active-bg: var(--t-primary-active);
    --bs-btn-active-border-color: var(--t-primary-active);
    --bs-btn-disabled-color: var(--t-on-primary);
    --bs-btn-disabled-bg: var(--t-primary);
    --bs-btn-disabled-border-color: var(--t-primary);
    --bs-btn-focus-shadow-rgb: var(--t-primary-rgb);
    color: var(--t-on-primary);
    background: linear-gradient(180deg, var(--t-primary-hover), var(--t-primary)) !important;
    border-color: var(--t-primary-active) !important;
    box-shadow:
        0 6px 16px -6px rgba(var(--t-primary-rgb), 0.65),
        inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
    transform: none;
}
html body .btn-primary:hover,
html body .btn-gradient-save:hover {
    color: var(--t-on-primary);
    background: linear-gradient(180deg, var(--t-primary-hover), var(--t-primary-hover)) !important;
    box-shadow:
        0 10px 22px -8px rgba(var(--t-primary-rgb), 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
    transform: translateY(-1px);
}
html body .btn-primary:active,
html body .btn-gradient-save:active {
    background: var(--t-primary-active) !important;
    transform: translateY(0);
}
html body .btn-primary i,
html body .btn-gradient-save i {
    color: inherit;
}
html body .btn-outline-primary {
    --bs-btn-color: var(--t-accent);
    --bs-btn-border-color: var(--t-primary);
    --bs-btn-hover-color: var(--t-on-primary);
    --bs-btn-hover-bg: var(--t-primary);
    --bs-btn-hover-border-color: var(--t-primary);
    --bs-btn-active-color: var(--t-on-primary);
    --bs-btn-active-bg: var(--t-primary-active);
    --bs-btn-active-border-color: var(--t-primary-active);
    --bs-btn-focus-shadow-rgb: var(--t-primary-rgb);
}
html body .btn-link {
    color: var(--t-accent);
}

/* -------------------------------------------------------------------------
   6. FORMS
   ------------------------------------------------------------------------- */
html body .form-control,
html body .form-select {
    border: 1px solid #d9d4c5;
    border-radius: var(--t-radius-sm);
    background-color: #fff;
}
html body .form-control:focus,
html body .form-select:focus,
html body .select2-container--default.select2-container--focus .select2-selection--single,
html body .select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--t-primary);
    box-shadow: 0 0 0 4px var(--t-ring);
}
html body .form-label,
html body label {
    font-weight: 600;
    color: #2a3248;
}
html body .form-check-input:checked {
    background-color: var(--t-primary);
    border-color: var(--t-primary-active);
}
html body .form-check-input:focus {
    box-shadow: 0 0 0 4px var(--t-ring);
    border-color: var(--t-primary);
}
html body .select2-container--default .select2-results__option--highlighted[aria-selected],
html body .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--t-primary);
    color: var(--t-on-primary);
}

/* -------------------------------------------------------------------------
   7. TABLES + DATATABLES
   ------------------------------------------------------------------------- */
html body .table > thead > tr > th,
html body table.dataTable thead th,
html body .table-pro thead th {
    background: #fbf9f3;
    color: #3a4258;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 2px solid var(--t-primary) !important;
}
html body .table > tbody > tr:hover > *,
html body .table tbody tr:hover {
    background-color: rgba(var(--t-primary-rgb), 0.07) !important;
}
html body .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(var(--t-primary-rgb), 0.025);
}
html body .dataTables_wrapper .dataTables_filter input {
    border-radius: 10px;
    border: 1px solid #d9d4c5;
}
html body .dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--t-primary);
    box-shadow: 0 0 0 4px var(--t-ring);
    outline: 0;
}
html body .dataTables_wrapper .dataTables_paginate .paginate_button.current,
html body .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
html body .page-item.active .page-link {
    background: var(--t-primary) !important;
    border-color: var(--t-primary-active) !important;
    color: var(--t-on-primary) !important;
}
html body .page-link {
    color: var(--t-accent);
    border-radius: 8px;
    margin: 0 2px;
}
html body .page-link:hover {
    background: var(--t-soft);
    color: var(--t-ink);
}

/* -------------------------------------------------------------------------
   8. TABS, BADGES, ALERTS, MODALS, MISC
   ------------------------------------------------------------------------- */
html body .nav-tabs .nav-link.active,
html body .nav-tabs .nav-item.show .nav-link {
    color: var(--t-ink);
    border-color: var(--t-line) var(--t-line) #fff;
    border-top: 3px solid var(--t-primary);
}
html body .nav-pills .nav-link.active,
html body .nav-pills .show > .nav-link {
    background: var(--t-primary);
    color: var(--t-on-primary);
}
html body .badge.bg-primary,
html body .badge-primary {
    background: var(--t-primary) !important;
    color: var(--t-on-primary) !important;
}
html body .alert-primary,
html body .alert-info {
    background: var(--t-soft);
    border-color: rgba(var(--t-primary-rgb), 0.4);
    color: var(--t-ink);
}
html body .modal-content {
    border: 0;
    border-radius: 18px;
    box-shadow: 0 30px 70px -20px rgba(8, 13, 28, 0.5);
    overflow: hidden;
}
html body .modal-header {
    background: var(--t-nav-gradient);
    color: #fff;
    border-bottom: 2px solid var(--t-primary);
}
html body .modal-header .modal-title {
    color: #fff;
}
html body .modal-header .btn-close {
    filter: invert(1) grayscale(1) brightness(2);
}
html body .progress-bar {
    background: linear-gradient(90deg, var(--t-primary), var(--t-primary-hover));
    color: var(--t-on-primary);
}
html body .list-group-item.active {
    background: var(--t-primary);
    border-color: var(--t-primary);
    color: var(--t-on-primary);
}
html body ::selection {
    background: var(--t-primary);
    color: var(--t-on-primary);
}
html body ::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--t-primary-hover), var(--t-primary-active));
    border-color: #ece7d9;
}
html body ::-webkit-scrollbar-track {
    background: #ece7d9;
}

/* loading splash */
html body .splash {
    background: var(--t-nav-gradient);
}

/* -------------------------------------------------------------------------
   9. EXECUTIVE / REPORTING DASHBOARD  (its own tokens follow the palette)
   ------------------------------------------------------------------------- */
html body .xd {
    --xd-primary: var(--t-chart);
    --xd-primary-2: var(--t-primary);
    --xd-line: var(--t-line);
    --xd-bg: var(--t-bg);
}
html body .xd-hero,
html body .rp-banner {
    background:
        radial-gradient(520px 220px at 90% -20%, rgba(var(--t-primary-rgb), 0.35), transparent 70%), var(--t-nav-gradient) !important;
}
html body .xd-btn.primary {
    background: linear-gradient(180deg, var(--t-primary-hover), var(--t-primary));
    border-color: var(--t-primary-active);
    color: var(--t-on-primary);
}
html body .xd-tab[aria-selected='true'] {
    color: var(--t-ink);
    box-shadow: inset 0 -3px 0 var(--t-primary);
}

/* -------------------------------------------------------------------------
   10. PALETTE SWITCHER (navbar button)
   ------------------------------------------------------------------------- */
.theme-switch .nav-link {
    padding: 0.55rem 0.8rem !important;
}
.theme-switch .dropdown-menu {
    min-width: 230px !important;
    padding: 0.5rem !important;
}
.theme-switch .theme-title {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--t-muted);
    padding: 0.35rem 0.7rem 0.45rem;
}
.theme-swatch {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    background: transparent;
    border: 0;
    border-radius: 10px;
    padding: 0.5rem 0.7rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.86rem;
    color: var(--t-ink);
    cursor: pointer;
}
.theme-swatch:hover {
    background: var(--t-soft);
}
.theme-swatch .dots {
    display: inline-flex;
}
.theme-swatch .dots i {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #fff;
    margin-left: -6px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.theme-swatch .dots i:first-child {
    margin-left: 0;
}
.theme-swatch.on {
    background: var(--t-soft);
    box-shadow: inset 3px 0 0 var(--t-primary);
}
.theme-swatch .tick {
    margin-left: auto;
    opacity: 0;
    color: var(--t-accent);
}
.theme-swatch.on .tick {
    opacity: 1;
}
