/* ============================================================
   APTEVIA - popup.css
   Version : V2.1 - 07/01/2026
   Objet   : Styles popup RDV + stepper + forms + timer
             + Étape 4 (Confirmation commande) : curseurs OUI/NON
             + FIX Paiement (iframe Stancer) : taille + hauteur + overflow
   Note    : Aucun changement d’architecture, uniquement styles.
   ============================================================ */

/* -----------------------------
   Overlay + container
------------------------------ */
#popup-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 9998;
  display: none;
}

#popup-container{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Classe de visibilité (utilisée par JS) */
#popup-overlay.ap-open{ display:block; }
#popup-container.ap-open{ display:flex; }

/* -----------------------------
   Layout global popup
------------------------------ */
#popup-content{
  width: 820px;
  max-width: calc(100vw - 40px);

  /* FIX: popup ne doit pas dépasser la hauteur écran */
  max-height: calc(100vh - 40px);

  /* garde une base visuelle */
  min-height: 520px;

  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);

  display: flex;
  flex-direction: column;
}

/* Stepper à gauche (si présent en sibling) */
#stepper{
  width: 220px;
  min-width: 220px;
  background: #f6f7f9;
  border-radius: 14px 0 0 14px;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#popup-container > #stepper,
#popup-container > aside#stepper{
  /* au cas où ton HTML place le stepper avant #popup-content */
}

#popup-container{
  /* wrapper */
  gap: 0;
}

#popup-container #stepper + #popup-content{
  border-radius: 0 14px 14px 0;
}

/* -----------------------------
   Stepper items
------------------------------ */
#stepper .step{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 10px;
  background: transparent;
  user-select: none;
}

#stepper .step .icon{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  background: #e7eaee;
  color: #002f3f;
}

#stepper .step .label{
  font-weight: 600;
  color: #002f3f;
  font-size: .95rem;
}

#stepper .step.active{
  background: rgba(153,207,22,.18);
}

#stepper .step.active .icon{
  background: #99cf16;
  color: #002f3f;
}

#stepper .step.done{
  opacity: .9;
}

#stepper .step.done .icon{
  background: #002f3f;
  color: #fff;
}

/* -----------------------------
   Timer
------------------------------ */
.reservation-timer{
  margin-top: auto;
  padding: 12px 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
}

.reservation-timer-label{
  font-size: .85rem;
  color: rgba(0,47,63,.85);
  margin-bottom: 8px;
}

#reservation-timer-value{
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: .5px;
  color: #002f3f;
}

/* -----------------------------
   Panels
------------------------------ */
.step-panel{
  display: none;
  padding: 22px 24px 0 24px;
  flex: 1;

  /* FIX: permet d’étirer une zone interne (paiement) */
  flex-direction: column;

  /* FIX: évite scroll global moche — on scrolle à l’intérieur si besoin */
  overflow: hidden;
}

.step-panel.active{
  display: flex; /* au lieu de block, pour le layout paiement */
}

.popup-main-content{
  /* si ton HTML a un wrapper, on le laisse respirer */
}

.popup-main-content h2{
  margin: 0 0 10px 0;
  font-size: 1.25rem;
  color: #002f3f;
}

.popup-main-content p{
  margin: 10px 0;
  color: rgba(0,47,63,.92);
  line-height: 1.4;
}

/* -----------------------------
   Footer nav
------------------------------ */
.popup-footer-nav{
  display: flex;
  gap: 10px;
  padding: 14px 24px 18px 24px;
  border-top: 1px solid rgba(0,0,0,.08);
  align-items: center;
  justify-content: flex-end;

  /* FIX: footer toujours visible */
  flex: 0 0 auto;
}

.back-btn,
.next-btn{
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .05s ease, opacity .15s ease;
}

.back-btn:active,
.next-btn:active{
  transform: translateY(1px);
}

.back-btn{
  background: #e9edf0;
  color: #002f3f;
}

.next-btn{
  background: #99cf16;
  color: #002f3f;
}

.next-btn.secondary{
  background: rgba(0,47,63,.10);
  color: #002f3f;
}

.next-btn.is-disabled,
.next-btn:disabled{
  opacity: .55;
  cursor: not-allowed;
}

/* -----------------------------
   Boxes / errors
------------------------------ */
.recap-box{
  background: #f7fafc;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  padding: 14px 14px;
  margin-top: 10px;
}

.error-box{
  background: rgba(220,53,69,.10);
  border: 1px solid rgba(220,53,69,.25);
  color: #b02a37;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  font-weight: 600;
}

/* -----------------------------
   Forms
------------------------------ */
.form-group{
  margin-top: 10px;
}

.form-group label{
  display: block;
  font-weight: 700;
  font-size: .92rem;
  margin-bottom: 6px;
  color: #002f3f;
}

.form-group input,
.form-group select{
  width: 100%;
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 1rem;
  outline: none;
}

.form-group input:focus,
.form-group select:focus{
  border-color: rgba(153,207,22,.9);
  box-shadow: 0 0 0 3px rgba(153,207,22,.18);
}

.form-row{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.form-col-20{ flex: 0 0 20%; min-width: 120px; }
.form-col-30{ flex: 0 0 30%; min-width: 160px; }
.form-col-40{ flex: 0 0 40%; min-width: 220px; }
.form-col-50{ flex: 0 0 50%; min-width: 260px; }

.divider-small{
  border: none;
  border-top: 1px solid rgba(0,0,0,.10);
  margin: 14px 0;
}

.checkbox-line{
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  color: rgba(0,47,63,.92);
}

.checkbox-line input[type="checkbox"]{
  margin-top: 3px;
}

/* Suggestions autocomplete adresse */
.suggestions-box{
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
  display: none;
  z-index: 10000;
  overflow: hidden;
}

.suggestions-box div{
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

.suggestions-box div:hover{
  background: rgba(153,207,22,.12);
}

/* ============================================================
   Password wrapper + bouton "👁" (toggle)
   ============================================================ */
.password-wrapper{
  display: flex;
  gap: 8px;
  align-items: center;
}

.password-wrapper input{
  flex: 1;
}

/* Bouton œil (HTML ajoute class="toggle-password") */
.password-wrapper .toggle-password{
  width: 48px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.18);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.password-wrapper .toggle-password:hover{
  background: rgba(0,0,0,.03);
}

/* -----------------------------
   ETAPE 4 - Curseurs OUI/NON
   (attend des inputs range)
------------------------------ */
.consent-row{
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}

.consent-row .consent-label{
  flex: 1;
  font-weight: 600;
  color: rgba(0,47,63,.95);
  line-height: 1.25;
}

/* Wrapper pour aligner le slider + labels */
.consent-control{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
  justify-content: flex-end;
}

.consent-badge{
  font-weight: 800;
  font-size: .9rem;
  width: 36px;
  text-align: center;
  user-select: none;
}

.consent-badge.no{ color: #d10f2f; }
.consent-badge.yes{ color: #1f7a00; }

/* Slider style de base */
input[type="range"].consent-slider{
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 6px;
  border-radius: 999px;
  outline: none;
  background: rgba(209,15,47,.45); /* rouge par défaut (NON) */
  cursor: pointer;
}

/* quand JS met .is-yes sur l'input */
input[type="range"].consent-slider.is-yes{
  background: rgba(31,122,0,.45);
}
input[type="range"].consent-slider.is-no{
  background: rgba(209,15,47,.45);
}

/* Thumb */
input[type="range"].consent-slider::-webkit-slider-thumb{
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid rgba(0,0,0,.25);
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}

input[type="range"].consent-slider.is-yes::-webkit-slider-thumb{
  border-color: rgba(31,122,0,.65);
}

input[type="range"].consent-slider.is-no::-webkit-slider-thumb{
  border-color: rgba(209,15,47,.65);
}

/* Firefox */
input[type="range"].consent-slider::-moz-range-track{
  height: 6px;
  border-radius: 999px;
  background: rgba(209,15,47,.45);
}
input[type="range"].consent-slider.is-yes::-moz-range-track{
  background: rgba(31,122,0,.45);
}
input[type="range"].consent-slider.is-no::-moz-range-track{
  background: rgba(209,15,47,.45);
}
input[type="range"].consent-slider::-moz-range-thumb{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid rgba(0,0,0,.25);
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
input[type="range"].consent-slider.is-yes::-moz-range-thumb{
  border-color: rgba(31,122,0,.65);
}
input[type="range"].consent-slider.is-no::-moz-range-thumb{
  border-color: rgba(209,15,47,.65);
}

/* ============================================================
   FIX PAIEMENT (Step 5) : IFRAME STANCER à la bonne taille
   - Sélecteurs tolérants (IDs connus + fallback)
   ============================================================ */

/* La zone step 5 doit pouvoir prendre la hauteur dispo */
#step-content-5{
  flex: 1;
  min-height: 0; /* clé pour permettre aux enfants de scroller */
}

/* Si tu as un wrapper paiement, on lui donne flex */
#step-content-5 .payment-wrap,
#step-content-5 .payment-zone,
#step-content-5 .payment-frame-wrap{
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Iframe: ciblage principal + fallbacks */
#stancer-iframe,
#step-content-5 iframe,
#step-content-5 .payment-frame{
  width: 100%;
  flex: 1;
  min-height: 460px; /* garantit une surface confortable */
  height: 100%;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

/* Si tu as un loading au-dessus, on évite qu’il écrase */
#payment-loading{
  margin-top: 10px;
}

/* Si la popup est plus grande, on profite */
@media (min-height: 760px){
  #stancer-iframe,
  #step-content-5 iframe,
  #step-content-5 .payment-frame{
    min-height: 540px;
  }
}

/* Step 6 (confirmation) : si contenu long, scroll interne sans casser footer */
#step-content-6{
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-bottom: 12px;
}

/* -----------------------------
   Responsive (simple)
------------------------------ */
@media (max-width: 920px){
  #popup-container{
    padding: 10px;
  }

  #popup-content{
    width: 100%;
    max-width: 100%;
    min-height: 520px;
    max-height: calc(100vh - 20px);
  }

  #stepper{
    display: none; /* si tu veux conserver : enlève ceci */
  }

  .popup-footer-nav{
    flex-wrap: wrap;
    justify-content: center;
  }

  /* iframe confortable même en mobile */
  #stancer-iframe,
  #step-content-5 iframe,
  #step-content-5 .payment-frame{
    min-height: 520px;
  }
}
