/* =========================================================================
   mobile.css — Optimisation navigation mobile (Crazy Phone)
   Couche responsive DÉDIÉE, chargée APRÈS design-system.css pour coexister
   avec le layout grand écran (mêmes URLs, MUDA responsive).
   Ne touche PAS au desktop : tout est scopé dans des @media (max-width).
   Palette : neon #39FF14 · fond #0D0D0D · blanc.
   ========================================================================= */

/* ────────────────────────────────────────────────────────────────────────
   1. BASE  (record 900px) — zéro scroll horizontal, médias fluides,
      containers pleine largeur, grilles inline protégées.
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  html, body {
    overflow-x: hidden;
    width: 100%;
  }
  body {
    font-size: 15px;
  }

  /* Médias fluides */
  img, svg, canvas, video, iframe, table,
  [class*="card"] img,
  .brand-logo, .model-img, .model-img-fallback,
  .product-img {
    max-width: 100%;
    height: auto;
  }

  /* Tout conteneur pleine largeur, sans débordement */
  .container, .navbar-container, .glass-footer, .page-hero,
  .tarifs-hero-v2, .tarifs-hero-v3, .hero, .shop-hero,
  .section-title, .nouveautes-container, .section,
  .shop-layout, .shop-main, .prod-grid,
  .form-card-neon, .selection-viewport, #selection-viewport,
  #results-viewport {
    overflow-x: hidden;
    max-width: 100%;
  }

  /* Filet de sécu : toute grille inline ne peut pas déborder */
  [style*="display: grid"], [style*="display:grid"],
  [style*="grid-template-columns"] {
    max-width: 100%;
  }

  /* Paddings latéraux un peu plus généreux au-delà de 480px */
  .container { padding-left: 18px; padding-right: 18px; }
}

/* ────────────────────────────────────────────────────────────────────────
   2. EN-HEADER / NAVIGATION MOBILE
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px;
  }
  .navbar-brand {
    font-size: 1.25rem;
    line-height: 1.2;
    white-space: nowrap;
  }
  .navbar-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }
  .navbar-toggle span {
    display: block;
    width: 26px;
    height: 3px;
    background: var(--neon-green, #39FF14);
    border-radius: 2px;
    transition: 0.3s;
  }
  /* Menu pleine largeur, colonnes tactiles */
  .navbar-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(13, 13, 13, 0.97);
    border: 1px solid #2a2a2a;
    flex-direction: column;
    align-items: stretch;
    display: none;
    z-index: 1000;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  }
  .navbar-links.show,
  .navbar-links.open {
    display: flex;
  }
  .navbar-links li {
    width: 100%;
  }
  .navbar-links li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 46px;
    padding: 15px 20px;
    font-size: 1.05rem;
    color: #f1f5f9;
    border-bottom: 1px solid #222;
  }
  .navbar-links li a.btn-neon {
    justify-content: center;
    margin: 8px 12px;
    text-align: center;
    min-height: 46px;
  }
}

/* ────────────────────────────────────────────────────────────────────────
   3. GRILLES → colonnes fluides (cartes services, produits, catégories)
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  [class*="grid"] {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
  }

  /* Billetterie boutique : 2 colonnes sur tablette */
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px;
  }
  .shop-layout {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }
  /* Sidebar boutique : pleine largeur, non sticky */
  .shop-sidebar {
    width: 100% !important;
    position: static !important;
    flex-shrink: 0 !important;
    padding: 20px !important;
  }
  .shop-sidebar > div { flex-direction: row !important; flex-wrap: wrap; gap: 6px !important; }
  .shop-sidebar .cat-link { min-width: calc(50% - 6px); justify-content: center; text-align: center; }

  /* Produit : laisse tomber la 2-colonne inline (1.2fr 1fr) */
  .prod-grid { grid-template-columns: 1fr !important; gap: 34px !important; }
  #main-image-viewport { height: min(58vw, 400px) !important; }

  /* Tarifs : grilles de catégories/marques/gammes en 2 colonnes */
  .save-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .save-card { padding: 18px 12px !important; }
  .brand-logo { width: 72px; height: 72px; }

  /* Nouveautés : grille téléphones 2 cols */
  .phones-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 14px; }
  .phone-card { padding: 18px; }

  /* Sections inline 2-colonnes (index contact etc.) → 1 seule colonne */
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Étape de devis inline : résultats empilés */
  .results-header { flex-direction: column; align-items: flex-start !important; gap: 12px !important; }
  .results-header h2 { font-size: 1.4em !important; }
}

/* Très petites grilles → 1 colonne nette */
@media (max-width: 480px) {
  .product-grid, .phones-grid, .save-grid,
  #category-grid, #brand-grid, #gamme-grid, #model-grid {
    grid-template-columns: 1fr !important;
  }
  /* Marques en 2 mini-colonnes (logos) */
  .brand-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .phone-card { padding: 16px; }
  .save-card { padding: 16px 12px !important; }
}

/* ────────────────────────────────────────────────────────────────────────
   4. CARTES : pleine largeur, padding compact, images fluides
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .glass-card {
    border-radius: 18px;
    overflow: hidden;
  }
  /* N'éclate pas les pastilles inline (spans marques de l'index) : max-width seul */
  .product-card, .phone-card, .save-card, .model-card,
  .form-card-neon { width: 100%; }

  /* Contenus longs (about, cgv, privacy) : padding compact */
  section > .container > .glass-card,
  .container .glass-card[style*="max-width"] {
    padding: 26px 20px !important;
  }
  .product-card { padding: 14px; }
  .model-card { height: auto !important; min-height: 200px; }
  .product-img-wrapper { padding: 12px; }
}

/* ────────────────────────────────────────────────────────────────────────
   5. CIBLES TACTILES ≥ 44px (boutons, liens nav, cat-link, petits liens)
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .btn-neon, .btn-neon-filled, .btn-neon-outline, .btn-neon-solid,
  button, input[type="submit"], .cta-button, .btn-primary,
  .cat-link, .back-btn, .save-btn, .product-arrow-btn,
  a[href*="tel:"], a[href*="wa.me"], a[href*="whatsapp"] {
    min-height: 44px;
  }
  .btn-neon, .btn-neon-filled, .btn-neon-outline, .btn-neon-solid {
    font-size: 0.95rem;
    padding: 12px 16px !important;
  }
  .btn-neon-lg { padding: 14px 20px !important; font-size: 1rem; }
  .cta-button { justify-content: center; }
}

/* Boutons pleine largeur sur très petit écran (CTAs héro / formulaires) */
@media (max-width: 480px) {
  .hero-cta { flex-direction: column !important; align-items: stretch !important; width: 100%; }
  .hero-cta .btn-neon, .hero-cta .btn-neon-lg {
    width: 100% !important;
    justify-content: center;
  }
  .cta-btns { flex-direction: column; align-items: stretch; }
  .cta-btns .btn-neon, .cta-btns .btn-neon-filled { width: 100% !important; justify-content: center; }
  .price-row .price { font-size: 1.5em !important; }
}

/* ────────────────────────────────────────────────────────────────────────
   6. TYPOGRAPHIE FLUIDE (clamp) — titres, heros, sections d'inline styles
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero h1, .hero-title, .page-hero h1 {
    font-size: clamp(1.7rem, 6vw, 2.4rem);
    line-height: 1.12;
  }
  .hero p, .hero-subtitle { font-size: 1rem; line-height: 1.5; }
  .hero { padding: 84px 16px 52px; }

  /* Titres inline surchargés (tarifs h1 2.8em, about/cgv/privacy h1 2.5rem) */
  .hero-content h1,
  h1[style*="font-size: 2.8em"], h1[style*="font-size: 2.5rem"] {
    font-size: clamp(1.7rem, 5.5vw, 2.4rem) !important;
    line-height: 1.15;
  }
  .neon-text { font-size: clamp(1.8rem, 5.5vw, 2.5rem) !important; }
  .range-title-wrapper h2 { font-size: 1.4rem !important; }
  .results-header h2 { font-size: 1.3em !important; }
}

/* ────────────────────────────────────────────────────────────────────────
   7. ZONES HÉRO / TITRES DE PAGE : paddings réduits, pas de débordement
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero, .page-hero {
    min-height: 0;
    padding-top: 96px;
  }
  .tarifs-hero-v2, .tarifs-hero-v3,
  .shop-hero { padding-top: 40px !important; }
  /* Nouveautés : bandeau héro compact */
  .hero-header { padding: 34px 14px !important; margin-bottom: 34px; }
  .nouveautes-container { padding: 20px 14px; }
  .price-range { margin-bottom: 44px; }
}

/* ────────────────────────────────────────────────────────────────────────
   8. RECHERCHE : pleine largeur + dropdown collé
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .save-search-box {
    width: 100%;
    max-width: none;
    padding: 4px 14px;
  }
  .save-search-box input { font-size: 0.95rem; }
  .search-dropdown {
    position: static;
    left: 0;
    right: 0;
    width: 100%;
  }
  /* Suivi : barre de recherche (reçu / tél) empilée */
  form[style*="display: flex"],
  form[style*="display:flex"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  form[style*="display: flex"] input,
  form[style*="display: flex"] button,
  form[style*="display:flex"] input,
  form[style*="display:flex"] button {
    width: 100% !important;
  }
}

/* ────────────────────────────────────────────────────────────────────────
   9. TABLEAUX DE TARIFS → défilement horizontal fluide (filet de sécu)
      Les tarifs actuels sont des cartes .price-row (pas de <table> public),
      donc on garde un défilement propre pour les éventuels <table>.
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  table:not(.no-stack) {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  th, td { padding: 12px 10px; }

  /* Rangées de prix : cartes empilées pleine largeur */
  .price-row { flex-direction: column !important; align-items: stretch !important; gap: 12px; text-align: center; }
  .price-row > div { justify-content: center !important; }
  .price-row .badge { margin: 6px auto 0; }
}

/* ────────────────────────────────────────────────────────────────────────
   10. FORMULAIRE DEVIS EXPRESS (formulaire/index.php) — mobile-first natif
       Étapes pleine largeur, champs tactiles, bouton envoyer en pleine largeur.
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .form-card-neon {
    margin: 0 6px;
    padding: 26px 18px !important;
    border-radius: 18px;
    overflow: hidden;
  }
}
@media (max-width: 600px) {
  .form-card-neon { padding: 22px 14px !important; }
  .custom-form .form-row { grid-template-columns: 1fr !important; display: grid; }
  .custom-form input, .custom-form select, .custom-form textarea {
    font-size: 16px; /* évite le zoom iOS */
  }
  .checkbox-group .custom-checkbox { min-height: 44px; align-items: center; }
  .custom-checkbox .checkmark { width: 24px; height: 24px; }
  .cta-button { width: 100% !important; height: 56px; justify-content: center; font-size: 1rem; }
  .alert-error { padding: 14px; }
}

/* ────────────────────────────────────────────────────────────────────────
   11. STEPPER TARIFS (save-stepper) : compact, jamais débordant
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .save-stepper { flex-wrap: wrap; justify-content: center; gap: 4px; margin-bottom: 34px !important; }
  .step-node { width: auto; min-width: 62px; gap: 6px !important; }
  .step-node i { width: 40px; height: 40px; }
  .step-node span { font-size: 0.68em !important; }
  .step-line { width: 18px; }
}
@media (max-width: 480px) {
  .save-stepper { gap: 2px; }
  .step-node { min-width: 56px; }
}

/* ────────────────────────────────────────────────────────────────────────
   12. PIED DE PAGE : colonnes empilées + cibles tactiles
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 18px;
  }
  .footer-grid a, .footer-grid .social-link {
    min-height: 44px;
    padding: 10px 14px;
  }
  .glass-footer { padding: 44px 18px 28px; margin-top: 60px; }
}

/* ────────────────────────────────────────────────────────────────────────
   13. BOUTONS FLOTTANTS / retour-haut : toujours tapables
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  [class*="floating"], [class*="back-to-top"], .mascot-float,
  [class*="quick-"] a {
    width: 52px;
    height: 52px;
    min-width: 44px;
    min-height: 44px;
  }
  .cta-fixed { bottom: 14px; right: 14px; }
}

/* ────────────────────────────────────────────────────────────────────────
   14. MICRO-CORRECTIONS (confort) : pas de débordement résiduel
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #avisCarousel { grid-template-columns: 1fr !important; }
  .gallery-thumbs, [style*="overflow-x: auto"] { -webkit-overflow-scrolling: touch; }
  .thumb { width: 64px !important; height: 64px !important; }
  .inline-flex-wrap, [style*="flex-wrap: wrap"] { gap: 10px; }
}
