/* Site Header Premium Styling */

/* Mobile Menu Button */
.mobile-menu-btn {
    color: var(--text);
}

.mobile-menu-btn {
    display: none;
    width: 44px;
    height: 45px;
    padding: 5px;
    border: 0;
    background: transparent;
    border-radius: 12px;
    cursor: pointer;
}

.mobile-menu-btn__bars {
    margin: 0 auto;
    position: relative;
    top: 0;
    width: 30px;
    height: 4px;
    background: currentColor;
    display: block;
    transition: margin 0.2s ease, width 0.2s ease;
}

.mobile-menu-btn__bars::before,
.mobile-menu-btn__bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 30px;
    height: 4px;
    background: currentColor;
    display: block;
    transition: margin 0.2s ease, width 0.2s ease, left 0.2s ease;
}

.mobile-menu-btn__bars::before { top: -9px; }
.mobile-menu-btn__bars::after { top: 9px; }

/* Site Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    isolation: isolate;
    contain: paint;
}

.site-header::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(
        90deg,
        #ff0000,
        #ff7f00,
        #ffff00,
        #00ff00,
        #00ffff,
        #0000ff,
        #8b00ff,
        #ff0000
    );
    background-size: 300% 100%;
    animation: rainbowBorder 6s linear infinite;
    pointer-events: none;
}

@keyframes rainbowBorder {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

.site-header .container {
    max-width: none;
    width: 100%;
    padding-right: 8px;
}

body[data-theme="light"] .site-header {
    background: rgba(255, 255, 255, 0.85);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

/* Header Inner */
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 72px;
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    flex: 0 0 auto;
}

body[data-theme="light"] .brand-icon {
    background: rgba(0, 0, 0, 0.08);
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.08);
}

body[data-theme="light"] .brand-logo {
    background: rgba(0, 0, 0, 0.08);
}

.brand-title {
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-left: 6px;
    font-family: Algerian, "Algerian", "Poppins", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

.brand-subtitle { 
    font-size: 12px; 
    color: var(--muted); 
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-actions .nav-link {
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--text);
}

.header-actions .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
}

body[data-theme="light"] .header-actions .nav-link:hover {
    background: rgba(0, 0, 0, 0.06);
}

.header-actions .nav-link.nav-cta {
    background: var(--primary-bg);
    color: var(--primary-text);
    font-weight: 700;
}

.nav-cta:hover { filter: brightness(0.96); }

/* User Profile Button */
.user-profile {
    width: 131px;
    height: 51px;
    border-radius: 15px;
    cursor: pointer;
    transition: 0.3s ease;
    background: linear-gradient(
        to bottom right,
        #2e8eff 0%,
        rgba(46, 142, 255, 0) 30%
    );
    background-color: rgba(46, 142, 255, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.user-profile:hover,
.user-profile:focus {
    background-color: rgba(46, 142, 255, 0.7);
    box-shadow: 0 0 10px rgba(46, 142, 255, 0.5);
    outline: none;
}

.user-profile-inner {
    width: 127px;
    height: 47px;
    border-radius: 13px;
    background-color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: #fff;
    font-weight: 600;
}

.user-profile-inner p {
    margin: 0;
    font-size: 14px;
    line-height: 1;
}

.user-profile-inner svg {
    width: 27px;
    height: 27px;
    fill: #fff;
}

/* User Chip */
.user-chip {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 900;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

body[data-theme="light"] .user-chip {
    border-color: rgba(0, 0, 0, 0.14);
}

/* Nav Toggle */
.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 10px;
}

.nav-toggle span {
    display: block;
    height: 2px;
    background: currentColor;
    border-radius: 999px;
}

body[data-theme="light"] .nav-toggle {
    border-color: rgba(0, 0, 0, 0.16);
    background: rgba(0, 0, 0, 0.04);
}

body[data-theme="light"] .nav-toggle span {
    background: currentColor;
}

.nav-toggle span + span { margin-top: 6px; }

/* Responsive Styles */
@media (max-width: 860px) {
    .mobile-menu-btn { display: inline-block; }

    .site-header .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .header-inner {
        min-height: 58px;
    }

    .brand { gap: 10px; }

    .mobile-menu-btn {
        width: 40px;
        height: 40px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-menu-btn__bars {
        width: 26px;
        height: 3px;
    }

    .mobile-menu-btn__bars::before,
    .mobile-menu-btn__bars::after {
        width: 26px;
        height: 3px;
    }

    .mobile-menu-btn__bars::before { top: -7px; }
    .mobile-menu-btn__bars::after { top: 7px; }

    .brand-icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }

    .brand-title {
        font-size: 18px;
        line-height: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 55vw;
    }

    .header-actions .nav-link {
        padding: 8px 10px;
        border-radius: 10px;
        font-size: 14px;
    }

    .user-chip {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }

    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }

    .nav {
        display: none;
        position: absolute;
        right: 16px;
        top: 76px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 12px;
        min-width: 210px;
        border-radius: 16px;
        background: rgba(0, 0, 0, 0.92);
        border: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow: var(--shadow);
    }

    .nav.is-open { display: flex; }
}

@media (max-width: 860px) {
    body[data-theme="light"] .nav {
        background: rgba(255, 255, 255, 0.92);
        border-color: rgba(0, 0, 0, 0.12);
    }
}

@media (max-width: 520px) {
    .user-profile {
        width: 116px;
        height: 46px;
        border-radius: 14px;
    }

    .user-profile-inner {
        width: 112px;
        height: 42px;
        border-radius: 12px;
        gap: 12px;
    }

    .user-profile-inner svg {
        width: 24px;
        height: 24px;
    }
}
