/* ============================================
   MOBILE MENU FIX
   Ensures menu toggle button is always visible and functional
   ============================================ */

/* Ensure menu is above everything on mobile */
@media (max-width: 768px) {
    /* Fix header z-index and prevent clipping */
    .ust-header {
        z-index: 9998 !important;
        overflow: visible !important; /* Prevent clipping of menu */
    }
    
    .ust-navbar {
        z-index: 9999 !important;
        overflow: visible !important; /* Prevent clipping of menu */
        position: relative !important;
    }
    
    /* Force menu toggle to be visible */
    #menu-toggle.ust-menu-toggle {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 10000 !important;
        pointer-events: auto !important;
        cursor: pointer !important;
        background: transparent !important;
        border: none !important;
        padding: 8px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        justify-content: center !important;
        align-items: center !important;
        flex-direction: column !important;
        gap: 5px !important;
    }
    
    /* Ensure spans are visible */
    #menu-toggle.ust-menu-toggle span {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 26px !important;
        height: 2px !important;
        background: #ffffff !important;
        border-radius: 2px !important;
        transition: all 0.3s ease !important;
        pointer-events: none !important;
    }
    
    /* Active state for hamburger animation */
    #menu-toggle.ust-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(7px, 7px) !important;
    }
    
    #menu-toggle.ust-menu-toggle.active span:nth-child(2) {
        opacity: 0 !important;
    }
    
    #menu-toggle.ust-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px) !important;
    }
    
    /* Ensure nav menu is properly positioned and fully visible */
    #nav-menu.ust-nav-menu {
        position: fixed !important;
        top: 60px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: calc(100vh - 60px) !important;
        max-height: calc(100vh - 60px) !important;
        min-height: calc(100vh - 60px) !important;
        z-index: 999999 !important; /* Very high z-index to ensure it's above everything */
        background: rgba(10, 10, 10, 0.98) !important;
        backdrop-filter: blur(32px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(32px) saturate(180%) !important;
        transform: translateX(-100%) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 1.5rem 1rem !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        list-style: none !important;
        will-change: transform, opacity, visibility !important;
    }
    
    #nav-menu.ust-nav-menu.active {
        transform: translateX(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        display: flex !important;
        flex-direction: column !important;
        z-index: 999999 !important; /* Ensure active state also has high z-index */
    }
    
    /* Ensure menu items are visible and properly styled */
    #nav-menu.ust-nav-menu li {
        width: 100% !important;
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
        list-style: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    }
    
    #nav-menu.ust-nav-menu li:last-child {
        border-bottom: none !important;
    }
    
    #nav-menu.ust-nav-menu a {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        padding: 1rem 1.5rem !important;
        font-size: 1rem !important;
        font-weight: 500 !important;
        color: #ffffff !important;
        text-decoration: none !important;
        min-height: 48px !important;
        opacity: 1 !important;
        visibility: visible !important;
        transition: all 0.3s ease !important;
        border-radius: 0 !important;
    }
    
    #nav-menu.ust-nav-menu a:hover,
    #nav-menu.ust-nav-menu a.active {
        background: rgba(1, 192, 87, 0.1) !important;
        color: #01c057 !important;
        padding-left: 2rem !important;
    }
    
    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    /* Ensure header doesn't interfere */
    .ust-header {
        z-index: 9998 !important;
    }
    
    .ust-navbar {
        z-index: 9999 !important;
        position: relative !important;
    }
    
    /* Ensure no other elements overlap the menu */
    .ust-header,
    .ust-navbar,
    .ust-logo,
    .ust-nav-cta {
        position: relative !important;
    }
    
    /* Make sure menu is above all content */
    body.menu-open .ust-header {
        z-index: 9998 !important;
    }
    
    body.menu-open #nav-menu.ust-nav-menu {
        z-index: 999999 !important; /* Very high z-index when menu is open */
        transform: translateX(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        display: flex !important;
    }
    
    /* Prevent page content from showing through */
    body.menu-open main,
    body.menu-open .block,
    body.menu-open section,
    body.menu-open .container,
    body.menu-open .row,
    body.menu-open .col,
    body.menu-open div:not(.ust-header):not(.ust-navbar):not(#nav-menu) {
        position: relative;
        z-index: 1 !important;
    }
    
    /* Ensure no other elements can cover the menu */
    body.menu-open * {
        position: relative;
    }
    
    body.menu-open #nav-menu.ust-nav-menu {
        position: fixed !important;
    }
}

