/* =========================================================
   ALIELITE — 3-COLUMN LINEAR HEADER & SLIDE-IN MENU
   Dark Cosmic Glassmorphism with #a78bfa Accent
   ========================================================= */

:root {
    --header-height-desktop: 64px;
    --header-height-mobile: 58px;
    --accent-purple: #a78bfa;
    --accent-purple-glow: rgba(167, 139, 250, 0.35);
    --header-bg: rgba(11, 12, 16, 0.82);
    --drawer-bg: rgba(13, 15, 22, 0.96);
    --glass-border: rgba(255, 255, 255, 0.08);
}

/* ---------------------------------------------------------
   HEADER BAR (Fixed top, 3-Column layout)
   --------------------------------------------------------- */
.cosmic-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: var(--header-height-desktop);
    z-index: 1000;
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.35);
    transition: background 0.3s ease, box-shadow 0.3s ease, height 0.3s ease;
}

.cosmic-navbar.scrolled {
    background: rgba(11, 12, 16, 0.95);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
    border-bottom-color: rgba(167, 139, 250, 0.18);
}

.cosmic-header-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: 100%;
    width: min(calc(100% - 24px), 1180px);
    margin-inline: auto;
    padding: 0 4px;
    gap: 10px;
    box-sizing: border-box;
}

.cosmic-col {
    display: flex;
    align-items: center;
    min-width: 0;
}

.cosmic-col-left {
    justify-content: flex-start;
}

.cosmic-col-center {
    justify-content: center;
}

.cosmic-col-right {
    justify-content: flex-end;
}

/* ---------------------------------------------------------
   LEFT COLUMN: User Profile or Guest Auth
   --------------------------------------------------------- */
.cosmic-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    padding: 3px 10px 3px 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
    max-width: 100%;
}

.cosmic-user-pill:hover {
    background: rgba(167, 139, 250, 0.12);
    border-color: rgba(167, 139, 250, 0.35);
    box-shadow: 0 0 12px var(--accent-purple-glow);
    transform: translateY(-1px);
}

.cosmic-avatar-wrap {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    padding: 1.5px;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid var(--accent-purple);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    overflow: hidden;
}

.cosmic-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.cosmic-username {
    font-size: 0.82rem;
    font-weight: 600;
    color: #ffd700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
    letter-spacing: 0.2px;
}

/* Guest buttons */
.cosmic-guest-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.cosmic-btn-auth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.cosmic-btn-login {
    color: #d9dbe5;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.cosmic-btn-login:hover {
    color: #ffd700;
    background: rgba(255, 215, 0, 0.08);
    border-color: rgba(255, 215, 0, 0.35);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.cosmic-btn-register {
    color: #ffffff;
    background: linear-gradient(135deg, #6c2bd9, #4f1db0);
    border: 1px solid rgba(167, 139, 250, 0.4);
    box-shadow: 0 0 10px rgba(108, 43, 217, 0.35);
}

.cosmic-btn-register:hover {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    box-shadow: 0 0 16px var(--accent-purple-glow);
    transform: translateY(-1px);
    color: #ffffff;
}

/* ---------------------------------------------------------
   CENTER COLUMN: Logo (Keeps existing markup)
   --------------------------------------------------------- */
.cosmic-col-center .logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #ffd700;
    font-family: "Orbitron", sans-serif;
    font-size: 1.12rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    text-decoration: none;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.35);
    white-space: nowrap;
    margin: 0;
}

.cosmic-col-center .logo:hover {
    color: #ffe87a;
    text-shadow: 0 0 24px rgba(255, 215, 0, 0.55);
}

.cosmic-col-center .logo .logo-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #0b0c10;
    background: radial-gradient(circle at 35% 30%, #fff, #ffd700 28%, #d49400 75%);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.55);
    font-size: 0.82rem;
    flex-shrink: 0;
}

/* ---------------------------------------------------------
   RIGHT COLUMN: Hamburger Icon
   --------------------------------------------------------- */
.cosmic-hamburger-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 1.05rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
    line-height: 1;
    transition: all 0.2s ease;
}

.cosmic-hamburger-btn:hover {
    background: rgba(167, 139, 250, 0.16);
    border-color: rgba(167, 139, 250, 0.45);
    color: var(--accent-purple);
    box-shadow: 0 0 14px var(--accent-purple-glow);
    transform: scale(1.05);
}

.cosmic-hamburger-btn:active {
    transform: scale(0.95);
}

/* ---------------------------------------------------------
   SLIDE-IN MENU & BACKDROP
   --------------------------------------------------------- */
.cosmic-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cosmic-drawer-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.cosmic-drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    z-index: 1100;
    background: var(--drawer-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(167, 139, 250, 0.2);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.75);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

.cosmic-drawer-panel.active {
    transform: translateX(0);
}

/* Drawer Header */
.cosmic-drawer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.cosmic-drawer-heading {
    font-family: "Orbitron", sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-purple);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.cosmic-drawer-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #85899b;
    font-size: 0.95rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s ease;
    padding: 0;
}

.cosmic-drawer-close:hover {
    color: #ffffff;
    background: rgba(255, 77, 94, 0.18);
    border-color: rgba(255, 77, 94, 0.4);
    transform: scale(1.05);
}

/* Drawer Scrollable Content */
.cosmic-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 24px;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* User Card at Top of Menu */
.cosmic-drawer-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(167, 139, 250, 0.06);
    border: 1px solid rgba(167, 139, 250, 0.15);
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.cosmic-drawer-user:hover {
    background: rgba(167, 139, 250, 0.12);
    border-color: rgba(167, 139, 250, 0.3);
}

.cosmic-drawer-user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    padding: 2px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--accent-purple);
    display: grid;
    place-items: center;
    overflow: hidden;
    flex-shrink: 0;
}

.cosmic-drawer-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.cosmic-drawer-user-avatar .guest-icon {
    font-size: 1.1rem;
    color: var(--accent-purple);
}

.cosmic-drawer-user-meta {
    min-width: 0;
    flex: 1;
}

.cosmic-drawer-user-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffd700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cosmic-drawer-user-email {
    font-size: 0.74rem;
    color: #85899b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* Section Labels & Dividers */
.cosmic-menu-section-label {
    font-size: 0.7rem;
    font-family: "Orbitron", sans-serif;
    font-weight: 700;
    color: #85899b;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 6px 10px 2px;
}

.cosmic-drawer-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
    margin: 4px 6px;
}

/* Menu Links */
.cosmic-menu-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cosmic-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    color: #d9dbe5;
    font-size: 0.86rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    font-family: inherit;
}

.cosmic-menu-item:hover {
    color: #ffffff;
    background: rgba(167, 139, 250, 0.12);
    border-color: rgba(167, 139, 250, 0.2);
    transform: translateX(3px);
}

.cosmic-menu-item-icon {
    width: 22px;
    display: grid;
    place-items: center;
    font-size: 0.88rem;
    color: var(--accent-purple);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.cosmic-menu-item:hover .cosmic-menu-item-icon {
    transform: scale(1.15);
}

.cosmic-menu-item-label {
    flex: 1;
}

.cosmic-menu-badge {
    background: #ffd700;
    color: #0b0c10;
    font-family: "Orbitron", sans-serif;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.45);
    line-height: 1.2;
}

/* Admin Item Highlight */
.cosmic-menu-admin {
    color: #00d4ff;
    border: 1px solid rgba(0, 212, 255, 0.15);
    background: rgba(0, 212, 255, 0.04);
}

.cosmic-menu-admin .cosmic-menu-item-icon {
    color: #00d4ff;
}

.cosmic-menu-admin:hover {
    background: rgba(0, 212, 255, 0.12);
    border-color: rgba(0, 212, 255, 0.35);
    color: #00d4ff;
}

/* Logout Item */
.cosmic-menu-logout-form {
    margin: 0;
    padding: 0;
    width: 100%;
}

.cosmic-menu-logout {
    color: #ff8f9b;
}

.cosmic-menu-logout .cosmic-menu-item-icon {
    color: #ff8f9b;
}

.cosmic-menu-logout:hover {
    color: #ff4d5e;
    background: rgba(255, 77, 94, 0.1);
}

.cosmic-menu-logout:hover .cosmic-menu-item-icon {
    color: #ff4d5e;
}

/* Body Scroll Lock */
body.cosmic-menu-locked {
    overflow: hidden !important;
}

/* ---------------------------------------------------------
   RESPONSIVE / MOBILE OPTIMIZATION (Desktop = Mobile Identical)
   Mobile-first: Tested at 360px width
   --------------------------------------------------------- */
@media (max-width: 600px) {
    .cosmic-navbar {
        height: var(--header-height-mobile);
    }

    .cosmic-header-grid {
        width: calc(100% - 16px);
        padding: 0;
        gap: 6px;
    }

    .cosmic-avatar-wrap {
        width: 28px;
        height: 28px;
    }

    .cosmic-user-pill {
        padding: 2px 6px 2px 2px;
        gap: 5px;
    }

    .cosmic-username {
        max-width: 65px;
        font-size: 0.74rem;
    }

    .cosmic-btn-auth {
        padding: 5px 8px;
        font-size: 0.72rem;
        gap: 3px;
    }

    .cosmic-col-center .logo {
        font-size: 0.98rem;
        gap: 6px;
    }

    .cosmic-col-center .logo .logo-icon {
        width: 26px;
        height: 26px;
        font-size: 0.74rem;
    }

    .cosmic-hamburger-btn {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
    }
}

@media (max-width: 380px) {
    .cosmic-username {
        max-width: 50px;
    }

    .cosmic-btn-auth span {
        display: inline;
    }

    .cosmic-btn-login {
        padding: 5px 7px;
    }

    .cosmic-btn-register {
        padding: 5px 7px;
    }
}
