/* ═══════════════════════════════════════════
   GED – Cour des Comptes — Charte graphique RDC
   Bleu #0095C9 · Jaune #FFF24B · Rouge #DB3832 (charte officielle CDC)
   ═══════════════════════════════════════════ */

:root {
    --cdc-blue:   #0095C9;
    --cdc-blue-dark:  #006f99;
    --cdc-yellow: #FFF24B;
    --cdc-yellow-dark: #e6da43;
    --cdc-red:    #DB3832;
    --cdc-red-dark:   #a32c27;
    --cdc-green:  #198754;
    --cdc-gray:   #6c757d;

    --sidebar-width: 260px;
    --topbar-height: 62px;
}

body {
    background: #f4f6f9;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Page de connexion ─────────────────────────── */

.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--cdc-blue-dark) 0%, var(--cdc-blue) 55%, #0fb3e0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container { width: 100%; max-width: 460px; padding: 1rem; }

.login-card { border: none; border-radius: 14px; }

/* Logo officiel : proportions et transparence préservées, jamais déformé */
.login-logo img { width: 140px; height: 90px; object-fit: contain; }

/* Logo dans le sidebar (visible, non dominant) */
.sidebar-brand-logo {
    display: flex; align-items: center; justify-content: center;
    padding: 0.5rem 1.25rem 0.75rem;
}
.sidebar-brand-logo img {
    width: 100%; max-width: 150px; height: auto;
    aspect-ratio: 621 / 402; object-fit: contain;
    /* Logo officiel en couleur : jamais monochrome, jamais déformé */
    opacity: 0.97;
}

.login-institution {
    color: #1a2b3c; font-weight: 800; letter-spacing: 3px;
    font-size: 1.05rem; margin: 0;
}
.login-country {
    color: #495765; font-size: 0.8rem; letter-spacing: 2px; margin-bottom: 1rem;
}
.login-divider {
    height: 3px; width: 90px; margin: 0 auto 1rem;
    background: linear-gradient(90deg, var(--cdc-blue), var(--cdc-yellow), var(--cdc-red));
    border-radius: 3px;
}
.login-app-name { color: #1a2b3c; font-weight: 700; }
.login-app-sub  { color: #495765; font-size: 0.9rem; }

.btn-primary {
    background: var(--cdc-blue); border-color: var(--cdc-blue);
}
.btn-primary:hover { background: var(--cdc-blue-dark); border-color: var(--cdc-blue-dark); }

.login-footer small { color: rgba(255, 255, 255, 0.75); }

/* ── Layout applicatif ─────────────────────────── */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: #0d2137;
    color: #d7e1ea;
    flex-shrink: 0;
    position: sticky; top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-brand .brand-name {
    display: block; font-weight: 800; font-size: 1.05rem; color: #fff;
}
.sidebar-brand .brand-sub {
    display: block; font-size: 0.7rem; color: #8fb0c8;
    letter-spacing: 0.5px; margin-top: 0.25rem;
}

.sidebar-nav { padding: 0.75rem 0.5rem 2rem; }

.nav-item {
    display: block; padding: 0.55rem 1rem;
    color: #bcd0e0; text-decoration: none;
    border-radius: 8px; font-size: 0.9rem;
    margin: 1px 0.5rem;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-item.active { background: var(--cdc-blue); color: #fff; font-weight: 600; }
.nav-icon { margin-right: 0.5rem; opacity: 0.8; }

.nav-group-title {
    display: block; padding: 1rem 1rem 0.25rem 1.5rem;
    font-size: 0.7rem; text-transform: uppercase;
    letter-spacing: 1.5px; color: #6e88a0; font-weight: 700;
}
.nav-group .nav-item { font-size: 0.85rem; }

.main-wrapper {
    flex: 1;
    display: flex; flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e3e8ee;
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1.5rem;
    position: sticky; top: 0; z-index: 40;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
}
.topbar-title { font-weight: 700; color: #1a2b3c; flex: 1; }

.hamburger {
    display: none;
    background: none; border: 1px solid #dee2e6; border-radius: 8px;
    font-size: 1.25rem; padding: 0.25rem 0.6rem;
}

.topbar-user .dropdown-toggle {
    background: none; border: 1px solid #e3e8ee; border-radius: 999px;
    padding: 0.35rem 1rem; font-size: 0.9rem; color: #1a2b3c;
}

.main-content { flex: 1; padding: 1.5rem; }

.footer {
    padding: 1rem 1.5rem;
    color: #8795a5; font-size: 0.8rem;
    border-top: 1px solid #e3e8ee;
    background: #fff;
}

/* ── Cartes statistiques du dashboard ──────────── */

.stat-card {
    border: none; border-radius: 12px;
    border-left: 4px solid var(--cdc-blue);
    box-shadow: 0 1px 4px rgba(16, 24, 40, 0.06);
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; color: #1a2b3c; }
.stat-card .stat-label { font-size: 0.8rem; color: #6e7d8d; text-transform: uppercase; letter-spacing: 0.5px; }

.stat-card--yellow { border-left-color: var(--cdc-yellow-dark); }
.stat-card--red    { border-left-color: var(--cdc-red); }
.stat-card--green  { border-left-color: var(--cdc-green); }
.stat-card--gray   { border-left-color: var(--cdc-gray); }

/* ── Badges sémantiques ────────────────────────── */

.badge-urgent     { background: var(--cdc-red); color: #fff; }
.badge-validation { background: var(--cdc-yellow-dark); color: #3d3900; }
.badge-success    { background: var(--cdc-green); color: #fff; }
.badge-archived   { background: var(--cdc-gray); color: #fff; }

/* ── Tableaux ──────────────────────────────────── */

.table-responsive { border-radius: 10px; }

/* ── Bouton principal de téléversement ─────────── */

.btn-upload-main {
    background: var(--cdc-blue); color: #fff;
    border-radius: 999px; padding: 0.65rem 1.5rem;
    font-weight: 700; box-shadow: 0 3px 10px rgba(0, 149, 201, 0.35);
}
.btn-upload-main:hover { background: var(--cdc-blue-dark); color: #fff; }

/* ── Responsive ────────────────────────────────── */

@media (max-width: 991.98px) {
    .app-shell { flex-direction: column; }

    .sidebar {
        position: fixed; top: 0; left: 0; z-index: 1050;
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }
    .sidebar.show { transform: translateX(0); }

    .hamburger { display: inline-block; }
    .main-content { padding: 1rem; }
}

@media (max-width: 575.98px) {
    .login-container { padding: 0.75rem; }
    .card-body.p-4.p-md-5 { padding: 1.25rem; }
}

/* Sidebar overlay sur mobile */
.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0; z-index: 1045;
    background: rgba(0, 0, 0, 0.45);
}
.sidebar-backdrop.show { display: block; }

/* ── Module Documents (Phase 3) : pastille d'extension ── */
.file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    margin-right: 0.35rem;
    border-radius: 0.3rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    background: var(--cdc-gray);
    text-transform: uppercase;
    vertical-align: -0.25rem;
    letter-spacing: 0.02em;
}
.file-icon[data-ext="pdf"] { background: var(--cdc-red); }
.file-icon[data-ext="jpg"],
.file-icon[data-ext="jpeg"],
.file-icon[data-ext="png"] { background: #0d6efd; }
.file-icon[data-ext="doc"],
.file-icon[data-ext="docx"] { background: #0d47a1; }
.file-icon[data-ext="xls"],
.file-icon[data-ext="xlsx"] { background: var(--cdc-green); }

/* ── Graphiques (Chart.js : responsive + maintainAspectRatio=false
   exigent un conteneur de hauteur explicite) ───────────────── */
.chart-box { height: 160px; position: relative; }
.chart-canvas { width: 100%; height: 100%; display: block; }
