/* =========================================================
   Formulaire Assurance Auto — natif (remplace l'iframe MASS)
   Toutes les classes sont préfixées .aa- pour éviter les conflits
   ========================================================= */
.aa-form {
  --aa-navy: var(--primary-color, #002448);
  --aa-accent: var(--accent-color, #4298ee);
  --aa-accent-2: var(--secondary-color, #41b9e9);
  --aa-bg: #ffffff;
  --aa-soft: #f4f8fd;
  --aa-line: #e3e9f2;
  --aa-muted: #6b7a90;
  --aa-error: #e5484d;
  --aa-ok: #22a06b;
  --aa-radius: 14px;

  position: relative;
  background: var(--aa-bg);
  border-radius: 22px;
  box-shadow: 0 24px 60px -20px rgba(0, 36, 72, .28), 0 2px 6px rgba(0, 36, 72, .06);
  overflow: hidden;
  text-align: left;
  font-family: "DM Sans", sans-serif;
  color: var(--aa-navy);
}

/* ---------- En-tête ---------- */
.aa-head {
  padding: 26px 28px 20px;
  background: linear-gradient(135deg, var(--aa-navy) 0%, #0a3d73 100%);
  color: #fff;
}
.aa-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}
.aa-badge i { color: #ffd166; }
.aa-title {
  margin: 12px 0 18px;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 700;
  color: #fff;
}
.aa-title span { color: var(--aa-accent-2); }

.aa-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .15);
  overflow: hidden;
}
.aa-progress-bar span {
  display: block;
  height: 100%;
  width: 25%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--aa-accent-2), var(--aa-accent));
  transition: width .45s cubic-bezier(.4, 0, .2, 1);
}
.aa-progress-txt {
  margin-top: 8px;
  font-size: 13px;
  opacity: .85;
}

/* ---------- Corps ---------- */
.aa-body { padding: 24px 28px 22px; margin: 0; }
.aa-step {
  display: none;
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.aa-step.is-active { display: block; animation: aaIn .35s ease both; }
.aa-step.is-back { animation-name: aaInBack; }
@keyframes aaIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes aaInBack { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }

.aa-field { margin-bottom: 18px; }
.aa-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.aa-row .aa-field { min-width: 0; }

.aa-form label,
.aa-label {
  display: block;
  margin: 0 0 7px;
  font-size: 14px;
  font-weight: 700;
  color: var(--aa-navy);
}
.aa-form sup { font-size: 10px; top: -.4em; color: var(--aa-accent); }

.aa-form input[type="text"],
.aa-form input[type="email"],
.aa-form input[type="tel"],
.aa-form select {
  display: block;
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--aa-line);
  border-radius: var(--aa-radius);
  background: var(--aa-soft);
  font: inherit;
  font-size: 15px;
  color: var(--aa-navy);
  outline: none;
  box-shadow: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
}
.aa-form input::placeholder { color: #9aa7b8; }
.aa-form input:focus,
.aa-form select:focus {
  border-color: var(--aa-accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(66, 152, 238, .15);
}
.aa-select { position: relative; }
.aa-select::after {
  content: "\f078";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 12px;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--aa-muted);
  pointer-events: none;
}
.aa-select select { padding-right: 40px; cursor: pointer; }

/* états de validation */
.aa-field.is-invalid input,
.aa-field.is-invalid select { border-color: var(--aa-error); background: #fff6f6; }
.aa-field.is-invalid .aa-tile span { border-color: #f3b4b6; }
.aa-field.is-valid input,
.aa-field.is-valid select { border-color: #bfe3d2; }
.aa-msg {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--aa-error);
}
.aa-hint {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--aa-muted);
}
.aa-hint i { color: var(--aa-accent); margin-right: 3px; }

/* ---------- Tuiles (radios) ---------- */
.aa-tiles { display: grid; gap: 10px; }
.aa-tiles-2 { grid-template-columns: repeat(2, 1fr); }
.aa-tiles-3 { grid-template-columns: repeat(3, 1fr); }
.aa-tiles-4 { grid-template-columns: repeat(4, 1fr); }
.aa-tiles-col { grid-template-columns: 1fr; }

.aa-form .aa-tile { position: relative; margin: 0; font-weight: 400; cursor: pointer; }
.aa-tile input { position: absolute; opacity: 0; pointer-events: none; }
.aa-tile span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 74px;
  padding: 10px 6px;
  border: 1.5px solid var(--aa-line);
  border-radius: var(--aa-radius);
  background: var(--aa-soft);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  transition: border-color .2s, background .2s, transform .15s, box-shadow .2s;
}
.aa-tile span i { font-size: 18px; color: var(--aa-accent); }
.aa-tiles-compact .aa-tile span { min-height: 48px; flex-direction: row; }
.aa-tile-row span {
  flex-direction: row;
  justify-content: flex-start;
  min-height: 60px;
  padding: 10px 16px;
  text-align: left;
  flex-wrap: wrap;
  column-gap: 12px;
}
.aa-tile-row span i { width: 22px; text-align: center; }
.aa-tile-row small {
  flex-basis: 100%;
  padding-left: 34px;
  margin-top: -4px;
  font-size: 12px;
  font-weight: 400;
  color: var(--aa-muted);
}
.aa-tile:hover span { border-color: #b9d5f5; background: #fff; }
.aa-tile input:focus-visible + span { box-shadow: 0 0 0 4px rgba(66, 152, 238, .2); }
.aa-tile input:checked + span {
  border-color: var(--aa-accent);
  background: #eef6ff;
  box-shadow: 0 6px 16px -8px rgba(66, 152, 238, .6);
}
.aa-tile input:checked + span::after {
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  top: 6px;
  right: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--aa-accent);
  color: #fff;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
}
.aa-tile:active span { transform: scale(.98); }

/* ---------- Case CGU + mentions ---------- */
.aa-form .aa-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 4px 0 12px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  cursor: pointer;
}
.aa-check input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--aa-accent);
  cursor: pointer;
}
.aa-check a,
.aa-legal a { color: var(--aa-accent); text-decoration: underline; }
.aa-check.is-invalid span { color: var(--aa-error); }
.aa-legal {
  margin: 0 0 6px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--aa-muted);
}

/* ---------- Erreur globale ---------- */
.aa-error {
  margin: 4px 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff1f1;
  border: 1px solid #f7caca;
  color: #b42318;
  font-size: 13.5px;
}

/* ---------- Navigation ---------- */
.aa-nav { display: flex; gap: 10px; margin-top: 8px; }
.aa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 56px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--aa-radius);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s, background .2s, opacity .2s;
  text-transform: none;
  letter-spacing: normal;
}
.aa-btn[hidden] { display: none; }
.aa-btn-primary {
  flex: 1;
  color: #fff;
  background: linear-gradient(135deg, var(--aa-accent) 0%, #2b7fd9 100%);
  box-shadow: 0 12px 24px -10px rgba(66, 152, 238, .8);
}
.aa-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 16px 28px -10px rgba(66, 152, 238, .9); }
.aa-btn-primary i { transition: transform .2s; }
.aa-btn-primary:hover i { transform: translateX(3px); }
.aa-btn-ghost {
  width: 56px;
  padding: 0;
  color: var(--aa-navy);
  background: var(--aa-soft);
  border: 1.5px solid var(--aa-line);
}
.aa-btn-ghost:hover { background: #fff; border-color: #b9d5f5; }
.aa-btn:disabled { opacity: .65; cursor: wait; transform: none; }

/* Spinner bouton */
.aa-spin {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: aaSpin .7s linear infinite;
}
@keyframes aaSpin { to { transform: rotate(360deg); } }

/* ---------- Réassurance ---------- */
.aa-trust {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--aa-muted);
}
.aa-trust i { color: var(--aa-ok); margin-right: 4px; }

/* ---------- Honeypot ---------- */
.aa-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Confirmation ---------- */
.aa-done {
  padding: 40px 28px 44px;
  text-align: center;
  animation: aaIn .4s ease both;
}
.aa-done-ico {
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e7f7ef;
  color: var(--aa-ok);
  font-size: 32px;
  box-shadow: 0 0 0 10px #f3fbf7;
}
.aa-done h3 { margin: 0 0 10px; font-size: 22px; font-weight: 700; color: var(--aa-navy); }
.aa-done p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--aa-muted); }

/* ---------- Mobile ---------- */
@media (max-width: 991px) {
  .aa-form { margin-top: 24px; }
}
@media (max-width: 480px) {
  .aa-head { padding: 22px 18px 18px; }
  .aa-title { font-size: 21px; }
  .aa-body { padding: 20px 18px 18px; }
  .aa-tiles-3 { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .aa-tile span { min-height: 66px; font-size: 13px; }
  .aa-row { grid-template-columns: 1fr; gap: 0; }
  .aa-form input[type="text"],
  .aa-form input[type="email"],
  .aa-form input[type="tel"],
  .aa-form select { font-size: 16px; } /* évite le zoom iOS */
}

/* =========================================================
   Recherche par plaque d'immatriculation
   ========================================================= */
.aa-plate-row { display: flex; gap: 10px; }
.aa-plate {
  flex: 1;
  display: flex;
  min-width: 0;
  height: 56px;
  border: 2px solid var(--aa-navy);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  transition: box-shadow .2s, border-color .2s;
}
.aa-plate:focus-within { box-shadow: 0 0 0 4px rgba(66, 152, 238, .2); border-color: var(--aa-accent); }
.aa-plate-eu {
  flex: 0 0 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 6px;
  background: #003399;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}
.aa-plate-eu i { font-style: normal; color: #ffcc00; font-size: 11px; margin-bottom: 6px; }
.aa-form .aa-plate input[type="text"] {
  flex: 1;
  height: 100%;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.aa-form .aa-plate input[type="text"]::placeholder { color: #c3ccd8; letter-spacing: .08em; }
.aa-form .aa-plate input[type="text"]:focus { box-shadow: none; background: transparent; }
.aa-btn-plate {
  flex: 0 0 auto;
  color: #fff;
  background: var(--aa-navy);
  padding: 0 18px;
}
.aa-btn-plate:hover { background: #0a3d73; }
.aa-btn-plate .aa-spin { width: 18px; height: 18px; }
.aa-plate-field.is-invalid .aa-plate { border-color: var(--aa-error); }
.aa-hint.is-error { color: var(--aa-error); }
.aa-hint.is-error i { color: var(--aa-error); }

.aa-vehicle {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: -4px 0 16px;
  padding: 14px 16px;
  border: 1.5px solid #bfe3d2;
  border-radius: var(--aa-radius);
  background: #f1faf5;
  animation: aaIn .35s ease both;
}
.aa-vehicle[hidden] { display: none; }
.aa-vehicle-ico {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #fff;
  color: var(--aa-ok);
  font-size: 20px;
  overflow: hidden;
}
.aa-vehicle-ico img { max-width: 38px; max-height: 38px; }
.aa-vehicle-txt { flex: 1; min-width: 0; line-height: 1.35; }
.aa-vehicle-txt strong { display: block; font-size: 15px; }
.aa-vehicle-txt span { display: block; font-size: 12.5px; color: var(--aa-muted); }
.aa-vehicle-edit {
  flex: 0 0 auto;
  border: 0;
  background: none;
  padding: 4px 0;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--aa-accent);
  text-decoration: underline;
  cursor: pointer;
}

.aa-manual-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -6px 0 16px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--aa-accent);
  cursor: pointer;
}
.aa-manual-link[hidden] { display: none; }
.aa-manual-link i { font-size: 11px; transition: transform .2s; }
.aa-manual-link.is-open i { transform: rotate(180deg); }
.aa-manual { animation: aaIn .3s ease both; }
.aa-manual[hidden] { display: none; }

@media (max-width: 480px) {
  .aa-btn-plate span { display: none; }
  .aa-btn-plate { width: 56px; padding: 0; }
  .aa-form .aa-plate input[type="text"] { font-size: 20px; }
}

/* =========================================================
   v3 — formulaire piloté par la doc (étapes dynamiques)
   ========================================================= */
.aa-tiles-5 { grid-template-columns: repeat(5, 1fr); }
.aa-tiles-6 { grid-template-columns: repeat(6, 1fr); }
.aa-tiles-compact .aa-tile span { min-height: 46px; padding: 8px 4px; }
.aa-tile-short span { min-height: 52px; font-size: 13.5px; }

/* Liste de choix (radio) */
.aa-tile-list span {
  position: relative;
  justify-content: flex-start;
  min-height: 50px;
  padding: 10px 14px 10px 44px;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}
.aa-tile-list span::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border: 2px solid #b8c4d4;
  border-radius: 50%;
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.aa-tile-list input:checked + span::before { border-color: var(--aa-accent); box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 10px var(--aa-accent); }
.aa-tile-list input:checked + span::after { display: none; }
.aa-tiles-col { gap: 8px; }
.aa-tile[hidden] { display: none; }

.aa-opt { font-style: normal; font-weight: 400; font-size: 12px; color: var(--aa-muted); }
.aa-field[hidden], .aa-subgroup[hidden], .aa-row[hidden] { display: none; }

/* Sous-groupes (sinistres, enfants) */
.aa-card {
  margin: 0 0 16px;
  padding: 16px 16px 2px;
  border: 1.5px solid var(--aa-line);
  border-radius: var(--aa-radius);
  background: #fbfcfe;
}
.aa-card-title {
  display: inline-block;
  margin-bottom: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #eef6ff;
  color: var(--aa-accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.aa-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.aa-row-3 .aa-label { font-size: 12.5px; font-weight: 600; }
.aa-row-cp { grid-template-columns: 120px 1fr; }
.aa-step-intro {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #eef6ff;
  font-size: 14px;
  color: var(--aa-navy);
}

/* Valeur en € */
.aa-suffix { position: relative; }
.aa-suffix span { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-weight: 700; color: var(--aa-muted); }
.aa-form .aa-suffix input { padding-right: 40px; }

/* Recherche de profession */
.aa-combo { position: relative; }
.aa-combo-list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 240px;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
  border: 1.5px solid var(--aa-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 32px -12px rgba(0, 36, 72, .25);
}
.aa-combo-list[hidden] { display: none; }
.aa-combo-list li { padding: 9px 10px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.aa-combo-list li:hover, .aa-combo-list li.is-active { background: #eef6ff; }
.aa-combo-list .aa-combo-empty { color: var(--aa-muted); cursor: default; }

.aa-field-check { margin-bottom: 4px; }
.aa-field-check.is-invalid .aa-check span { color: var(--aa-error); }
.aa-form select:disabled { opacity: .6; cursor: not-allowed; }
.aa-model { animation: aaIn .3s ease both; }
.aa-model[hidden] { display: none; }

@media (max-width: 480px) {
  .aa-tiles-6 { grid-template-columns: repeat(3, 1fr); }
  .aa-tiles-5 { grid-template-columns: repeat(3, 1fr); }
  .aa-row-3 { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .aa-row-cp { grid-template-columns: 1fr; }
  .aa-card { padding: 14px 12px 2px; }
}

/* Neutralise la classe .error de l'ancien script.js à l'intérieur du formulaire */
.aa-form input.error, .aa-form select.error { border: 1.5px solid var(--aa-line) !important; animation: none !important; }
.aa-form .aa-field.is-invalid input.error, .aa-form .aa-field.is-invalid select.error { border-color: var(--aa-error) !important; }
