/* ==========================================================================
   GEA-Map Guinée — Design tokens & styles transverses
   --------------------------------------------------------------------------
   Charte UNICEF : bleu #1CABE2 (primaire), bleu foncé #00355A (texte/nav).
   Inspiré de la charte UNICEF Brand Toolkit ; à valider par la communication
   avant publication externe.
   ========================================================================== */

:root {
  /* Palette UNICEF */
  --unicef-blue: #1CABE2;
  --unicef-dark: #00355A;
  --unicef-blue-soft: #d8f1fa;
  --unicef-orange: #F7B500;
  --unicef-green: #00833D;
  --unicef-red: #E2231A;

  /* Surcharges Bootstrap (variables overridables) */
  --bs-primary: var(--unicef-blue);
  --bs-primary-rgb: 28, 171, 226;
  --bs-link-color: var(--unicef-dark);
  --bs-link-hover-color: var(--unicef-blue);
  --bs-border-color: #dee2e6;

  /* Typographie */
  --font-family-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                      "Helvetica Neue", Arial, "Noto Sans", sans-serif,
                      "Apple Color Emoji", "Segoe UI Emoji";

  /* Espaces (échelle 4px) */
  --space-xs: .25rem;
  --space-sm: .5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
}

/* --------------------------------------------------------------------------
   Layout général
   -------------------------------------------------------------------------- */
html, body {
  height: 100%;
}

body {
  font-family: var(--font-family-base);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #f8f9fa;
  color: #212529;
}

main {
  flex: 1 0 auto;
}

/* --------------------------------------------------------------------------
   Boutons & liens — surcharges UNICEF
   -------------------------------------------------------------------------- */
.btn-primary {
  --bs-btn-bg: var(--unicef-blue);
  --bs-btn-border-color: var(--unicef-blue);
  --bs-btn-hover-bg: #128cba;
  --bs-btn-hover-border-color: #128cba;
  --bs-btn-active-bg: var(--unicef-dark);
  --bs-btn-active-border-color: var(--unicef-dark);
}

.btn-outline-primary {
  --bs-btn-color: var(--unicef-blue);
  --bs-btn-border-color: var(--unicef-blue);
  --bs-btn-hover-bg: var(--unicef-blue);
  --bs-btn-hover-border-color: var(--unicef-blue);
}

a:not(.btn) {
  text-underline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Header / branding
   -------------------------------------------------------------------------- */
.site-header {
  background-color: #fff;
  border-bottom: 3px solid var(--unicef-blue);
}

.site-header .navbar-brand img {
  height: 40px;
  width: auto;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background-color: var(--unicef-dark);
  color: #cfd8e3;
  border-top: 4px solid var(--unicef-blue);
  font-size: .9rem;
}

.site-footer a {
  color: #fff;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Accessibilité
   -------------------------------------------------------------------------- */

/* Skip link visible au focus uniquement (visually-hidden-focusable de
   Bootstrap est OK, on ajoute juste la couleur primaire au focus). */
.skip-link:focus {
  background-color: var(--unicef-dark);
  color: #fff;
  padding: .5rem 1rem;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2000;
  border-radius: 0 0 .25rem 0;
  text-decoration: none;
}

/* Focus visible : 2px outline UNICEF — surcharge le focus Bootstrap par
   défaut (qui est correct mais peu contrasté en RTL). */
:focus-visible {
  outline: 2px solid var(--unicef-blue);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   Cartes / composants métier (helpers)
   -------------------------------------------------------------------------- */
.card-stat {
  border-left: 4px solid var(--unicef-blue);
}

/* --------------------------------------------------------------------------
   Listes CRUD (P30) — en-têtes triables + thead collant
   -------------------------------------------------------------------------- */
.crud-table-wrap {
  max-height: 70vh;
}
.crud-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bs-body-bg, #fff);
  box-shadow: inset 0 -1px 0 var(--bs-border-color, #dee2e6);
}
.crud-sort {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.crud-sort:hover { color: var(--unicef-blue); }
.crud-sort.active { color: var(--unicef-blue); font-weight: 600; }

/* --------------------------------------------------------------------------
   Formulaires CRUD / site (P30) — champs rendus bruts ({{ field }}) sans
   classe Bootstrap : on les style ici (centralisé, ex-blocs <style> inline).
   Adapté au thème sombre (bordure + fond via variables) + focus UNICEF.
   -------------------------------------------------------------------------- */
.crud-form-card input[type="text"],
.crud-form-card input[type="email"],
.crud-form-card input[type="tel"],
.crud-form-card input[type="url"],
.crud-form-card input[type="number"],
.crud-form-card input[type="date"],
.crud-form-card input[type="password"],
.crud-form-card input[type="color"],
.crud-form-card select,
.crud-form-card textarea {
  width: 100%;
  padding: .375rem .75rem;
  border: 1px solid var(--bs-border-color, #ced4da);
  border-radius: .375rem;
  background-color: var(--bs-body-bg, #fff);
  color: var(--bs-body-color, inherit);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.crud-form-card input:focus,
.crud-form-card select:focus,
.crud-form-card textarea:focus {
  outline: none;
  border-color: var(--unicef-blue);
  box-shadow: 0 0 0 .2rem rgba(28, 171, 226, .25);
}
.crud-form-card textarea { min-height: 80px; }
.crud-form-card input[type="color"] { padding: .25rem; height: 2.5rem; }

/* --------------------------------------------------------------------------
   Leaflet — thème sombre global (mini-cartes hors page Carte, P30)
   -------------------------------------------------------------------------- */
.mini-map {
  background: #e6e9ec;
}
[data-bs-theme="dark"] .mini-map {
  background: #0b1220;
}
[data-bs-theme="dark"] .leaflet-tile-pane {
  filter: brightness(.78) contrast(1.05);
}

.empty-state {
  padding: var(--space-xl) var(--space-md);
  text-align: center;
  color: #6c757d;
}

/* --------------------------------------------------------------------------
   Home — hero (P30) : adapte fond + titre au thème clair/sombre
   -------------------------------------------------------------------------- */
.home-hero {
  background-color: #fff;
}
.home-hero-title {
  color: var(--unicef-dark);
}
[data-bs-theme="dark"] .home-hero {
  background-color: var(--bs-body-bg, #111827);
}
[data-bs-theme="dark"] .home-hero-title {
  color: var(--unicef-blue);
}

.empty-state i {
  font-size: 2.5rem;
  color: var(--unicef-blue-soft);
  display: block;
  margin-bottom: var(--space-md);
}

/* ==========================================================================
   App shell (P24) — topbar fixe + sidebar pliable + main scrollable
   ========================================================================== */

:root {
  --app-topbar-height: 56px;
  --app-sidebar-width: 240px;
  --app-sidebar-width-collapsed: 64px;
  --app-sidebar-bg: #f8f9fa;
  --app-sidebar-border: #e5e7eb;
  --app-sidebar-text: #495057;
  --app-sidebar-active-bg: var(--unicef-blue-soft);
  --app-sidebar-active-text: var(--unicef-dark);
}

/* ---- Dark theme overrides (Bootstrap 5.3 data-bs-theme) ---- */
[data-bs-theme="dark"] {
  --app-sidebar-bg: #1f2937;
  --app-sidebar-border: #374151;
  --app-sidebar-text: #d1d5db;
  --app-sidebar-active-bg: #1e40af;
  --app-sidebar-active-text: #ffffff;
  --bs-body-bg: #111827;
  --bs-body-color: #e5e7eb;
  --bs-link-color: #60a5fa;
  --bs-link-hover-color: #93c5fd;
}

/* Le body sans sidebar (anonyme, ou block sidebar override) ne pose pas
   de margin-left ; sinon le main est décalé pour laisser place à la sidebar. */
body.has-sidebar .app-content-wrap {
  margin-left: var(--app-sidebar-width);
  transition: margin-left 0.2s ease;
}
body.has-sidebar.app-sidebar--collapsed .app-content-wrap {
  margin-left: var(--app-sidebar-width-collapsed);
}
[dir="rtl"] body.has-sidebar .app-content-wrap {
  margin-left: 0;
  margin-right: var(--app-sidebar-width);
}
[dir="rtl"] body.has-sidebar.app-sidebar--collapsed .app-content-wrap {
  margin-right: var(--app-sidebar-width-collapsed);
}

/* ---- Topbar ---- */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--bs-body-bg, #fff);
  border-bottom: 1px solid var(--bs-border-color);
  height: var(--app-topbar-height);
  display: flex;
  align-items: center;
}
.app-topbar-nav {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 1rem;
  gap: 0.5rem;
}
.app-topbar-brand {
  color: inherit;
  text-decoration: none;
}
.app-topbar-brand:hover { color: var(--unicef-blue); }
.app-topbar-link {
  text-decoration: none;
  color: var(--bs-body-color);
}
.app-topbar-link.active {
  color: var(--unicef-blue);
  font-weight: 600;
}

/* ---- Recherche globale (P30) ---- */
.app-search {
  position: relative;
  min-width: 220px;
  max-width: 340px;
  flex: 1 1 220px;
}
.app-search-icon {
  position: absolute;
  top: 50%;
  inset-inline-start: 0.6rem;
  transform: translateY(-50%);
  color: var(--bs-secondary-color, #6c757d);
  pointer-events: none;
  font-size: 0.85rem;
}
.app-search-input {
  padding-inline-start: 2rem;
  padding-inline-end: 1.8rem;
}
.app-search-kbd {
  position: absolute;
  top: 50%;
  inset-inline-end: 0.5rem;
  transform: translateY(-50%);
  font-size: 0.7rem;
  background: var(--bs-tertiary-bg, #e9ecef);
  color: var(--bs-secondary-color, #6c757d);
  border-radius: 0.25rem;
  padding: 0 0.35rem;
  pointer-events: none;
}
.app-search-input:focus ~ .app-search-kbd { display: none; }
.app-search-results {
  position: absolute;
  z-index: 1100;
  inset-inline: 0;
  top: calc(100% + 4px);
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 0.375rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
}
.app-search-results[hidden] { display: none; }
.app-search-result {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: start;
  border: 0;
  background: none;
  padding: 0.4rem 0.75rem;
  color: var(--bs-body-color);
  font-size: 0.85rem;
  cursor: pointer;
}
.app-search-result:hover,
.app-search-result.active {
  background: var(--unicef-blue-soft);
  color: var(--unicef-dark);
}
[data-bs-theme="dark"] .app-search-result:hover,
[data-bs-theme="dark"] .app-search-result.active {
  background: rgba(96, 165, 250, 0.2);
  color: #fff;
}
.app-search-result .code {
  margin-inline-start: auto;
  font-size: 0.72rem;
  color: var(--bs-secondary-color, #6c757d);
}

/* ---- Theme toggle (icône varie selon le thème actif) ---- */
.app-theme-icon-light { display: none; }
.app-theme-icon-dark { display: inline; }
[data-bs-theme="dark"] .app-theme-icon-light { display: inline; }
[data-bs-theme="dark"] .app-theme-icon-dark { display: none; }

/* ---- Sidebar ---- */
.app-sidebar {
  position: fixed;
  top: var(--app-topbar-height);
  left: 0;
  bottom: 0;
  width: var(--app-sidebar-width);
  background: var(--app-sidebar-bg);
  border-right: 1px solid var(--app-sidebar-border);
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.2s ease, transform 0.2s ease;
  z-index: 1020;
}
[dir="rtl"] .app-sidebar {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid var(--app-sidebar-border);
}
body.app-sidebar--collapsed .app-sidebar {
  width: var(--app-sidebar-width-collapsed);
}
.app-sidebar-nav {
  padding: 0.75rem 0;
}
.app-sidebar-group {
  padding: 0.5rem 0;
}
.app-sidebar-group + .app-sidebar-group {
  border-top: 1px solid var(--app-sidebar-border);
}
.app-sidebar-title {
  padding: 0.25rem 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--app-sidebar-text);
  opacity: 0.75;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}
.app-sidebar-title > .bi { font-size: 0.9rem; }
.app-sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  color: var(--app-sidebar-text);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.1s ease;
  border-left: 3px solid transparent;
}
[dir="rtl"] .app-sidebar-item {
  border-left: none;
  border-right: 3px solid transparent;
}
.app-sidebar-item:hover {
  background: rgba(28, 171, 226, 0.08);
  color: var(--unicef-dark);
}
[data-bs-theme="dark"] .app-sidebar-item:hover {
  background: rgba(96, 165, 250, 0.15);
  color: #ffffff;
}
.app-sidebar-item.active {
  background: var(--app-sidebar-active-bg);
  color: var(--app-sidebar-active-text);
  border-left-color: var(--unicef-blue);
  font-weight: 500;
}
[dir="rtl"] .app-sidebar-item.active {
  border-left-color: transparent;
  border-right-color: var(--unicef-blue);
}
.app-sidebar-item > .bi {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
}

/* Mode collapsed : on cache les labels et titres de section, mais on
   garde les icônes et un tooltip natif via title (à brancher en JS). */
body.app-sidebar--collapsed .app-sidebar-label,
body.app-sidebar--collapsed .app-sidebar-title {
  display: none;
}
body.app-sidebar--collapsed .app-sidebar-item {
  justify-content: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

/* ---- Main content ---- */
.app-content-wrap {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--app-topbar-height));
}
.app-main {
  flex: 1 0 auto;
}

/* ---- Responsive : <992px la sidebar bascule en off-canvas ---- */
@media (max-width: 991.98px) {
  body.has-sidebar .app-content-wrap {
    margin-left: 0;
  }
  [dir="rtl"] body.has-sidebar .app-content-wrap {
    margin-right: 0;
  }
  .app-sidebar {
    transform: translateX(-100%);
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
  }
  [dir="rtl"] .app-sidebar {
    transform: translateX(100%);
  }
  body.app-sidebar--mobile-open .app-sidebar {
    transform: translateX(0);
    width: var(--app-sidebar-width); /* toujours plein écran en mobile */
  }
  body.app-sidebar--mobile-open .app-sidebar-label,
  body.app-sidebar--mobile-open .app-sidebar-title {
    display: revert;
  }
  body.app-sidebar--mobile-open::after {
    /* Backdrop sombre pour fermer en cliquant à côté. */
    content: "";
    position: fixed;
    inset: var(--app-topbar-height) 0 0 0;
    background: rgba(0,0,0,0.4);
    z-index: 1010;
  }
}

/* ---- Footer : on retire le mt-auto qui pourrait ajouter de l'espace
   en trop quand le contenu est court (le flexbox du wrap s'en charge) ---- */
body.has-sidebar .site-footer {
  background: transparent;
}

/* ==========================================================================
   P31 — Refresh visuel global (CSS uniquement, aucune modif de markup)
   --------------------------------------------------------------------------
   Objectif : sortir du « Bootstrap brut ». Surfaces douces, élévation
   subtile, rayons cohérents, typographie soignée. Tout passe par des
   tokens + variables Bootstrap 5.3 pour rester cohérent en clair/sombre.
   ========================================================================== */

:root {
  /* Rayons cohérents sur TOUS les composants (btn, card, input, badge…). */
  --bs-border-radius: 0.625rem;
  --bs-border-radius-sm: 0.45rem;
  --bs-border-radius-lg: 0.9rem;
  --bs-border-radius-xl: 1.1rem;

  /* Échelle d'ombres maison (élévation). */
  --gea-shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --gea-shadow: 0 2px 4px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .08);
  --gea-shadow-lg: 0 8px 24px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .08);

  --gea-surface: #ffffff;
  /* Fond légèrement teinté (bleu-gris) — assez présent pour que les cartes
     blanches ressortent (sinon « tout blanc »), tout en restant sobre. */
  --gea-bg: #e7edf3;
}

[data-bs-theme="dark"] {
  --gea-shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --gea-shadow: 0 2px 8px rgba(0, 0, 0, .45);
  --gea-shadow-lg: 0 10px 28px rgba(0, 0, 0, .55);
  --gea-surface: #1b2433;
  --gea-bg: #0e1521;
  --bs-body-bg: #0e1521;
  --bs-border-color: #2a3547;
}

/* ---- Base : fond, typographie, lissage ---- */
body {
  /* Dégradé très subtil pour donner de la profondeur (vs aplat blanc). */
  background-color: var(--gea-bg);
  background-image: linear-gradient(180deg,
    color-mix(in srgb, var(--unicef-blue) 5%, var(--gea-bg)) 0%,
    var(--gea-bg) 220px);
  background-attachment: fixed;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0.1px;
}
[data-bs-theme="dark"] body { background-image: none; }

h1, h2, h3, .h1, .h2, .h3 {
  font-weight: 600;
  letter-spacing: -0.015em;
}
.display-5 { letter-spacing: -0.02em; }

/* ---- Cartes : élévation douce, en-tête discret, survol pour les liens ---- */
.card {
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-lg);
  box-shadow: var(--gea-shadow-sm);
  background-clip: border-box;
}
.card .card-header {
  /* Très léger lavis bleu UNICEF pour donner du ton aux en-têtes. */
  background-color: color-mix(in srgb, var(--unicef-blue) 5%, transparent);
  border-bottom: 1px solid var(--bs-border-color);
  font-weight: 600;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.card .card-body { padding: 1.15rem; }

/* Cartes cliquables (accueil) : transition + léger soulèvement au survol. */
a.card {
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
a.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--gea-shadow);
  border-color: var(--unicef-blue);
}

/* Carte « stat » : accent plus fin et arrondi propre du coin. */
.card-stat {
  border-left: 3px solid var(--unicef-blue);
}

/* Grands chiffres de KPI : chiffres tabulaires alignés. */
.card .h2, .card .display-5, [data-kpi] {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ---- Boutons : transitions + élévation discrète ---- */
.btn {
  --bs-btn-border-radius: var(--bs-border-radius);
  font-weight: 500;
  transition: transform .1s ease, box-shadow .12s ease, background-color .12s ease,
              border-color .12s ease, color .12s ease;
}
.btn-lg { font-weight: 600; }
.btn-primary {
  box-shadow: 0 1px 2px rgba(28, 171, 226, .25);
}
.btn-primary:hover { box-shadow: 0 3px 10px rgba(28, 171, 226, .35); }
.btn:active { transform: translateY(1px); }

/* ---- Champs : rayon + focus UNICEF homogène ---- */
.form-control, .form-select {
  border-radius: var(--bs-border-radius);
}
.form-control:focus, .form-select:focus {
  border-color: var(--unicef-blue);
  box-shadow: 0 0 0 .2rem rgba(28, 171, 226, .2);
}

/* ---- Badges : un poil plus de présence ---- */
.badge {
  font-weight: 600;
  letter-spacing: .2px;
  border-radius: var(--bs-border-radius-sm);
}

/* ---- Tableaux : en-têtes discrets, lignes aérées, survol doux ---- */
.table {
  --bs-table-bg: transparent;
}
.table > thead th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--bs-secondary-color, #6c757d);
  font-weight: 600;
  border-bottom: 1px solid var(--bs-border-color);
}
.table > tbody td, .table > tbody th {
  padding-top: .7rem;
  padding-bottom: .7rem;
  border-color: color-mix(in srgb, var(--bs-border-color) 60%, transparent);
}
.table-hover > tbody > tr:hover > * {
  --bs-table-bg-state: rgba(28, 171, 226, .06);
}
[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * {
  --bs-table-bg-state: rgba(96, 165, 250, .1);
}

/* ---- Topbar : surface translucide + ombre fine ---- */
.app-topbar {
  background: color-mix(in srgb, var(--bs-body-bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--bs-border-color);
  box-shadow: var(--gea-shadow-sm);
}
.app-topbar-brand { font-weight: 700; letter-spacing: -0.01em; }

/* ---- Sidebar : items en « pilule », accent gauche conservé ---- */
.app-sidebar { box-shadow: inset -1px 0 0 var(--app-sidebar-border); }
.app-sidebar-item {
  margin: 1px 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--bs-border-radius);
}
.app-sidebar-item.active {
  box-shadow: none;
}
.app-sidebar-item > .bi { opacity: .9; }
.app-sidebar-title { font-weight: 600; }

/* ---- Liste-group : harmonise les rayons internes des cartes ---- */
.list-group-flush { border-radius: inherit; }

/* ---- Alertes : rayon cohérent + accent latéral ---- */
.alert {
  border-radius: var(--bs-border-radius);
  border-inline-start-width: 4px;
}

/* ---- Fil d'Ariane : plus léger ---- */
.breadcrumb { font-size: .85rem; }
.breadcrumb-item + .breadcrumb-item::before { opacity: .5; }

/* ---- Empty state : icône en pastille douce ---- */
.empty-state {
  background: var(--gea-surface);
  border: 1px dashed var(--bs-border-color);
  border-radius: var(--bs-border-radius-lg);
}
.empty-state i {
  background: var(--unicef-blue-soft);
  color: var(--unicef-blue);
  width: 4rem; height: 4rem; line-height: 4rem;
  border-radius: 50%;
  font-size: 1.75rem;
  margin-inline: auto;
}
[data-bs-theme="dark"] .empty-state {
  background: var(--gea-surface);
}
[data-bs-theme="dark"] .empty-state i {
  background: rgba(96, 165, 250, .15);
  color: #93c5fd;
}

/* ---- Hero accueil : léger dégradé pour donner de la profondeur ---- */
.home-hero {
  background: linear-gradient(135deg, #ffffff 0%, var(--unicef-blue-soft) 100%);
}
[data-bs-theme="dark"] .home-hero {
  background: linear-gradient(135deg, #0e1521 0%, #14233a 100%);
}

/* ---- Footer : un peu plus de respiration ---- */
.site-footer { font-size: .85rem; }

/* ---- Barres de défilement discrètes (WebKit) ---- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bs-border-color) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--bs-secondary-color, #6c757d) 40%, transparent);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--bs-secondary-color, #6c757d) 65%, transparent);
  background-clip: padding-box;
}

/* Respecte la préférence « mouvement réduit ». */
@media (prefers-reduced-motion: reduce) {
  a.card, .btn { transition: none; }
  a.card:hover, .btn:active { transform: none; }
}

/* ==========================================================================
   P32 — Champs de formulaire & filtres
   --------------------------------------------------------------------------
   Deux corrections importantes signalées en production :
   1) Les widgets Django rendus en {{ field }} SANS classe Bootstrap
      apparaissaient « bruts » (file/select/textarea natifs). On leur donne
      l'allure d'un .form-control — mais UNIQUEMENT s'ils n'ont pas déjà une
      classe Bootstrap (sélecteurs gardés par :not(.form-control/.form-select)
      → aucun conflit avec les champs déjà stylés).
   2) Les filtres « pilule » (btn-check) n'affichaient jamais l'état
      sélectionné (markup corrigé dans les templates) ; on stylise ici
      l'état actif aux couleurs UNICEF.
   ========================================================================== */

/* 1) Widgets bruts → allure form-control (sans toucher aux champs classés). */
input[type="text"]:not(.form-control),
input[type="email"]:not(.form-control),
input[type="tel"]:not(.form-control),
input[type="url"]:not(.form-control),
input[type="number"]:not(.form-control),
input[type="password"]:not(.form-control),
input[type="search"]:not(.form-control),
input[type="date"]:not(.form-control),
input[type="datetime-local"]:not(.form-control),
input[type="time"]:not(.form-control),
input[type="file"]:not(.form-control),
textarea:not(.form-control),
select:not(.form-select):not(.form-control) {
  display: block;
  width: 100%;
  padding: .5rem .85rem;
  font-size: .95rem;
  line-height: 1.5;
  color: var(--bs-body-color);
  background-color: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, #ced4da);
  border-radius: var(--bs-border-radius);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input[type="file"]:not(.form-control) { padding: .35rem .6rem; }
textarea:not(.form-control) { min-height: 80px; }
input:not(.form-control):not(.btn-check):focus,
textarea:not(.form-control):focus,
select:not(.form-select):not(.form-control):focus {
  outline: none;
  border-color: var(--unicef-blue);
  box-shadow: 0 0 0 .2rem rgba(28, 171, 226, .2);
}

/* 2) Filtres « pilule » : état actif aux couleurs UNICEF (s'applique aux
   toggles btn-check outline-secondary utilisés par les filtres). */
.btn-check:checked + .btn-outline-secondary,
.btn-check:active + .btn-outline-secondary {
  --bs-btn-active-bg: var(--unicef-blue);
  --bs-btn-active-border-color: var(--unicef-blue);
  --bs-btn-active-color: #fff;
  background-color: var(--unicef-blue);
  border-color: var(--unicef-blue);
  color: #fff;
}
.btn-check:focus-visible + .btn {
  outline: 2px solid var(--unicef-blue);
  outline-offset: 1px;
}

/* Pastille de couleur d'un type d'intervention dans les filtres. */
.filter-dot {
  display: inline-block;
  width: .65rem;
  height: .65rem;
  border-radius: 50%;
  margin-inline-end: .35rem;
  vertical-align: baseline;
  border: 1px solid rgba(0, 0, 0, .15);
}
/* Quand la pilule est active (fond bleu), la pastille garde un contour clair. */
.btn-check:checked + .btn .filter-dot { border-color: rgba(255, 255, 255, .6); }

/* ==========================================================================
   P33 — Formulaires en grille 2 colonnes (form_grid.html)
   ========================================================================== */
.form-grid .form-label {
  margin-bottom: .25rem;
  font-weight: 500;
  font-size: .9rem;
}
.form-grid .form-text { font-size: .8rem; }

/* Les champs « larges » occupent toute la largeur même en grille 2 colonnes. */
.form-grid .form-col:has(textarea),
.form-grid .form-col:has(select[multiple]) {
  flex: 0 0 100%;
  max-width: 100%;
}

/* Tailles spécifiques des widgets particuliers (ex-styles inline, désormais
   globaux pour couvrir aussi le formulaire « initiative » en accordéon). */
input[type="color"]:not(.form-control) {
  width: 5rem !important;
  height: 2.5rem;
  padding: .25rem;
}
select[multiple]:not(.form-select) { min-height: 9rem; }

/* Carte de formulaire : un peu plus dense (marges réduites). */
.crud-form-card .card-body { padding: 1.1rem 1.25rem; }
.form-page { padding-top: 1.25rem; padding-bottom: 2rem; }
