/* =========================================================
   CyberSource BGFI — Responsive overrides (mobile/tablette)
   Charge APRÈS styles.css pour corriger les superpositions
   ========================================================= */

/* ----- Base reset pour éviter tout overflow horizontal ----- */
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, video { max-width: 100%; height: auto; }
.container { width: min(var(--container), calc(100% - 32px)); }

/* ----- Hero typography qui scale partout ----- */
.hero-title, .page-title {
  font-size: clamp(1.8rem, 4.4vw + .5rem, 3.4rem);
  line-height: 1.12;
  letter-spacing: -.025em;
  word-wrap: break-word;
}
.hero-lead, .page-lead {
  font-size: clamp(.95rem, .6vw + .85rem, 1.15rem);
  line-height: 1.55;
}
.section-title { font-size: clamp(1.4rem, 2vw + .8rem, 2rem); line-height:1.2; }
.eyebrow, .kicker { font-size: clamp(.7rem, .3vw + .65rem, .85rem); }

.btn { white-space: normal; line-height:1.2; }

/* ============================================================
   TABLET — 768 à 1099 px
   Ajout d'un breakpoint manquant entre 880 et 1100
   ============================================================ */
@media (max-width: 1099px) and (min-width: 881px) {
  .hero-inner { gap: 24px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; }
  .contact-info { grid-template-columns: repeat(2, 1fr); }
  .process { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .pricing-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   TABLET / MOBILE LARGE — jusqu'à 880px
   ============================================================ */
@media (max-width: 880px) {
  /* Header */
  .site-header { padding: 0; }
  .navbar { height: 64px; padding: 0; gap: 12px; }
  .brand { min-width: 0; gap: 10px; }
  .brand-logo { width: 110px; }
  .menu-toggle { z-index: 1100; }

  /* Nav menu mobile : full-screen propre */
  .nav-menu {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(0, 33, 64, .98);
    padding: 16px 18px 24px;
    gap: 4px;
    box-shadow: 0 16px 48px rgba(0,0,0,.35);
  }
  .nav-actions { margin-left:auto; }
  .nav-actions .btn { display: inline-flex !important; padding: 8px 14px; font-size: .82rem; }
  .nav-actions .btn .arrow { display:none; }

  /* Hero */
  .hero { padding: 0; }
  .hero-inner {
    padding: 36px 0 32px !important;
    grid-template-columns: 1fr !important;
    gap: 28px;
  }
  .hero-copy { text-align: left; }
  .hero-actions { flex-wrap: wrap; gap: 10px; }
  .hero-actions .btn { flex: 1 1 auto; min-width: 0; justify-content: center; }
  .hero-points { gap: 10px; flex-wrap: wrap; }
  .hero-point { font-size: .82rem; }

  /* Trust strip plus aéré */
  .trust-card { grid-template-columns: 1fr !important; gap: 0; padding: 18px; }
  .trust-item { padding: 16px 0; }
  .trust-item + .trust-item { border-top: 1px solid var(--line); border-left: 0; padding-top: 16px; }

  /* Sections plus compactes */
  .section { padding: 56px 0; }
  .section-sm { padding: 36px 0; }
  .section-head { margin-bottom: 28px; }
  .section-head p { font-size: .95rem; }

  /* Grids → 1 colonne */
  .grid-4, .grid-3, .grid-2, .split,
  .feature-cols, .stats-row, .calc-results,
  .contact-info, .process, .faq-list,
  .pricing-cards, .backoffice-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  /* Cards */
  .card, .solution-card, .benefit-card, .sector-card, .step-card, .info-card {
    padding: 22px;
  }
  .card h3, .solution-card h3 { font-size: 1.05rem; }
  .card p, .solution-card p { font-size: .92rem; }

  /* Contact layout (form + sidebar) */
  .contact-layout {
    grid-template-columns: 1fr !important;
    gap: 22px;
    margin-top: 24px !important;
  }
  .form-card { padding: 22px !important; }
  .form-grid { grid-template-columns: 1fr !important; gap: 14px; }
  .form-grid .field.full { grid-column: 1 !important; }
  .side-card { padding: 22px; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr 1fr !important; gap: 24px; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; gap: 12px; align-items: flex-start; padding: 18px 0; }
  .footer-bottom nav { flex-wrap: wrap; gap: 12px; }

  /* CTA band */
  .cta-band { grid-template-columns: 1fr !important; padding: 30px !important; gap: 16px; }
  .cta-actions { flex-direction: column; align-items: stretch; gap: 12px; }
  .cta-actions .btn { width: 100%; justify-content: center; }
  .cta-text { padding: 0 !important; }
  .cta-band::before { display:none !important; }
}

/* ============================================================
   MOBILE — jusqu'à 620px
   Le visuel hero "payment-lab" est purement décoratif et complexe
   On le simplifie : un seul écran centré + on cache les cartes overlappées
   ============================================================ */
@media (max-width: 620px) {
  .container { padding: 0 4px; }
  .navbar { gap: 8px; }
  .brand-logo { width: 96px; }
  .brand-product, .brand-divider { display: none; }
  .nav-actions .btn { padding: 7px 12px; font-size: .78rem; }

  /* Hero copy plus serré */
  .hero-copy { padding: 0; }
  .hero-actions .btn { font-size: .92rem; padding: 13px 18px; }
  .hero-points { flex-direction: column; align-items: stretch; gap: 8px; margin-top: 18px; }
  .hero-point {
    background: rgba(255, 255, 255, .07);
    padding: 10px 14px;
    border-radius: 10px;
    backdrop-filter: blur(4px);
  }

  /* Hero visual : on SIMPLIFIE le payment-lab */
  .hero-visual { min-height: auto; }
  .payment-lab {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 0;
    transform: none;
    padding: 8px;
  }
  .payment-lab > * { position: relative !important; transform: none !important; }
  .dashboard-window {
    position: static !important;
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
    min-height: 240px;
    margin: 0 auto;
    top: auto !important; right: auto !important; left: auto !important; bottom: auto !important;
  }
  /* Sur les très petits écrans on cache les cartes overlappées qui créent du désordre */
  .checkout-card, .phone-card, .invoice-card, .code-card, .nfc-card, .nfc-phone {
    display: none !important;
  }

  /* Window content ré-adapté */
  .window-body { grid-template-columns: 0 1fr; }
  .side-menu { display: none; }
  .dash-main { padding: 12px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metrics .metric { padding: 10px; }
  .metric small { font-size: .68rem; }
  .metric b { font-size: 1rem; }

  /* Sections */
  .section { padding: 44px 0; }
  .section-head { margin-bottom: 22px; }
  .section-head p { font-size: .92rem; }

  /* Buttons */
  .hero-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .hero-actions .btn { width: 100%; }

  /* Solution cards plus aérées */
  .solution-card { padding: 22px 20px; }
  .chip-row { flex-wrap: wrap; gap: 6px; }
  .chip { font-size: .72rem; padding: 3px 9px; }

  /* Forme contact mobile */
  .form-card h2 { font-size: 1.2rem; }
  .form-card .text-muted { font-size: .85rem; }
  .field label { font-size: .82rem; }
  .field input, .field select, .field textarea {
    font-size: 16px !important; /* iOS no auto-zoom */
    padding: 10px 12px;
  }
  /* Téléphone : indicatif + numéro empilés si trop étroit */
  .form-card .field > div[style*="display:flex"] { flex-wrap: wrap; }
  .form-card .field > div[style*="display:flex"] select { max-width: none !important; flex: 1 1 100%; }
  .form-card .field > div[style*="display:flex"] input { flex: 1 1 100%; }

  /* Produits intéressés en pleine largeur */
  .product-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .product-pick { padding: .55rem .7rem !important; font-size: .85rem !important; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr !important; gap: 20px; }
  .footer-col { padding: 0; }
  .footer-bottom { font-size: .8rem; }

  /* CTA band */
  .cta-band { padding: 24px 22px !important; }
  .cta-band h2 { font-size: 1.2rem; }
  .cta-band p { font-size: .9rem; }

  /* Trust card */
  .trust-item h3 { font-size: 1rem; }
  .trust-item p { font-size: .88rem; }

  /* FAQ */
  .faq-button { font-size: .92rem; padding: 14px 16px; }
  .faq-panel p { font-size: .9rem; padding: 0 16px 14px; }

  /* Hero shine décoratif moins envahissant */
  .hero-shine { opacity: .35; }

  /* Section dark stats */
  .dark-card { padding: 18px 20px; }
  .dark-card b { font-size: 1.6rem; }
}

/* ============================================================
   VERY SMALL — jusqu'à 380px
   ============================================================ */
@media (max-width: 380px) {
  .container { width: calc(100% - 16px); }
  .brand-logo { width: 84px; }
  .nav-actions .btn { padding: 6px 10px; font-size: .72rem; }
  .nav-actions .btn .arrow { display: none; }
  .hero-title, .page-title { font-size: 1.55rem; }
  .product-grid { grid-template-columns: 1fr !important; }
  .form-grid .field { min-width: 0; }
}

/* ============================================================
   FIXES généraux
   ============================================================ */

/* Sticky header ne doit jamais cacher l'ancre */
section[id] { scroll-margin-top: 90px; }

/* Empêche les éléments floats decoratifs de fuir */
.hero, .section, .section-dark, .section-muted { position: relative; overflow: hidden; }
.hero-shine { pointer-events: none; }

/* Focus states accessibles */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Body lock quand menu mobile ouvert */
body.menu-open { overflow: hidden; }

/* Page Merci centrée correctement */
body[data-page="thanks"] .hero-actions {
  justify-content: center;
}
body[data-page="thanks"] .hero-actions .btn {
  flex: 0 0 auto;
}

/* Alertes formulaire mieux espacées */
.alert-success, .alert-error {
  font-size: .95rem;
  line-height: 1.5;
}

/* Form spacing global */
.form-grid .field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--ink);
}
.form-grid .field input,
.form-grid .field select,
.form-grid .field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  background: white;
  transition: border-color .15s, box-shadow .15s;
}
.form-grid .field input:focus,
.form-grid .field select:focus,
.form-grid .field textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(58, 162, 171, .15);
}
.form-grid .field textarea { min-height: 110px; resize: vertical; }
.product-pick { transition: all .15s; }
.product-pick:hover { border-color: var(--teal) !important; background: var(--soft) !important; }
.product-pick:has(input:checked) {
  border-color: var(--navy) !important;
  background: linear-gradient(135deg, rgba(0,53,101,.05), rgba(58,162,171,.08)) !important;
  box-shadow: 0 4px 12px rgba(0,53,101,.08);
}

/* Bouton submit plus visible */
.form-card .btn.btn-dark.btn-block {
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  font-weight: 600;
  padding: 14px 22px;
  font-size: 1rem;
  box-shadow: 0 10px 26px rgba(0, 53, 101, .25);
}
.form-card .btn.btn-dark.btn-block:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(0, 53, 101, .32);
}
