/* =============================================================================
   socle.css — Jetons de design (couleurs, rayons, ombres), base, mise en page, menu, composants
   (cartes, indicateurs, boutons, badges, tableaux, filtres, champs, fenêtres, notifications), utilitaires.
   Sections 1 à 24.
   Découpage du 07/10/2026 de l'ancien style.css (nettoyé : règles mortes et déclarations écrasées retirées,
   rendu vérifié identique). Chargés dans cet ordre par base.html et connexion.html : socle → ecrans →
   finitions. L'ordre compte : à sélecteur égal, la règle la plus loin l'emporte (une section plus loin
   peut volontairement en écraser une plus haute). Jetons (:root) : socle.css, section 1.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. Variables CSS (design tokens)
   ----------------------------------------------------------------------------- */

:root {
  /* Courbes d'animation communes (revue de design du 22/10/2026) : sortie franche pour l'interface,
     tiroir façon iOS pour les feuilles qui montent du bas */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  /* Couleurs principales */

  --couleur-blanc:      #FFFFFF;

  /* Surfaces */
  --surface-0:    #FFFFFF;
  --surface-1:    #F4F6FA;
  --surface-2:    #EBEEF4;

  /* Bordures */

  /* Texte */

  /* Fond de page (plus gris que les surfaces, pour détacher les cartes blanches) */

  /* Tableaux : en-tête bleu, lignes alternées */

  --texte-blanc:       #FFFFFF;

  /* Sidebar */
  --sidebar-fond:          #0B1F3A;
     /* haut d'écran mobile : barre d'état (theme-color), barre du haut, haut du menu */
  --sidebar-largeur:       240px;
  --sidebar-item-actif:    rgba(76,141,224,0.18);
  --sidebar-item-hover:    rgba(255,255,255,0.06);
  --sidebar-texte:         rgba(255,255,255,0.72);
  --sidebar-texte-actif:   #FFFFFF;
  --sidebar-accent:        #8FB3E6;

  /* Typographie */

  --taille-xs:      11px;
  --taille-sm:      12px;
  --taille-base:    14px;
  --taille-md:      15px;
  --taille-lg:      18px;
  --taille-xl:      26px;
  --taille-2xl:     28px;
  --interligne:     1.6;

  /* Espacement */
  --espace-xs:   4px;
  --espace-sm:   8px;
  --espace-md:   16px;
  --espace-lg:   24px;
  --espace-xl:   32px;
  --espace-2xl:  48px;

  /* Rayons */

  /* Ombres — discrètes */
  --ombre-sm:  0 1px 2px rgba(16,24,40,0.06), 0 1px 4px rgba(16,24,40,0.08);
  --ombre-md:  0 10px 28px rgba(16,24,40,0.08), 0 2px 6px rgba(16,24,40,0.04);
  /* Relief des cartes (07/10/2026, choix « doux + ombre bleu nuit au survol ») : plus de bordure grise, une ombre
     douce détache les blocs du fond ; indicateurs un peu plus hauts que les grands blocs ; au survol, ombre bleu
     nuit (#0B1F3A, celui de la barre latérale) — les indicateurs se soulèvent, les grands blocs ne bougent pas. */

  /* Transitions */
  --transition: 150ms ease;

  /* Header */
  --header-hauteur: 56px;

  /* Aliases sémantiques pour les composants JS */
}

/* -----------------------------------------------------------------------------
   2. Reset & base
   ----------------------------------------------------------------------------- */

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--fonte);
  font-size: var(--taille-base);
  line-height: var(--interligne);

  min-height: 100vh;
}

a {
  color: var(--couleur-bleu);
  text-decoration: none;
}
@media (hover: hover) and (pointer: fine) { a:hover {
  text-decoration: underline;
} }

h1, h2, h3, h4, h5 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--texte-principal);
}

p { margin: 0; }

ul, ol { list-style: none; }

button {
  font-family: var(--fonte);
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: var(--fonte);
  font-size: var(--taille-base);
}

/* -----------------------------------------------------------------------------
   3. Layout principal — Sidebar + Contenu
   ----------------------------------------------------------------------------- */

/* -----------------------------------------------------------------------------
   4. Sidebar
   ----------------------------------------------------------------------------- */

/* Logo AVA6 Méditerranée (texte blanc : prévu pour le fond sombre de la barre latérale) */

/* Bouton menu mobile */

/* Menu ouvert : le bouton devient « fermer » (×), à droite du logo au lieu de le recouvrir */

/* Overlay mobile */

/* -----------------------------------------------------------------------------
   5. Zone de contenu principal
   ----------------------------------------------------------------------------- */

.contenu {
  margin-left: var(--sidebar-largeur);
  flex: 1;
  min-width: 0;            /* un tableau large défile dans son cadre au lieu d'élargir la page */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Largeur max 1 720 px, centrée (05/10/2026 : à 1 480 px calée à gauche, une bande grise restait à droite
   sur un écran 1920 px) : l'écran du Mac est rempli, un écran plus grand garde deux marges égales. */
.page {
  flex: 1;
  padding: 36px 40px 48px;
  max-width: 1720px;
  width: 100%;
  margin-inline: auto;
}

/* -----------------------------------------------------------------------------
   6. En-tête de page
   ----------------------------------------------------------------------------- */

.page__entete {
  margin-bottom: 28px;
}

.page__titre {
  font-size: var(--taille-xl);
  font-weight: 700;
  color: var(--texte-principal);
  letter-spacing: -0.6px;
  line-height: 1.2;
}

/* -----------------------------------------------------------------------------
   7. KPI Cards
   ----------------------------------------------------------------------------- */

.kpi-grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--espace-md);
  margin-bottom: var(--espace-xl);
}

/* Tableau de bord : 6 indicateurs sur une ligne, puis 3, puis 2 */

.kpi-card {
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
  min-width: 0;
}

@media (hover: hover) and (pointer: fine) { .kpi-card:hover {
  box-shadow: var(--ombre-survol);
} }

/* Icône au-dessus du libellé : le libellé dispose de toute la largeur */
.kpi-card__entete {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}

.kpi-card__label {
  margin-bottom: var(--espace-sm);
}

.kpi-card__entete .kpi-card__label {
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Pastille d'icône teintée */

.kpi-card__valeur {
            /* au-delà, l'espace fine des milliers (212 000) disparaît */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Variantes historiques (bord gauche coloré) — conservées pour compatibilité */

/* -----------------------------------------------------------------------------
   8. Section Header
   ----------------------------------------------------------------------------- */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--espace-md);
  gap: var(--espace-md);
}

/* -----------------------------------------------------------------------------
   9. Cartes génériques (Chart Card, contenu)
   ----------------------------------------------------------------------------- */

.carte__titre {
  margin-bottom: var(--espace-md);
}

/* -----------------------------------------------------------------------------
   10. Boutons
   ----------------------------------------------------------------------------- */

.btn:focus-visible {
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* -----------------------------------------------------------------------------
   11. Badges
   ----------------------------------------------------------------------------- */

.badge {
  line-height: 18px;
}

.badge--orange  { background: rgba(224,123,42,0.1); color: var(--couleur-orange); }
.badge--gris    { background: #DDE3EB;              color: var(--texte-secondaire); }

/* Status badge */

/* -----------------------------------------------------------------------------
   12. Tableaux de données
   ----------------------------------------------------------------------------- */

.table thead {
  background: var(--tableau-entete);
}

.table thead tr {
  background: var(--tableau-entete);   /* fond peint sur la ligne entière : pas de raccord entre cellules */
}

.table th {
  padding: 11px 16px;
  text-align: left;
  font-size: var(--taille-sm);
  font-weight: 600;
  color: var(--tableau-entete-texte);
  white-space: nowrap;
}

/* Tableau posé dans une carte (sans cadre) : coins arrondis de l'en-tête */
.carte .table thead tr { background: none; }
.carte .table thead th { background: var(--tableau-entete); }
.carte .table thead th:first-child { border-top-left-radius: var(--rayon-md); }
.carte .table thead th:last-child  { border-top-right-radius: var(--rayon-md); }

.table td {
  padding: 12px 16px;

  vertical-align: middle;
}

/* Lignes alternées blanc / gris (fond sur la ligne entière) */

/* La couleur de la ligne est aussi peinte sur chaque cellule : les deux couches se recouvrent
   au raccord des cellules, ce qui évite le fil clair que WebKit dessine entre deux colonnes
   de largeur non entière. */
.table thead th,
.table tbody td {
  background-color: inherit;
}

@media (hover: hover) and (pointer: fine) { .table:not(.table--sans-survol) tbody tr:hover {
  background: var(--tableau-survol);
} }

.table td.num,
.table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table td.hausse { color: var(--couleur-vert); }
.table td.baisse { color: var(--couleur-rouge); }

/* -----------------------------------------------------------------------------
   13. Barre de filtres
   ----------------------------------------------------------------------------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;

  border-radius: var(--rayon-lg);
}

/* -----------------------------------------------------------------------------
   14. Champs de formulaire
   ----------------------------------------------------------------------------- */

.champ {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.champ__label--obligatoire::after {
  content: " *";
}

.input,
.select {
  background: var(--surface-0);

  outline: none;
  width: 100%;
}

@media (hover: hover) and (pointer: fine) { .input:hover,
.select:hover {
  border-color: #B7C2D3;
} }

.input:focus,
.select:focus {
  border-color: var(--couleur-bleu-clair);
}

.input--sm,
.select--sm {
  padding: 0 10px;
}

.champ__erreur {
  font-size: var(--taille-xs);
  color: var(--couleur-rouge);
}

/* Search field */
.search-field {
  position: relative;
}

.search-field .input {
  padding-left: 34px;
}

.search-field__icone {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);

  pointer-events: none;
  width: 16px;
  height: 16px;
}

/* -----------------------------------------------------------------------------
   15. Alertes
   ----------------------------------------------------------------------------- */

.alerte {
  display: flex;

  border-left: 4px solid;
}

.alerte__icone {
  flex-shrink: 0;

  margin-top: 1px;
}

.alerte__contenu {
  flex: 1;
}

.alerte__titre {
  margin-bottom: 2px;
}

.alerte--info    {   border-color: var(--couleur-bleu);    }

.alerte--alerte  {  border-color: var(--couleur-orange);  }
.alerte--erreur  {   border-color: var(--couleur-rouge);   }

/* -----------------------------------------------------------------------------
   16. Toast / notifications
   ----------------------------------------------------------------------------- */

.toast-conteneur {
  position: fixed;

  z-index: 1000;
  display: flex;
  flex-direction: column;

  pointer-events: none;
}

.toast {
  max-width: 360px;
  pointer-events: auto;
  animation: toast-entree 200ms ease;
}

.toast--succes  { background: var(--couleur-vert); }
.toast--erreur  { background: var(--couleur-rouge); }
.toast--alerte  { background: var(--couleur-orange); }

@keyframes toast-entree {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -----------------------------------------------------------------------------
   17. Modales
   ----------------------------------------------------------------------------- */

.modal-fond {
  position: fixed;
  inset: 0;

  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--espace-md);
  animation: modal-fond-entree 180ms ease;          /* 300 → 180 ms (22/10/2026) */
}

.modal-fond.cache {
  display: none;
}

@keyframes modal-fond-entree {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-entree 220ms var(--ease-out);    /* 380 → 220 ms (22/10/2026) */
}

@keyframes modal-entree {
  from { opacity: 0; transform: scale(0.98) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal--large {
  max-width: 760px;
}

.modal__entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal__fermer {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.modal__corps {
  padding: var(--espace-lg);
}

.modal__pied {
  display: flex;
  justify-content: flex-end;

  border-radius: 0 0 16px 16px;
}

/* -----------------------------------------------------------------------------
   18. État vide
   ----------------------------------------------------------------------------- */

.etat-vide {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--espace-2xl) var(--espace-lg);
  text-align: center;
  color: var(--texte-tertiaire);
}

.etat-vide__icone {
  width: 48px;
  height: 48px;
  margin-bottom: var(--espace-md);
  opacity: 0.4;
}

.etat-vide__titre {
  font-size: var(--taille-md);
  font-weight: 600;
  color: var(--texte-secondaire);
  margin-bottom: var(--espace-xs);
}

.etat-vide__texte {
  font-size: var(--taille-base);
  max-width: 320px;
}

/* -----------------------------------------------------------------------------
   19. Indicateur de chargement
   ----------------------------------------------------------------------------- */

.chargement {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--espace-sm);
  padding: var(--espace-xl);
  color: var(--texte-tertiaire);
  font-size: var(--taille-base);
}

.chargement__spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--bordure);
  border-top-color: var(--couleur-bleu);
  border-radius: 50%;
  animation: rotation 600ms linear infinite;
}

@keyframes rotation {
  to { transform: rotate(360deg); }
}

/* Overlay pleine page */

/* -----------------------------------------------------------------------------
   23. Diviseur
   ----------------------------------------------------------------------------- */

.diviseur {
  height: 1px;
  background: var(--bordure);
  margin: var(--espace-lg) 0;
}

/* -----------------------------------------------------------------------------
   24. Utilitaires
   ----------------------------------------------------------------------------- */

.texte-sm        { font-size: var(--taille-sm); }
.texte-xs        { font-size: var(--taille-xs); }
.texte-gris      { color: var(--texte-tertiaire); }

.texte-rouge     { color: var(--couleur-rouge); }

.gras            { font-weight: 600; }

.flex            { display: flex; }

.gap-sm          { gap: var(--espace-sm); }

.cache           { display: none !important; }

/* Nombre formaté */
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
