/**
 * Mobile Menu Styles
 *
 * Hamburger menu for mobile navigation (768px and below).
 * Works with both logged-in (nav.php) and public (nav-public.php) contexts.
 */

/* =========================================
   VISIBILITY UTILITIES
   ========================================= */

/* Desktop-only elements: visible by default, hidden on mobile */
@media (max-width: 768px) {
    .nav-desktop-only {
        display: none !important;
    }
}

/* Mobile-only elements: hidden by default, shown on mobile */
.nav-mobile-only {
    display: none !important;
}

@media (max-width: 768px) {
    .nav-mobile-only {
        display: flex !important;
    }
}

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

.hamburger-btn {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 101;
    transition: opacity 0.2s ease;
}

.hamburger-btn:hover {
    opacity: 0.7;
}

.hamburger-btn:focus {
    outline: 2px solid var(--primary, #667eea);
    outline-offset: 2px;
    border-radius: 4px;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 3px;
    background-color: var(--text-dark, #2D2D2D);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Animated X when menu is open */
.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

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

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 999;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* =========================================
   MOBILE MENU PANEL
   ========================================= */

.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 320px;
    height: 100%;
    background: var(--bg-white, #FFFFFF);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu.active {
    transform: translateX(0);
}

/* Prevent body scroll when menu is open */
body.mobile-menu-open {
    overflow: hidden;
}

/* =========================================
   CLOSE BUTTON
   ========================================= */

.mobile-menu-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-light, #6B6B6B);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease;
}

.mobile-menu-close:hover {
    background: #f5f5f5;
    color: var(--text-dark, #2D2D2D);
}

.mobile-menu-close:focus {
    outline: 2px solid var(--primary, #667eea);
    outline-offset: 2px;
}

/* =========================================
   MENU HEADER
   ========================================= */

.mobile-menu-header {
    padding: 24px 20px;
    padding-top: 60px; /* Space for close button */
    border-bottom: 1px solid #E5E7EB;
    background: linear-gradient(180deg, #FAFAFA 0%, #FFFFFF 100%);
}

.mobile-menu-greeting {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark, #2D2D2D);
    margin-bottom: 12px;
}

.mobile-menu-credits {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.mobile-menu-credits .credits-icon {
    font-size: 16px;
}

.mobile-menu-credits .credits-label {
    font-weight: 400;
    opacity: 0.9;
}

/* Public header variant (shows logo instead of greeting) */
.mobile-menu-header-public {
    text-align: center;
    padding: 32px 20px;
    padding-top: 60px;
}

.mobile-menu-logo {
    height: 36px;
    width: auto;
}

/* =========================================
   MENU LIST
   ========================================= */

.mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 12px 0;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    color: var(--text-dark, #2D2D2D);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.mobile-menu-item:hover,
.mobile-menu-item:focus {
    background: #F5F5F5;
}

.mobile-menu-item:focus {
    outline: none;
    box-shadow: inset 3px 0 0 var(--primary, #667eea);
}

.mobile-menu-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.mobile-menu-text {
    flex: 1;
}

/* CTA item (Create Story / Sign Up) - prominent styling */
.mobile-menu-cta {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    margin: 8px 16px;
    border-radius: 10px;
    font-weight: 600;
}

.mobile-menu-cta:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

.mobile-menu-cta:focus {
    box-shadow: inset 3px 0 0 white;
}

/* Logout item - muted styling */
.mobile-menu-logout {
    color: var(--text-light, #6B6B6B);
}

/* Divider between menu sections */
.mobile-menu-divider {
    height: 1px;
    background: #E5E7EB;
    margin: 8px 20px;
}

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

.mobile-menu:focus {
    outline: none;
}

/* Focus visible for keyboard users */
.mobile-menu-item:focus-visible {
    outline: 2px solid var(--primary, #667eea);
    outline-offset: -2px;
}

/* =========================================
   REDUCED MOTION
   ========================================= */

@media (prefers-reduced-motion: reduce) {
    .mobile-menu,
    .mobile-menu-overlay,
    .hamburger-line {
        transition: none;
    }
}
