/* Mobile Navigation - Standalone Panel */
/* This mobile menu is a separate element outside the header */
/* No conflicts with inline header styles */

/* ========== HAMBURGER BUTTON IN HEADER ========== */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 100;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #f0f0f0;
    border-radius: 2px;
    transition: all 0.3s ease;
    margin: 3px 0;
}

.mobile-menu-toggle:hover span {
    background: #8A2BE2;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========== MOBILE: SHOW HAMBURGER, HIDE DESKTOP NAV ========== */
@media (max-width: 767px) {
    /* Fix header layout - brand left, hamburger right */
    .header-island {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 0 !important;
        padding: 0.6rem 1rem !important;
        border-radius: 30px !important;
        width: 94% !important;
        margin: 12px auto !important;
    }

    .mobile-menu-toggle {
        display: flex;
        order: 2;
    }

    .header-island .brand {
        order: 1;
        flex-shrink: 0;
    }

    /* Hide desktop navigation in header */
    .header-island .nav-links,
    .header-island nav,
    .header-island .auth-section,
    .header-island .user-profile-container,
    .header-island .auth-actions {
        display: none !important;
    }
}

/* ========== STANDALONE MOBILE MENU (outside header) ========== */
#mobile-menu-panel {
    display: none;
}

@media (max-width: 767px) {
    #mobile-menu-panel {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        max-width: 80vw;
        height: 100vh;
        height: 100dvh;
        background: #0a0814;
        border-left: 1px solid rgba(138, 43, 226, 0.2);
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
        z-index: 9999;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden;
    }

    #mobile-menu-panel.open {
        transform: translateX(0);
    }

    /* Panel inner layout */
    .mobile-panel-inner {
        display: flex;
        flex-direction: column;
        height: 100%;
        background: #0a0814;
    }

    /* ========== HEADER BAR ========== */
    .mobile-panel-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 20px;
        background: rgba(138, 43, 226, 0.08);
        border-bottom: 1px solid rgba(138, 43, 226, 0.15);
        flex-shrink: 0;
    }

    .mobile-panel-title {
        font-size: 1.1rem;
        font-weight: 600;
        color: #fff;
        letter-spacing: 0.5px;
    }

    .mobile-panel-close {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: #a0a0c0;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        padding: 0;
    }

    .mobile-panel-close:hover,
    .mobile-panel-close:active {
        background: rgba(138, 43, 226, 0.25);
        border-color: rgba(138, 43, 226, 0.4);
        color: #fff;
    }

    .mobile-panel-close svg {
        width: 20px;
        height: 20px;
        pointer-events: none;
    }

    /* ========== NAV LINKS ========== */
    .mobile-panel-nav {
        flex: 1;
        padding: 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-panel-links {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .mobile-panel-links li {
        margin: 0;
        padding: 0;
    }

    .mobile-panel-links a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 16px;
        color: #d0d0e0;
        text-decoration: none;
        font-weight: 500;
        font-size: 0.95rem;
        border-radius: 12px;
        background: transparent;
        border-left: 3px solid transparent;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: rgba(138, 43, 226, 0.15);
    }

    .mobile-panel-links a:hover,
    .mobile-panel-links a:active {
        background: rgba(138, 43, 226, 0.12);
        color: #fff;
        border-left-color: #8A2BE2;
    }

    .mobile-panel-links a.active {
        background: rgba(138, 43, 226, 0.15);
        color: #fff;
        border-left-color: #8A2BE2;
    }

    .mobile-panel-links svg {
        width: 20px;
        height: 20px;
        opacity: 0.7;
        flex-shrink: 0;
    }

    /* ========== AUTH BUTTONS ========== */
    .mobile-panel-auth {
        padding: 20px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(0, 0, 0, 0.2);
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .mobile-panel-auth a {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: 14px 20px;
        font-weight: 600;
        font-size: 0.95rem;
        border-radius: 12px;
        text-decoration: none;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: rgba(138, 43, 226, 0.15);
    }

    .mobile-auth-login,
    .mobile-panel-btn {
        color: #d0d0e0;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.12);
    }

    .mobile-auth-login:hover,
    .mobile-auth-login:active,
    .mobile-panel-btn:hover,
    .mobile-panel-btn:active {
        background: rgba(255, 255, 255, 0.12);
        color: #fff;
    }

    .mobile-auth-register,
    .mobile-panel-btn-primary {
        color: #fff;
        background: linear-gradient(135deg, #8A2BE2 0%, #5B21B6 100%);
        border: none;
        box-shadow: 0 4px 15px rgba(138, 43, 226, 0.3);
    }

    .mobile-auth-register:hover,
    .mobile-auth-register:active,
    .mobile-panel-btn-primary:hover,
    .mobile-panel-btn-primary:active {
        transform: translateY(-1px);
        box-shadow: 0 6px 20px rgba(138, 43, 226, 0.4);
    }

    /* ========== USER SECTION (logged in) ========== */
    .mobile-panel-user {
        padding: 20px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(0, 0, 0, 0.2);
        flex-shrink: 0;
    }

    .mobile-user-card,
    .mobile-panel-user-link {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px 16px;
        background: linear-gradient(135deg, rgba(138, 43, 226, 0.15) 0%, rgba(91, 33, 182, 0.1) 100%);
        border: 1px solid rgba(138, 43, 226, 0.25);
        border-radius: 14px;
        text-decoration: none;
        color: #fff;
        transition: all 0.2s ease;
    }

    .mobile-user-card:hover,
    .mobile-user-card:active,
    .mobile-panel-user-link:hover,
    .mobile-panel-user-link:active {
        background: linear-gradient(135deg, rgba(138, 43, 226, 0.25) 0%, rgba(91, 33, 182, 0.15) 100%);
        border-color: rgba(138, 43, 226, 0.4);
    }

    .mobile-user-avatar,
    .mobile-panel-avatar {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        background: rgba(138, 43, 226, 0.3);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .mobile-user-avatar svg,
    .mobile-panel-avatar svg {
        width: 22px;
        height: 22px;
        color: #fff;
    }

    .mobile-user-info {
        flex: 1;
        min-width: 0;
    }

    .mobile-user-name,
    .mobile-panel-username {
        font-weight: 600;
        font-size: 0.95rem;
        color: #fff;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
    }

    .mobile-user-label {
        font-size: 0.75rem;
        color: #a0a0c0;
        margin-top: 2px;
    }

    .mobile-user-arrow,
    .mobile-panel-chevron {
        width: 18px;
        height: 18px;
        color: #a0a0c0;
        flex-shrink: 0;
    }

    /* ========== OVERLAY ========== */
    #mobile-menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 9998;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    #mobile-menu-overlay.active {
        display: block;
        opacity: 1;
    }

    /* ========== BODY LOCK ========== */
    body.mobile-menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }
}

/* ========== SMALL PHONES ========== */
@media (max-width: 480px) {
    #mobile-menu-panel {
        width: 260px;
        max-width: 85vw;
    }

    .mobile-panel-header {
        padding: 14px 16px;
    }

    .mobile-panel-nav {
        padding: 14px;
    }

    .mobile-panel-links a {
        padding: 12px 14px;
        font-size: 0.9rem;
    }

    .mobile-panel-auth {
        padding: 16px;
    }
}
