/* Shared site header + nav + menu overlay – use with components/site-header.js
   Same class names and IDs as main site so auth script works without changes. */

#site-header-root {
    position: relative;
    z-index: 500;
}

.header {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    z-index: 100;
    background: #000000;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 20px 8px;
}

.header .logo-link { display: flex; align-items: center; }
.header .logo-link img { height: 72px; width: auto; display: block; }

.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: none;
    border: none;
    color: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    opacity: 1;
    position: relative;
    z-index: 101;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
}
.hamburger:hover { opacity: 0.9; }
.hamburger span {
    display: block;
    width: 24px;
    height: 4px;
    background-color: currentColor;
    border-radius: 2px;
}

/* Mobile / tablet: visible background + solid white bars so lines always show */
@media (max-width: 1023px) {
    .hamburger {
        background: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.3);
        color: #ffffff;
    }
    .hamburger span {
        width: 24px;
        min-width: 24px;
        height: 5px;
        min-height: 5px;
        background-color: #ffffff !important;
        border-radius: 2px;
    }
}

.nav-row {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 4px;
    padding: 4px 20px 8px;
    background: #000;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.nav-row::-webkit-scrollbar { display: none; }
.nav-row a {
    color: #64748b;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
}
.nav-row a[href]:not([href="#"]) { color: #94a3b8; pointer-events: auto; }
.nav-row a[href]:not([href="#"]):hover { color: #fff; }
.nav-row a.active { color: #fff; font-weight: 600; }

.nav-row .nav-btn-apps {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.9375rem;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}
.nav-row .nav-btn-apps:hover { color: #fff; }

/* ----- Desktop nav: single row, logo | nav | menu (only at 1200px+ so burger isn't pushed off on tablets) ----- */
@media (min-width: 1200px) {
    .header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 12px 48px 14px;
        gap: 24px;
    }
    .header-top {
        display: contents;
    }
    .header .logo-link {
        order: 1;
    }
    .header .logo-link img {
        height: 56px;
    }
    .nav-row {
        order: 2;
        flex: 0 1 auto;
        margin: 0 auto;
        padding: 0;
        gap: 6px;
        overflow: visible;
        border: none;
        background: transparent;
    }
    .nav-row a,
    .nav-row .nav-btn-apps {
        font-size: 0.9375rem;
        font-weight: 500;
        padding: 10px 16px;
        border-radius: 8px;
        transition: color 0.15s, background 0.15s;
    }
    .nav-row a:hover,
    .nav-row .nav-btn-apps:hover {
        color: #fff;
        background: rgba(148, 163, 184, 0.12);
    }
    .nav-row a.active {
        color: #fff;
        background: rgba(59, 130, 246, 0.2);
    }
    .nav-row a.active:hover {
        background: rgba(59, 130, 246, 0.28);
    }
    .hamburger {
        order: 3;
        width: 44px;
        height: 44px;
    }
}

/* Apps overlay – same pattern as menu overlay */
.apps-overlay {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    min-width: 100vw;
    min-height: 100vh;
    background: #000000;
    z-index: 9998;
    flex-direction: column;
    overflow-y: auto;
    box-sizing: border-box;
    pointer-events: none;
}
.apps-overlay.open {
    display: flex;
    pointer-events: auto;
}
.apps-overlay-inner {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    box-sizing: border-box;
}
.apps-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 20px 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    background: #000000;
    flex-shrink: 0;
}
.apps-overlay-header .logo-link { display: flex; align-items: center; }
.apps-overlay-header .logo-link img { height: 72px; width: auto; display: block; }
.apps-overlay-close {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: none;
    border: none;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
}
.apps-overlay-close:hover { opacity: 0.9; }
.apps-overlay-close .close-x {
    position: absolute;
    width: 22px;
    height: 3px;
    background: currentColor;
    border-radius: 2px;
    top: 50%;
    left: 50%;
    margin-top: -1.5px;
    margin-left: -11px;
}
.apps-overlay-close .close-x:first-child { transform: rotate(45deg); }
.apps-overlay-close .close-x:last-child { transform: rotate(-45deg); }
.apps-overlay-panel {
    flex: 1;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 32px 24px 48px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}
.apps-overlay-link {
    display: block;
    text-align: center;
    padding: 16px 24px;
    color: #e2e8f0;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    background: rgba(30, 41, 59, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.apps-overlay-link:hover {
    color: #fff;
    border-color: rgba(148, 163, 184, 0.4);
    background: rgba(30, 41, 59, 0.55);
}

.menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    min-width: 100vw;
    min-height: 100vh;
    max-width: none;
    background: #000000;
    z-index: 9999;
    flex-direction: column;
    overflow-y: auto;
    box-sizing: border-box;
    pointer-events: none;
}
.menu-overlay.open {
    display: flex;
    pointer-events: auto;
}
.menu-overlay-inner {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}
.menu-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 20px 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    background: #000000;
    flex-shrink: 0;
}
.menu-overlay-header .logo-link { display: flex; align-items: center; }
.menu-overlay-header .logo-link img { height: 72px; width: auto; display: block; }
.menu-overlay-close {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
}
.menu-overlay-close:hover { opacity: 0.9; }
.menu-overlay-close span {
    display: block;
    width: 24px;
    height: 4px;
    background-color: #ffffff;
    border-radius: 2px;
}

.menu-panel {
    flex: 1;
    width: 100%;
    padding: 28px 24px 40px;
}
.menu-panel h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.menu-panel a {
    display: block;
    padding: 14px 0;
    color: #e2e8f0;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
}
.menu-panel a:hover { color: #fff; }

.menu-guest-links { display: flex; flex-direction: column; gap: 12px; }
.menu-guest-links a {
    display: block;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    padding: 14px 20px;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.menu-guest-links a.menu-btn-signin {
    background: #2563eb;
    color: #fff;
    border: 1px solid rgba(96, 165, 250, 0.5);
}
.menu-guest-links a.menu-btn-signin:hover { background: #1d4ed8; color: #fff; }
.menu-guest-links a.menu-btn-create {
    background: transparent;
    color: #93c5fd;
    border: 2px solid rgba(96, 165, 250, 0.6);
}
.menu-guest-links a.menu-btn-create:hover {
    background: rgba(59, 130, 246, 0.15);
    color: #bfdbfe;
    border-color: rgba(96, 165, 250, 0.8);
}
.menu-guest-divider { color: #64748b; font-size: 0.875rem; text-align: center; padding: 4px 0; }

.menu-user-info {
    display: none;
    padding: 16px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.15);
    margin-bottom: 16px;
}
.menu-user-info.show { display: block; }
.menu-user-info .menu-user-name { font-weight: 600; color: #fff; font-size: 1rem; margin-bottom: 2px; }
.menu-user-info .menu-user-email { font-size: 0.875rem; color: #94a3b8; margin-bottom: 8px; }
.menu-user-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}
.menu-user-badge.vip { background: rgba(249, 115, 22, 0.25); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.5); }
.menu-user-badge.premium { background: rgba(59, 130, 246, 0.25); color: #93c5fd; border: 1px solid rgba(96, 165, 250, 0.4); }
.menu-user-badge.paid { background: rgba(59, 130, 246, 0.25); color: #93c5fd; border: 1px solid rgba(96, 165, 250, 0.4); }
.menu-user-badge.free { background: rgba(148, 163, 184, 0.2); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.25); }
.menu-user-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.menu-user-actions a { color: #93c5fd; font-weight: 600; }
.menu-user-signout {
    padding: 12px;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #94a3b8;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.menu-user-signout:hover { color: #e2e8f0; border-color: rgba(148, 163, 184, 0.5); }
.menu-panel .menu-extra {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}
.menu-panel .menu-extra a { color: #93c5fd; font-weight: 600; }
