/* =====================================================
   form.css — Optimisé TOUS appareils
   iPhone SE → iPhone 16 Pro Max
   Android petit → grand écran
   Tablette · Desktop · Mode paysage
   ===================================================== */

/* ── Reset universel ── */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;  /* iOS : empêche zoom auto */
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ── Fond de page ── */
body {
  background: #f0f0f0 !important;
  margin: 0;
  padding: 0;
  overscroll-behavior: none;      /* empêche le pull-to-refresh accidentel */
}

/* =====================================================
   CADRE TÉLÉPHONE
   ===================================================== */
.phone-frame {
  position: relative;
  background: #1a1a1a;
  border-radius: 48px;
  padding: 18px 10px;
  box-shadow:
    0 0 0 2px #333,
    0 0 0 6px #111,
    0 30px 80px rgba(0,0,0,0.35);
  max-width: 400px;
  width: calc(100% - 2rem);
  margin: 1.5rem auto;
}

/* Encoche dynamique */
.phone-frame::before {
  content: '';
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  width: 90px; height: 24px;
  background: #1a1a1a;
  border-radius: 20px;
  z-index: 10;
}

/* Boutons volume gauche */
.phone-frame::after {
  content: '';
  position: absolute;
  left: -10px; top: 90px;
  width: 4px; height: 32px;
  background: #333;
  border-radius: 3px 0 0 3px;
  box-shadow: 0 44px 0 #333, 0 80px 0 #333;
}

/* Bouton power droite */
.phone-btn-power {
  position: absolute;
  right: -10px; top: 120px;
  width: 4px; height: 50px;
  background: #333;
  border-radius: 0 3px 3px 0;
}

/* =====================================================
   ÉCRAN (form-page)
   ===================================================== */
.form-page {
  background: #fff;
  border: 2px solid #000;
  border-radius: 36px;
  overflow: hidden;
  min-height: 600px;
  position: relative;
  /* Scroll interne fluide sur iOS */
  -webkit-overflow-scrolling: touch;
}

/* =====================================================
   EN-TÊTE
   ===================================================== */
.app-header {
  background: var(--green-dark);
  padding: 0.9rem 1.2rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 2px solid var(--gold);
  flex-wrap: nowrap;
  overflow: hidden;
}

.app-header .logo-img,
.app-header .logo-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  flex-shrink: 0;
  object-fit: contain;
  background: #fff;
}

.app-header .logo-placeholder {
  background: var(--green-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--gold);
}

.app-header .header-text { min-width: 0; }

.app-header .header-text h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1rem, 4vw, 1.4rem);
  font-weight: 700;
  color: var(--gold);
  line-height: 1.1;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header .header-text p {
  font-size: clamp(0.6rem, 2.2vw, 0.75rem);
  color: var(--green-pale);
  opacity: 0.85;
  margin: 0.1rem 0 0;
  line-height: 1.3;
}

/* =====================================================
   BANNIÈRE ANNONCE
   ===================================================== */
.annonce-banner {
  background: #FEF9EC;
  border-left: 4px solid var(--gold);
  margin: 0.8rem 1rem;
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
}
.annonce-banner .annonce-titre {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green-dark);
  margin-bottom: 0.3rem;
}
.annonce-banner .annonce-texte {
  font-size: 0.85rem;
  color: #444;
  line-height: 1.5;
  margin: 0;
}

/* =====================================================
   ALERTES
   ===================================================== */
.alert {
  margin: 0 1rem 0.5rem;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}
.alert-info   { background: #D1ECF1; color: #0C5460; border: 1px solid #BEE5EB; }
.alert-danger { background: #F8D7DA; color: #721C24; border: 1px solid #F5C6CB; }

/* =====================================================
   CORPS DU FORMULAIRE
   ===================================================== */
.form-body {
  background: #fff;
  margin: 0 1rem;
  border-radius: 10px;
  padding: 0.9rem 1rem 0.5rem;
  border: 1px solid #eee;
}

.form-group { margin-bottom: 0.75rem; }

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.3rem;
}
.form-group label .required { color: var(--status-rej); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;             /* IMPORTANT : min 16px pour éviter zoom iOS */
  background: #fafafa;
  color: #222;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;  /* supprime délai 300ms mobile */
}

.form-control:focus {
  outline: none;
  border-color: var(--green-med);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(227,62,63,0.12);
}
.form-control.error { border-color: var(--status-rej); }

/* Select — flèche personnalisée */
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23B02A2B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-error {
  font-size: 0.76rem;
  color: var(--status-rej);
  margin-top: 0.2rem;
  min-height: 1rem;
}

/* =====================================================
   CARTES PAIEMENT
   ===================================================== */
.pay-cards { display: flex; gap: 0.75rem; }

.pay-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 0.9rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafafa;
  position: relative;
  min-height: 70px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.pay-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.pay-logo { height: 30px; width: auto; max-width: 72px; object-fit: contain; }
.pay-logo-fallback { align-items: center; justify-content: center; }
.pay-fb-circle {
  width: 34px; height: 34px;
  border-radius: 50%;
  color: #fff; font-weight: 700; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
}
.pay-name { font-size: 0.82rem; font-weight: 700; color: #444; }

.pay-card.wave-card.selected,
.pay-card.wave-card:has(input:checked) { border-color: #003399; background: rgba(0,51,153,0.05); }
.pay-card.wave-card.selected .pay-name,
.pay-card.wave-card:has(input:checked) .pay-name { color: #003399; }
.pay-card.wave-card:hover { border-color: #003399; }

/* =====================================================
   BOUTON SOUMETTRE
   ===================================================== */
.submit-wrap { padding: 0.8rem 1rem 0.3rem; }

.btn-submit {
  display: block;
  width: 100%;
  padding: 0.9rem;
  background: var(--green-dark);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.02em;
  text-align: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  /* Evite double-tap zoom sur iOS */
  user-select: none;
  -webkit-user-select: none;
}
.btn-submit:active  { background: var(--green-deep); transform: scale(0.98); }
.btn-submit:hover   { background: var(--green-med); }

/* =====================================================
   FOOTER
   ===================================================== */
.form-footer {
  text-align: center;
  padding: 0.5rem 1rem 0.7rem;
  font-size: 0.76rem;
  color: #aaa;
}
.form-footer a { color: #aaa; text-decoration: underline; }

/* =====================================================
   RESPONSIVE — PETITS MOBILES (< 360px)
   Samsung Galaxy A série, anciens iPhones SE
   ===================================================== */
@media (max-width: 359px) {
  .phone-frame  { border-radius: 32px; padding: 12px 7px; width: 100%; margin: 0.5rem auto; }
  .form-page    { border-radius: 24px; min-height: auto; }
  .app-header   { padding: 0.6rem 0.8rem; gap: 0.6rem; }
  .app-header .logo-img,
  .app-header .logo-placeholder { width: 38px; height: 38px; font-size: 1.2rem; }
  .app-header .header-text h1   { font-size: 0.95rem; }
  .form-body    { margin: 0 0.5rem; padding: 0.6rem 0.7rem 0.4rem; }
  .annonce-banner { margin: 0.5rem 0.5rem; padding: 0.5rem 0.7rem; }
  .submit-wrap  { padding: 0.6rem 0.5rem 0.3rem; }
  .form-control { font-size: 16px; padding: 0.6rem 0.7rem; }
}

/* =====================================================
   RESPONSIVE — MOBILES STANDARD (360px–480px)
   iPhone 12/13/14/15, Samsung Galaxy S
   ===================================================== */
@media (min-width: 360px) and (max-width: 480px) {
  .phone-frame { max-width: 380px; }
}

/* =====================================================
   RESPONSIVE — GRANDS MOBILES (481px–599px)
   iPhone Plus, Pixel XL, Galaxy Note
   ===================================================== */
@media (min-width: 481px) and (max-width: 599px) {
  .phone-frame { max-width: 400px; }
  .app-header  { padding: 1rem 1.3rem; }
}

/* =====================================================
   RESPONSIVE — TABLETTE (≥ 600px)
   iPad mini, Galaxy Tab, Surface
   ===================================================== */
@media (min-width: 600px) {
  .phone-frame { max-width: 420px; }
  .app-header  { padding: 1rem 1.5rem; }
  .form-body   { padding: 1rem 1.2rem 0.6rem; }
}

/* =====================================================
   RESPONSIVE — DESKTOP (≥ 900px)
   ===================================================== */
@media (min-width: 900px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 0;
  }
  .phone-frame { margin: 0 auto; }
}

/* =====================================================
   MODE PAYSAGE MOBILE (landscape)
   ===================================================== */
@media (max-height: 500px) and (orientation: landscape) {
  body { align-items: flex-start; padding: 0.5rem 0; }
  .phone-frame {
    margin: 0.3rem auto;
    border-radius: 28px;
    padding: 10px 8px;
    max-width: 500px;
  }
  .phone-frame::before { display: none; } /* cacher encoche en landscape */
  .app-header  { padding: 0.4rem 1rem; }
  .app-header .logo-img,
  .app-header .logo-placeholder { width: 34px; height: 34px; }
  .form-body   { padding: 0.4rem 0.8rem 0.3rem; }
  .form-group  { margin-bottom: 0.35rem; }
  .form-control { padding: 0.45rem 0.7rem; }
  .submit-wrap { padding: 0.4rem 1rem 0.2rem; }
}

/* =====================================================
   GRAND ÉCRAN TABLETTE PAYSAGE / DESKTOP (≥ 1024px)
   ===================================================== */
@media (min-width: 1024px) {
  .phone-frame {
    max-width: 430px;
    box-shadow:
      0 0 0 2px #444,
      0 0 0 7px #1a1a1a,
      0 40px 100px rgba(0,0,0,0.4);
  }
}

/* =====================================================
   ACCESSIBILITÉ — Réduction de mouvement
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
  .btn-submit, .pay-card, .form-control, .btn-confirmer, .btn-wave-pay {
    transition: none !important;
    transform: none !important;
  }
}

/* =====================================================
   DARK MODE (si activé sur l'appareil)
   ===================================================== */
@media (prefers-color-scheme: dark) {
  body { background: #1a1a1a !important; }
  .phone-frame {
    background: #0d0d0d;
    box-shadow: 0 0 0 2px #444, 0 0 0 6px #222, 0 30px 80px rgba(0,0,0,0.6);
  }
}

/* =====================================================
   SAFE AREA — iPhone X et plus (encoche + home bar)
   ===================================================== */
@supports (padding: max(0px)) {
  .phone-frame {
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }
  .form-footer {
    padding-bottom: max(0.7rem, env(safe-area-inset-bottom));
  }
}
