/*
 * Header + mobile navigation.
 * Based on reference styles.css header section.
 */

.site-header {
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background: rgba(2, 7, 18, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.header-inner {
    height: 100%;
    display: grid;
    grid-template-columns: 186px minmax(0, 1fr) 190px;
    align-items: center;
    gap: 16px;
}

/* ── Brand ─────────────────────────────────────────────────── */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    white-space: nowrap;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
}
.brand:hover, .brand:focus {
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    width: 28px;
    height: 25px;
    flex: 0 0 28px;
    filter: drop-shadow(0 0 10px rgba(255, 31, 109, 0.25));
}

.brand-name {
    font-size: 19px;
    line-height: 1;
    letter-spacing: -0.45px;
}

/* ── Main nav ──────────────────────────────────────────────── */
.main-nav {
    min-width: 0;
}

.main-nav-list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-nav-item {
    display: flex;
    align-items: center;
}

.main-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 550;
    color: #eef1f6;
    transition: color 0.2s;
}

.main-nav-link > span {
    display: block;
    line-height: 1;
}

.main-nav-link:hover,
.main-nav-link:focus-visible,
.main-nav-link.is-active {
    color: var(--pink-2);
}

/* Mobile-only nav items — hidden on desktop */
.mobile-only { display: none; }

.nav-logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    width: 100%;
}
.nav-signup-btn {
    color: var(--pink) !important;
}

/* ── Desktop chevron (inside link) ────────────────────────── */
.nav-chevron {
    display: block;
    width: 11px;
    height: 11px;
    flex: 0 0 11px;
    color: currentColor;
    transition: transform 160ms ease;
}

/* ── Mobile toggle (hidden on desktop) ───────────────────── */
.nav-sub-toggle { display: none; }
.nav-row { display: contents; }

/* ── Nav dropdown ─────────────────────────────────────────── */
.has-dropdown {
    position: relative;
}

.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    padding: 10px 0;
    padding-top: 18px;
    background: #0a1422;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s, visibility 0.15s;
    transition-delay: 0.1s;
}

/* Bridge — invisible area between link and dropdown to maintain hover */
.nav-dropdown::before {
    content: "";
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
}

.nav-dropdown a {
    display: block;
    padding: 9px 18px;
    font-size: 14px;
    color: var(--muted);
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}

.nav-dropdown a:hover {
    color: #fff;
    background: rgba(255, 31, 109, 0.08);
}

/* Desktop: hover/focus on entire .has-dropdown opens submenu */
.has-dropdown:hover > .nav-dropdown,
.has-dropdown:focus-within > .nav-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0.15s;
}

.has-dropdown:hover .nav-chevron,
.has-dropdown:focus-within .nav-chevron {
    transform: rotate(180deg);
}

/* ── Header actions ────────────────────────────────────────── */
.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #ff6a98;
    border: 1px solid rgba(255, 49, 88, 0.4);
    border-radius: 20px;
    background: rgba(255, 31, 109, 0.08);
    white-space: nowrap;
    transition: border-color 0.2s, background 0.2s;
}

.plan-badge:hover {
    border-color: rgba(255, 49, 88, 0.7);
    background: rgba(255, 31, 109, 0.15);
    color: #ff8aaf;
}

.login-link {
    font-size: 15px;
    white-space: nowrap;
    transition: color 0.2s;
}

.login-link:hover,
.login-link:focus-visible {
    color: var(--pink-2);
}

.logout-form {
    display: inline;
}

.logout-btn {
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
}

/* ── Nav overlay ──────────────────────────────────────────── */
.nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(2, 7, 19, 0.65);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}
.nav-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* ── Nav toggle X animation ──────────────────────────────── */
.nav-toggle.is-active > span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}
.nav-toggle.is-active > span:nth-child(2) {
    opacity: 0;
}
.nav-toggle.is-active > span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* ── Mobile nav toggle ─────────────────────────────────────── */
.nav-toggle {
    display: none;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle > span:not(.visually-hidden) {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    margin: 4px 0;
    transition: transform 0.2s;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1199.98px) {
    .header-inner {
        grid-template-columns: 172px minmax(0, 1fr) 172px;
    }
    .main-nav-list {
        gap: 18px;
    }
    .main-nav-link,
    .login-link {
        font-size: 14px;
    }
}

@media (max-width: 991.98px) {
    .mobile-only { display: list-item; }

    .nav-mobile-secondary {
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid rgba(255,255,255,0.08);
    }

    .nav-auth-actions {
        display: flex !important;
        gap: 10px;
        padding: 20px 0 10px;
        margin-top: 12px;
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    .nav-mobile-join { flex: 1; text-align: center; }
    .nav-mobile-login { flex: 1; text-align: center; }

    .site-header {
        height: auto;
        min-height: 68px;
    }
    .header-inner {
        grid-template-columns: 1fr auto auto;
        min-height: 68px;
        padding: 10px 0;
    }
    .nav-toggle {
        display: block;
        grid-column: 2;
        grid-row: 1;
    }
    .header-actions {
        grid-column: 3;
        grid-row: 1;
    }
    .main-nav {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(320px, 85vw);
        background: #0a1422;
        border-left: 1px solid var(--line);
        z-index: 200;
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.25s ease, visibility 0.25s;
        overflow-y: auto;
        padding: 20px 18px;
    }
    .main-nav.is-open {
        transform: translateX(0);
        visibility: visible;
    }
    .main-nav-list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }
    .main-nav-item {
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.06);
        flex-direction: column;
        align-items: stretch;
    }
    .main-nav-link {
        width: 100%;
        justify-content: flex-start;
        min-height: 48px;
        font-size: 16px;
    }
    /* Hide desktop chevron on mobile */
    .nav-chevron { display: none; }

    /* Mobile nav-row: link + toggle side by side */
    .nav-row {
        display: flex;
        align-items: center;
        width: 100%;
    }
    .nav-row > .main-nav-link {
        flex: 1 1 auto;
        min-width: 0;
    }
    .nav-sub-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 44px;
        width: 44px;
        height: 48px;
        background: none;
        border: none;
        color: var(--muted);
        cursor: pointer;
        padding: 0;
    }
    .toggle-icon {
        font-size: 20px;
        font-weight: 300;
        line-height: 1;
        transition: transform 160ms ease;
    }
    .nav-sub-toggle[aria-expanded="true"] .toggle-icon {
        transform: rotate(45deg);
    }

    /* Mobile dropdown */
    .nav-dropdown {
        position: static;
        transform: none;
        min-width: 0;
        width: 100%;
        margin-top: 0;
        padding: 0 0 8px 18px;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition: none;
    }
    .has-dropdown > .nav-dropdown,
    .nav-row + .nav-dropdown {
        display: none;
    }
    .has-dropdown.is-expanded > .nav-dropdown,
    .has-dropdown.is-expanded .nav-row + .nav-dropdown {
        display: block;
    }
    .nav-dropdown a {
        padding: 8px 0;
        font-size: 15px;
        white-space: normal;
    }

    /* Override desktop hover — don't open on hover in mobile */
    .has-dropdown:hover > .nav-dropdown,
    .has-dropdown:focus-within > .nav-dropdown {
        display: none;
    }
    .has-dropdown.is-expanded:hover > .nav-dropdown,
    .has-dropdown.is-expanded:focus-within > .nav-dropdown {
        display: block;
    }
}

@media (max-width: 767.98px) {
    .login-link,
    .header-actions .icon-btn {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .header-actions .btn-gradient {
        padding: 0 13px;
    }
    .brand-name {
        font-size: 17px;
    }
}
