/* ------------------------------------------------------------------
   Rex Change — charte navy / gold, header inspiré de rexchange.ch.
   Style sobre, institutionnel, mobile-first.
   ------------------------------------------------------------------ */

:root {
  --navy: #0A1F3A;
  --navy-soft: #16335c;
  --gold: #C9A961;
  --gold-soft: #e3c98a;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --border: #d8d8d2;
  --error: #a3261c;
  --error-bg: #fbe9e7;
  --success: #1f6f43;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--navy); }
a:hover { color: var(--gold); }

/* --- Header (fond noir comme rexchange.ch, accent gold) --- */
.header {
  background: #000000;
  border-bottom: 3px solid var(--gold);
  padding: 0.9rem 1.25rem;
}
.header__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.header__logo {
  display: block;
  max-height: 56px;
  width: auto;
}
.header__tagline {
  font-size: 0.8rem;
  color: var(--gold-soft);
  text-align: right;
}

.container {
  max-width: 820px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

h1, h2, h3 {
  color: var(--navy);
  font-weight: 600;
  margin-top: 0;
}
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; margin-top: 1.6rem; }
h3 { font-size: 1rem; }

/* --- Stepper --- */
.stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}
.stepper__item {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
}
.stepper__item--current {
  border-color: var(--gold);
  color: var(--navy);
  font-weight: 600;
  background: #fffaef;
}
.stepper__item--done {
  border-color: var(--navy);
  color: var(--navy);
}

/* --- Formulaires --- */
.field { display: flex; flex-direction: column; margin-bottom: 1.1rem; }
.field__label {
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--navy);
  font-size: 0.95rem;
}
.field__label .req {
  color: var(--error);
  margin-left: 0.15rem;
  font-weight: 700;
}
.field__hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
.field__error {
  font-size: 0.8rem;
  color: var(--error);
  margin-top: 0.25rem;
  font-weight: 600;
}
.field--error input,
.field--error select,
.field--error textarea {
  border-color: var(--error);
  background: #fffafa;
}
.field__row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.field__row > .field { flex: 1; min-width: 220px; }

input[type="text"], input[type="email"], input[type="tel"],
input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201, 169, 97, 0.25);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.35rem 0;
  font-size: 0.95rem;
}
.check input { margin-top: 0.25rem; }

/* --- Téléphone (indicatif + numéro côte à côte) --- */
.phone-row { display: flex; gap: 0.5rem; align-items: stretch; }
/* Indicatif : largeur fixe suffisante pour drapeau + indicatif (texte court). */
.phone-row > select.phone-indic,
.phone-row > .choices:has(.phone-indic),
.phone-row > .choices { flex: 0 0 200px; min-width: 200px; max-width: 200px; }
.phone-row > input { flex: 1; min-width: 0; }
/* Dropdown ouvert : laisser sortir du champ pour afficher "🇦🇪 +971 Émirats arabes unis" entier. */
.phone-row .choices__list--dropdown,
.phone-row .choices__list[aria-expanded] {
  min-width: 320px;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .phone-row { flex-direction: column; }
  .phone-row > select.phone-indic,
  .phone-row > .choices { flex: 1; width: 100%; min-width: 0; max-width: none; }
  .phone-row .choices__list--dropdown { min-width: 100%; }
}

/* --- Boutons --- */
.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
}
.btn--primary { background: var(--navy); color: #fff; }
.btn--primary:hover { background: var(--navy-soft); color: #fff; }
.btn--ghost {
  background: transparent;
  color: var(--navy);
  border-color: var(--navy);
}
.btn--ghost:hover { background: var(--navy); color: #fff; }

.actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* --- Boîte ADE répétable --- */
.ade-block {
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #fbfaf6;
}

/* --- Alertes --- */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}
.alert--error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error);
}
.alert--info {
  background: #eef3fb;
  color: var(--navy);
  border: 1px solid #cbd8ee;
}
.alert--success {
  background: #e9f5ee;
  color: var(--success);
  border: 1px solid var(--success);
}

/* --- Récap --- */
.recap-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px dotted var(--border);
}
.recap-row:last-child { border: 0; }
.recap-row__label { color: var(--muted); }
.recap-row__value { font-weight: 600; color: var(--navy); text-align: right; }

/* --- Footer --- */
.footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 2rem 1rem 1rem;
}

/* --- Choices.js override (fait coller au thème) ---
   Notre CSS étant chargé APRÈS Choices.js, ces règles écrasent les défauts.
*/
.choices { font-size: 1rem; margin-bottom: 0; }
.choices__inner {
  padding: 0.6rem 0.7rem;          /* aligne la hauteur avec les <input> */
  border-radius: 4px;
  border-color: var(--border);
  background: #fff;
  min-height: 44px;                /* aligne avec <input> ~44px */
  font-size: 1rem;
}
.choices[data-type*="select-multiple"] .choices__inner { padding: 0.35rem 0.5rem; }
.choices.is-focused .choices__inner,
.choices.is-open .choices__inner {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201, 169, 97, 0.25);
}
/* Chips de multi-select : navy + texte blanc */
.choices__list--multiple .choices__item {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  border-radius: 3px;
}
/* Dropdown ouverte : items lisibles (par défaut bg gris/texte blanc → illisible) */
.choices__list--dropdown,
.choices__list[aria-expanded] {
  background: #fff;
  border-color: var(--border);
}
.choices__list--dropdown .choices__item,
.choices__list[aria-expanded] .choices__item {
  color: var(--text);
  background: #fff;
}
/* Survol / focus clavier : navy + texte blanc bien contrasté */
.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted,
.choices__list--dropdown .choices__item.is-highlighted,
.choices__list[aria-expanded] .choices__item.is-highlighted {
  background-color: var(--navy) !important;
  color: #fff !important;
}
/* Élément déjà sélectionné dans la dropdown : navy léger pour le distinguer */
.choices__list--dropdown .choices__item--selectable[aria-selected="true"],
.choices__list[aria-expanded] .choices__item--selectable[aria-selected="true"] {
  background-color: #eef3fb;
  color: var(--navy);
  font-weight: 600;
}
/* Cache le « Press to select » par défaut (encombrant en multi-langue) */
.choices__list--dropdown .choices__item--selectable::after,
.choices__list[aria-expanded] .choices__item--selectable::after { display: none; }

/* --- Responsive --- */
@media (max-width: 600px) {
  .container { margin: 1rem auto; }
  .card { padding: 1.1rem; }
  .actions { flex-direction: column-reverse; }
  .actions .btn { width: 100%; text-align: center; }
  .header__tagline { display: none; }
  .header__logo { max-height: 44px; }
}
