/*
 * SHADES — Mobile responsive fixes (global)
 * ------------------------------------------
 * Patch CSS appliqué à toutes les pages pour corriger les pires problèmes
 * d'affichage mobile sur les ~30 pages du site.
 *
 * Stratégie : règles ciblées avec !important pour OVERRIDER les styles
 * desktop existants sans tout réécrire. Trois breakpoints :
 *   - <= 900px : tablette portrait + mobile large
 *   - <= 640px : mobile standard
 *   - <= 380px : mobile compact (iPhone SE)
 */

/* ===================================================================
 *  GLOBAL — Toujours actif (anti-débordement horizontal)
 * =================================================================== */
html, body {
  max-width: 100% !important;
  overflow-x: hidden !important;
}
img, video, iframe, table {
  max-width: 100% !important;
  height: auto;
}
code, pre {
  word-break: break-word;
  white-space: pre-wrap;
}

/* ===================================================================
 *  <= 900px — Tablette portrait + mobile large
 * =================================================================== */
@media (max-width: 900px) {

  /* Conteneurs principaux : padding réduit */
  .hero, .hero-inner, .features, .pricing, .roi-section,
  .contact-section, .cta-section, .services-grid, .container,
  .content, .wrap, section[class*="-section"] {
    padding-left: 18px !important;
    padding-right: 18px !important;
  }

  /* Grilles 5+ colonnes → 2-3 colonnes */
  .services-strip,
  .tl-grid,
  .stat-grid,
  .stats-grid,
  .demo-kpis {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Grilles 4 colonnes → 2 colonnes */
  .sim-cmp-grid,
  .roi-stats,
  .hero-stats {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Grilles 3 colonnes → 1-2 colonnes */
  .features-grid,
  .pricing-grid,
  .testi-grid,
  .tem-grid,
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  /* Hero 2 colonnes → 1 colonne empilée */
  .hero-inner,
  .roi-inner,
  .contact-inner,
  [class*="-inner"][style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }

  /* Tailles de police hero */
  .hero-h1, .hero-title, h1 {
    font-size: clamp(28px, 7vw, 42px) !important;
    line-height: 1.15 !important;
  }
  h2, .section-title, .cta-title {
    font-size: clamp(22px, 5.5vw, 32px) !important;
    line-height: 1.2 !important;
  }
  .hero-sub, .section-sub {
    font-size: 13px !important;
    line-height: 1.6 !important;
  }

  /* Nav : éviter le débordement */
  .nav, nav.nav, .hdr {
    padding-left: 14px !important;
    padding-right: 14px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .nav-links {
    gap: 16px !important;
    flex-wrap: wrap !important;
  }
  .nav-links a {
    font-size: 11px !important;
  }
  .nav-cta {
    padding: 8px 14px !important;
    font-size: 8px !important;
  }

  /* Pill nav flottante : plus discrète */
  #shades-nav-pill {
    bottom: 12px !important;
    right: 12px !important;
    gap: 4px !important;
  }
  #shades-nav-pill a {
    padding: 6px 9px !important;
    font-size: 8px !important;
  }

  /* Modal détail outil : full-screen mobile */
  .tool-modal .tm-card {
    padding: 22px 18px !important;
    max-height: 95vh !important;
  }
  .tool-modal .tm-features {
    grid-template-columns: 1fr !important;
  }
  .tool-modal .tm-name {
    font-size: 24px !important;
  }

  /* Cookie banner : mieux positionné */
  #shades-cookie-banner {
    left: 8px !important;
    right: 8px !important;
    bottom: 8px !important;
    padding: 14px 18px !important;
  }

  /* Tables : scroll horizontal forcé si trop large */
  .table-wrap, table {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Formulaires : champs full-width */
  .form-inp, input[type="text"], input[type="email"], input[type="tel"],
  input[type="password"], select, textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    font-size: 16px !important; /* anti-zoom iOS */
  }

  /* Boutons : full-width sur mobile */
  .btn-primary, .btn-secondary, .form-submit, .btn-action,
  .login-btn, .nav-cta {
    width: auto;
    min-height: 44px; /* touch target Apple HIG */
  }

  /* CTAs hero empilés */
  .hero-actions, .hero-ctas {
    flex-direction: column !important;
    width: 100% !important;
  }
  .hero-actions a, .hero-ctas a {
    width: 100% !important;
    text-align: center !important;
  }

  /* Footer : layout vertical */
  footer, .foot, .footer {
    flex-direction: column !important;
    text-align: center !important;
    padding: 24px 18px !important;
    gap: 14px !important;
  }
  .foot-links {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 12px !important;
  }

  /* Padding sections */
  .hero {
    min-height: auto !important;
    padding-top: 100px !important;
    padding-bottom: 50px !important;
  }
  .features, .pricing, .roi-section, .contact-section, .cta-section {
    padding-top: 60px !important;
    padding-bottom: 60px !important;
  }
}

/* ===================================================================
 *  <= 640px — Mobile standard
 * =================================================================== */
@media (max-width: 640px) {

  /* Conteneurs : encore plus compacts */
  .hero, .features, .pricing, .roi-section,
  .contact-section, .container, .content, .wrap {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  /* Grilles 2 colonnes → 1 colonne */
  .services-strip,
  .tl-grid,
  .stat-grid,
  .stats-grid,
  .demo-kpis,
  .sim-cmp-grid,
  .roi-stats,
  .hero-stats,
  .services-grid,
  .info-grid {
    grid-template-columns: 1fr !important;
  }

  /* Hero compact */
  .hero-h1, .hero-title, h1 {
    font-size: clamp(24px, 8vw, 36px) !important;
  }

  /* Cartes feature : padding réduit */
  .feature-card {
    padding: 18px !important;
  }

  /* Nav logo plus petit */
  .nav-logo-text, .logo {
    font-size: 15px !important;
  }
  .nav-badge {
    font-size: 7px !important;
    padding: 2px 6px !important;
  }

  /* Cacher les éléments nav non-essentiels */
  .nav-links a:not(.nav-cta) {
    display: none;
  }

  /* CTA banner pricing reduit */
  .pricing-card {
    padding: 24px 20px !important;
  }

  /* Tarif prix : réduit */
  .pricing-card .price, [class*="pricing"] .num {
    font-size: 36px !important;
  }
}

/* ===================================================================
 *  <= 380px — Mobile compact (iPhone SE, anciens Android)
 * =================================================================== */
@media (max-width: 380px) {

  /* Tailles ultra-compactes */
  body {
    font-size: 14px !important;
  }
  .hero-h1, .hero-title, h1 {
    font-size: 22px !important;
  }
  h2, .section-title {
    font-size: 19px !important;
  }
  .nav, .hdr {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
  .nav-cta {
    padding: 6px 10px !important;
  }
}

/* ===================================================================
 *  PRINT — Optimisé pour l'impression
 * =================================================================== */
@media print {
  #shades-nav-pill, #shades-cookie-banner, .nav, .nav-cta, footer {
    display: none !important;
  }
  body {
    background: white !important;
    color: black !important;
  }
  .hero, .features, .pricing {
    padding: 20px !important;
  }
}
