/* =============================================
   MOBILE NAVIGATION FIX - Universal
   Fixes hamburger menu, close button, overlay
   for all pages on mobile devices
   ============================================= */

/* Hide mobile-only elements on desktop */
.mobile-menu-header,
.mobile-menu-overlay {
    display: none !important;
}

/* Mobile styles */
@media (max-width: 768px) {

    /* ---- SIDE-PANEL NAV MENU ---- */
    .nav-menu {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        left: auto !important;
        width: 80% !important;
        max-width: 320px !important;
        height: 100vh !important;
        height: 100dvh !important;
        background: #ffffff !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        align-items: stretch !important;
        padding: 0 !important;
        padding-top: 70px !important;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: none !important;
        z-index: 9998 !important;
        overflow-y: auto !important;
        border-radius: 0 !important;
        animation: none !important;
        gap: 0 !important;
    }

    .nav-menu.mobile-active,
    .nav-menu.active {
        right: 0 !important;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15) !important;
    }

    /* ---- NAV ITEMS ---- */
    .nav-menu li {
        width: 100% !important;
        margin: 0 !important;
        border-bottom: 1px solid #f0f0f0 !important;
        list-style: none !important;
    }

    .nav-menu li:last-child {
        border-bottom: none !important;
    }

    .nav-menu .nav-link {
        color: #333 !important;
        padding: 16px 24px !important;
        display: flex !important;
        align-items: center !important;
        font-size: 1rem !important;
        font-weight: 500 !important;
        border-radius: 0 !important;
        width: 100% !important;
        transition: background 0.2s ease !important;
        text-decoration: none !important;
        border-bottom: none !important;
    }

    .nav-menu .nav-link:hover,
    .nav-menu .nav-link:active {
        background: rgba(102, 126, 234, 0.08) !important;
        color: #667eea !important;
    }

    .nav-menu .login-btn {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        color: white !important;
        margin: 16px 20px !important;
        padding: 14px 24px !important;
        border-radius: 12px !important;
        text-align: center !important;
        justify-content: center !important;
        font-weight: 600 !important;
        width: auto !important;
    }

    .nav-menu .login-btn:hover,
    .nav-menu .login-btn:active {
        color: white !important;
    }

    .nav-menu .user-profile-btn {
        background: rgba(102, 126, 234, 0.1) !important;
        color: #667eea !important;
        margin: 16px 20px !important;
        border-radius: 12px !important;
        justify-content: center !important;
    }

    /* ---- HAMBURGER BUTTON ---- */
    .hamburger {
        display: flex !important;
        flex-direction: column !important;
        z-index: 10000 !important;
        position: relative !important;
        padding: 8px !important;
        cursor: pointer !important;
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation !important;
    }

    .hamburger span {
        width: 24px !important;
        height: 2.5px !important;
        background: white !important;
        margin: 3px 0 !important;
        transition: all 0.3s ease !important;
        border-radius: 2px !important;
        display: block !important;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 6px) !important;
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0 !important;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -6px) !important;
    }

    /* ---- MOBILE MENU HEADER (Close button + branding) ---- */
    .mobile-menu-header {
        display: flex !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 70px !important;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        align-items: center !important;
        padding: 0 20px !important;
        z-index: 1 !important;
    }

    .mobile-menu-header h3 {
        color: white !important;
        font-size: 1.2rem !important;
        margin: 0 !important;
        font-weight: 600 !important;
    }

    .mobile-menu-close {
        position: absolute !important;
        top: 15px !important;
        right: 16px !important;
        width: 40px !important;
        height: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(255, 255, 255, 0.2) !important;
        border: none !important;
        border-radius: 50% !important;
        cursor: pointer !important;
        z-index: 10001 !important;
        font-size: 1.2rem !important;
        color: white !important;
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation !important;
    }

    .mobile-menu-close:active {
        background: rgba(255, 255, 255, 0.35) !important;
    }

    /* ---- OVERLAY ---- */
    .mobile-menu-overlay {
        display: none !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: rgba(0, 0, 0, 0.5) !important;
        z-index: 9997 !important;
        opacity: 0 !important;
        transition: opacity 0.3s ease !important;
    }

    .mobile-menu-overlay.active {
        display: block !important;
        opacity: 1 !important;
    }

    /* ---- LOGIN MODAL MOBILE IMPROVEMENTS ---- */
    .modal {
        align-items: center;
        justify-content: center;
    }

    .modal-content {
        width: 92% !important;
        max-width: 400px !important;
        margin: auto !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        border-radius: 16px !important;
    }

    .modal .close-btn,
    .modal .close-modal {
        font-size: 2rem !important;
        padding: 8px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        cursor: pointer;
    }
}
