/**
 * WhenBRRR Mobile Menu Styles - Production Ready
 * Mobile-first, smooth animations, no layout shift
 */

/* ==========================================
   HAMBURGER BUTTON
   ========================================== */

.hamburger {
    /* Hidden on desktop by default */
    display: none;
    
    /* Fixed positioning for mobile */
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 10001;
    
    /* Size & spacing */
    width: 44px;
    height: 44px;
    padding: 8px;
    
    /* Styling */
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    cursor: pointer;
    
    /* Shadow */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    
    /* Flexbox for icon centering */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    
    /* Smooth transitions */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger:hover {
    background: #f8f9fa;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.hamburger:active {
    transform: scale(0.96);
}

.hamburger:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* Hamburger icon lines */
.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #1a1a1a;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animate to X when open */
.menu-is-open .hamburger span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-is-open .hamburger span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.menu-is-open .hamburger span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ==========================================
   SIDEBAR
   ========================================== */

.sidebar {
    /* Desktop: Static positioning (set by your main CSS) */
    position: static;
    width: 260px;
    height: 100vh;
}

/* ==========================================
   OVERLAY
   ========================================== */

.app-overlay {
    /* Hidden by default */
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-overlay.is-visible {
    display: block;
    opacity: 1;
}

/* ==========================================
   MOBILE STYLES (max-width: 768px)
   ========================================== */

@media (max-width: 768px) {
    
    /* Show hamburger on mobile */
    .hamburger {
        display: flex !important;
    }
    
    /* Sidebar mobile behavior */
    .sidebar {
        /* Fixed positioning */
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        
        /* Size */
        width: 85vw !important;
        max-width: 320px !important;
        height: 100vh !important;
        
        /* Styling */
        background: #fff !important;
        box-shadow: 2px 0 16px rgba(0, 0, 0, 0.1) !important;
        
        /* Hidden by default - slide from left */
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        
        /* Stack order */
        z-index: 10000 !important;
        
        /* Scrolling */
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Open state */
    .sidebar.is-open {
        transform: translateX(0) !important;
    }
    
    /* Prevent body scroll when menu open */
    .menu-is-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
    }
    
    /* Close button styling */
    .sidebar__close {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
        background: transparent;
        border: none;
        cursor: pointer;
        color: #666;
        border-radius: 6px;
        transition: all 0.2s ease;
    }
    
    .sidebar__close:hover {
        background: rgba(0, 0, 0, 0.05);
        color: #1a1a1a;
    }
    
    .sidebar__close:focus {
        outline: 2px solid #0066cc;
        outline-offset: 2px;
    }
    
}

/* ==========================================
   DESKTOP CLEANUP (min-width: 769px)
   ========================================== */

@media (min-width: 768px) {
    
    /* Hide mobile-only elements */
    .hamburger,
    .app-overlay,
    .sidebar__close {
        display: none !important;
    }
    
    /* Reset sidebar to static */
    .sidebar {
        position: static !important;
        transform: none !important;
        width: 260px !important;
    }
    
    /* Reset body */
    .menu-is-open {
        overflow: auto !important;
        position: static !important;
        width: auto !important;
    }
    
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

/* Skip link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    z-index: 100000;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .hamburger,
    .hamburger span,
    .sidebar,
    .app-overlay {
        transition: none !important;
    }
}

/* ==========================================
   PERFORMANCE OPTIMIZATIONS
   ========================================== */

/* GPU acceleration for smooth transforms */
.sidebar,
.app-overlay,
.hamburger span {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Remove will-change when not animating */
.sidebar:not(.is-open) {
    will-change: auto;
}

.app-overlay:not(.is-visible) {
    will-change: auto;
}
