/* ═══════════════════════════════════════════════════════════════
   🚨 CRITICAL FIXES - iPhone Issues
   1. Hamburger menu visibility
   2. Countdown layout
   3. Performance optimization
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   🍔 FIX 1: HAMBURGER MENU - ALWAYS VISIBLE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 428px) and (orientation: portrait) {
    
    /* Make hamburger FIXED and ALWAYS visible */
    .hamburger {
        display: flex !important;
        position: fixed !important;
        top: 1rem !important;
        right: 1rem !important;
        width: 56px !important;
        height: 56px !important;
        background: rgba(10, 15, 25, 0.95) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        border: 3px solid rgba(255, 255, 255, 0.35) !important;
        border-radius: 14px !important;
        padding: 14px !important;
        z-index: 9999 !important;
        box-shadow: 
            0 8px 24px rgba(0, 0, 0, 0.7),
            0 4px 12px rgba(0, 0, 0, 0.5),
            inset 0 1px 2px rgba(255, 255, 255, 0.15) !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
        flex-direction: column !important;
        justify-content: space-around !important;
        align-items: center !important;
    }
    
    .hamburger:active {
        transform: scale(0.92) !important;
        box-shadow: 
            0 4px 16px rgba(0, 0, 0, 0.7),
            inset 0 1px 2px rgba(255, 255, 255, 0.15) !important;
    }
    
    .hamburger span {
        display: block !important;
        width: 28px !important;
        height: 3.5px !important;
        background: white !important;
        border-radius: 2px !important;
        transition: all 0.3s ease !important;
    }
    
    /* Hamburger X animation when active */
    .hamburger.active span:nth-child(1) {
        transform: translateY(11px) rotate(45deg) !important;
    }
    
    .hamburger.active span:nth-child(2) {
        opacity: 0 !important;
        transform: translateX(-20px) !important;
    }
    
    .hamburger.active span:nth-child(3) {
        transform: translateY(-11px) rotate(-45deg) !important;
    }
    
    /* Ensure hamburger is above everything */
    .main-nav {
        position: relative;
        z-index: 9998;
    }
}

/* ═══════════════════════════════════════════════════════════════
   ⏰ FIX 2: COUNTDOWN - FULL WIDTH, NOT CUT OFF
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 428px) and (orientation: portrait) {
    
    .countdown {
        padding: 3.5rem 1.5rem !important;
        overflow: visible !important;
    }
    
    .countdown h2 {
        font-size: 2.2rem !important;
        font-weight: 900 !important;
        margin-bottom: 2.5rem !important;
        text-align: center !important;
    }
    
    /* Countdown timer - FULL WIDTH */
    .countdown-timer {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 1.5rem !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto 3rem auto !important;
        overflow: visible !important;
    }
    
    /* Each countdown item - VISIBLE */
    .countdown-item {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 80px !important;
        flex: 0 0 auto !important;
        background: rgba(0, 149, 219, 0.1) !important;
        padding: 1.2rem 0.8rem !important;
        border-radius: 12px !important;
        border: 2px solid rgba(0, 149, 219, 0.3) !important;
    }
    
    /* Numbers - BIG and VISIBLE */
    .countdown-number {
        font-size: 3.5rem !important;
        font-weight: 900 !important;
        line-height: 1 !important;
        color: var(--flyer-blue, #0095DB) !important;
        text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3) !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* Labels - CLEAR */
    .countdown-label {
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        letter-spacing: 1px !important;
        text-transform: uppercase !important;
        color: #333 !important;
    }
    
    /* Register button in countdown */
    .countdown-register,
    .countdown .register-btn {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   ⚡ FIX 3: PERFORMANCE OPTIMIZATION
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 428px) and (orientation: portrait) {
    
    /* Optimize images */
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
        will-change: auto;
    }
    
    /* Lazy load images below fold */
    .gallery-img,
    .team-badge {
        content-visibility: auto;
        contain-intrinsic-size: 300px;
    }
    
    /* Hardware acceleration for critical elements only */
    .hamburger,
    .nav-menu,
    .nav-overlay {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        will-change: transform, opacity;
    }
    
    /* Remove unnecessary animations on scroll */
    * {
        will-change: auto !important;
    }
    
    /* Optimize fonts */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeSpeed;
    }
    
    /* Reduce repaints */
    section {
        contain: layout style;
    }
    
    /* Optimize scrolling */
    html {
        scroll-behavior: auto;
    }
    
    @media (prefers-reduced-motion: no-preference) {
        html {
            scroll-behavior: smooth;
        }
    }
}

/* ═══════════════════════════════════════════════════════════════
   🎯 ADDITIONAL MOBILE FIXES
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 428px) and (orientation: portrait) {
    
    /* Ensure all sections are visible */
    section {
        overflow: visible !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Container adjustments */
    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 1.5rem !important;
    }
    
    /* Fix any cut-off content */
    .countdown-timer,
    .packages-grid,
    .teams-grid,
    .gallery-grid {
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }
    
    /* Ensure buttons are full width */
    .register-btn,
    .package-cta,
    .btn {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   🔧 SAFARI SPECIFIC FIXES
   ═══════════════════════════════════════════════════════════════ */

@supports (-webkit-touch-callout: none) {
    @media (max-width: 428px) and (orientation: portrait) {
        
        /* iOS Safari hamburger fix */
        .hamburger {
            -webkit-tap-highlight-color: rgba(33, 150, 243, 0.3);
            -webkit-user-select: none;
            user-select: none;
        }
        
        /* iOS Safari countdown fix */
        .countdown-timer {
            -webkit-overflow-scrolling: touch;
        }
        
        /* Prevent zoom on double-tap */
        * {
            touch-action: manipulation;
        }
        
        /* Allow global zoom */
        html {
            touch-action: pan-x pan-y pinch-zoom;
        }
    }
}

/* ═══════════════════════════════════════════════════════════════
   📱 LANDSCAPE MODE FIXES
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 926px) and (orientation: landscape) and (max-height: 428px) {
    
    /* Hamburger in landscape */
    .hamburger {
        display: flex !important;
        position: fixed !important;
        top: 1rem !important;
        right: 1rem !important;
        width: 50px !important;
        height: 50px !important;
        z-index: 9999 !important;
    }
    
    /* Countdown in landscape */
    .countdown {
        padding: 2.5rem 2rem !important;
    }
    
    .countdown-timer {
        gap: 2rem !important;
    }
    
    .countdown-item {
        min-width: 70px !important;
        padding: 1rem 0.7rem !important;
    }
    
    .countdown-number {
        font-size: 3rem !important;
    }
    
    .countdown-label {
        font-size: 0.75rem !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   🎨 ENSURE VISUAL CONSISTENCY
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 428px) {
    
    /* Consistent spacing */
    section {
        margin: 0 !important;
        border: none !important;
    }
    
    /* Consistent backgrounds */
    .countdown {
        background: white !important;
    }
    
    /* No horizontal scrolling */
    body,
    html {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    
    /* Fix any overflow */
    * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Exception for specific elements */
    img,
    .nav-menu,
    .countdown-number,
    .hero-hundred {
        max-width: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   END CRITICAL FIXES
   ═══════════════════════════════════════════════════════════════ */
