/* ============================================================
   GESTION FRAT — theme.css
   Charte "Terre & Lumière" — source unique de tous les styles.
   ------------------------------------------------------------
   MODE D'EMPLOI (à respecter strictement, voir skill ui-guidelines)
   1. Toute couleur, taille, espacement passe par les tokens (:root).
   2. Toute page s'assemble avec les composants ci-dessous.
   3. Aucun style local : pas de <style>, pas d'attribut style,
      pas de règle .mapage .composant. Si un composant manque,
      on l'ajoute ICI, dans la couche composants.
   Couches : 1 tokens · 2 base · 3 mise en page · 4 composants · 5 états/utilitaires
   ============================================================ */

/* ============================================================
   1. TOKENS — ne jamais contourner : var(--...) partout
   ============================================================ */
:root {
  /* Couleurs — structure */
  --c-primary-strong: #7C441F;   /* bandeaux, titres KPI */
  --c-primary:        #9C5B33;  /* actions principales */
  --c-primary-hover:  #8A4E28;
  --c-primary-soft:   #F1E2D2;  /* fonds teintés, en-têtes de tableau */
  --c-accent:         #C97B4A;  /* touche secondaire, illustrative */
  --c-bg:             #FAF5EC;  /* fond de page */
  --c-surface:        #FFFDF7;  /* cartes, tableaux, champs */
  --c-text:           #3A2E21;
  --c-muted:          #8A7A66;  /* textes secondaires */
  --c-border:         #E6D9C4;
  --c-on-dark:        #FFFDF7;  /* texte posé sur --c-primary-strong */
  --c-on-dark-muted:  rgba(255, 253, 247, 0.78);

  /* Couleurs — statuts : 2 processus INDEPENDANTS, inscription et paiement.
     Une inscription porte toujours 2 badges (un par processus) ; il n'y a
     plus de statut global. Même teinte = même degré d'avancement :
       pending  = en attente (des deux côtés)
       toreview = paiement reçu, à contrôler par la compta
       ok       = validé (des deux côtés)
     Toutes ces paires respectent un contraste >= 4,5:1. */
  --c-pending-bg:   #FCF3DE;  --c-pending-text:   #8A6410;
  --c-toreview-bg:  #F7E3D3;  --c-toreview-text:  #7C441F;
  --c-ok-bg:        #E5F2E8;  --c-ok-text:        #2F6B42;
  --c-cancelled-bg: #EFEFEA;  --c-cancelled-text: #6E6B62;  /* Annulée, neutre */
  --c-refused-bg:   #FAE7E2;  --c-refused-text:   #A2402E;  /* Inscription refusée */

  /* Espacements (échelle unique) */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
  --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px;

  /* Rayons */
  --radius-sm: 8px;  --radius: 12px;

  /* Ombres */
  --shadow-1: 0 2px 8px rgba(124, 68, 31, 0.08);

  /* Typographie
     Serif géorgien dispo partout (self-hosted par le système).
     Pour montée en gamme (Fraunces, EB Garamond) : self-host dans
     public/fonts/ puis changer UNIQUEMENT ces deux tokens. */
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --text-xs:   12px;
  --text-sm:   14px;
  --text-base: 15px;
  --text-lg:   18px;
  --text-xl:   22px;
  --text-2xl:  28px;

  /* Mesures de mise en page */
  --container: 1100px;
  --nav-h: 56px;
}

/* ============================================================
   2. BASE — reset minimal + réglages globaux
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; }

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--c-text);
  background: var(--c-bg);
  overflow-wrap: anywhere;           /* jamais de texte qui déborde */
  overflow-x: clip;                  /* aucun défilement horizontal de la page (clip garde le sticky) */
}

img, svg { max-width: 100%; height: auto; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.25; }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

p { max-width: 72ch; }              /* longueur de ligne lisible */

a { color: var(--c-primary-strong); }

/* Focus visible et homogène partout (accessibilité clavier) */
:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}

/* Respect de la préférence système */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   3. MISE EN PAGE — squelette commun à toutes les pages
   ============================================================ */
.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

/* Bandeau supérieur fixe (identique sur toutes les pages) */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-primary-strong);
  color: var(--c-on-dark);
}
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--nav-h);
  flex-wrap: wrap;
}
.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--c-on-dark);
  text-decoration: none;
}
.nav__brand svg { width: 26px; height: 26px; }

/* Burger du menu mobile : n'apparaît que si JS est actif ET écran étroit.
   Sans JS ( vieux téléphones ), les liens restent visibles, empilés :
   la navigation ne dépend jamais de JavaScript. */
.nav__burger {
  display: none;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--c-on-dark);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}
.nav__burger::before { content: "☰"; font-size: var(--text-lg); line-height: 1; }
.nav__burger:hover { background: rgba(255, 255, 255, 0.12); }

.nav__links { display: flex; gap: 2px; flex-wrap: wrap; }
.nav__link {
  display: inline-block;
  padding: 8px 10px;
  border: none;                      /* reset natif des <button> : un bouton-lien = un lien */
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  color: var(--c-on-dark-muted);
  text-decoration: none;
  font-size: var(--text-sm);
  cursor: pointer;
}
.nav__link:hover { color: var(--c-on-dark); background: rgba(255, 255, 255, 0.12); }
.nav__link.is-active { color: var(--c-on-dark); background: rgba(255, 255, 255, 0.2); }
.nav__link--logout { margin-inline-start: var(--space-2); }

/* Menu mobile : le panneau repousse simplement le contenu vers le bas.
   Pas d'overlay, pas de z-index, pas de calcul de hauteur : rien qui
   puisse bugguer ou sauter sur un téléphone lent. */
@media (max-width: 640px) {
  html.js .nav__burger { display: inline-flex; }
  .nav__links {
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    padding-block: 0 var(--space-2);
  }
  html.js .nav__links:not(.is-open) { display: none; }
  .nav__link--logout {
    margin-inline-start: 0;
    border-top: 1px solid rgba(255, 253, 247, 0.22);
    border-radius: 0;
    margin-top: var(--space-1);
  }
}

/* Espace de contenu principal + titre de page */
.page { padding-block: var(--space-5) var(--space-7); }
/* Espacement vertical uniforme entre les blocs directs d'une page */
.page > * + * { margin-top: var(--space-4); }
.page__head { margin-bottom: 0; }
.page__meta {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  color: var(--c-muted);
  font-size: var(--text-sm);
  margin-top: var(--space-2);
}

/* Les ancres ne passent jamais sous le bandeau fixe */
:target, [id] { scroll-margin-top: calc(var(--nav-h) + var(--space-3)); }

/* ============================================================
   4. COMPOSANTS — le seul vocabulaire visuel autorisé
   ============================================================ */

/* ---- Boutons : une seule action primaire par écran ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 18px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.2;
  white-space: nowrap;               /* un libellé de bouton ne casse jamais en lettres */
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn--primary { background: var(--c-primary); color: #fff; }
.btn--primary:hover { background: var(--c-primary-hover); }
.btn--outline { background: transparent; color: var(--c-primary-strong); border-color: var(--c-primary); }
.btn--outline:hover { background: var(--c-primary-soft); }
.btn--link { background: none; border: none; padding-inline: 4px; color: var(--c-primary); text-decoration: underline; }
.btn--sm { padding: 6px 12px; font-size: var(--text-xs); }
.btn--block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

/* ---- Icônes SVG ( sprite FontAwesome self-hébergé ) ----
   Taille et couleur suivent le texte : aucune couleur à déclarer,
   l'icône s'adapte au bandeau brun, aux boutons, aux badges, aux alertes. */
.icon {
  width: 1em;
  height: 1em;
  fill: currentColor;
  flex-shrink: 0;                   /* jamais écrasée dans un bouton étroit */
  vertical-align: -0.125em;         /* alignement optique sur la ligne de texte */
}
.icon--lg { width: 1.5em; height: 1.5em; }

/* ---- Statuts : 2 processus indépendants, TOUJOURS 2 badges ----
   Dimension INSCRIPTION (validée par l'admin) :
     .badge--reg-pending   « Inscription en attente »
     .badge--reg-validated « Inscription validée »
     .badge--reg-refused   « Inscription refusée »
     .badge--reg-cancelled « Annulée »               (annule tout, badge unique)
   Dimension PAIEMENT (validée par la compta) :
     .badge--pay-pending   « En attente de paiement »
     .badge--pay-toreview  « Paiement à valider »
     .badge--pay-validated « Paiement validé »
   Règle : jamais de statut fusionné. Les 4 combinaisons sont légitimes
   (validée non payée, payée non validée, les deux, aucune). Les 2 badges
   se placent toujours dans .badge-pair, inscription d'abord. */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 7px;
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}
.badge-pair {
  display: inline-flex;
  flex-wrap: wrap;                   /* à 360px les 2 badges passent à la ligne */
  align-items: center;
  gap: var(--space-2);
}
.badge--reg-pending   { background: var(--c-pending-bg);   color: var(--c-pending-text); }
.badge--reg-validated { background: var(--c-ok-bg);        color: var(--c-ok-text); }
.badge--reg-refused   { background: var(--c-refused-bg);   color: var(--c-refused-text); }
.badge--reg-cancelled { background: var(--c-cancelled-bg); color: var(--c-cancelled-text); }
.badge--pay-pending   { background: var(--c-pending-bg);   color: var(--c-pending-text); }
.badge--pay-toreview  { background: var(--c-toreview-bg);  color: var(--c-toreview-text); }
.badge--pay-validated { background: var(--c-ok-bg);        color: var(--c-ok-text); }
.badge--neutral       { background: var(--c-cancelled-bg); color: var(--c-cancelled-text); }

/* ---- Cartes et indicateurs ---- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: var(--space-4);
}

/* ---- Pages d'authentification : contenu centré dans le viewport ---- */
.auth {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth > .card { width: 100%; max-width: 420px; }
/* La page d'auth gère elle-même son centrage vertical : pas de padding doublé */
.page--auth { padding-block: 0; }
.kpi {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  min-width: 150px;
}
.kpi__value {
  display: block;
  font-size: var(--text-xl);
  color: var(--c-primary-strong);
  font-variant-numeric: tabular-nums;
}
.kpi__label { font-size: var(--text-xs); color: var(--c-muted); }

/* ---- Tableaux : toujours dans .table-scroll (gestion mobile) ---- */
.table-scroll {
  overflow-x: auto;                  /* le défilement reste LOCAL au tableau */
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  font-size: var(--text-sm);
}
.table th {
  padding: 10px 12px;
  background: var(--c-primary-soft);
  color: var(--c-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;               /* en-tête sur une ligne : c'est .table-scroll qui défile */
}
.table td {
  padding: 10px 12px;
  border-top: 1px solid var(--c-border);
  vertical-align: middle;
}
.table .num, .num {
  text-align: right;
  font-variant-numeric: tabular-nums;  /* montants alignés en colonne */
  white-space: nowrap;
}

/* ---- Formulaires ---- */
.label {
  display: block;
  font-size: var(--text-xs);
  color: var(--c-muted);
  margin-bottom: var(--space-1);
}
.field {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  font: inherit;
  color: inherit;
}
.field:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 2px var(--c-primary-soft); }
.field--error { border-color: var(--c-refused-text); }
.hint { font-size: var(--text-xs); color: var(--c-muted); margin-top: var(--space-1); }
.hint--error { color: var(--c-refused-text); }
.form-grid { display: grid; gap: var(--space-4); }
.form-grid--cols2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .form-grid--cols2 { grid-template-columns: 1fr; } }
/* Formulaire compact dans une ligne de tableau (boutons d'action admin) */
.form--inline { display: inline; }

/* Ligne membre à cocher (formulaire d'inscription) */
.check-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}
.check-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--c-primary); }
.check-row__body { flex: 1; min-width: 0; }
.check-row__meta { display: block; font-size: var(--text-xs); color: var(--c-muted); }

/* ---- Messages ---- */
.alert { padding: var(--space-3) 14px; border-radius: var(--radius-sm); font-size: var(--text-sm); }
.alert ul { margin-top: var(--space-2); padding-inline-start: var(--space-5); }
.alert--ok      { background: var(--c-ok-bg);       color: var(--c-ok-text); }
.alert--pending { background: var(--c-pending-bg);  color: var(--c-pending-text); }
.alert--toreview{ background: var(--c-toreview-bg); color: var(--c-toreview-text); }
.alert--error   { background: var(--c-refused-bg);  color: var(--c-refused-text); }

/* ---- Contenu markdown assaini (actualité, introduction d'événement) ---- */
.markdown > * + * { margin-top: var(--space-3); }

/* ---- Listes à puces espacées ---- */
.list { padding-inline-start: 20px; }
.list li + li { margin-top: var(--space-2); }

.empty {
  padding: var(--space-7);
  text-align: center;
  color: var(--c-muted);
}

/* ============================================================
   5. UTILITAIRES — last resort, jamais de mise en forme locale
   ============================================================ */
.row { display: flex; gap: var(--gap, var(--space-3)); flex-wrap: wrap; align-items: center; }
.col { display: flex; flex-direction: column; gap: var(--gap, var(--space-3)); }
.muted { color: var(--c-muted); }
.right { text-align: right; }
.wrap-anywhere { overflow-wrap: anywhere; }
.is-hidden { display: none; }
.img--rounded { border-radius: var(--radius-sm); }   /* images d'événements */
.img--sm { max-width: 240px; }                        /* aperçu image (détail admin) */
.img--xs { max-width: 80px; }                         /* aperçu image (formulaire admin) */
@media (max-width: 640px) {
  /* zones tactiles : aucun bouton < 44px de haut sur mobile */
  .btn { min-height: 44px; }
  .nav__link { min-height: 44px; display: inline-flex; align-items: center; }
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   POUR ÉTENDRE — protocole (voir skill ui-guidelines)
   Un nouveau style arrive ici seulement si :
   1. il est utilisé (ou réutilisable) sur plusieurs écrans ;
   2. il consomme exclusivement des tokens existants ;
   3. les autres composants restent inchangés (aucun effet de bord).
   Nom : .bloc__element--modificateur. Jamais de sélecteur paginé.
   ============================================================ */

/* ---- Référence de paiement : bloc mis en avant + bouton copier ----
   Utilisé sur la confirmation d'inscription et le détail d'une inscription
   (2 écrans). La référence doit être immédiatement identifiable. */
.ref-paiement {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-4);
  background: var(--c-primary-soft);
  border: 1.5px solid var(--c-primary);
  border-radius: var(--radius);
}
.ref-paiement__label {
  flex-basis: 100%;
  font-size: var(--text-xs);
  color: var(--c-muted);
}
.ref-paiement__code {
  font-size: var(--text-xl);
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.5px;
  color: var(--c-primary-strong);
  overflow-wrap: anywhere;
}