/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE.CSS — ThinkTwice v9.1
   Completes mobile/tablet coverage for all pages.
   Loaded last to override inline styles and existing CSS.
   Breakpoints: 480 (phone), 640 (small tablet), 768 (tablet), 1024 (laptop)
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Global ────────────────────────────────────────────────────────── */
html, body { overflow-x: hidden; }
img { max-width: 100%; height: auto; }

/* ── Word-wrap for long emails/URLs ──────────────────────────────── */
.footer-links a,
.footer-links span,
footer a {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ── Tablet ≤ 1024px ──────────────────────────────────────────────── */
@media (max-width: 1024px) {

    /* Footer grids — 2 colonnes */
    .footer-grid,
    .footer-grid-simple {
        grid-template-columns: 1fr 1fr !important;
        gap: 2rem !important;
    }
    .footer-brand { grid-column: span 2; }
    
    /* pq-adv-grid (fonctionnalites.html) — 2 colonnes sur tablette */
    .pq-adv-grid {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* ── Tablet / large phone ≤ 768px ─────────────────────────────────── */
@media (max-width: 768px) {

    /* ── Header ─────────────────────────────────────────────────── */
    .header-container { padding: 0 1rem; }
    .logo img { height: 28px; }
    .header-actions .lang-switch { display: none; }
    .header-actions .btn { padding: 0.5rem 1rem; font-size: 0.82rem; }
    .nav.active {
        max-height: 80vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* ── Mobile dropdown — améliorer le toggle ──────────────────── */
    .nav-dropdown {
        width: 100%;
    }
    .nav-dropdown-toggle {
        width: 100%;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center;
        padding: 0.75rem 1rem !important;
        text-align: left;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    /* Assurer que le menu s'affiche quand actif */
    .nav-dropdown.active .nav-dropdown-menu {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        background: rgba(99, 102, 241, 0.08) !important;
        border-radius: 0.75rem;
        margin-top: 0.5rem;
        padding: 0.5rem !important;
    }
    .nav-dropdown-item {
        padding: 0.75rem 1rem !important;
    }

    /* ── Footer — FORCER 1 colonne sur mobile ───────────────────── */
    .footer-grid,
    .footer-grid-simple,
    footer .footer-grid,
    footer .footer-grid-simple {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    .footer-brand { 
        grid-column: span 1 !important; 
    }
    .footer-bottom {
        flex-direction: column !important;
        text-align: center !important;
        gap: 1rem !important;
    }
    .footer-bottom-left { 
        justify-content: center; 
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .footer-legal {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.8rem !important;
    }
    .social-links { justify-content: center; }

    /* ── Footer (inline-styled on product pages) ───────────────── */
    footer .container > div[style*="grid-template-columns"],
    footer .container > .footer-grid[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    footer div[style*="justify-content:space-between"] {
        flex-direction: column !important;
        gap: 1rem !important;
        text-align: center !important;
    }
    footer div[style*="justify-content:space-between"] > div[style*="display:flex;gap:1.5rem"] {
        justify-content: center !important;
        flex-wrap: wrap !important;
    }

    /* ── 2-col grids ─────────────────────────────────────────────── */
    div[style*="grid-template-columns:repeat(2,1fr)"] {
        grid-template-columns: 1fr !important;
    }
    
    /* ── pq-adv-grid (fonctionnalites.html) — 1 colonne sur mobile ─ */
    .pq-adv-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    .pq-adv-card {
        padding: 1.5rem !important;
    }
    .pq-adv-card h3 {
        font-size: 1rem !important;
    }
    .pq-adv-card p {
        font-size: 0.85rem !important;
    }

    /* ── Timeline stats row (comment-ca-marche.html) ───────────── */
    .ccm-stats-row {
        flex-wrap: wrap !important;
        gap: 1rem !important;
    }
    .ccm-stat {
        flex: 1 1 auto !important;
        min-width: 80px !important;
    }
    .ccm-stat-value {
        font-size: 1.3rem !important;
    }
    .ccm-stat-label {
        font-size: 0.65rem !important;
    }

    /* ── Contact section ───────────────────────────────────────── */
    .contact-grid { gap: 2rem !important; }
    .contact-form .form-row {
        flex-direction: column;
        gap: 0;
    }
    .contact-form .form-group { width: 100%; }

    /* iOS zoom prevention — inputs ≥ 16px */
    input[type="text"], input[type="email"], input[type="tel"],
    input[type="number"], input[type="url"], textarea, select {
        font-size: 16px !important;
    }

    /* ── Buttons — touch-friendly ──────────────────────────────── */
    .btn, .nh-btn-primary, .nh-btn-ghost, .nh-btn-cta,
    .cat-tab, .btn-primary, .btn-secondary {
        min-height: 48px;
    }

    /* ── Product hero ──────────────────────────────────────────── */
    .product-hero { text-align: center; }
    .product-hero-actions { justify-content: center; }
    .product-hero-breadcrumb { justify-content: center; }
    .product-stats-bar { grid-template-columns: 1fr 1fr !important; }

    /* ── Demo page ─────────────────────────────────────────────── */
    .demo-title { font-size: 1.8rem !important; }
    .booking-container { padding: 0 0.5rem; }
    .calendly-inline-widget { min-height: 600px; }

    /* ── CTA flex buttons ──────────────────────────────────────── */
    div[style*="display:flex;gap:1rem;justify-content:center"] {
        flex-direction: column !important;
        align-items: center !important;
    }
    div[style*="display:flex;gap:1rem;justify-content:center"] .btn {
        width: 100%;
        max-width: 320px;
        justify-content: center;
    }
    
    /* ── nh-why-grid (index.html) — 1 colonne sur mobile ────────── */
    .nh-why-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ── Small phone ≤ 480px ──────────────────────────────────────────── */
@media (max-width: 480px) {

    .product-hero h1 { font-size: 1.6rem !important; }
    .product-stats-bar { grid-template-columns: 1fr !important; }
    .demo-title { font-size: 1.4rem !important; }

    .nh-section-title, .section-title {
        font-size: clamp(1.3rem, 6vw, 1.8rem) !important;
    }
    .nh-section-subtitle, .section-subtitle {
        font-size: 0.9rem !important;
    }

    /* Phishing tabs stack vertically */
    .cat-tabs {
        flex-direction: column;
        align-items: stretch;
    }
    .cat-tab { text-align: center; justify-content: center; }

    /* Check strip (formations) */
    .check-strip {
        grid-template-columns: 1fr !important;
        padding: 1.25rem !important;
    }
    
    /* Timeline stats — reduce further on small phones */
    .ccm-stats-row {
        justify-content: center !important;
    }
    .ccm-stat {
        min-width: 70px !important;
    }
    .ccm-stat-value {
        font-size: 1.1rem !important;
    }
    
    /* pq-adv-card — smaller padding on tiny screens */
    .pq-adv-card {
        padding: 1.25rem !important;
    }
    .pq-adv-icon {
        width: 44px !important;
        height: 44px !important;
        font-size: 1rem !important;
    }
}

/* ── Touch devices — no hover effects ─────────────────────────────── */
@media (hover: none) {
    .cursor-follower { display: none !important; }
    .hover-card:hover {
        transform: none !important;
        box-shadow: none !important;
    }
}

/* ── Landscape phone ──────────────────────────────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
    .nh-hero, .product-hero, .sp-hero {
        min-height: auto !important;
        padding-top: 5rem !important;
        padding-bottom: 2rem !important;
    }
}

/* ── Reduced motion (accessibility) ───────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .nh-global-particles, #ambientCanvas { display: none !important; }
}

/* ── Safe area insets (notched phones) ─────────────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
    .header {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    footer { padding-bottom: env(safe-area-inset-bottom); }
    .cookie-banner { padding-bottom: env(safe-area-inset-bottom); }
}

/* ── Print ─────────────────────────────────────────────────────────── */
@media print {
    .header, .cursor-follower, .nh-global-particles,
    #ambientCanvas, .cookie-banner, .nh-marquee { display: none !important; }
    body { background: #fff !important; color: #000 !important; }
    a[href]::after { content: " (" attr(href) ")"; font-size: .8em; color: #666; }
    a[href^="#"]::after, a[href^="javascript"]::after { content: ""; }
}
