/* ==========================================================================
   FastJoins v2 — top bar
   ========================================================================== */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--nav-h);
    background: rgba(16, 18, 23, 0.86);
    backdrop-filter: saturate(140%) blur(12px);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    height: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}
.brand img { border-radius: 8px; }

/* Links */
.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.15s, background-color 0.15s;
}
.nav-link svg { width: 17px; height: 17px; }
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--text); }
.nav-link.active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -12px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
}

/* Right side */
.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.show-mobile { display: none; }

/* Account menu */
.account { position: relative; }

.account-trigger {
    display: flex;
    padding: 2px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: none;
    cursor: pointer;
    transition: border-color 0.15s;
}
.account-trigger:hover,
.account.open .account-trigger { border-color: var(--accent); }
.account-trigger .avatar { border-radius: 50%; }

.account-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 248px;
    padding: 6px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s var(--ease), transform 0.15s var(--ease), visibility 0.15s;
}
.account.open .account-menu { opacity: 1; visibility: visible; transform: none; }

.account-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 12px;
}
.account-head img { border-radius: 50%; }
.account-head strong { display: block; font-size: 14px; line-height: 1.2; }
.account-head small { color: var(--text-3); font-size: 12px; }

.account-menu .item {
    display: block;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    text-decoration: none;
    font-size: 14px;
}
.account-menu .item:hover { background: var(--surface-2); color: var(--text); }
.account-menu .item.danger { color: var(--red); }
.account-menu .item.danger:hover { background: var(--red-soft); }

.account-menu .sep { height: 1px; background: var(--border); margin: 6px 4px; }
.account-menu .item-label { padding: 4px 10px; font-size: 12px; color: var(--text-3); }

.lang-switch {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 2px 6px 6px;
}
.lang-switch button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-raised);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.lang-switch button img { width: 16px; height: auto; border-radius: 2px; }
.lang-switch button:hover { border-color: var(--border-strong); color: var(--text); }
.lang-switch button.active { border-color: var(--accent); color: var(--text); background: var(--accent-soft); cursor: default; }

/* Medium screens: icon-only links (label shown as tooltip) */
@media (min-width: 761px) and (max-width: 1080px) {
    .topbar-inner { gap: 16px; }
    .nav-link { padding: 0 10px; }
    .nav-link span { display: none; }
    .nav-right .hide-mobile.ghost { display: none; }
}

/* Mobile: links become a bottom tab bar */
@media (max-width: 760px) {
    /* backdrop-filter would trap the fixed tab bar inside the header */
    .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
    .topbar-inner { padding: 0 16px; gap: 12px; }
    .brand { flex: 1; }
    .hide-mobile { display: none; }
    .show-mobile { display: inline; }

    .nav-links {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        justify-content: space-around;
        gap: 0;
        height: 64px;
        padding: 0 4px env(safe-area-inset-bottom);
        background: rgba(16, 18, 23, 0.94);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
    }

    .nav-link {
        flex: 1;
        flex-direction: column;
        justify-content: center;
        gap: 3px;
        height: 100%;
        padding: 0;
        font-size: 11px;
        border-radius: 0;
    }
    .nav-link svg { width: 20px; height: 20px; }
    .nav-link:hover { background: none; }
    .nav-link.active { color: var(--accent-text); }
    .nav-link.active::after { top: 0; bottom: auto; left: 30%; right: 30%; }
}
