/* ============================================================================
   IV PAY — socle visuel du site autonome (charte : ../../DESIGN.md).
   Identité propre : bleu-indigo de confiance, distinct du rouge du site
   Immigration Voyages. Deux thèmes (clair / nuit) par `data-theme`, posé
   avant la peinture par js/socle.js. Polices Sora + Inter self-hostées
   (css/polices.css). Aucun appel externe.
   Ce fichier fournit les tokens et les classes de cadre (container, page-hero,
   editor-card, cat-title, field, form-2col, btn…) que les écrans empruntaient
   autrefois à la coquille du site principal.
   ============================================================================ */

/* ---- Couleurs : thème clair (défaut) ---- */
:root {
  --iv: #2B46D4;
  --iv-deep: #1E34A8;
  --iv-soft: #ECEFFC;
  --iv-ring: rgba(43, 70, 212, .28);

  --ink: #10172A;
  --navy-dark: #10172A;      /* titres sombres — alias d'encre sur la charte bleue */
  --muted: #5A6478;
  --faint: #8A93A8;

  --bg: #F5F6FB;
  --card: #FFFFFF;
  --card-2: #FBFBFE;
  --fond-doux: #F0F1F6;      /* remplissage neutre (étape inactive, bandeau de prix) */
  --line: #E6E8F2;
  --line-fort: #D5D9E8;

  --teal: #0E9F6E;           /* vérifié / payé */
  --teal-ink: #0A6E4C;
  --teal-tint: #E7F6EF;
  --ocre: #C98A14;           /* en attente */
  --ocre-tint: #FBF2DE;
  --rouge: #DB4A43;          /* non livré / erreur */
  --rouge-tint: #FDECEA;

  --shadow: 0 1px 2px rgba(16, 23, 42, .06), 0 10px 26px rgba(16, 23, 42, .07);
  --shadow-h: 0 2px 6px rgba(16, 23, 42, .08), 0 18px 44px rgba(16, 23, 42, .12);

  --hero-bg: #2B46D4;        /* bandeau de tête : toujours texte blanc dessus */
  --hero-ink: #FFFFFF;

  --r-card: 16px;
  --r-bloc: 11px;
  --r-pill: 99px;
}

/* ---- Couleurs : thème nuit ---- */
:root[data-theme="nuit"] {
  --iv: #7E90F2;
  --iv-deep: #9AA8F6;
  --iv-soft: #1A2140;
  --iv-ring: rgba(126, 144, 242, .40);

  --ink: #EAEDF7;
  --navy-dark: #EAEDF7;
  --muted: #A6AEC6;
  --faint: #727B96;

  --bg: #0A0E1C;
  --card: #121829;
  --card-2: #0F1424;
  --fond-doux: #1A2136;
  --line: #222A42;
  --line-fort: #30395A;

  --teal: #35C491;
  --teal-ink: #8EE6C4;
  --teal-tint: #10261E;
  --ocre: #E0A93B;
  --ocre-tint: #2A2210;
  --rouge: #F0736C;
  --rouge-tint: #2A1513;

  --shadow: 0 1px 2px rgba(0, 0, 0, .40), 0 10px 26px rgba(0, 0, 0, .46);
  --shadow-h: 0 2px 6px rgba(0, 0, 0, .46), 0 18px 44px rgba(0, 0, 0, .56);

  --hero-bg: #161C33;
  --hero-ink: #EAEDF7;
}

/* Sans choix explicite, on suit le réglage du système. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --iv: #7E90F2; --iv-deep: #9AA8F6; --iv-soft: #1A2140; --iv-ring: rgba(126, 144, 242, .40);
    --ink: #EAEDF7; --navy-dark: #EAEDF7; --muted: #A6AEC6; --faint: #727B96;
    --bg: #0A0E1C; --card: #121829; --card-2: #0F1424; --fond-doux: #1A2136; --line: #222A42; --line-fort: #30395A;
    --teal: #35C491; --teal-ink: #8EE6C4; --teal-tint: #10261E; --ocre: #E0A93B; --ocre-tint: #2A2210;
    --rouge: #F0736C; --rouge-tint: #2A1513;
    --shadow: 0 1px 2px rgba(0,0,0,.40), 0 10px 26px rgba(0,0,0,.46);
    --shadow-h: 0 2px 6px rgba(0,0,0,.46), 0 18px 44px rgba(0,0,0,.56);
    --hero-bg: #161C33; --hero-ink: #EAEDF7;
  }
}

/* ---- Remise à zéro douce ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: 'Sora', 'Inter', sans-serif; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
a { color: var(--iv-deep); }
a:hover { color: var(--iv); }
img { max-width: 100%; height: auto; }

/* ---- Surfaces du navigateur habillées depuis la palette ---- */
::selection { background: var(--iv-soft); color: var(--iv-deep); }
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--iv-ring); border-radius: 6px; }
* { scrollbar-color: var(--line-fort) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--line-fort); border-radius: 99px; border: 3px solid var(--bg); }

/* ---- Largeur de lecture ---- */
.container { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* ---- Bandeau de tête ---- */
.page-hero {
  background: var(--hero-bg);
  color: var(--hero-ink);
  padding: clamp(28px, 6vw, 56px) 0;
}
.page-hero .container { max-width: 980px; }
.page-hero h1 { color: var(--hero-ink); margin: 0 0 6px; font-size: clamp(1.6rem, 4.5vw, 2.3rem); line-height: 1.15; padding-right: 84px; }
.page-hero p { margin: 0; color: var(--hero-ink); opacity: .88; font-size: clamp(.95rem, 2.5vw, 1.08rem); line-height: 1.5; }

/* ---- Zone de contenu ---- */
.content { padding: clamp(22px, 5vw, 40px) 0 56px; }

/* ---- Carte ---- */
.editor-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 26px);
}
.cat-title { font-size: 1.08rem; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; line-height: 1.3; }

/* ---- Champs ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .86rem; font-weight: 600; color: var(--ink); }
.field input, .field select, .field textarea {
  font-family: inherit;
  font-size: 16px;            /* 16px mini : évite le zoom iOS au focus */
  color: var(--ink);
  background: var(--card);
  padding: 11px 13px;
  border: 1px solid var(--line-fort);
  border-radius: 9px;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--iv);
  box-shadow: 0 0 0 3px var(--iv-ring);
}
.field small { font-size: .78rem; color: var(--muted); line-height: 1.45; }

/* Deux colonnes qui retombent en une seule au téléphone. */
.form-2col { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }

/* Message d'erreur (saisie, connexion) — commun à tous les écrans. */
.pay-erreur {
  background: var(--rouge-tint); border: 1px solid var(--rouge); color: var(--rouge);
  border-radius: 9px; padding: 11px 13px; font-size: .86rem; line-height: 1.45; margin: 12px 0 0;
}

/* ---- Boutons ---- */
.btn {
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 12px 20px;
  border-radius: var(--r-bloc);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:focus-visible { box-shadow: 0 0 0 3px var(--iv-ring); }

/* Principal : l'indigo IV Pay (dans ce site, « btn-red » = l'action de marque). */
.btn-red { background: var(--iv); border-color: var(--iv); color: #fff; box-shadow: var(--shadow); }
.btn-red:hover { background: var(--iv-deep); border-color: var(--iv-deep); color: #fff; }

/* Fantôme : carte bordée, vire à l'indigo au survol. */
.btn-ghost { background: var(--card); border-color: var(--line-fort); color: var(--ink); }
.btn-ghost:hover { border-color: var(--iv); color: var(--iv-deep); }
.btn-ghost.on { background: var(--iv-soft); border-color: var(--iv); color: var(--iv-deep); }

/* Contour : transparent, bord indigo. */
.btn-outline { background: transparent; border-color: var(--iv); color: var(--iv-deep); }
.btn-outline:hover { background: var(--iv-soft); }

.btn[disabled], .btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---- Bascule de thème (pastille flottante, lisible sur tout fond) ---- */
.theme-bascule {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 50;
  background: var(--card);
  border: 1px solid var(--line-fort);
  color: var(--ink);
  border-radius: var(--r-pill);
  padding: 7px 13px;
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.theme-bascule:hover { border-color: var(--iv); color: var(--iv-deep); }

/* ---- Toast ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(14px);
  max-width: min(92vw, 460px);
  background: var(--ink);
  color: var(--bg);
  padding: 13px 18px;
  border-radius: var(--r-bloc);
  box-shadow: var(--shadow-h);
  font-size: .9rem;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 9999;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Pied ---- */
.iv-pied {
  text-align: center;
  color: var(--muted);
  font-size: .82rem;
  padding: 26px 16px 36px;
  line-height: 1.6;
}
.iv-pied b { color: var(--ink); font-weight: 600; }

/* ---- Mot-symbole IV Pay ---- */
.iv-mot { display: inline-flex; align-items: center; gap: 8px; }
.iv-mot-carre {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--iv); color: #fff;
  display: grid; place-items: center; flex: none;
}
.iv-mot-txt { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1.12rem; letter-spacing: -.02em; color: var(--ink); }
.iv-mot-txt i { font-style: normal; color: var(--iv); }

/* ---- Écran de connexion (gestion) ---- */
.iv-login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.iv-login-carte { width: 100%; max-width: 410px; }
.iv-login-logo { margin-bottom: 20px; }
.iv-login h1 { font-size: 1.4rem; margin: 0 0 6px; }
.iv-login > .iv-login-carte p { color: var(--muted); margin: 0 0 20px; font-size: .92rem; line-height: 1.5; }
.iv-login .field { margin-bottom: 15px; }
.iv-login .btn { margin-top: 6px; }

/* ---- Barre de l'espace connecté ---- */
.iv-barre { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.iv-barre .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.iv-barre .btn { padding: 8px 14px; font-size: .84rem; }

@media (prefers-reduced-motion: reduce) {
  .btn, .toast { transition: none; }
}
