/**
 * MOBILE LAYOUT FIXES - Perfect Mobile Experience
 * Fixes: No cropping, perfect alignment, proper line breaks, consistent spacing
 */

/* ========================================
   CRITICAL: Prevent Any Horizontal Overflow
======================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* ========================================
   FIX 1: NO CROPPING - Perfect Container System
======================================== */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem; /* 16px safe padding on all sides */
    box-sizing: border-box;
    overflow-x: hidden;
}

/* All sections maintain 16px padding */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem !important;  /* 16px */
        padding-right: 1rem !important; /* 16px */
    }
    
    /* Ensure all child elements respect container bounds */
    .container > * {
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
}

/* ========================================
   FIX 2: PERFECT ALIGNMENT - Center Everything
======================================== */

/* Center align all text elements on mobile */
@media (max-width: 768px) {
    .hero-text,
    .section-header,
    .section-title,
    .section-subtitle,
    .hero-title,
    .hero-description,
    .hero-badge {
        text-align: center !important;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* Center align stats and CTAs */
    .hero-stats,
    .hero-ctas {
        justify-content: center;
        align-items: center;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ========================================
   FIX 3: HEADLINE LINE BREAK - Perfect Typography
======================================== */

.hero-title {
    font-size: clamp(1.5rem, 6vw, 4rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    text-align: center;
    margin: 0 auto 1rem;
    padding: 0 0.5rem;
    max-width: 100%;
    color: #111827;
    word-spacing: normal;
    hyphens: none;
    overflow-wrap: normal;
    white-space: normal;
}

/* Keep "Sales Team" together and make it green */
.hero-title .highlight {
    color: #22c55e;
    white-space: nowrap; /* Prevents "Sales Team" from breaking */
    display: inline;
}

/* Mobile-specific headline sizing */
@media (max-width: 375px) {
    .hero-title {
        font-size: 1.4rem; /* 22.4px */
        line-height: 1.3;
        padding: 0 0.25rem;
    }
}

@media (min-width: 376px) and (max-width: 480px) {
    .hero-title {
        font-size: 1.6rem; /* 25.6px */
        line-height: 1.3;
    }
}

@media (min-width: 481px) and (max-width: 640px) {
    .hero-title {
        font-size: 1.8rem; /* 28.8px */
        line-height: 1.3;
    }
}

@media (min-width: 641px) and (max-width: 768px) {
    .hero-title {
        font-size: 2rem; /* 32px */
        line-height: 1.25;
    }
}

/* ========================================
   FIX 4: CONSISTENT SPACING - Perfect Rhythm
======================================== */

/* Mobile section spacing - consistent throughout */
@media (max-width: 768px) {
    .hero {
        padding: 70px 0 2.5rem;
    }
    
    .trust-section {
        padding: 2.5rem 0;
        margin-bottom: 0;
    }
    
    .problem-section {
        padding: 2.5rem 0;
        margin-bottom: 0;
    }
    
    .solution-section {
        padding: 2.5rem 0;
        margin-bottom: 0;
    }
    
    .video-demos-section {
        padding: 2.5rem 0;
        margin-bottom: 0;
    }
    
    .pricing-section {
        padding: 2.5rem 0;
        margin-bottom: 0;
    }
    
    .comparison-section {
        padding: 2.5rem 0;
        margin-bottom: 0;
    }
    
    .roi-calculator-section {
        padding: 2.5rem 0;
        margin-bottom: 0;
    }
    
    .audience-section {
        padding: 2.5rem 0;
        margin-bottom: 0;
    }
    
    .process-section {
        padding: 2.5rem 0;
        margin-bottom: 0;
    }
    
    .faq-section {
        padding: 2.5rem 0;
        margin-bottom: 0;
    }
    
    .cta-section {
        padding: 2.5rem 0;
        margin-bottom: 0;
    }
    
    /* Section header spacing */
    .section-header {
        margin-bottom: 2rem;
        padding: 0 1rem;
    }
    
    /* Gap between section elements */
    .problems-grid,
    .solutions-grid,
    .videos-grid,
    .pricing-grid,
    .comparison-grid,
    .audience-grid,
    .process-timeline {
        gap: 1.5rem;
    }
}

/* ========================================
   ADDITIONAL MOBILE OPTIMIZATIONS
======================================== */

/* Hero section specific fixes */
@media (max-width: 768px) {
    .hero-content {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        width: 100%;
        align-items: center;
        text-align: center;
    }
    
    .hero-text {
        width: 100%;
        max-width: 100%;
    }
    
    .hero-visual {
        width: 100%;
        max-width: 100%;
        margin-top: 1rem;
    }
    
    .hero-badge {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }
    
    .hero-description {
        font-size: 0.95rem;
        line-height: 1.6;
        color: #4b5563;
        margin-bottom: 1.5rem;
        max-width: 100%;
    }
    
    .hero-stats {
        display: flex;
        justify-content: space-around;
        gap: 1rem;
        margin-bottom: 1.5rem;
        flex-wrap: wrap;
        width: 100%;
    }
    
    .stat-item {
        text-align: center;
        flex: 0 1 30%;
        min-width: 80px;
    }
    
    .stat-number {
        font-size: 1.5rem;
        font-weight: 800;
        color: #22c55e;
        display: block;
        line-height: 1;
        margin-bottom: 0.25rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
        color: #6b7280;
        font-weight: 500;
    }
    
    .hero-ctas {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
        align-items: center;
        margin-top: 1rem;
    }
    
    .hero-ctas .btn {
        width: 100%;
        max-width: 300px;
        min-height: 50px;
        font-size: 0.95rem;
        padding: 0.75rem 1.5rem;
        justify-content: center;
        text-align: center;
    }
}

/* Video and chat demo positioning */
@media (max-width: 768px) {
    .video-container {
        position: relative;
        width: 100%;
        border-radius: 1rem;
        overflow: hidden;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    }
    
    .video-container video {
        width: 100%;
        height: auto;
        display: block;
    }
    
    .video-overlay {
        position: static;
        margin-top: 1rem;
        width: 100%;
        max-width: 100%;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        border-radius: 0.75rem;
        padding: 0;
        overflow: hidden;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    
    .demo-chat {
        width: 100%;
    }
    
    .chat-messages {
        padding: 1rem;
        max-height: 400px;
        overflow-y: auto;
    }
    
    .message-bubble {
        font-size: 0.85rem;
        line-height: 1.4;
        max-width: 75%;
        padding: 0.5rem 0.75rem;
    }
}

/* Trust badges mobile layout */
@media (max-width: 768px) {
    .trust-badges {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0 1rem;
    }
    
    .trust-badge {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        padding: 1rem;
        text-align: center;
    }
}

/* Card layouts mobile */
@media (max-width: 768px) {
    .problems-grid,
    .solutions-grid,
    .pricing-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .problem-card,
    .solution-card,
    .pricing-card {
        margin: 0;
        padding: 1.5rem;
    }
}

/* Comparison section mobile */
@media (max-width: 768px) {
    .comparison-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .comparison-card {
        padding: 1.5rem;
    }
}

/* Calculator mobile layout */
@media (max-width: 768px) {
    .calculator-container {
        display: grid;
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .calculator-inputs,
    .calculator-results {
        width: 100%;
    }
}

/* Videos grid mobile */
@media (max-width: 768px) {
    .videos-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .video-card {
        width: 100%;
    }
}

/* Process timeline mobile */
@media (max-width: 768px) {
    .process-timeline {
        display: grid;
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Audience grid mobile */
@media (max-width: 768px) {
    .audience-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .audience-badge {
        font-size: 0.85rem;
        padding: 0.75rem 0.5rem;
    }
}

/* FAQ mobile */
@media (max-width: 768px) {
    .faq-container {
        padding: 0 1rem;
    }
    
    .faq-item {
        margin-bottom: 1rem;
    }
    
    .faq-question {
        padding: 1rem;
        font-size: 0.95rem;
    }
}

/* CTA section mobile */
@media (max-width: 768px) {
    .cta-content {
        padding: 0 1rem;
    }
    
    .cta-title {
        font-size: 1.5rem;
        line-height: 1.3;
        margin-bottom: 1rem;
    }
    
    .cta-description {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }
    
    .cta-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }
    
    .cta-buttons .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .urgency-indicators {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 2rem;
    }
}

/* ========================================
   PREVENT ALL POSSIBLE OVERFLOW SOURCES
======================================== */

@media (max-width: 768px) {
    /* Prevent images from overflowing */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Prevent videos from overflowing */
    video {
        max-width: 100%;
        height: auto;
    }
    
    /* Prevent buttons from overflowing */
    .btn,
    .nav-cta-btn,
    button {
        max-width: 100%;
        word-wrap: break-word;
    }
    
    /* Prevent long text from overflowing */
    p, span, div, h1, h2, h3, h4, h5, h6 {
        overflow-wrap: break-word;
        word-wrap: break-word;
        hyphens: auto;
        max-width: 100%;
    }
    
    /* Prevent tables from overflowing */
    table {
        max-width: 100%;
        overflow-x: auto;
        display: block;
    }
    
    /* Prevent pre and code blocks from overflowing */
    pre, code {
        max-width: 100%;
        overflow-x: auto;
        word-wrap: break-word;
    }
}

/* ========================================
   TOUCH-FRIENDLY MOBILE INTERACTIONS
======================================== */

@media (max-width: 768px) {
    /* Minimum touch targets */
    .btn,
    .nav-cta-btn,
    .faq-question,
    .nav-link {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Prevent text selection on interactive elements */
    .btn,
    .nav-cta-btn,
    .faq-question {
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Improve input field sizing */
    input,
    textarea,
    select {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px;
    }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
======================================== */

@media (max-width: 768px) {
    /* Enable hardware acceleration */
    .video-container,
    .hero-visual,
    .video-overlay,
    .btn {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    /* Smooth scrolling */
    html {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}
