/* ====================================
   RESPONSIVE MOBILE FIX - EXPERT
   ==================================== */

/* Prevent all elements from overflowing */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Débordement global (prévention) */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Force responsive containers */
.container,
.hero-content,
.services-grid,
.why-grid,
.portfolio-grid,
.contact-content,
.footer-content {
    max-width: 100%;
    overflow-x: hidden;
}

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

@media (max-width: 768px) {
    table {
        font-size: 0.875rem;
    }
}

/* Force wrap long text */
h1, h2, h3, h4, h5, h6,
p, li, span, a {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Responsive Embeds (videos, iframes) */
iframe, 
embed, 
object,
video {
    max-width: 100%;
    height: auto;
}

/* ====================================
   TYPOGRAPHIE MOBILE OPTIMISÉE
   ==================================== */

/* Mobile (320px - 480px) */
@media (max-width: 480px) {
    h1, .hero-title {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
        padding: 0 8px;
    }
    
    h2 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
        padding: 0 8px;
    }
    
    h3 {
        font-size: 1.25rem !important;
        line-height: 1.4 !important;
    }
    
    p {
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }
    
    .gradient-text {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
        display: block;
    }
    
    .hero-description {
        font-size: 0.9375rem !important;
        line-height: 1.6 !important;
        padding: 0 8px;
    }
}

/* Tablette (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    h1, .hero-title {
        font-size: 2rem !important;
        line-height: 1.3 !important;
    }
    
    h2 {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
    }
    
    .gradient-text {
        font-size: 2rem !important;
        line-height: 1.3 !important;
    }
}

/* ====================================
   BOUTONS & CTAs MOBILE
   ==================================== */

@media (max-width: 768px) {
    .hero-cta,
    .cta-buttons,
    .ai-cta-buttons,
    .hero-cta-modern {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }
    
    .hero-cta .btn,
    .cta-buttons .btn,
    .ai-cta-buttons .btn,
    .btn-modern-primary,
    .btn-modern-secondary {
        width: 100%;
        padding: 14px 24px;
        font-size: 1rem;
        text-align: center;
    }
}

/* ====================================
   HERO SECTION MOBILE
   ==================================== */

@media (max-width: 768px) {
    .hero {
        padding: 100px 0 60px !important;
    }
    
    .hero-badge {
        font-size: 0.8125rem;
        padding: 8px 16px;
        white-space: normal;
        text-align: center;
    }
    
    .hero-stats-modern {
        flex-direction: column;
        gap: 12px;
    }
    
    .stat-card-modern {
        width: 100%;
        padding: 16px;
    }
}

/* Fix for comparison tables */
.comparison-table,
.comparison-row {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .comparison-table {
        display: block;
        width: 100%;
    }
    
    .comparison-col {
        min-width: 100px;
        font-size: 0.875rem;
        padding: 12px 8px;
    }
}

/* Fix for service features lists */
.service-features {
    width: 100%;
    padding-left: 0;
}

.service-features li {
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Fix for logo images */
.logo img,
.footer-logo img {
    max-height: 45px;
    width: auto;
}

@media (max-width: 480px) {
    .logo img {
        max-height: 35px;
    }
}

/* Fix for portfolio images */
.portfolio-item img,
.about-image img,
.hero-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Fix for form inputs */
input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
select {
    max-width: 100%;
    width: 100%;
}

/* Éviter le zoom iOS */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Fix for badges and tags */
.badge,
.tag,
.service-badge,
.hero-badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 480px) {
    .badge,
    .tag {
        font-size: 0.8125rem;
        padding: 6px 12px;
    }
}

/* Fix for grid layouts on very small screens */
@media (max-width: 360px) {
    .container {
        padding: 0 8px;
    }
    
    .hero {
        padding: 90px 0 30px;
    }
    
    section {
        padding: 40px 0;
    }
    
    .service-card,
    .contact-form {
        padding: 20px;
    }
}

/* Touch Targets (Accessibilité) */
@media (max-width: 768px) {
    a, button {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
