/* Dashboard HMA — Styles */

:root {
    --hma-blue: #1a365d;
    --hma-blue-light: #2c5282;
    --hma-blue-accent: #3182ce;
    --hma-green: #276749;
    --hma-green-light: #38a169;
    --hma-red: #c53030;
    --hma-red-light: #fc8181;
    --hma-orange: #c05621;
    --hma-yellow: #d69e2e;
    --hma-gray: #718096;
    --hma-gray-light: #a0aec0;
    --hma-bg: #f0f4f8;
    --hma-card-bg: #ffffff;
    --hma-border: #e2e8f0;
    --hma-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --hma-radius: 10px;
}

body {
    background-color: var(--hma-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    color: #2d3748;
    font-size: 14px;
}

/* ── Sidebar ── */
.sidebar {
    background: linear-gradient(180deg, var(--hma-blue) 0%, #0f2440 100%);
    color: white;
    min-height: 100vh;
    padding: 1.5rem 1.2rem;
    position: sticky;
    top: 0;
}

.sidebar h4 {
    color: white;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
}

.sidebar hr {
    border-color: rgba(255, 255, 255, 0.15) !important;
    margin: 1rem 0;
}

.sidebar label {
    color: #cbd5e0;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.3rem;
    display: block;
}

/* Dropdown dans sidebar — texte lisible sur fond fonce */
.sidebar .Select-control {
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    border-radius: 6px !important;
    min-height: 36px !important;
}

.sidebar .Select-control:hover {
    border-color: rgba(255, 255, 255, 0.4) !important;
}

.sidebar .Select-value-label,
.sidebar .Select-value .Select-value-label {
    color: #ffffff !important;
    font-weight: 500 !important;
    font-size: 0.88rem !important;
}

.sidebar .Select-placeholder,
.sidebar .Select--single > .Select-control .Select-placeholder {
    color: #a0aec0 !important;
}

.sidebar .Select-input > input {
    color: #ffffff !important;
}

.sidebar .Select-arrow-zone .Select-arrow {
    border-top-color: #a0aec0 !important;
}

.sidebar .Select.is-open .Select-arrow {
    border-bottom-color: #a0aec0 !important;
}

/* Menu deroulant ouvert (overlay blanc) */
.sidebar .Select-menu-outer {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    margin-top: 2px !important;
    z-index: 999 !important;
}

.sidebar .Select-option {
    color: #2d3748 !important;
    font-size: 0.88rem !important;
    padding: 8px 12px !important;
}

.sidebar .Select-option:hover,
.sidebar .Select-option.is-focused {
    background: #edf2f7 !important;
    color: #1a365d !important;
}

.sidebar .Select-option.is-selected {
    background: #3182ce !important;
    color: #ffffff !important;
}

.sidebar .Select-noresults {
    color: #718096 !important;
}

/* ── Titre page ── */
#titre-dashboard {
    font-weight: 700;
    color: var(--hma-blue);
    font-size: 1.4rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--hma-blue-accent);
    margin-bottom: 1.5rem !important;
}

/* ── KPI Cards ── */
.kpi-card {
    background: var(--hma-card-bg);
    border-radius: var(--hma-radius);
    padding: 1.1rem 1rem;
    box-shadow: var(--hma-shadow);
    text-align: center;
    margin-bottom: 0.5rem;
    border-top: 3px solid var(--hma-blue-accent);
    transition: transform 0.15s, box-shadow 0.15s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.kpi-card .kpi-title {
    font-size: 0.7rem;
    color: var(--hma-gray);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.kpi-card .kpi-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--hma-blue);
    line-height: 1.2;
    margin-bottom: 0.3rem;
    font-variant-numeric: tabular-nums;
}

.kpi-card .kpi-pct {
    font-size: 0.78rem;
    color: var(--hma-gray-light);
    margin-top: 0.15rem;
}

.kpi-card .kpi-delta-up {
    color: var(--hma-green);
    font-size: 0.8rem;
    font-weight: 600;
}

.kpi-card .kpi-delta-down {
    color: var(--hma-red);
    font-size: 0.8rem;
    font-weight: 600;
}

/* KPI container — espacement */
#kpi-cards-container {
    margin-bottom: 1.5rem !important;
}

#kpi-cards-container .row {
    gap: 0;
}

/* ── Tableau CRD ── */
.crd-table {
    background: var(--hma-card-bg);
    border-radius: var(--hma-radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--hma-shadow);
    margin-bottom: 1.5rem;
}

.crd-table h5 {
    font-weight: 700;
    color: var(--hma-blue);
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--hma-border);
}

.crd-table h6 {
    font-weight: 700;
    font-size: 0.9rem;
}

.crd-row {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--hma-border);
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 4px;
    margin-bottom: 1px;
}

.crd-row:last-child {
    border-bottom: none;
}

.crd-row:hover {
    background-color: #edf2f7;
}

.crd-row.subtotal {
    font-weight: 700;
    background-color: #f7fafc;
    border-left: 3px solid var(--hma-blue-accent);
    padding-left: calc(0.75rem - 3px);
}

.crd-row.drilldown-1 {
    padding-left: 2.5rem;
    font-size: 0.88rem;
    color: #4a5568;
    background-color: #fafbfc;
}

.crd-row.drilldown-2 {
    padding-left: 4rem;
    font-size: 0.82rem;
    color: var(--hma-gray);
    background-color: #f8f9fa;
}

.crd-label {
    flex: 1;
    font-size: 0.9rem;
}

.crd-montant {
    width: 130px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    font-size: 0.9rem;
}

.crd-pct {
    width: 75px;
    text-align: right;
    color: var(--hma-gray-light);
    font-size: 0.82rem;
}

.crd-bar {
    width: 100px;
    margin-left: 0.75rem;
}

.crd-bar-inner {
    height: 6px;
    border-radius: 3px;
    background-color: var(--hma-blue-accent);
    transition: width 0.3s;
}

/* ── Section seuil ── */
.seuil-section {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #f6e05e;
    border-radius: var(--hma-radius);
    padding: 1.25rem;
    margin-top: 1.25rem;
}

.seuil-section h6 {
    color: var(--hma-orange);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.seuil-section .kpi-title {
    font-size: 0.72rem;
    color: var(--hma-gray);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.seuil-section .kpi-value {
    color: var(--hma-blue) !important;
    font-weight: 700 !important;
}

/* ── Graphiques ── */
.chart-card {
    background: var(--hma-card-bg);
    border-radius: var(--hma-radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--hma-shadow);
    margin-bottom: 1.5rem;
}

/* Espacement entre rangees de charts */
#page-content .row {
    margin-bottom: 0.5rem;
}

/* ── Tables BF / Budget ── */
.crd-table table {
    margin-bottom: 0;
    font-size: 0.85rem;
}

.crd-table table th {
    background-color: #f7fafc;
    color: var(--hma-blue);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    border-bottom: 2px solid var(--hma-border);
    padding: 0.6rem 0.5rem;
}

.crd-table table td {
    padding: 0.5rem;
    vertical-align: middle;
    border-color: var(--hma-border);
}

.crd-table table tbody tr:hover {
    background-color: #edf2f7 !important;
}

/* ── Slider sidebar ── */
.sidebar .rc-slider {
    margin-bottom: 0.5rem;
}

.sidebar .rc-slider-mark-text {
    color: #cbd5e0 !important;
    font-size: 0.7rem;
}

.sidebar .rc-slider-tooltip-inner {
    background: var(--hma-blue-accent);
    border-radius: 4px;
    font-size: 0.75rem;
    padding: 2px 6px;
}

.sidebar .rc-slider-track {
    background-color: var(--hma-blue-accent) !important;
}

.sidebar .rc-slider-handle {
    border-color: var(--hma-blue-accent) !important;
}

/* ── Checkbox sidebar ── */
.sidebar .form-check-label {
    color: #e2e8f0;
    font-size: 0.85rem;
}

/* ── Alerts ── */
.alert {
    border-radius: var(--hma-radius);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar {
        min-height: auto;
        padding: 1rem;
    }

    .kpi-card {
        padding: 0.75rem;
    }

    .kpi-card .kpi-value {
        font-size: 1.1rem;
    }

    .crd-bar {
        display: none;
    }

    .crd-montant {
        width: 100px;
        font-size: 0.82rem;
    }

    .crd-table {
        padding: 0.75rem;
    }
}

@media (max-width: 576px) {
    .crd-pct {
        display: none;
    }

    #titre-dashboard {
        font-size: 1.1rem;
    }
}
