/* Mobile Optimizations for Hyphy Burger */

/* Custom viewport height property */
:root {
    --vh: 1vh;
}

/* Base Mobile Styles */
@media (max-width: 768px) {
    /* Main Container */
    body {
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        min-height: calc(var(--vh, 1vh) * 100);
    }
    
    /* Header Logo */
    .header-container img {
        max-width: 90%;
        height: auto;
    }
    
    /* Decorative Image */
    .decorative-image-container {
        max-width: 95%;
        padding: 0 10px;
    }
    
    /* Tray Container */
    #tray-container {
        max-width: 95%;
        padding: 0 10px;
    }
    
    .tray-base-img {
        width: 100%;
        height: auto;
    }
    
    /* Tray Items - Better Mobile Positioning */
    .tray-item {
        max-width: 60px;
        touch-action: manipulation;
    }
    
    /* Tray Labels */
    .tray-label {
        font-size: 0.6rem !important;
        padding: 0.05rem 0.15rem !important;
    }
    
    /* Content Sections */
    .content-section {
        width: 90% !important;
        max-width: none !important;
        margin: 10px auto !important;
        padding: 1rem !important;
        position: relative !important;
        transform: none !important;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    /* Menu Pages */
    .menu-page img {
        width: 100%;
        height: auto;
        margin-bottom: 10px;
    }
    
    /* Events Section */
    #shake-content .space-y-4 > div {
        padding: 0.75rem !important;
        margin-bottom: 0.75rem;
    }
    
    /* Info Hub Tabs */
    .info-tab-btn {
        font-size: 0.75rem !important;
        padding: 0.5rem !important;
    }
    
    /* Forms */
    input, textarea, select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        width: 100% !important;
    }
    
    /* Merch Store */
    .merch-item-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }
    
    .merch-item {
        margin-bottom: 0.5rem;
    }
    
    .merch-item-name {
        font-size: 0.5rem !important;
        line-height: 1.2 !important;
    }
    
    .merch-item-price {
        font-size: 0.9rem !important;
    }
    
    .merch-filter-btn {
        font-size: 0.6rem !important;
        padding: 0.4rem 0.6rem !important;
        margin: 0.25rem !important;
    }
    
    /* Game Area */
    #game-area {
        width: 100% !important;
        height: 300px !important;
        touch-action: none;
        position: relative !important;
    }
    
    #game-controls-container {
        width: 100% !important;
        position: sticky !important;
        bottom: 0 !important;
        background: rgba(0,0,0,0.8) !important;
        padding: 10px !important;
        z-index: 999 !important;
    }
    
    #game-controls {
        display: flex !important;
        justify-content: center !important;
        gap: 2rem !important;
        width: 100% !important;
    }
    
    .game-button {
        padding: 1rem 2rem !important;
        font-size: 1rem !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }
    
    /* Content Feed */
    #content-feed .grid {
        grid-template-columns: 1fr !important;
    }
    
    .tiktok-embed {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* Contact Banner */
    .bg-red-600.text-white {
        padding: 0.75rem !important;
        font-size: 0.9rem !important;
    }
    
    /* Close Buttons */
    .close-btn {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.9rem !important;
        position: sticky;
        bottom: 10px;
    }
    
    /* Suggestion Mascot */
    #suggestion-mascot {
        width: 60px !important;
        height: 60px !important;
        right: 10px !important;
        bottom: 10px !important;
    }
    
    /* Modal Windows */
    .fixed.inset-0 {
        padding: 10px !important;
    }
    
    /* Font Sizes */
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.2rem !important;
    }
    
    p, li {
        font-size: 0.9rem !important;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    /* Even smaller tray items */
    .tray-item {
        max-width: 50px;
    }
    
    /* Stack filter buttons */
    .merch-filter-btn {
        display: block !important;
        width: 100% !important;
        margin: 0.25rem 0 !important;
    }
    
    /* Single column merch grid on very small screens */
    @media (max-width: 380px) {
        .merch-item-container {
            grid-template-columns: 1fr !important;
        }
    }
    
    /* Game controls adjustment */
    #game-controls {
        gap: 1rem !important;
    }
    
    .game-button {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.9rem !important;
    }
    
    /* Info Hub tabs stack */
    .flex.justify-center.mb-6 {
        flex-direction: column !important;
    }
    
    .info-tab-btn {
        width: 100% !important;
        margin: 2px 0 !important;
    }
}

/* iPhone SE and similar small devices */
@media (max-width: 375px) {
    .header-container img {
        max-width: 95%;
    }
    
    #tray-container {
        max-width: 100%;
        padding: 0 5px;
    }
    
    .tray-item {
        max-width: 45px;
    }
    
    .content-section {
        width: 95% !important;
        padding: 0.75rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    .merch-item-name {
        font-size: 0.45rem !important;
    }
}

/* Landscape Mode Adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .content-section {
        max-height: 90vh !important;
        padding: 0.5rem !important;
    }
    
    #game-area {
        height: 250px !important;
    }
    
    .header-container,
    .decorative-image-container {
        display: none; /* Hide decorative elements in landscape */
    }
    
    #tray-container {
        margin-top: 10px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .tray-item:hover {
        transform: none !important;
    }
    
    .merch-item:hover {
        transform: translateY(0) !important;
    }
    
    /* Larger touch targets */
    button, a, .tray-item {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Disable hover image swap on mobile - show primary only */
    .merch-item .secondary-image {
        display: none !important;
    }
    
    .merch-item:hover .primary-image {
        opacity: 1 !important;
    }
}

/* iOS Specific Fixes */
@supports (-webkit-touch-callout: none) {
    /* iOS momentum scrolling */
    .content-section {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Fix for iOS form zoom */
    input, textarea, select {
        font-size: 16px !important;
    }
    
    /* Fix for iOS button styling */
    button {
        -webkit-appearance: none;
        border-radius: 0;
    }
}

/* Performance Optimizations */
@media (max-width: 768px) {
    /* Disable animations on mobile for better performance */
    * {
        animation-duration: 0.3s !important;
    }
    
    /* Optimize images */
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    /* Reduce shadows and effects */
    .content-section {
        box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    }
    
    .merch-item {
        box-shadow: none !important;
    }
}

/* Accessibility for Mobile */
@media (max-width: 768px) {
    /* Ensure readable contrast */
    .text-white {
        text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    }
    
    /* Focus indicators */
    button:focus, a:focus {
        outline: 3px solid #fbbf24 !important;
        outline-offset: 2px;
    }
}

/* Loading States for Mobile */
@media (max-width: 768px) {
    .loading {
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: loading 1.5s infinite;
    }
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}