/* ============================================================
   SolarThrone Top Bar — horizontal navigation
   Replaces the sidebar with a compact top nav bar
   ============================================================ */

/* ---------- App Shell (no sidebar) ---------- */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---------- Top Bar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 200;
    background: rgba(10, 14, 26, 0.92);
    border-bottom: 1px solid var(--topbar-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.topbar__inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: var(--topbar-height);
    padding: 0 var(--space-lg);
    gap: var(--space-lg);
}

/* ---------- Brand ---------- */
.topbar__brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    display: flex;
    gap: 0;
    flex-shrink: 0;
}

.topbar__brand-solar {
    color: var(--metal-gold);
    text-shadow: 0 0 20px rgba(201, 146, 46, 0.3);
}

.topbar__brand-throne {
    color: var(--metal-chrome);
}

.topbar__brand:hover .topbar__brand-solar {
    text-shadow: 0 0 24px rgba(201, 146, 46, 0.5);
    color: #daa63a;
}

.topbar__brand:hover .topbar__brand-throne {
    color: var(--star-warm);
}

/* ---------- Nav Links (desktop) ---------- */
.topbar__nav-group {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.topbar__link {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(232, 224, 208, 0.55);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 9999px;
    transition: color 0.2s, background 0.2s;
}

.topbar__link:hover {
    color: var(--metal-chrome);
    background: rgba(232, 224, 208, 0.06);
    text-shadow: none;
}

.topbar__link--active {
    color: var(--star-warm);
    background: rgba(201, 146, 46, 0.1);
}

.topbar__link--active:hover {
    color: var(--star-warm);
    background: rgba(201, 146, 46, 0.15);
}

/* ---------- Stats Readout (center-right) ---------- */
.topbar__stats {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--space-lg);
}

.topbar__stat {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.topbar__stat-label {
    font-family: var(--font-display);
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(192, 184, 168, 0.5);
}

.topbar__stat-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: rgba(232, 224, 208, 0.7);
}

.topbar__stat--credits .topbar__stat-value {
    color: var(--metal-gold);
    font-weight: 700;
}

/* Inline fuel bar */
.topbar__stat-bar {
    width: 60px;
    height: 6px;
    border-radius: 3px;
    background: rgba(10, 14, 26, 0.8);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.topbar__stat-bar--mobile {
    width: 100%;
    height: 6px;
}

.topbar__stat-bar-fill {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #3a9aa6, #5bb8c4);
    box-shadow: 0 0 4px rgba(91, 184, 196, 0.3);
    transition: width 0.4s ease;
}

/* ---------- Mobile Toggle (hidden on desktop) ---------- */
.topbar__mobile-toggle {
    display: none;
    background: none;
    border: 1px solid rgba(232, 224, 208, 0.12);
    border-radius: 4px;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    color: rgba(232, 224, 208, 0.6);
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
    margin-left: auto;
}

.topbar__mobile-toggle:hover {
    color: var(--metal-chrome);
    border-color: rgba(232, 224, 208, 0.3);
    background: rgba(232, 224, 208, 0.05);
    box-shadow: none;
    filter: none;
}

/* ---------- Avatar + Dropdown (far right) ---------- */
.topbar__profile {
    position: relative;
    margin-left: var(--space-sm);
}

.topbar__avatar-btn {
    background: none;
    border: 2px solid rgba(232, 224, 208, 0.15);
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
}

.topbar__avatar-btn:hover {
    border-color: rgba(201, 146, 46, 0.4);
    box-shadow: 0 0 12px rgba(201, 146, 46, 0.15);
    filter: none;
}

.topbar__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    background:
        radial-gradient(ellipse at 35% 30%, #daa63a 0%, transparent 50%),
        linear-gradient(160deg, #c9922e 0%, #b5751a 50%, #9a6218 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.topbar__avatar--has-image {
    background: none;
}

.topbar__avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.topbar__avatar-initial {
    font-weight: 700;
    font-size: 0.8rem;
    color: #0a0e1a;
    line-height: 1;
}

/* Dropdown panel */
.topbar__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: rgba(10, 14, 26, 0.98);
    border: 1px solid var(--topbar-border);
    border-radius: var(--panel-radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 300;
}

.topbar__dropdown-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--topbar-border);
}

.topbar__dropdown-name {
    display: block;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--star-warm);
}

.topbar__dropdown-location {
    display: block;
    font-size: 0.7rem;
    color: rgba(232, 224, 208, 0.45);
    margin-top: 2px;
}

.topbar__dropdown-location--transit {
    color: #f5c842;
}

.topbar__dropdown-item {
    display: block;
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(232, 224, 208, 0.6);
    text-decoration: none;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.topbar__dropdown-item:hover {
    color: var(--metal-chrome);
    background: rgba(232, 224, 208, 0.05);
    text-shadow: none;
}

.topbar__dropdown-item--logout:hover {
    color: var(--alert-red);
    background: rgba(224, 68, 32, 0.08);
}

.topbar__dropdown-form {
    border-top: 1px solid var(--topbar-border);
}

/* Dropdown transitions */
.dropdown-enter { transition: opacity 0.15s ease, transform 0.15s ease; }
.dropdown-enter-start { opacity: 0; transform: translateY(-4px); }
.dropdown-enter-end { opacity: 1; transform: translateY(0); }
.dropdown-leave { transition: opacity 0.1s ease, transform 0.1s ease; }
.dropdown-leave-start { opacity: 1; transform: translateY(0); }
.dropdown-leave-end { opacity: 0; transform: translateY(-4px); }

/* ---------- Mobile Menu (disclosure panel) ---------- */
.topbar__mobile-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    border-top: 1px solid var(--topbar-border);
    background: rgba(10, 14, 26, 0.98);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: var(--space-md) var(--space-lg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Mobile menu transitions */
.mobile-menu-enter { transition: opacity 0.2s ease, max-height 0.2s ease; overflow: hidden; }
.mobile-menu-enter-start { opacity: 0; max-height: 0; }
.mobile-menu-enter-end { opacity: 1; max-height: 500px; }
.mobile-menu-leave { transition: opacity 0.15s ease, max-height 0.15s ease; overflow: hidden; }
.mobile-menu-leave-start { opacity: 1; max-height: 500px; }
.mobile-menu-leave-end { opacity: 0; max-height: 0; }

.topbar__mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--topbar-border);
    margin-bottom: var(--space-md);
}

.topbar__mobile-link {
    display: block;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(232, 224, 208, 0.6);
    text-decoration: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--panel-radius);
    transition: color 0.2s, background 0.2s;
}

.topbar__mobile-link:hover {
    color: var(--metal-chrome);
    background: rgba(232, 224, 208, 0.04);
    text-shadow: none;
}

.topbar__mobile-link--active {
    color: var(--star-warm);
    background: rgba(201, 146, 46, 0.08);
}

/* Mobile stats */
.topbar__mobile-stats {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--topbar-border);
    margin-bottom: var(--space-md);
}

.topbar__mobile-stat {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.topbar__mobile-stat .topbar__stat-label {
    min-width: 4em;
}

.topbar__stat-value--credits {
    color: var(--metal-gold);
    font-weight: 700;
}

/* Mobile profile */
.topbar__mobile-profile {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--topbar-border);
    margin-bottom: var(--space-md);
}

.topbar__mobile-profile-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar__mobile-profile-name {
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--star-warm);
}

.topbar__mobile-profile-location {
    font-size: 0.7rem;
    color: rgba(232, 224, 208, 0.45);
}

.topbar__mobile-profile-location--transit {
    color: #f5c842;
}

/* Mobile actions */
.topbar__mobile-actions {
    display: flex;
    gap: var(--space-sm);
}

.topbar__mobile-action {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(232, 224, 208, 0.6);
    text-decoration: none;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid rgba(232, 224, 208, 0.12);
    border-radius: 4px;
    background: none;
    cursor: pointer;
    transition: all 0.2s;
}

.topbar__mobile-action:hover {
    color: var(--metal-chrome);
    border-color: rgba(232, 224, 208, 0.3);
    background: rgba(232, 224, 208, 0.05);
    text-shadow: none;
}

.topbar__mobile-action--logout:hover {
    color: var(--alert-red);
    border-color: rgba(224, 68, 32, 0.4);
    background: rgba(224, 68, 32, 0.08);
}


/* ---------- Responsive: Mobile (< 1024px) ---------- */
@media (max-width: 63.9375em) {
    .topbar__nav-group {
        display: none;
    }

    .topbar__stats {
        display: none;
    }

    .topbar__profile {
        display: none;
    }

    .topbar__mobile-toggle {
        display: flex;
    }
}

@media (max-width: 30em) {
    .topbar__inner {
        padding: 0 var(--space-md);
    }

    .topbar__brand {
        font-size: 0.95rem;
        letter-spacing: 0.12em;
    }

    .topbar__mobile-menu {
        padding: var(--space-md);
    }
}
