/* Mobile-specific optimizations */

/* Prevent horizontal scrolling */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* Mobile popup optimizations */
@media (max-width: 768px) {
    .mobile-popup-overlay {
        padding: 0.5rem;
    }
    
    .mobile-popup {
        max-width: calc(100% - 1rem);
        margin: 0;
    }
    
    .popup-header {
        padding: 1.25rem 1.25rem 0 1.25rem;
    }
    
    .popup-header h3 {
        font-size: 1.125rem;
    }
    
    .popup-content {
        padding: 0 1.25rem 1.25rem 1.25rem;
    }
    
    .popup-content p {
        font-size: 0.875rem;
        margin-bottom: 1.25rem;
    }
    
    .email-input-popup {
        padding: 0.875rem 1rem;
        font-size: 16px;
        min-height: 48px;
    }
    
    .popup-close {
        min-width: 44px;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .mobile-popup-overlay {
        padding: 0.25rem;
    }
    
    .mobile-popup {
        max-width: calc(100% - 0.5rem);
    }
    
    .popup-header {
        padding: 1rem 1rem 0 1rem;
    }
    
    .popup-header h3 {
        font-size: 1rem;
    }
    
    .popup-content {
        padding: 0 1rem 1rem 1rem;
    }
    
    .popup-content p {
        font-size: 0.8rem;
        margin-bottom: 1rem;
    }
    
    .email-input-popup {
        padding: 0.75rem 0.875rem;
        font-size: 16px;
        min-height: 44px;
    }
}

/* Mobile viewport optimizations */
@media (max-width: 768px) {
    /* Improve text readability */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }
    
    /* Optimize images */
    img {
        max-width: 100%;
        height: auto;
        display: block;
    }
    
    /* Improve form elements */
    input, button, select, textarea {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        border-radius: 8px;
    }
    
    /* Optimize buttons for touch */
    .btn {
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Compact mobile navigation */
    .navbar .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }
    
    .nav-brand {
        display: flex;
        align-items: center;
        gap: 0.375rem;
        flex-shrink: 0;
        min-width: 0;
        margin-left: 0;
        margin-right: auto;
        justify-content: flex-start;
    }
    
    .logo {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }
    
    .brand-text {
        font-size: 0.875rem;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .nav-actions {
        flex-shrink: 0;
        margin-left: auto;
        margin-right: 0;
        display: flex;
        align-items: center;
    }
    
    .nav-actions .btn {
        min-height: 36px;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Improve scrolling */
    * {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
    
    /* Optimize for mobile browsers */
    body {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    /* Reduce padding and margins */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* Ultra compact navigation */
    .navbar .container {
        gap: 0.375rem;
        padding: 0.5rem 0.75rem;
    }
    
    .nav-brand {
        gap: 0.25rem;
    }
    
    .logo {
        width: 18px;
        height: 18px;
    }
    
    .brand-text {
        font-size: 0.75rem;
    }
    
    .nav-actions .btn {
        padding: 0.375rem 0.625rem;
        font-size: 0.7rem;
        min-height: 28px;
    }
    
    /* Ultra small devices */
    @media (max-width: 360px) {
        .navbar .container {
            padding: 0.375rem 0.5rem;
            gap: 0.25rem;
        }
        
        .nav-brand {
            gap: 0.125rem;
        }
        
        .logo {
            width: 16px;
            height: 16px;
        }
        
        .brand-text {
            font-size: 0.7rem;
        }
        
        .nav-actions .btn {
            padding: 0.25rem 0.5rem;
            font-size: 0.65rem;
            min-height: 24px;
        }
    }
    
    /* Optimize hero section */
    .hero {
        padding-top: 8rem;
        padding-bottom: 4rem;
        min-height: 70vh;
        margin-top: 0;
    }
    
    .hero-content {
        padding-top: 1rem;
    }
    
    .hero-title {
        font-size: 1.75rem;
        line-height: 1.2;
        margin-bottom: 0.75rem;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
        line-height: 1.4;
        margin-bottom: 1.5rem;
    }
    
    /* Optimize mobile CTA */
    .mobile-cta {
        padding: 0.75rem;
    }
    
    .email-signup-mobile {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .email-signup-mobile input[type="email"] {
        min-height: 44px;
        padding: 0.75rem 1rem;
        font-size: 16px;
    }
    
    .email-signup-mobile .btn {
        min-height: 44px;
        padding: 0.75rem 1rem;
        width: 100%;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 2rem 0 3rem;
        min-height: 50vh;
    }
    
    .hero-morph-container {
        width: 240px;
        height: 200px;
    }
    
    .section {
        padding: 3rem 0;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        padding: 1rem 1.5rem;
    }
    
    .email-input,
    .email-input-large {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .faq-question {
        min-height: 44px;
    }
    
    .tab-btn {
        min-height: 44px;
    }
    
    .hero-indicator {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .hero-morph-step {
        transition: opacity 0.3s ease;
    }
    
    .btn::before {
        display: none;
    }
}


/* Print styles */
@media print {
    .navbar,
    .mobile-cta,
    .btn,
    .email-signup-nav,
    .email-signup-hero,
    .email-signup-integration,
    .email-signup-final,
    .email-signup-mobile {
        display: none !important;
    }
    
    .hero {
        background: white !important;
        color: black !important;
    }
    
    .hero-title,
    .hero-subtitle {
        color: black !important;
    }
    
    section {
        page-break-inside: avoid;
    }
}

/* Mobile performance optimizations */
@media (max-width: 768px) {
    /* Reduce animation complexity on mobile */
    .hero::before,
    .hero::after {
        animation: none;
    }
    
    .hero-morph-container {
        animation: none;
    }
    
    .step-circle {
        animation: none;
    }
    
    .brain-circle {
        animation: none;
    }
    
    .data-chip {
        animation: none;
    }
    
    /* Optimize images */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Improve text readability */
    .hero-title,
    .hero-subtitle,
    .section-title,
    .step-title,
    .benefit-card h3,
    .privacy-content h3,
    .faq-question {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }
    
    /* Improve form elements */
    input,
    button,
    select,
    textarea {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        border-radius: var(--radius-lg);
    }
    
    /* Improve scrolling */
    * {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
    
    /* Optimize for mobile browsers */
    body {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
    
    /* Improve touch feedback */
    .btn:active,
    .faq-question:active,
    .tab-btn:active,
    .hero-indicator:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* Mobile-specific spacing */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Mobile hero improvements */
    .hero-content {
        gap: 2rem;
    }
    
    .hero-text {
        text-align: center;
    }
    
    .hero-ctas {
        justify-content: center;
    }
    
    /* Mobile section improvements */
    .how-it-works,
    .benefits,
    .free-integration,
    .privacy,
    .faq,
    .final-cta {
        padding: 4rem 0;
    }
    
    /* Mobile process improvements */
    .process-step {
        margin-bottom: 2rem;
    }
    
    .step-info {
        max-width: none;
        padding: 0 1rem;
    }
    
    /* Mobile integration improvements */
    .integration-benefits {
        margin-bottom: 2rem;
    }
    
    .benefit-item {
        margin-bottom: 1.5rem;
    }
    
    /* Mobile FAQ improvements */
    .faq-item {
        margin-bottom: 1rem;
    }
    
    .faq-question {
        font-size: 1rem;
        line-height: 1.4;
    }
    
    .faq-answer p {
        font-size: 0.875rem;
        line-height: 1.5;
    }
    
    /* Mobile final CTA improvements */
    .final-cta-content {
        padding: 0 1rem;
    }
    
    .final-cta-content h2 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .final-cta-content p {
        font-size: 1rem;
        line-height: 1.5;
    }
}
