/* ============================================================
   PDRCL — Portail National des Collectivités Locales
   Congo-Brazzaville
   ============================================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #14532D;
    --topbar-bg: #0A2A1E;
    --panel: rgba(0,0,0,.22);
    --panel2: rgba(0,0,0,.15);
    --ink: #FFFFFF;
    --muted: #D8E4DC;
    --faint: #AFC2B4;
    --gold: #F0CC6E;
    --green: #2FBF6B;
    --greentext: #B6F5D2;
    --line: rgba(240,204,110,.4);
    --line2: rgba(240,204,110,.22);
    --topbar-border: rgba(201,162,39,.18);
    --footer-bg: #061A12;
    --footer-text: #AFC2B4;
    --input-bg: rgba(0,0,0,.22);
    --tag-bg: rgba(0,0,0,.15);
    --tag-border: rgba(240,204,110,.3);
    --tag-text: #E8D9A8;
    --corner: rgba(0,149,67,.16);
    --seg-bg: rgba(255,255,255,.05);
    --seg-active: #E4C15C;
    --seg-active-text: #092619;
    --glow: rgba(228,193,92,.14);
    --glowhover: rgba(228,193,92,.32);

    --color-disponible: var(--green);
    --color-en-cours: var(--gold);

    --radius-sm: 7px;
    --radius-md: 13px;
    --radius-lg: 16px;
    --transition: .3s ease;
}

:root[data-theme="light"] {
    --bg: #FAF6EC;
    --topbar-bg: #FAF6EC;
    --panel: #ffffff;
    --panel2: #FCFAF4;
    --ink: #0B3B2E;
    --muted: #5B6B60;
    --faint: #93A198;
    --gold: #B8860B;
    --green: #009543;
    --greentext: #0B6E3B;
    --line: #E7E1D2;
    --line2: #EDE7D8;
    --topbar-border: #E7E1D2;
    --footer-bg: #0B3B2E;
    --footer-text: #B9CABB;
    --input-bg: #ffffff;
    --tag-bg: #F1EEE6;
    --tag-border: #E3DDCE;
    --tag-text: #6E7E73;
    --corner: rgba(0,149,67,.09);
    --seg-bg: #F1EEE6;
    --seg-active: #0B3B2E;
    --seg-active-text: #F2E9CE;
    --glow: rgba(201,162,39,.10);
    --glowhover: rgba(201,162,39,.20);
}

html { scroll-behavior: smooth; }
body {
    font-family: 'Public Sans', sans-serif;
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    transition: background .45s ease, color .45s ease;
}

/* ────────────────────────────────────────
   FLAG BAR
──────────────────────────────────────── */
.flag-bar { height: 4px; display: flex; }
.flag-bar span { flex: 1; }
.flag-bar .f1 { background: #009543; }
.flag-bar .f2 { background: #FBDE4A; }
.flag-bar .f3 { background: #DC241F; }

/* ────────────────────────────────────────
   TOPBAR
──────────────────────────────────────── */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 44px;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    flex-wrap: wrap;
    transition: background .45s ease;
}

.nav-brand { display: flex; align-items: center; gap: 14px; text-decoration: none; flex-shrink: 0; }
.nav-brand-logo {
    width: 36px; height: 36px;
    border-radius: 9px;
    background: #ffffff;
    box-shadow: 0 0 0 1px var(--line), 0 4px 12px rgba(0,0,0,.25);
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    padding: 3px;
}
.nav-brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.nav-brand-fallback { font-size: 1.1rem; }
.nav-brand-text { line-height: 1; }
.nav-brand-text .name { font-family: 'Marcellus', serif; font-size: 21px; letter-spacing: 1px; color: var(--ink); }
.nav-brand-text .tagline { font-size: 9px; letter-spacing: 2.5px; color: var(--faint); margin-top: 4px; }

.nav-center { flex: 1; text-align: center; }
.nav-subtitle { color: var(--muted); font-size: .78rem; letter-spacing: .5px; }

.nav-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.seg-group { display: flex; gap: 2px; background: var(--seg-bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg-btn {
    border: none; background: transparent; color: var(--muted);
    font-family: 'Public Sans', sans-serif; font-weight: 700; font-size: 11px; letter-spacing: .5px;
    padding: 6px 11px; border-radius: 7px; cursor: pointer; white-space: nowrap;
    transition: background .2s, color .2s;
}
.seg-btn[data-on="1"] { background: var(--seg-active) !important; color: var(--seg-active-text) !important; }

/* ────────────────────────────────────────
   HERO
──────────────────────────────────────── */
.hero-section { padding: 56px 44px 30px; max-width: 1300px; margin: 0 auto; }
.hero-inner { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; flex-wrap: wrap; }
.hero-left { max-width: 620px; }
.hero-title { font-family: 'Marcellus', serif; font-weight: 400; font-size: clamp(2.2rem, 4.2vw, 54px); line-height: 1.04; color: var(--ink); }
.hero-title-accent { font-family: 'Cormorant Garamond', serif; font-style: italic; font-weight: 600; color: var(--gold); }
.hero-subtitle { font-size: 15px; line-height: 1.65; color: var(--muted); margin-top: 20px; max-width: 520px; }

.search-box { position: relative; max-width: 560px; margin-top: 28px; }
.search-icon { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); color: var(--faint); display: flex; pointer-events: none; }
.search-input {
    width: 100%; padding: 15px 18px 15px 48px;
    border-radius: 14px; border: 1px solid var(--line);
    background: var(--input-bg); color: var(--ink);
    font-family: 'Public Sans', sans-serif; font-size: 15px;
    outline: none; transition: border-color .25s, box-shadow .25s;
}
.search-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--glowhover); }
.search-input::placeholder { color: var(--faint); }

.hero-right { display: flex; flex-direction: column; gap: 16px; }
.hero-stats { display: flex; gap: 12px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px 22px; min-width: 96px; text-align: center; }
.stat-number { font-family: 'Marcellus', serif; font-size: 31px; color: var(--ink); line-height: 1; }
.stat-card--available .stat-number { color: var(--greentext); }
.stat-card--pending .stat-number { color: var(--gold); }
.stat-label { display: block; font-size: 9px; letter-spacing: 1.5px; color: var(--faint); margin-top: 5px; }

.hero-legend { display: flex; gap: 20px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-disponible { background: var(--green); }
.dot-en-cours { background: var(--gold); }

/* ────────────────────────────────────────
   CONTENT WRAPPER
──────────────────────────────────────── */
.page-wrapper { max-width: 1300px; margin: 0 auto; padding: 0 44px 20px; }

/* ────────────────────────────────────────
   SECTION LABELS
──────────────────────────────────────── */
.section-label { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.section-label-text { font-size: 11px; letter-spacing: 2px; font-weight: 700; }
.section-label-text--dispo { color: var(--greentext); }
.section-label-text--encours { color: var(--gold); }
.section-label-line { flex: 1; height: 1px; background: var(--line); }

/* ────────────────────────────────────────
   DEPARTMENTS GRID
──────────────────────────────────────── */
.dept-grid { display: grid; gap: 16px; margin-top: 18px; }
.dept-grid--featured { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.dept-grid--compact { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

/* ────────────────────────────────────────
   DEPARTMENT CARD
──────────────────────────────────────── */
.dept-card {
    position: relative;
    display: block;
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.dept-card, .dept-card * { text-decoration: none; }

.dept-card--available {
    background: var(--panel);
    border: 1px solid var(--line);
    padding: 26px;
    cursor: pointer;
}
.dept-card--available:hover {
    transform: translateY(-6px);
    box-shadow: 0 22px 50px rgba(0,0,0,.35), 0 0 0 1px var(--gold), 0 0 34px var(--glowhover);
    border-color: var(--gold);
}
.dept-card--available::before {
    content: '';
    position: absolute; top: 0; right: 0; width: 82px; height: 82px;
    background: linear-gradient(135deg, transparent 50%, var(--corner) 50%);
}

.dept-card--pending {
    background: var(--panel2);
    border: 1px solid var(--line2);
    padding: 18px;
    cursor: not-allowed;
    opacity: .88;
}
.dept-card--pending:hover {
    transform: translateY(-5px);
    box-shadow: 0 18px 40px rgba(0,0,0,.32), 0 0 0 1px var(--gold), 0 0 26px var(--glowhover);
    border-color: var(--gold);
}

.dept-card-header { display: flex; justify-content: space-between; align-items: center; position: relative; gap: 8px; }

.dept-badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-weight: 700; border-radius: 7px;
}
.dept-badge--disponible {
    font-size: 10px; letter-spacing: 1.5px; color: var(--greentext);
    background: rgba(0,149,67,.16); border: 1px solid rgba(0,149,67,.4);
    padding: 5px 11px;
}
.dept-badge--encours {
    font-size: 9px; letter-spacing: 1.2px; color: var(--gold);
    background: rgba(201,162,39,.12); border: 1px solid rgba(201,162,39,.3);
    padding: 4px 9px;
}
.dept-lock { font-size: 11px; color: var(--faint); opacity: .7; }
.dept-arrow { font-size: 22px; color: var(--gold); line-height: 1; transition: transform var(--transition); }
.dept-card--available:hover .dept-arrow { transform: translateX(5px); }

.dept-logo {
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; border: 1.5px dashed var(--gold);
    background: rgba(228,193,92,.06); box-shadow: 0 0 0 6px var(--glow);
    overflow: hidden;
}
.dept-card--available .dept-logo { width: 62px; height: 62px; margin-top: 20px; box-shadow: 0 0 0 6px var(--glow); }
.dept-card--pending .dept-logo { width: 46px; height: 46px; margin-top: 16px; box-shadow: 0 0 0 5px var(--glow); }
.dept-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.dept-name { font-family: 'Marcellus', serif; font-weight: 400; color: var(--ink); }
.dept-card--available .dept-name { font-size: 28px; margin: 18px 0 0; }
.dept-card--pending .dept-name { font-size: 20px; margin: 14px 0 0; }

.dept-meta { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.dept-chef-lieu { font-size: 13px; color: var(--greentext); font-weight: 600; }
.dept-region {
    font-size: 10px; letter-spacing: .5px; color: var(--tag-text);
    background: var(--tag-bg); border: 1px solid var(--tag-border);
    padding: 2px 8px; border-radius: 6px;
}
.dept-card--pending .dept-chef-lieu { font-size: 12px; }
.dept-card--pending .dept-region { font-size: 9px; padding: 1px 7px; }

.dept-desc { line-height: 1.55; color: var(--muted); }
.dept-card--available .dept-desc { font-size: 13.5px; margin: 14px 0 0; }
.dept-card--pending .dept-desc { font-size: 12px; line-height: 1.5; margin: 12px 0 0; }

.dept-divider { height: 1px; background: var(--line2); }
.dept-card--available .dept-divider { margin: 22px 0 15px; }
.dept-card--pending .dept-divider { margin: 16px 0 12px; }

.dept-card-footer { display: flex; justify-content: space-between; }
.dept-card-footer .col--right { text-align: right; }
.dept-footer-label { color: var(--faint); }
.dept-footer-value { font-weight: 600; color: var(--ink); }
.dept-card--available .dept-footer-label { font-size: 9px; letter-spacing: 1.5px; }
.dept-card--available .dept-footer-value { font-size: 15px; margin-top: 3px; }
.dept-card--pending .dept-footer-label { font-size: 8px; letter-spacing: 1px; }
.dept-card--pending .dept-footer-value { font-size: 13px; margin-top: 2px; }

/* ────────────────────────────────────────
   NO RESULTS
──────────────────────────────────────── */
.no-results { display: none; text-align: center; padding: 70px 20px; animation: fadeIn .4s ease both; }
.no-results.is-visible { display: block; }
.no-results-title { font-family: 'Marcellus', serif; font-size: 26px; color: var(--ink); }
.no-results-query { font-size: 13px; color: var(--muted); margin-top: 10px; }

/* ────────────────────────────────────────
   INFO NOTICE
──────────────────────────────────────── */
.info-notice {
    display: flex; align-items: flex-start; gap: 12px;
    margin-top: 34px; background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius-md); padding: 16px 20px;
    font-size: 12.5px; line-height: 1.5; color: var(--muted);
}
.info-notice-icon { color: var(--gold); font-weight: 700; flex-shrink: 0; }

/* ────────────────────────────────────────
   FLASH MESSAGES
──────────────────────────────────────── */
.flash-message {
    display: flex; align-items: center; gap: .75rem;
    max-width: 1300px; margin: 16px auto 0; padding: .85rem 1.5rem .85rem 1rem;
    border-radius: var(--radius-md);
    font-size: .88rem; font-weight: 500;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
    transition: opacity .4s, transform .4s;
}
.flash-info { background: rgba(147,197,253,.1); color: #93c5fd; border: 1px solid rgba(147,197,253,.25); }
.flash-success { background: rgba(134,239,172,.1); color: #86efac; border: 1px solid rgba(134,239,172,.25); }
.flash-close { margin-left: auto; background: none; border: none; cursor: pointer; color: inherit; opacity: .6; font-size: .9rem; transition: opacity .2s; }
.flash-close:hover { opacity: 1; }

/* ────────────────────────────────────────
   FOOTER
──────────────────────────────────────── */
.footer { margin-top: 34px; padding: 22px 44px; background: var(--footer-bg); color: var(--footer-text); font-size: 12px; letter-spacing: .3px; }
.footer-inner { max-width: 1300px; margin: 0 auto; }

/* ────────────────────────────────────────
   ANIMATIONS
──────────────────────────────────────── */
@keyframes cardReveal { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ────────────────────────────────────────
   RESPONSIVE
──────────────────────────────────────── */
@media (max-width: 900px) {
    .hero-inner { flex-direction: column; align-items: flex-start; }
    .hero-right { width: 100%; }
}

@media (max-width: 768px) {
    .navbar, .hero-section, .page-wrapper, .footer { padding-left: 20px; padding-right: 20px; }
    .nav-center { display: none; }
    .hero-stats { gap: 8px; }
    .stat-card { padding: 10px 14px; min-width: 70px; }
    .stat-number { font-size: 22px; }
    .dept-grid--featured { grid-template-columns: 1fr; }
    .dept-grid--compact { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (max-width: 480px) {
    .dept-grid--compact { grid-template-columns: 1fr 1fr; }
    .seg-btn { padding: 6px 8px; font-size: 10px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .1ms !important; }
}
