/*
 * Shared topbar stylesheet source-of-truth.
 * Every surface should consume this file through the same `#globalTopbarMount`
 * contract instead of redefining topbar layout locally.
 */

:root {
    --global-topbar-height: 64px;
}

/*
 * Fixed top bar layout rule:
 * - #globalTopbarMount reserves header space in normal flow
 * - .global-topbar is the actual fixed layer pinned to viewport top
 * This keeps page content/sidebar offsets stable across pages.
 */
#globalTopbarMount {
    display: block;
    height: var(--global-topbar-height);
}

.global-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 60;
    height: var(--global-topbar-height);
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid rgba(229, 231, 235, 1);
    backdrop-filter: blur(16px);
}

html.dark .global-topbar {
    background: rgba(2, 6, 23, 0.94);
    border-bottom-color: rgba(31, 41, 55, 1);
}

.global-topbar::before {
    content: "";
    position: absolute;
    inset: auto 18% -1px 18%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(127, 104, 255, 0.45), rgba(255, 111, 88, 0.4), transparent);
    pointer-events: none;
}

.global-topbar__container {
    max-width: 1440px;
    margin: 0 auto;
    height: 100%;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.global-topbar__left,
.global-topbar__right,
.global-topbar__nav {
    display: flex;
    align-items: center;
}

.global-topbar__left,
.global-topbar__right {
    gap: 12px;
}

.global-topbar__nav {
    gap: 2px;
}

.global-topbar__sidebar-btn,
.global-topbar__icon-btn {
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
}

.global-topbar__icon-btn {
    display: inline-flex;
}

.global-topbar__sidebar-btn {
    display: none;
}

html.dark .global-topbar__sidebar-btn,
html.dark .global-topbar__icon-btn {
    color: rgba(229, 231, 235, 0.88);
}

.global-topbar__sidebar-btn:hover,
.global-topbar__icon-btn:hover {
    background: rgba(243, 244, 246, 0.9);
}

html.dark .global-topbar__sidebar-btn:hover,
html.dark .global-topbar__icon-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

.global-topbar__brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    position: relative;
}

.global-topbar__brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.68) 44%, rgba(255, 255, 255, 0.2) 100%),
        linear-gradient(135deg, rgba(127, 104, 255, 0.18), rgba(255, 111, 88, 0.2));
    border: 1px solid rgba(229, 231, 235, 0.9);
    box-shadow:
        0 14px 30px rgba(15, 23, 42, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.35) inset,
        0 0 26px rgba(127, 104, 255, 0.12);
    flex-shrink: 0;
}

html.dark .global-topbar__brand-mark {
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04) 46%, rgba(255, 255, 255, 0.02) 100%),
        linear-gradient(135deg, rgba(127, 104, 255, 0.2), rgba(255, 111, 88, 0.14));
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.global-topbar__brand-mark img {
    display: block;
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.global-topbar__brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.global-topbar__brand-kicker {
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #7c3aed;
    line-height: 1;
}

html.dark .global-topbar__brand-kicker {
    color: #c4b5fd;
}

.global-topbar__brand-title-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.global-topbar__brand-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #111827;
    line-height: 1;
}

.global-topbar__brand-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(127, 104, 255, 0.12), rgba(255, 111, 88, 0.12));
    border: 1px solid rgba(127, 104, 255, 0.18);
    color: #6d28d9;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
}

html.dark .global-topbar__brand-badge {
    background: linear-gradient(135deg, rgba(127, 104, 255, 0.18), rgba(255, 111, 88, 0.14));
    border-color: rgba(196, 181, 253, 0.18);
    color: #ddd6fe;
}

.global-topbar__brand-subtitle {
    font-size: 0.74rem;
    color: #6b7280;
    line-height: 1.2;
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


html.dark .global-topbar__brand-title {
    color: #f9fafb;
}

html.dark .global-topbar__brand-subtitle {
    color: rgba(229, 231, 235, 0.66);
}


.global-topbar__link,
.global-topbar__dropdown-toggle {
    min-height: 42px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

html.dark .global-topbar__link,
html.dark .global-topbar__dropdown-toggle {
    color: rgba(229, 231, 235, 0.76);
}

.global-topbar__link:hover,
.global-topbar__dropdown-toggle:hover,
.global-topbar__link.is-active,
.global-topbar__dropdown.is-open .global-topbar__dropdown-toggle {
    color: #7c3aed;
    background: rgba(127, 104, 255, 0.08);
    border-color: rgba(127, 104, 255, 0.1);
}

html.dark .global-topbar__link:hover,
html.dark .global-topbar__dropdown-toggle:hover,
html.dark .global-topbar__link.is-active,
html.dark .global-topbar__dropdown.is-open .global-topbar__dropdown-toggle {
    color: #c4b5fd;
    background: rgba(127, 104, 255, 0.14);
    border-color: rgba(196, 181, 253, 0.08);
}

.global-topbar__dropdown {
    position: relative;
}

.global-topbar__dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 280px;
    padding: 12px;
    border-radius: 20px;
    border: 1px solid rgba(229, 231, 235, 1);
    background: rgba(255, 255, 255, 0.98);
    box-shadow:
        0 18px 50px rgba(15, 23, 42, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.4) inset;
    display: none;
}

html.dark .global-topbar__dropdown-menu {
    background: rgba(15, 23, 42, 0.98);
    border-color: rgba(31, 41, 55, 1);
    box-shadow: none;
}

.global-topbar__dropdown.is-open .global-topbar__dropdown-menu {
    display: block;
}

.global-topbar__dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px;
    border-radius: 14px;
    text-decoration: none;
    color: #6b7280;
}

html.dark .global-topbar__dropdown-item {
    color: rgba(229, 231, 235, 0.82);
}

.global-topbar__dropdown-item:hover,
.global-topbar__dropdown-item.is-active {
    background: rgba(243, 244, 246, 0.95);
}

html.dark .global-topbar__dropdown-item:hover,
html.dark .global-topbar__dropdown-item.is-active {
    background: rgba(255, 255, 255, 0.05);
}

.global-topbar__dropdown-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: linear-gradient(135deg, rgba(127, 104, 255, 0.16), rgba(255, 111, 88, 0.16));
}

.global-topbar__dropdown-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.global-topbar__dropdown-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #111827;
}

.global-topbar__dropdown-desc {
    font-size: 0.76rem;
    color: #6b7280;
}

html.dark .global-topbar__dropdown-title {
    color: #f9fafb;
}

html.dark .global-topbar__dropdown-desc {
    color: rgba(229, 231, 235, 0.6);
}

.global-topbar__account {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(249, 250, 251, 0.95);
    border: 1px solid rgba(229, 231, 235, 1);
}

html.dark .global-topbar__account {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(31, 41, 55, 1);
}

.global-topbar__avatar {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #7f68ff, #ff6f58);
}

.global-topbar__account-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.1;
}

.global-topbar__account-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #111827;
}

.global-topbar__account-plan {
    font-size: 0.72rem;
    color: #6b7280;
}

html.dark .global-topbar__account-name {
    color: #f9fafb;
}

html.dark .global-topbar__account-plan {
    color: rgba(229, 231, 235, 0.62);
}

.global-topbar__cta,
.global-topbar__ghost,
.global-topbar__logout {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(229, 231, 235, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    background: #fff;
    color: #374151;
    cursor: pointer;
}

html.dark .global-topbar__ghost,
html.dark .global-topbar__logout {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(31, 41, 55, 1);
    color: #e5e7eb;
}

.global-topbar__cta {
    border-color: transparent;
    color: #fff;
    background: linear-gradient(135deg, #7f68ff, #ff6f58);
    box-shadow:
        0 12px 30px rgba(127, 104, 255, 0.22),
        0 0 30px rgba(127, 104, 255, 0.16);
}

.global-topbar__guest-actions,
.global-topbar__auth-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.global-topbar__lang {
    display: inline-flex;
    align-items: center;
    padding: 3px;
    border-radius: 999px;
    border: 1px solid rgba(229, 231, 235, 1);
    background: rgba(249, 250, 251, 0.95);
}

html.dark .global-topbar__lang {
    border-color: rgba(31, 41, 55, 1);
    background: rgba(255, 255, 255, 0.04);
}

.global-topbar__lang-btn {
    min-width: 54px;
    min-height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #6b7280;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
}

html.dark .global-topbar__lang-btn {
    color: rgba(229, 231, 235, 0.76);
}

.global-topbar__lang-btn.is-active {
    color: #111827;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

html.dark .global-topbar__lang-btn.is-active {
    color: #f9fafb;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.global-topbar__mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(229, 231, 235, 1);
    background: rgba(255, 255, 255, 0.92);
    color: #374151;
    cursor: pointer;
}

html.dark .global-topbar__mobile-menu-btn {
    border-color: rgba(31, 41, 55, 1);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(229, 231, 235, 0.92);
}

.global-topbar__mobile-shell {
    position: fixed;
    inset: var(--global-topbar-height) 0 0 0;
    z-index: 59;
}

.global-topbar__mobile-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(6px);
}

.global-topbar__mobile-panel {
    position: absolute;
    top: 10px;
    left: 12px;
    right: 12px;
    max-height: calc(100vh - var(--global-topbar-height) - 24px);
    overflow: auto;
    padding: 16px;
    border-radius: 24px;
    border: 1px solid rgba(229, 231, 235, 1);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

html.dark .global-topbar__mobile-panel {
    border-color: rgba(31, 41, 55, 1);
    background: rgba(2, 6, 23, 0.98);
    box-shadow: none;
}

.global-topbar__mobile-shell.is-open .global-topbar__mobile-panel {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.global-topbar__mobile-header,
.global-topbar__mobile-footer,
.global-topbar__mobile-account,
.global-topbar__mobile-link,
.global-topbar__mobile-link--product {
    display: flex;
    align-items: center;
}

.global-topbar__mobile-header,
.global-topbar__mobile-footer,
.global-topbar__mobile-account {
    justify-content: space-between;
}

.global-topbar__mobile-brand,
.global-topbar__mobile-account-copy,
.global-topbar__mobile-link-copy {
    display: flex;
    flex-direction: column;
}

.global-topbar__mobile-brand-kicker {
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #7c3aed;
    line-height: 1;
}

html.dark .global-topbar__mobile-brand-kicker {
    color: #c4b5fd;
}

.global-topbar__mobile-brand-title-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.global-topbar__mobile-brand-title,
.global-topbar__mobile-account-name,
.global-topbar__mobile-link-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #111827;
}

.global-topbar__mobile-brand-subtitle,
.global-topbar__mobile-account-plan,
.global-topbar__mobile-link-desc,
.global-topbar__mobile-section-title {
    font-size: 0.76rem;
    color: #6b7280;
}

html.dark .global-topbar__mobile-brand-title,
html.dark .global-topbar__mobile-account-name,
html.dark .global-topbar__mobile-link-title {
    color: #f9fafb;
}

.global-topbar__mobile-brand-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(127, 104, 255, 0.12), rgba(255, 111, 88, 0.12));
    border: 1px solid rgba(127, 104, 255, 0.16);
    color: #6d28d9;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

html.dark .global-topbar__mobile-brand-badge {
    background: linear-gradient(135deg, rgba(127, 104, 255, 0.18), rgba(255, 111, 88, 0.14));
    border-color: rgba(196, 181, 253, 0.18);
    color: #ddd6fe;
}

html.dark .global-topbar__mobile-brand-subtitle,
html.dark .global-topbar__mobile-account-plan,
html.dark .global-topbar__mobile-link-desc,
html.dark .global-topbar__mobile-section-title {
    color: rgba(229, 231, 235, 0.66);
}

.global-topbar__mobile-close {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(229, 231, 235, 1);
    background: rgba(255, 255, 255, 0.92);
    color: #374151;
    cursor: pointer;
}

html.dark .global-topbar__mobile-close {
    border-color: rgba(31, 41, 55, 1);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(229, 231, 235, 0.92);
}

.global-topbar__mobile-account {
    gap: 10px;
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid rgba(229, 231, 235, 1);
    background: rgba(249, 250, 251, 0.82);
    justify-content: flex-start;
}

html.dark .global-topbar__mobile-account {
    border-color: rgba(31, 41, 55, 1);
    background: rgba(255, 255, 255, 0.04);
}

.global-topbar__mobile-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(229, 231, 235, 0.82);
}

html.dark .global-topbar__mobile-section {
    border-top-color: rgba(31, 41, 55, 1);
}

.global-topbar__mobile-section-title {
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.global-topbar__mobile-link {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border-radius: 16px;
    border: 1px solid transparent;
    background: transparent;
    color: #374151;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    justify-content: flex-start;
}

html.dark .global-topbar__mobile-link {
    color: rgba(229, 231, 235, 0.9);
}

.global-topbar__mobile-link + .global-topbar__mobile-link,
.global-topbar__mobile-link--product + .global-topbar__mobile-link--product {
    margin-top: 8px;
}

.global-topbar__mobile-link:hover,
.global-topbar__mobile-link.is-active,
.global-topbar__mobile-link--product:hover,
.global-topbar__mobile-link--product.is-active {
    background: rgba(243, 244, 246, 0.95);
}

html.dark .global-topbar__mobile-link:hover,
html.dark .global-topbar__mobile-link.is-active,
html.dark .global-topbar__mobile-link--product:hover,
html.dark .global-topbar__mobile-link--product.is-active {
    background: rgba(255, 255, 255, 0.05);
}

.global-topbar__mobile-link--button {
    border: 0;
    cursor: pointer;
}

.global-topbar__mobile-link--accent {
    background: linear-gradient(135deg, #7f68ff, #ff6f58);
    color: #fff;
}

html.dark .global-topbar__mobile-link--accent {
    color: #fff;
}

.global-topbar__mobile-link--product {
    width: 100%;
    gap: 12px;
    padding: 12px;
    border-radius: 18px;
    text-decoration: none;
}

.global-topbar__mobile-link-icon {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(127, 104, 255, 0.16), rgba(255, 111, 88, 0.16));
    flex-shrink: 0;
}

.global-topbar__mobile-footer {
    gap: 10px;
    margin-top: 18px;
}

.global-topbar__icon-btn--mobile {
    flex-shrink: 0;
}

body.global-topbar-mobile-open {
    overflow: hidden;
}

@media (max-width: 1024px) {
    .global-topbar__sidebar-btn {
        display: inline-flex;
    }

    .global-topbar__nav,
    .global-topbar__account,
    .global-topbar__auth-actions .global-topbar__ghost,
    .global-topbar__auth-actions .global-topbar__logout,
    .global-topbar__guest-actions .global-topbar__ghost,
    .global-topbar__lang {
        display: none;
    }

    .global-topbar__brand-subtitle {
        display: none;
    }

    .global-topbar__brand-kicker,
    .global-topbar__brand-badge {
        display: none;
    }

    .global-topbar__brand-mark {
        width: 42px;
        height: 42px;
        border-radius: 14px;
    }

    .global-topbar__brand-mark img {
        width: 24px;
        height: 24px;
    }

    .global-topbar__app-switch-label {
        display: none;
    }

    .global-topbar__container {
        padding: 0 12px;
    }

    .global-topbar__mobile-menu-btn {
        display: inline-flex;
    }

    .global-topbar__guest-actions .global-topbar__cta,
    .global-topbar__auth-actions .global-topbar__icon-btn {
        display: none;
    }
}
