/* ==========================================================================
   Formulaire rachat de crédits — charte Finapole (www.finapole.fr)
   Turquoise #009CA6 / #00767E, magenta #E2007A, vert #70A800, police Plus Jakarta Sans.
   Repris de landing_pages/rachat_credit/formulaire/style.css : les noms de variables
   (--pink, --navy…) sont conservés pour garder le même code, mais pointent vers les couleurs Finapole.
   ========================================================================== */
:root {
  --navy: #090d16;        /* texte principal */
  --pink: #009ca6;        /* couleur d'action (turquoise Finapole) */
  --pink-dark: #00767e;   /* survol */
  --pink-soft: #e6f7f8;   /* fond turquoise clair */
  --accent: #e2007a;      /* magenta Finapole */
  --bg-soft: #f8fafc;
  --line: #e2e8f0;
  --muted: #64748b;
  --green: #70a800;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: transparent; }
body { font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--navy); -webkit-font-smoothing: antialiased; }
#target-form { padding: 8px 10px 40px; } /* marge pour l'ombre de la carte dans l'iframe */
p { margin: 0 0 1rem; }
.d-none { display: none !important; }

.lead-form {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 60px -20px rgba(9, 13, 22, 0.35), 0 2px 6px rgba(9, 13, 22, 0.06);
  padding: 22px 18px 18px;
  color: var(--navy);
  scroll-margin-top: 12px;
}
@media (min-width: 576px) {
  .lead-form { padding: 30px 30px 24px; }
}

/* ---------- En-tête & progression ---------- */
.form-head { margin-bottom: 22px; }
.form-head-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.form-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--pink);
  background: var(--pink-soft);
  border-radius: 999px;
  padding: 5px 11px;
  white-space: nowrap;
}
.form-step-count { font-size: 0.82rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.form-progress {
  height: 6px;
  background: #edf0f2;
  border-radius: 999px;
  overflow: hidden;
}
.form-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--accent));
  border-radius: 999px;
  transition: width 0.45s ease;
}

/* ---------- Étapes ---------- */
.form-step { display: none; }
.form-step.active { display: block; animation: stepIn 0.35s ease; }
@keyframes stepIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.step-title { font-size: 1.35rem; font-weight: 800; margin: 0 0 4px; letter-spacing: -0.01em; }
.step-sub { color: var(--muted); font-size: 0.95rem; margin: 0 0 18px; }

.q-block { margin-bottom: 20px; }
.q-label { font-weight: 700; font-size: 1rem; margin: 0 0 8px; }
.q-label i { color: var(--pink); margin-right: 4px; }
.q-help { font-size: 0.85rem; color: var(--muted); margin: -4px 0 10px; }

/* ---------- Choix (liste verticale) ---------- */
.choice-list { display: grid; gap: 8px; }
.choice {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-weight: 600;
  font-size: 0.97rem;
  color: var(--navy);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px 13px 46px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.choice::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  border: 2px solid #c5ccd2;
  border-radius: 50%;
  background: #fff;
  transition: all 0.15s;
}
.choice:hover { border-color: var(--pink); }
.choice.active {
  border-color: var(--pink);
  background: var(--pink-soft);
  box-shadow: 0 0 0 3px rgba(0, 156, 166, 0.12);
}
.choice.active::before {
  border-color: var(--pink);
  background: var(--pink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M13.485 3.929a1 1 0 0 1 0 1.414l-6.364 6.364a1 1 0 0 1-1.414 0L2.515 8.515a1 1 0 1 1 1.414-1.414l2.485 2.485 5.657-5.657a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E") center / 12px no-repeat;
}

/* ---------- Chips (choix horizontaux) ---------- */
.chip-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.chip-row-2 { grid-template-columns: repeat(2, 1fr); }
.chip-row-3 { grid-template-columns: repeat(3, 1fr); }
.chip-row-4 { grid-template-columns: repeat(4, 1fr); }
.chip {
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--navy);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  min-height: 50px;
  padding: 8px 4px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.15;
}
.chip:hover { border-color: var(--pink); }
.chip.active {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(0, 156, 166, 0.6);
}
@media (max-width: 380px) {
  .chip { font-size: 0.85rem; }
}

/* ---------- Champs ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-weight: 700;
  font-size: 0.93rem;
  margin-bottom: 6px;
}
.field label small { font-weight: 500; color: var(--muted); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-grid .field { min-width: 0; }
.field-grid-city { grid-template-columns: 1.6fr 1fr; }
@media (max-width: 400px) {
  #step-2 .field-grid { grid-template-columns: 1fr; gap: 0; }
}

.lead-form input[type="text"],
.lead-form input[type="tel"],
.lead-form input[type="email"],
.lead-form input[type="date"],
.lead-form select {
  width: 100%;
  font: inherit;
  font-size: 1rem; /* >= 16px : évite le zoom iOS */
  color: var(--navy);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  min-height: 52px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.lead-form input::placeholder { color: #a3adb5; }
.lead-form input:focus,
.lead-form select:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(0, 156, 166, 0.14);
}
.lead-form select {
  padding-right: 40px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23090d16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E") right 14px center / 14px no-repeat;
  cursor: pointer;
}

.input-suffix { position: relative; }
.input-suffix input { padding-right: 76px !important; }
.input-suffix span {
  position: absolute;
  right: 6px;
  top: 6px;
  bottom: 6px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
  background: var(--bg-soft);
  border-radius: 8px;
  pointer-events: none;
}

/* Sections conditionnelles */
.sub-section {
  border-left: 3px solid var(--pink);
  background: #fbfbfc;
  border-radius: 0 12px 12px 0;
  padding: 14px 14px 2px;
  margin-top: 12px;
}
.sub-title { font-weight: 800; font-size: 0.95rem; margin-bottom: 10px; }
.fade-slide {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  display: none;
}
.fade-slide.show { display: block; opacity: 1; transform: none; }

/* ---------- Consentement ---------- */
.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 12px;
  margin: 6px 0 14px;
}
.consent input {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  accent-color: var(--pink);
  cursor: pointer;
}
.consent label { font-size: 0.8rem; line-height: 1.45; color: #4a5a66; cursor: pointer; }

/* ---------- Boutons de navigation ---------- */
.nav-row { display: flex; gap: 10px; margin-top: 8px; }
.btn-next {
  flex: 1;
  width: 100%;
  font: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  background: var(--pink);
  border: 0;
  border-radius: 14px;
  min-height: 58px;
  padding: 14px 18px;
  cursor: pointer;
  box-shadow: 0 10px 22px -10px rgba(0, 156, 166, 0.75);
  transition: transform 0.12s, background-color 0.15s, box-shadow 0.15s;
}
.btn-next i { margin-left: 6px; }
.btn-next:hover { background: var(--pink-dark); }
.btn-next:active { transform: scale(0.98); }
.btn-back {
  flex: 0 0 58px;
  font-size: 1.2rem;
  color: var(--navy);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
}
.btn-back:hover { border-color: var(--navy); }

.form-secure { text-align: center; font-size: 0.8rem; color: var(--muted); margin: 12px 0 0; }
.form-trust {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  list-style: none;
  padding: 16px 0 0;
  margin: 18px 0 0;
  border-top: 1px solid #eef1f3;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
}
.form-trust i { color: var(--green); margin-right: 4px; }

/* ---------- Erreurs ---------- */
.warning, .field-error {
  display: block;
  color: #d92d20;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 8px;
}
.field-error { margin: 6px 0 0; }
.warning.d-none, .field-error.d-none { display: none !important; }
.select-warning, .input-warning { border-color: #d92d20 !important; background-color: #fff8f7 !important; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
}
.shake { animation: shake 0.3s ease-in-out; }

/* ---------- Autocomplétion ville ---------- */
.autocomplete-wrapper { position: relative; }
.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  min-width: 220px;
  z-index: 1000;
  display: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(9, 13, 22, 0.15);
  max-height: 220px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 4px;
}
.suggestions li { padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 0.95rem; }
.suggestions li:hover { background: var(--pink-soft); }

/* ---------- Loader & message final ---------- */
#my-loader {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  z-index: 9998;
  font-weight: 700;
  color: var(--navy);
}
.spinner {
  width: 52px;
  height: 52px;
  border: 5px solid #cdeff1;
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-toast {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(9, 13, 22, 0.55);
}
.form-toast-card {
  max-width: 460px;
  background: #fff;
  border-radius: 20px;
  padding: 30px 24px;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
}
.form-toast-card i { font-size: 3rem; display: block; margin-bottom: 12px; }
.form-toast-success i { color: var(--green); }
.form-toast-error i { color: var(--pink); }
.form-toast-card p { margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--navy); line-height: 1.5; }

/* Conditions d'éligibilité : alerte forte mais non bloquante */
.eligibility-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fff7e6;
  border: 1px solid #fcd38a;
  border-left: 4px solid #e08a00;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 4px 0 16px;
}
.eligibility-box i { color: #b45309; margin-top: 3px; }
.eligibility-box p { margin: 0; font-size: 0.9rem; line-height: 1.45; color: #5b3d05; }
.eligibility-box.d-none { display: none !important; }

/* Mention légale en petit sous « Étude gratuite » : étape 1 uniquement
   (affichée par défaut, masquée dès l'étape 2 pour rester visible si :has n'est pas supporté) */
.form-legal-mini{margin:6px 0 0;font-size:.72rem;line-height:1.3;color:#6b7280;text-align:center}
.lead-form:has(#step-2.active, #step-3.active, [data-step="2"].active, [data-step="3"].active) .form-legal-mini{display:none}

/* ---------- Ajustements Finapole ---------- */
.lead-form { border-radius: 22px; border: 1px solid #eef2f6; }
.form-badge { color: var(--pink-dark); }
.form-progress-bar { background: linear-gradient(90deg, #009ca6, #00767e 60%, #e2007a); }
.btn-next { background: linear-gradient(135deg, #009ca6 0%, #00767e 100%); }
.btn-next:hover { background: #00767e; }
.q-label i { color: var(--pink); }

/* ---------- Confirmation dans l'iframe ---------- */
.form-done { background: #fff; border-radius: 22px; border: 1px solid #eef2f6; box-shadow: 0 24px 60px -20px rgba(9, 13, 22, 0.25); padding: 34px 24px 28px; text-align: center; }
.done-icon { width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 50%; background: linear-gradient(135deg, #009ca6, #00767e); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 2.4rem; box-shadow: 0 14px 30px -12px rgba(0, 156, 166, 0.8); }
.done-steps { list-style: none; padding: 0; margin: 18px auto 16px; max-width: 320px; text-align: left; display: grid; gap: 10px; }
.done-steps li { display: flex; align-items: center; gap: 12px; font-weight: 600; color: var(--muted); }
.done-steps li span { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 800; }
.done-steps li.ok { color: var(--navy); }
.done-steps li.ok span { background: var(--green); border-color: var(--green); color: #fff; }
.done-steps li.cur { color: var(--navy); }
.done-steps li.cur span { border-color: var(--pink); color: var(--pink); }
.done-tip { background: var(--pink-soft); border-radius: 12px; padding: 12px 14px; font-size: .9rem; font-weight: 600; color: #00585e; margin: 0; }
.done-tip i { margin-right: 6px; }
