/* ═══════════════════════════════════════════════════════════════
   global.css — Variables, reset et composants partagés
   Chargé en premier dans toutes les pages d'Épargnia
═══════════════════════════════════════════════════════════════ */

/* ── VARIABLES ── */
:root {
  color-scheme: light only;
  --orange:       #FF6B2C;
  --orange-dark:  #C2410C; /* a11y : ratio 4.66:1 sur blanc — utilisé pour les CTA porteurs de texte */
  --orange2:      #FF8C00;
  --yellow:       #FFD93D;
  --yellow2:      #FFE566;
  --yellow-light: #FEF9C3;
  --bg:           #FFFDF5;
  --white:        #FFFFFF;
  --surface:      #FFF8EC;
  --border:       #FFE4B5;
  --green:        #22C55E;
  --green-light:  #DCFCE7;
  --red:          #EF4444;
  --red-light:    #FEE2E2;
  --blue:         #3B82F6;
  --blue-light:   #DBEAFE;
  --purple:       #8B5CF6;
  --purple-light: #EDE9FE;
  --teal:         #14B8A6;
  --teal-light:   #CCFBF1;
  --text:         #1A1200;
  --muted:        #6B5530; /* a11y : ratio ~5.9:1 sur --bg (avant : #8A7050 = 4.4:1) */
  --font-display: 'Nunito', sans-serif;
  --font-body:    'Outfit', sans-serif;
  --radius:       20px;
  --radius-sm:    12px;
  --shadow:       0 4px 24px rgba(255,107,44,0.12);
  --shadow-sm:    0 2px 12px rgba(0,0,0,0.06);
  --shadow-card:  0 2px 12px rgba(0,0,0,0.06);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* ── A11Y : focus visible global (WCAG 2.4.7) ──
   Toute règle outline:none ailleurs DOIT s'accompagner d'un :focus-visible. */
:where(a, button, [role="button"], input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--orange-dark);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ── A11Y : lien d'évitement (WCAG 2.4.1) ──
   Visible uniquement quand il reçoit le focus clavier. */
.skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  background: var(--text);
  color: var(--white);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  z-index: 10000;
  transition: top 0.2s;
}
.skip-link:focus { top: 8px; }

/* ── A11Y : utilitaire « visuellement masqué » (heading masqué pour lecteurs d'écran) ── */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ── A11Y : préférence de mouvement réduit ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── BOUTON RETOUR ── */
.back-btn {
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,0.22);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  color: white;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.2s;
  flex-shrink: 0;
}
.back-btn:hover { background: rgba(255,255,255,0.35); }

/* ── FORMULAIRES ── */
.form-group  { margin-bottom: 16px; }
.form-label  {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
}
.input-wrap  { position: relative; }
.form-input  {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.form-input:focus   { border-color: var(--orange); background: var(--white); }
.form-input.error   { border-color: var(--red); }
.form-input.success { border-color: var(--green); }
select.form-input   { cursor: pointer; }

.eye-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--muted);
  padding: 4px;
}

.error-msg        { font-size: 12px; color: var(--red); margin-top: 5px; display: none; }
.error-msg.show   { display: block; }

/* ── BOUTON SOUMETTRE + SPINNER ── */
.submit-btn {
  width: 100%;
  padding: 16px;
  /* a11y : gradient conservé pour l'identité, mais texte foncé pour passer 4.5:1
     - --text sur --orange #FF6B2C ≈ 5.7:1 (OK)
     - --text sur --yellow #FFD93D ≈ 14:1 (OK) */
  background: linear-gradient(135deg, var(--orange), var(--yellow));
  color: var(--text);
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 6px 20px rgba(255,107,44,0.35);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.submit-btn:hover     { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(255,107,44,0.45); }
.submit-btn:active    { transform: scale(0.98); }
.submit-btn:disabled  { opacity: 0.6; cursor: not-allowed; transform: none; }

.spinner {
  width: 18px;
  height: 18px;
  /* a11y : adapté au texte foncé du submit-btn */
  border: 2px solid rgba(26,18,0,0.25);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.spinner.show { display: block; }

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

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1);
  z-index: 9999;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── BADGE PENDING (paiement en attente, etc.) ── */
.badge-pending {
  display: inline-block;
  background: #FEF9C3;
  color: #854d0e;
  border: 1px solid #FDE68A;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
}

/* ── BOUTON RETOUR ACCUEIL (onglets internes) ── */
.btn-retour-accueil {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--orange);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 12px;
  transition: opacity 0.2s;
}
.btn-retour-accueil:hover  { opacity: 0.75; }
.btn-retour-accueil:active { opacity: 0.5; }

/* ── UTILITAIRES (remplace les style="..." inline) ──
   Pas de !important ici : le JS doit pouvoir surcharger via style.display. */
.is-hidden     { display: none; }
.is-flex       { display: flex; }
.is-block      { display: block; }
.flex-1        { flex: 1; }
.ml-auto       { margin-left: auto; }
.mb-0          { margin-bottom: 0; }
.mt-8          { margin-top: 8px; }
.text-right    { text-align: right; }
.w-80          { width: 80px; }
.w-0           { width: 0%; }
.fs-28         { font-size: 28px; }
.muted-line    { font-size: 12px; color: var(--muted); line-height: 1.7; }
.muted-line-tight { font-size: 12px; color: var(--muted); line-height: 1.6; }
.subhead-bold  { font-size: 12px; font-weight: 800; color: var(--text); margin-bottom: 8px; }

/* ── PASTILLES DE COULEUR (légendes calendrier) ── */
.dot           { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot-green     { background: var(--green); }
.dot-orange    { background: var(--orange); }
.dot-purple    { background: #8B5CF6; }
.dot-blue      { background: #3B82F6; }

/* ── EN-TÊTE COMMUN (pages internes) ── */
.header {
  background: linear-gradient(135deg, var(--orange), var(--orange2), var(--yellow));
  position: relative;
  overflow: hidden;
}
.header::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.09);
  border-radius: 50%;
}
.header::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -30px;
  width: 150px; height: 150px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}

/* ── FOOTER COMMUN ── */
footer { background: #1A1200; padding: 32px 20px; text-align: center; }
.footer-logo  { font-family: var(--font-display); font-size: 22px; font-weight: 900; color: var(--yellow); margin-bottom: 8px; }
.footer-links { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.footer-links a { color: rgba(255,255,255,0.5); text-decoration: none; font-size: 13px; transition: color 0.2s; }
.footer-links a:hover { color: var(--yellow); }
.footer-copy  { color: rgba(255,255,255,0.25); font-size: 12px; }

/* ── ANIMATIONS COMMUNES ── */
@keyframes fadeIn  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse   { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes float   { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ── LOGO ── */
.header-logo      { font-family: var(--font-display); font-size: 22px; font-weight: 900; color: white; }
.header-logo span { opacity: 0.85; }
