/* ============================================================
   ADPMA — Formulaire de contact popup
   ============================================================ */

:root {
  --adpma-green:        #1a3a2e;
  --adpma-green-dark:   #2d6a4f;
  --adpma-green-light:  #E1F5EE;
  --adpma-green-mid:    #9FE1CB;
  --adpma-text:         #1a1a1a;
  --adpma-muted:        #6b7280;
  --adpma-hint:         #9ca3af;
  --adpma-border:       #e5e7eb;
  --adpma-bg:           #ffffff;
  --adpma-surface:      #f9fafb;
  --adpma-red:          #dc2626;
  --adpma-radius:       10px;
  --adpma-radius-sm:    6px;
}

/* ── Bouton CTA ────────────────────────────────────────────── */

.adpma-contact-btn {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  padding: 12px 28px;
  background: var(--adpma-green);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--adpma-radius-sm);
  cursor: pointer;
  transition: background .15s, transform .1s;
  text-decoration: none;
}
.adpma-contact-btn:hover  { background: var(--adpma-green-dark); }
.adpma-contact-btn:active { transform: scale(.97); }

/* ── Overlay ───────────────────────────────────────────────── */

.adpma-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, .55);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
  box-sizing: border-box;
  overflow: hidden; /* bloque tout débordement interne */
}
.adpma-modal-overlay.open {
  display: flex;
  animation: adpmaFadeOverlay .2s ease;
}
@keyframes adpmaFadeOverlay {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Boîte modale ──────────────────────────────────────────── */

.adpma-modal-box {
  position: relative;
  background: var(--adpma-bg);
  border-radius: var(--adpma-radius);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  max-height: 90dvh; /* tient compte du clavier logiciel sur mobile */
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.75rem;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .2);
  animation: adpmaSlideUp .22s ease;
}
@keyframes adpmaSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.adpma-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--adpma-hint);
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.adpma-modal-close:hover {
  color: var(--adpma-text);
  background: var(--adpma-surface);
}

/* ── Branding ──────────────────────────────────────────────── */

.adpma-form-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}
.adpma-logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--adpma-green-light);
  border: 1px solid var(--adpma-green-mid);
  border-radius: 999px;
  padding: 6px 16px 6px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--adpma-green-dark);
  letter-spacing: .02em;
}
.adpma-form-brand p {
  margin-top: 8px;
  font-size: 13px;
  color: var(--adpma-muted);
}

/* ── Barre de progression ──────────────────────────────────── */

.adpma-progress-wrap {
  display: flex;
  align-items: flex-start; /* chaque colonne aligne dot + label verticalement */
  margin-bottom: 1.5rem;
}

.adpma-progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 30px;
}

.adpma-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--adpma-border);
  background: var(--adpma-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--adpma-hint);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: all .25s;
}
.adpma-dot.active {
  background: var(--adpma-green);
  border-color: var(--adpma-green);
  color: #fff;
}
.adpma-dot.done {
  background: var(--adpma-green-light);
  border-color: var(--adpma-green-mid);
  color: var(--adpma-green-dark);
}
.adpma-dot.done::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--adpma-green-dark);
  border-bottom: 2px solid var(--adpma-green-dark);
  transform: rotate(-45deg) translate(0, -1px);
}
.adpma-dot.done span { display: none; }

.adpma-step-label {
  font-size: 11px;
  color: var(--adpma-hint);
  text-align: center;
  margin-top: 5px;
  white-space: nowrap; /* le texte déborde visuellement mais reste centré sur le dot */
  transition: color .25s;
}
.adpma-step-label.active { color: var(--adpma-green); font-weight: 600; }
.adpma-step-label.done   { color: var(--adpma-green-dark); }

.adpma-line {
  flex: 1;
  height: 2px;
  background: var(--adpma-border);
  margin: 14px 4px 0; /* 14px = centre vertical du dot (30px/2 - 1px) */
  transition: background .3s;
}
.adpma-line.done { background: var(--adpma-green-mid); }

/* ── Steps ─────────────────────────────────────────────────── */

.adpma-step { display: none; animation: adpmaFadeStep .2s ease; }
.adpma-step.active { display: block; }
@keyframes adpmaFadeStep {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.adpma-step-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--adpma-text);
  margin-bottom: 4px;
}
.adpma-step-sub {
  font-size: 13px;
  color: var(--adpma-muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

/* ── Champs ─────────────────────────────────────────────────── */

.adpma-field { margin-bottom: 1rem; }
.adpma-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--adpma-muted);
  margin-bottom: 6px;
}
.adpma-field input,
.adpma-field select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 13px;
  height: auto;        /* neutralise le height:51px du thème Listeo */
  line-height: 1.4;    /* neutralise le line-height:51px du thème */
  margin: 0;           /* neutralise le margin:0 0 16px 0 du thème */
  font-size: 16px; /* ≥16px évite le zoom automatique sur iOS */
  border: 1.5px solid var(--adpma-border);
  border-radius: var(--adpma-radius-sm);
  background: var(--adpma-bg);
  color: var(--adpma-text);
  box-shadow: none;    /* neutralise le box-shadow du thème */
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
}
.adpma-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
  cursor: pointer;
}
.adpma-field input:focus,
.adpma-field select:focus {
  border-color: var(--adpma-green);
  box-shadow: 0 0 0 3px rgba(29, 158, 117, .12);
}
.adpma-field input.adpma-error,
.adpma-field select.adpma-error { border-color: var(--adpma-red); }

.adpma-field-hint {
  font-size: 11px;
  color: var(--adpma-hint);
  margin-top: 5px;
}
.adpma-field-error {
  font-size: 12px;
  color: var(--adpma-red);
  margin-top: 5px;
  display: none;
}
.adpma-field-error.visible { display: block; }

.adpma-field-row {
  display: flex;
  gap: 12px;
}
.adpma-field-row > .adpma-field {
  flex: 1 1 0%;   /* flex-basis: 0 → partage strictement égal, indépendant du contenu */
  min-width: 0;
  overflow: hidden;
}
.adpma-field-row > .adpma-field select,
.adpma-field-row > .adpma-field input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  max-width: 100%;
}
.adpma-field-row .adpma-field label {
  text-align: center;
}

/* ── Consentement ──────────────────────────────────────────── */

.adpma-consent-wrap {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 1.25rem;
  padding: 12px;
  background: var(--adpma-surface);
  border: 1px solid var(--adpma-border);
  border-radius: var(--adpma-radius-sm);
}
.adpma-consent-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--adpma-green);
  cursor: pointer;
}
.adpma-consent-wrap label {
  font-size: 12.5px;
  color: var(--adpma-muted);
  line-height: 1.5;
  cursor: pointer;
}
.adpma-consent-wrap label a {
  color: var(--adpma-green);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.adpma-rgpd-error { margin-top: 6px; }

/* ── Actions ───────────────────────────────────────────────── */

.adpma-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 1.5rem;
}
.adpma-btn {
  padding: 10px 20px;
  border-radius: var(--adpma-radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--adpma-border);
  background: var(--adpma-bg);
  color: var(--adpma-muted);
  font-family: inherit;
  transition: all .15s;
}
.adpma-btn:hover { background: var(--adpma-surface); color: var(--adpma-text); }
.adpma-btn-primary {
  background: var(--adpma-green);
  border-color: var(--adpma-green);
  color: #fff;
}
.adpma-btn-primary:hover { background: var(--adpma-green-dark); border-color: var(--adpma-green-dark); }
.adpma-btn:active { transform: scale(.98); }
.adpma-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ── Spinner ───────────────────────────────────────────────── */

.adpma-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: adpmaSpin .6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes adpmaSpin { to { transform: rotate(360deg); } }

/* ── Écran succès ──────────────────────────────────────────── */

.adpma-success {
  text-align: center;
  padding: 2rem 1rem;
  animation: adpmaFadeStep .3s ease;
}
.adpma-success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--adpma-green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}
.adpma-success h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--adpma-text);
}
.adpma-success p {
  font-size: 14px;
  color: var(--adpma-muted);
  line-height: 1.6;
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 480px) {
  /* Overlay : réduit le padding pour gagner de l'espace sur 320px */
  .adpma-modal-overlay { padding: 0.5rem; }

  /* Boîte modale : pleine largeur, coins en bas supprimés pour un look "sheet" */
  .adpma-modal-box {
    padding: 1.25rem 1rem;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    margin-top: auto; /* colle la modal en bas de l'overlay */
    max-height: 92dvh;
    max-height: 92vh; /* fallback */
  }

  /* Overlay en colonne pour positionner la sheet en bas */
  .adpma-modal-overlay {
    align-items: flex-end;
  }

  /* Grille des champs : passe en colonne unique */
  .adpma-field-row { grid-template-columns: 1fr; }

  /* Boutons d'action : empilés et pleine largeur */
  .adpma-form-actions {
    flex-direction: column-reverse;
    gap: 10px;
  }
  .adpma-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
    text-align: center;
  }

  /* Bouton CTA principal : pleine largeur sur mobile */
  .adpma-contact-btn {
    display: flex;
    width: 100%;
    justify-content: center;
  }

  /* Réduction légère de la taille du titre */
  .adpma-step-title { font-size: 15px; }
}
