/* ==========================================================================
   Dark Theme — Component Overrides
   ========================================================================== */

/* Body */
html.dark-theme body,
.dark-theme body {
    background-color: var(--adv-bg);
    background-image:
        linear-gradient(160deg, rgba(14,21,32,0.96) 0%, rgba(18,28,42,0.94) 40%, rgba(16,24,38,0.95) 100%);
    color: var(--adv-text);
}

/* KPI cards */
.dark-theme .dash-kpi-card {
    background: var(--adv-surface-raised) !important;
}

/* Dashboard cards */
.dark-theme .dash-card {
    background: var(--adv-surface-raised) !important;
}

/* DataGrid cell border */
.dark-theme .rz-datatable .rz-datatable-data td {
    border-bottom-color: var(--adv-border-subtle) !important;
}

/* Tabs */
.dark-theme .rz-tabview-nav .rz-tabview-nav-link:hover {
    color: var(--adv-primary-light) !important;
}

.dark-theme .rz-tabview-nav .rz-tabview-nav-link.rz-tabview-nav-link-active,
.dark-theme .rz-tabview-nav .rz-state-active .rz-tabview-nav-link {
    color: var(--adv-primary-light) !important;
    border-bottom-color: var(--adv-primary) !important;
}

.dark-theme .rz-tabview-panels,
.dark-theme .rz-tabview-panel {
    color: var(--adv-text) !important;
}

/* Custom table */
.dark-theme .adv-table tbody td {
    border-bottom-color: var(--adv-border-subtle);
}

.dark-theme .adv-table-link {
    color: var(--adv-primary-light);
}

/* Inputs */
.dark-theme .rz-textbox,
.dark-theme .rz-inputtext,
.dark-theme .rz-dropdown,
.dark-theme .rz-multiselect,
.dark-theme .rz-datepicker {
    background: var(--adv-surface-raised) !important;
    color: var(--adv-text) !important;
}

/* Buttons - light variant */
.dark-theme .rz-button.rz-light,
.dark-theme .rz-button.rz-variant-flat {
    color: var(--adv-text) !important;
}

.dark-theme .rz-button.rz-light:hover,
.dark-theme .rz-button.rz-variant-flat:hover {
    background: var(--adv-hover-subtle) !important;
}

/* Badges */
.dark-theme .rz-badge.rz-light {
    background: var(--adv-hover-subtle) !important;
    color: var(--adv-text) !important;
}

/* Dialog */
.dark-theme .rz-dialog {
    background: var(--adv-surface-raised) !important;
}

.dark-theme .rz-dialog-content {
    background: var(--adv-surface-raised) !important;
    color: var(--adv-text) !important;
}

/* Breadcrumb */
.dark-theme .rz-breadcrumb {
    color: var(--adv-text-muted);
}

.dark-theme .rz-breadcrumb a {
    color: var(--adv-primary-light) !important;
}

/* The calendar quick view's Delete (#2037): the darker red is for light surfaces. */
.dark-theme {
    --calendar-quickview-danger: var(--adv-danger-light);
}

/* Agenda items */
.dark-theme .dash-agenda-item {
    background: rgba(var(--adv-white-rgb, 255, 255, 255), 0.03);
}

.dark-theme .dash-agenda-item:hover {
    background: var(--adv-border);
}

/* Mobile header */
.dark-theme .adv-mobile-header {
    background: var(--adv-surface);
}

/* Topbar buttons */
.dark-theme .adv-topbar-actions .rz-button:hover {
    color: var(--adv-primary-light) !important;
}

/* IMPROVED: shared detail icon dark theme */
.dark-theme .adv-detail-icon {
    background: rgba(var(--adv-primary-rgb), 0.15);
}

/* IMPROVED: criteria card dark theme */
.dark-theme .adv-criteria-card {
    background: var(--adv-surface-raised);
    border-color: var(--adv-border);
}

/* IMPROVED: footer row dark theme */
.dark-theme .rz-datatable .rz-datatable-footer td,
.dark-theme .rz-datatable-tfoot td,
.dark-theme .rz-grid-table tfoot td {
    background: transparent !important;
    border: none !important;
    border-top: 2px solid var(--adv-border) !important;
}

/* Links */
.dark-theme a {
    color: var(--adv-primary-light);
}

.dark-theme a:hover,
.dark-theme a:focus {
    color: var(--adv-primary);
}

/* RadzenText color inheritance */
.dark-theme .rz-text-body1,
.dark-theme .rz-text-body2,
.dark-theme .rz-text-subtitle1,
.dark-theme .rz-text-subtitle2,
.dark-theme .rz-text-h5,
.dark-theme .rz-text-h6,
.dark-theme .rz-text-display-h5,
.dark-theme .rz-text-display-h6 {
    color: var(--adv-text) !important;
}

.dark-theme .rz-text-caption {
    color: var(--adv-text-muted) !important;
}

/* Radzen checkbox */
.dark-theme .rz-chkbox-box {
    border-color: var(--rz-base-400) !important;
    background: var(--adv-surface-raised) !important;
}

/* RadzenSwitch */
.dark-theme .rz-switch .rz-switch-track {
    background: var(--rz-base-500) !important;
    border-color: var(--rz-base-400) !important;
}

.dark-theme .rz-switch-checked .rz-switch-track {
    background: var(--adv-primary-darker) !important;
    border-color: var(--adv-primary-darker) !important;
}

.dark-theme .rz-switch .rz-switch-thumb {
    background: var(--rz-base-100) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.dark-theme .rz-switch-checked .rz-switch-thumb {
    background: #dce4ec !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

/* Dropdown/select panels */
.dark-theme .rz-dropdown-panel,
.dark-theme .rz-multiselect-panel {
    background: var(--adv-surface-raised) !important;
    border-color: var(--adv-grid-header-border) !important;
}

.dark-theme .rz-dropdown-item:hover,
.dark-theme .rz-multiselect-item:hover {
    background: var(--adv-row-hover) !important;
}
