/* Mobile Navigation */
@media (max-width: 1023px) {
    nav {
        position: sticky;
        top: 0;
        z-index: 100;
        width: 100%;
        overflow: visible;
    }
    
    nav > div {
        overflow: visible;
    }
    
    /* Hide desktop nav on mobile */
    .hidden.lg\\:flex {
        display: none !important;
        pointer-events: none !important;
    }
    
    /* Mobile Menu Button */
    #mobileMenuBtn {
        position: relative;
        z-index: 10002;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        pointer-events: auto;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        border: none;
        background: transparent;
    }
    
    #mobileMenuBtn:focus {
        outline: 2px solid rgba(16, 185, 129, 0.5);
        outline-offset: 2px;
    }
    
    /* Hide duplicate buttons */
    #mobileMenuBtn ~ #mobileMenuBtn {
        display: none !important;
    }
    
    /* Mobile Menu */
    #mobileMenu {
        position: fixed !important;
        top: 0 !important;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100vh;
        background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(0, 0, 0, 0.99) 100%);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        z-index: 99999 !important;
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease, visibility 0.35s ease;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 0;
        padding-top: 80px;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
        visibility: hidden;
        opacity: 0;
        will-change: transform, opacity;
    }
    
    @media (min-width: 640px) {
        #mobileMenu {
            padding-top: 80px;
        }
    }
    
    #mobileMenu.hidden {
        display: none;
        visibility: hidden;
        opacity: 0;
        transform: translateX(-100%);
        pointer-events: none;
    }
    
    #mobileMenu.show {
        transform: translateX(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        display: block !important;
        z-index: 99999 !important;
    }
    
    /* Mobile Menu Close Button */
    .mobile-menu-close-btn {
        position: fixed !important;
        top: 1rem !important;
        right: 1rem !important;
        width: 48px !important;
        height: 48px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: rgba(239, 68, 68, 0.9) !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
        border-radius: 50% !important;
        color: #ffffff !important;
        font-size: 1.5rem !important;
        cursor: pointer !important;
        z-index: 100001 !important;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
        pointer-events: auto !important;
    }
    
    .mobile-menu-close-btn:hover,
    .mobile-menu-close-btn:active {
        background: rgba(239, 68, 68, 1) !important;
        border-color: rgba(255, 255, 255, 0.5) !important;
        color: #ffffff !important;
        transform: scale(1.1);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6) !important;
    }
    
    /* Mobile Menu Content */
    #mobileMenu .mobile-menu-content {
        padding: 1rem;
        padding-bottom: 2rem;
        min-height: 100%;
        display: flex;
        flex-direction: column;
        position: relative;
        z-index: 100000;
    }
    
    @media (min-width: 640px) {
        #mobileMenu .mobile-menu-content {
            padding: 1.5rem;
            padding-bottom: 2.5rem;
        }
    }
    
    /* Menu Section Headers */
    #mobileMenu .menu-section-title {
        color: rgba(16, 185, 129, 0.8);
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        padding: 1rem 1rem 0.5rem 1rem;
        margin-top: 0.5rem;
    }
    
    /* Menu Items */
    #mobileMenu a,
    #mobileMenu button {
        min-height: 56px;
        padding: 0.875rem 1rem;
        font-size: 0.9375rem;
        font-weight: 500;
        border-radius: 0.75rem;
        margin-bottom: 0.5rem;
        -webkit-tap-highlight-color: rgba(16, 185, 129, 0.2);
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        border: 1px solid rgba(255, 255, 255, 0.05);
        background: rgba(255, 255, 255, 0.03);
        display: flex;
        align-items: center;
        width: 100%;
        color: rgba(229, 231, 235, 0.95);
    }
    
    #mobileMenu a:hover,
    #mobileMenu a:active,
    #mobileMenu a:focus,
    #mobileMenu button:hover,
    #mobileMenu button:active,
    #mobileMenu button:focus {
        background: rgba(16, 185, 129, 0.15);
        border-color: rgba(16, 185, 129, 0.4);
        transform: translateX(4px);
        color: #10b981;
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
    }
    
    #mobileMenu a i,
    #mobileMenu button i {
        width: 28px;
        text-align: center;
        font-size: 1.125rem;
        margin-right: 0.75rem;
        flex-shrink: 0;
    }
    
    #mobileMenu a span,
    #mobileMenu button span {
        flex: 1;
        text-align: left;
    }
    
    /* Balance Display */
    #mobileMenu .balance-display {
        background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.15) 100%);
        border: 1px solid rgba(16, 185, 129, 0.3);
        border-radius: 0.75rem;
        padding: 1rem;
        margin: 0.5rem 0 1rem 0;
    }
    
    /* User Profile Section */
    #mobileMenu .user-profile-section {
        margin-top: auto;
        padding-top: 1.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    /* Logout Button */
    #mobileMenu .logout-btn {
        background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(249, 115, 22, 0.2) 100%);
        border: 1px solid rgba(239, 68, 68, 0.3);
        color: #fca5a5;
        margin-top: 1rem;
    }
    
    #mobileMenu .logout-btn:hover,
    #mobileMenu .logout-btn:active {
        background: linear-gradient(135deg, rgba(239, 68, 68, 0.3) 0%, rgba(249, 115, 22, 0.3) 100%);
        border-color: rgba(239, 68, 68, 0.5);
        color: #f87171;
    }
    
    /* Login Button */
    #mobileMenu .login-btn {
        background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.2) 100%);
        border: 1px solid rgba(16, 185, 129, 0.4);
        color: #6ee7b7;
        justify-content: center;
    }
    
    #mobileMenu .login-btn:hover,
    #mobileMenu .login-btn:active {
        background: linear-gradient(135deg, rgba(16, 185, 129, 0.3) 0%, rgba(5, 150, 105, 0.3) 100%);
        border-color: rgba(16, 185, 129, 0.6);
        color: #34d399;
    }
    
    /* Backdrop */
    .mobile-menu-backdrop {
        position: fixed !important;
        top: 0 !important;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 99998 !important;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        touch-action: manipulation;
        pointer-events: none;
        cursor: pointer;
    }
    
    .mobile-menu-backdrop.show {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        z-index: 99998 !important;
        cursor: pointer;
    }
    
    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
    
    /* Touch-friendly mobile menu links */
    .mobile-menu-link {
        -webkit-tap-highlight-color: rgba(16, 185, 129, 0.2);
        touch-action: manipulation;
    }
}

