/* ==============================================
   AGENT #21 — RESPONSIVE FIX — tourak-digital.com
   Date: 2026-06-06
   Scope: assets/css/ uniquement
   ============================================== */

/* -----------------------------------------------
   1. TAP TARGETS — Tous les éléments interactifs
      doivent faire >= 44px (WCAG 2.5.5)
   ----------------------------------------------- */
@media (max-width: 991px) {
  /* Boutons principaux */
  .btn,
  button[type="submit"],
  input[type="submit"] {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Liens de navigation */
  .nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Formulaire devis rapide (services.css) */
  .quick-quote-form input,
  .quick-quote-form select,
  .quick-quote-form textarea {
    min-height: 44px;
    padding: 12px 16px;
    box-sizing: border-box;
  }

  /* Toggle hamburger */
  .nav-toggle {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* -----------------------------------------------
   2. OVERFLOW HORIZONTAL — Empêcher le scroll X
   ----------------------------------------------- */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* Images fluides globales (sécurité) */
img, video, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

/* Tables responsives */
table {
  max-width: 100%;
  overflow-x: auto;
  display: block;
}

/* -----------------------------------------------
   3. SERVICES.CSS — Manques responsive corrigés
   ----------------------------------------------- */
@media (max-width: 991px) {
  /* Grille avantages avec minmax trop grand */
  .advantage-grid,
  .features-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
  }

  /* Timeline méthodologie */
  .methodology-timeline {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  /* Services showcase — déjà en 1col mais ajout padding */
  .services-showcase {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .service-showcase-card {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem 1rem;
  }

  /* Type cards — grille 1 colonne */
  .types-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Advantage cards */
  .advantage-grid {
    grid-template-columns: 1fr;
  }

  /* Formulaire contact rapide */
  .quick-quote-form {
    padding: 1.25rem;
  }
  .quick-quote-form .form-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .quick-quote-form select,
  .quick-quote-form input,
  .quick-quote-form textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Hero service */
  .service-title {
    font-size: clamp(1.6rem, 6vw, 2.2rem);
    word-break: break-word;
    hyphens: auto;
  }
  .service-hero {
    padding: 80px 0 60px;
  }
  .service-hero-content {
    max-width: 100%;
    padding: 0 1rem;
  }

  /* FAQ */
  .faq-list {
    max-width: 100%;
    padding: 0;
    margin-top: 2rem;
  }
  .faq-question {
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 1rem 1.25rem;
  }

  /* CTA content */
  .cta-content {
    max-width: 100%;
    padding: 0 1rem;
  }
  .cta-content h2 {
    font-size: clamp(1.4rem, 5vw, 2rem);
  }

  /* Barre sticky bottom déjà dans mobile-fix.css — harmonie */
  .mobile-contact-bar a {
    font-size: 0.8rem;
    padding: 10px 8px;
    gap: 6px;
  }
}

@media (max-width: 480px) {
  /* Hero titre services small phone */
  .service-title {
    font-size: clamp(1.4rem, 8vw, 1.9rem);
  }

  /* Boutons pleine largeur sur très petit écran */
  .service-hero .btn,
  .cta-content .btn {
    width: 100%;
    justify-content: center;
  }

  /* Cards services internes — réduire padding */
  .type-card,
  .advantage-card {
    padding: 1.25rem 1rem;
  }
}

/* -----------------------------------------------
   4. BARRE DE CONTACT MOBILE — safe-area
   ----------------------------------------------- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .mobile-contact-bar {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
}

/* -----------------------------------------------
   5. TEXTE — Empêcher overflow sur petit écran
   ----------------------------------------------- */
@media (max-width: 768px) {
  h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
  }

  p, li {
    overflow-wrap: break-word;
  }

  /* URLs/liens longs */
  a {
    overflow-wrap: break-word;
    word-break: break-word;
  }
}

/* -----------------------------------------------
   6. LIGHT MODE — Fix texte invisible services.css
      (Complète tk-unified.css — éléments manquants)
   ----------------------------------------------- */
[data-theme="light"] .timeline-step h3,
[data-theme="light"] .showcase-content h2,
[data-theme="light"] .contact-option,
[data-theme="light"] .contact-option h3,
[data-theme="light"] .tech-item span {
  color: #1a1a2e !important;
}

[data-theme="light"] .showcase-list li {
  color: #4a4a5a !important;
}

[data-theme="light"] .quick-quote-form input,
[data-theme="light"] .quick-quote-form select,
[data-theme="light"] .quick-quote-form textarea {
  color: #1a1a2e !important;
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .quick-quote-form input::placeholder,
[data-theme="light"] .quick-quote-form textarea::placeholder {
  color: #9ca3af !important;
}

/* -----------------------------------------------
   7. TABLETTE (768-991px) — Ajustements manquants
   ----------------------------------------------- */
@media (min-width: 769px) and (max-width: 991px) {
  /* Grilles 2 colonnes pour tablette portrait */
  .types-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .advantage-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Nav phone visible tablette */
  .nav-phone {
    display: flex !important;
  }
}

/* -----------------------------------------------
   8. CORRECTIFS AUDIT MOBILE 2026-06-09 (LOT fix-mobile-com)
      Scope strict: assets/css/ — corrige les bugs CSS de
      vms/audit-mobile-com.md (B3,B6,B7,B8,B9,B12,B13,B18)
   ----------------------------------------------- */

/* B3 — container width:100% + box-sizing : anti-overflow horizontal
   (le container des pages services etait max-width sans width:100%) */
.container,
.service-hero-content,
.cta-content,
.footer-grid,
.hero-content {
  width: 100%;
  box-sizing: border-box;
}

/* Securite anti-debordement : aucun enfant direct ne depasse le viewport */
@media (max-width: 991px) {
  body * {
    max-width: 100%;
  }
  /* exceptions : carrousels/sliders concus pour deborder en interne
     (clippes par overflow:hidden du parent) */
  .clients-track,
  .clients-slider .clients-track,
  .marquee-track {
    max-width: none;
  }
}

/* B6 — theme-toggle tap target >= 44px (etait 40x40 fixe dans style.css) */
@media (max-width: 991px) {
  .theme-toggle {
    min-width: 44px !important;
    min-height: 44px !important;
    width: 44px !important;
    height: 44px !important;
  }
}

/* B7 — hero padding-top >= hauteur navbar fixe : le H1 ne doit pas
   passer sous la barre de navigation. mobile-fix.css force padding:40px 0
   a 768px ; on retablit un padding-top suffisant sans casser le 0 lateral. */
@media (max-width: 768px) {
  .hero {
    padding-top: 96px !important;
    padding-bottom: 36px !important;
  }
}
@media (max-width: 480px) {
  .hero {
    padding-top: 92px !important;
  }
}
@media (max-width: 360px) {
  .hero {
    padding-top: 84px !important;
  }
}

/* B8 — stat-label min 12px (etait 0.7rem = 11.2px, sous le seuil lisibilite) */
@media (max-width: 768px) {
  .hero-stats .stat-label,
  .stat-label {
    font-size: 0.75rem !important; /* 12px */
    line-height: 1.3 !important;
  }
}

/* B9 — service-desc ne doit pas etre masquee sur petit ecran
   (style.css mettait display:none a <=480px -> contenu manquant) */
@media (max-width: 480px) {
  .service-desc {
    display: block !important;
    font-size: 0.8rem !important;
    line-height: 1.45 !important;
  }
}

/* B12 — boutons CTA hero en colonne pleine largeur sur mobile
   (.hero-cta passe deja en column ; on complete .cta-buttons + largeur) */
@media (max-width: 768px) {
  .hero-cta,
  .cta-buttons {
    flex-direction: column !important;
    align-items: center !important;
    gap: 12px !important;
  }
  .hero-cta .btn,
  .cta-buttons .btn {
    width: 100%;
    max-width: 320px;
    min-height: 48px;
  }
}

/* B13 — footer 2 colonnes propres en tablette, 1 colonne en mobile.
   Reduit le gap pour eviter colonnes trop etroites entre 576-768px. */
@media (max-width: 768px) {
  .footer-grid,
  .footer-grid-extended {
    grid-template-columns: 1fr 1fr !important;
    gap: 24px !important;
  }
}
@media (max-width: 480px) {
  .footer-grid,
  .footer-grid-extended {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
}

/* B18 — eviter le chevauchement scroll-to-top / whatsapp-float au pouce.
   style.css positionne deja scroll-to-top a bottom:80px ; on garantit que
   le whatsapp reste en bas a droite distinct et au-dessus de la barre mobile. */
@media (max-width: 768px) {
  .scroll-to-top {
    bottom: 84px !important;
    right: 16px !important;
    z-index: 1001 !important;
  }
  .whatsapp-float {
    bottom: 20px !important;
    right: 16px !important;
  }
}

/* Securite supplementaire : padding body si barre de contact mobile presente
   (couvre les pages qui chargent responsive-fix.css mais pas mobile-fix.css) */
@media (max-width: 768px) {
  body.has-mobile-bar {
    padding-bottom: calc(75px + env(safe-area-inset-bottom)) !important;
  }
}
