﻿/* ========================================
   XENTRA NETWORK - MOBILE HAMBURGER MENU
   Beautiful Mobile Navigation System
   ======================================== */

/* ===== HAMBURGER MENU BUTTON ===== */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 999999 !important; /* Super high z-index to always be on top */
    width: 50px;
    height: 50px;
    background: rgba(59, 130, 246, 0.95);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    padding: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    pointer-events: auto !important; /* Button should catch clicks */
}

.mobile-menu-btn:hover {
    background: rgba(59, 130, 246, 1);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

/* Hamburger Icon - ≡ Symbol */
.hamburger {
    font-size: 28px;
    font-weight: 300;
    color: #ffffff;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: 100%;
    height: 100%;
}

/* Hide the ≡ text when active and show X instead */
.mobile-menu-btn.active .hamburger {
    font-size: 0 !important; /* Completely hide the ≡ text */
}

.mobile-menu-btn.active .hamburger::before {
    content: '×' !important; /* Use × character for close */
    font-size: 32px !important;
    font-weight: 300 !important;
    color: #ffffff !important;
    display: block !important;
    line-height: 1 !important;
}

/* ===== MOBILE MENU OVERLAY ===== */
.mobile-menu-overlay {
    display: none; /* Completely remove from DOM when not active */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block; /* Show in DOM only when active */
    opacity: 1;
}

/* ===== MOBILE MENU PANEL ===== */
.mobile-menu-panel {
    display: none; /* Completely remove from DOM when not active */
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 350px;
    height: 100vh;
    background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 100%);
    z-index: 10000;
    overflow-y: auto;
    transition: right 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
    -webkit-overflow-scrolling: touch;
}

.mobile-menu-panel.active {
    display: block; /* Show in DOM only when active */
    right: 0;
}

/* Menu Header */
.mobile-menu-header {
    padding: 20px;
    background: rgba(59, 130, 246, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-menu-header .logo {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mobile-menu-header .icon {
    font-size: 1.8rem;
    color: #3b82f6;
}

/* Menu Content */
.mobile-menu-content {
    padding: 20px 0;
}

/* Menu Items */
.mobile-menu-item {
    display: block;
    padding: 16px 20px;
    color: #ffffff;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-menu-item i {
    font-size: 1.2rem;
    width: 24px;
    color: #3b82f6;
}

.mobile-menu-item:hover,
.mobile-menu-item:active {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: #3b82f6;
    padding-left: 25px;
}

.mobile-menu-item.active {
    background: rgba(59, 130, 246, 0.2);
    border-left-color: #3b82f6;
}

/* Menu Divider */
.mobile-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 10px 20px;
}

/* Menu Section Title */
.mobile-menu-section {
    padding: 12px 20px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
}

/* User Profile in Menu */
.mobile-menu-user {
    padding: 20px;
    background: rgba(59, 130, 246, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-menu-user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #ffffff;
}

.mobile-menu-user-info {
    flex: 1;
}

.mobile-menu-user-name {
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
}

.mobile-menu-user-email {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Theme Toggle in Menu */
.mobile-menu-theme {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-menu-theme-label {
    color: #ffffff;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-menu-theme-label i {
    font-size: 1.2rem;
    color: #3b82f6;
}

.theme-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: 0.4s;
    border-radius: 34px;
}

.theme-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .theme-slider {
    background-color: #3b82f6;
}

input:checked + .theme-slider:before {
    transform: translateX(24px);
}

/* Logout Button in Menu */
.mobile-menu-logout {
    margin: 20px;
    padding: 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    color: #ef4444;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.mobile-menu-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

.mobile-menu-logout i {
    font-size: 1.1rem;
}

/* ===== SHOW ONLY ON MOBILE ===== */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex !important;
        pointer-events: auto !important;
    }
    
    /* Make sure overlay and panel don't block clicks when closed */
    .mobile-menu-overlay:not(.active),
    .mobile-menu-panel:not(.active) {
        display: none !important;
        pointer-events: none !important;
    }
    
    /* Hide desktop navigation on mobile */
    .navbar .nav-menu {
        display: none !important;
    }
    
    /* Ensure all page content is clickable */
    body > *:not(.mobile-menu-btn):not(.mobile-menu-overlay):not(.mobile-menu-panel) {
        pointer-events: auto !important;
        position: relative;
        z-index: 1;
    }
}

@media (min-width: 769px) {
    .mobile-menu-btn,
    .mobile-menu-overlay,
    .mobile-menu-panel {
        display: none !important;
        pointer-events: none !important;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes slideInRight {
    from {
        right: -100%;
    }
    to {
        right: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== SCROLLBAR STYLING ===== */
.mobile-menu-panel::-webkit-scrollbar {
    width: 6px;
}

.mobile-menu-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.mobile-menu-panel::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.5);
    border-radius: 3px;
}

.mobile-menu-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.7);
}

/* ===== ACCESSIBILITY ===== */
.mobile-menu-btn:focus,
.mobile-menu-item:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* ===== PREVENT BODY SCROLL WHEN MENU OPEN ===== */
body.mobile-menu-open {
    overflow: hidden;
}


/* ===== NUCLEAR FIX - ENSURE CLICKS WORK ON MOBILE ===== */
@media (max-width: 768px) {
    /* Remove any potential click blockers */
    body {
        pointer-events: auto !important;
        overflow-x: hidden !important;
    }
    
    /* Make sure ALL content is clickable except when menu is open */
    body:not(.mobile-menu-open) *:not(.mobile-menu-overlay):not(.mobile-menu-panel) {
        pointer-events: auto !important;
    }
    
    /* ONLY block clicks when menu is actually open */
    body.mobile-menu-open .mobile-menu-overlay {
        pointer-events: auto !important;
    }
    
    /* Mobile menu button ALWAYS clickable */
    .mobile-menu-btn {
        pointer-events: auto !important;
        z-index: 10001 !important;
    }
    
    /* Force overlays to be hidden when not active */
    .mobile-menu-overlay:not(.active) {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
        opacity: 0 !important;
        z-index: -1 !important;
    }
    
    .mobile-menu-panel:not(.active) {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
        z-index: -1 !important;
    }
    
    /* Make sure navigation, forms, buttons are all clickable */
    nav, form, button, a, input, select, textarea, label {
        pointer-events: auto !important;
    }
    
    /* Auth pages specific fixes */
    .auth-section,
    .auth-container,
    .auth-card,
    .auth-form,
    .form-group {
        pointer-events: auto !important;
    }
}