/* Improved Logged-In Lobby — gated by App.EnhancedUIElements.ImprovedLoggedInLobby */

/* Shared toggle sizing (same proportions desktop + mobile) */
.app-header__wallet--improved {
    --currency-pill-size: 2.5rem;
}

/* --- Mobile: center wallet between logo and burger --- */
@media not all and (min-width: 1025px) {
    .app-header:has(.app-header__wallet--improved) {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        justify-content: unset;
        gap: calc(var(--spacing) * 2);
    }

    .app-header:has(.app-header__wallet--improved) .app-header__logo-mobile {
        grid-column: 1;
    }

    .app-header:has(.app-header__wallet--improved) .app-header__controls {
        grid-column: 2;
        display: flex;
        justify-content: center;
        align-items: center;
        flex: unset;
        width: 100%;
        min-width: 0;
        margin-inline: 0;
    }

    .app-header:has(.app-header__wallet--improved) .app-header__burger {
        grid-column: 3;
    }

    /* Search stays absolute under the header — keep it out of the grid flow */
    .app-header:has(.app-header__wallet--improved) .app-header__search-wrapper {
        grid-column: 1 / -1;
    }
}

/* Outer wallet shell */
.app-header__wallet--improved {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing) * 2.5);
    flex: 0 0 auto;
    width: max-content;
    max-width: 100%;
    min-width: 0;
    height: auto;
    min-height: calc(var(--spacing) * 14);
    padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
    border-radius: 1.25rem;
    background: var(--color-header-items-bg, var(--bg-tier-3, #E4F4FF));
    border: 1px solid color-mix(in srgb, var(--primary-accent-color, #782DB6) 12%, transparent);
    box-shadow: none;
}

.app-header__wallet--improved .app-header__gc-switch {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing) * 2.5);
    width: auto;
    min-width: 0;
    height: auto;
}

.app-header__wallet--improved .balance__checkbox--pill {
    position: relative;
    display: block;
    flex-shrink: 0;
    margin: 0;
    border: none;
    border-radius: 999px;
    line-height: 0;
}

.app-header__wallet--improved .balance__checkbox--pill .material-switch-control-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Horizontal GC | SC track — circle fills half and shares the track border */
.currency-pill-toggle {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    box-sizing: border-box;
    width: calc(var(--currency-pill-size) * 2);
    height: var(--currency-pill-size);
    padding: 0;
    border-radius: 999px;
    background: #fff;
    border: 1.5px solid color-mix(in srgb, var(--primary-accent-color, #782DB6) 70%, #fff);
    overflow: hidden;
    cursor: pointer;
    user-select: none;
}

.currency-pill-toggle::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    border-radius: 50%;
    background: var(--primary-accent-color, #782DB6);
    transition: left 0.22s ease;
    z-index: 0;
}

/* checked = GC (left); unchecked = SC (right) */
.balance__checkbox--pill .material-switch-control-input:not(:checked) ~ .currency-pill-toggle::before {
    left: 50%;
}

.currency-pill-toggle__option {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-family: var(--heading-font, var(--body-font));
    font-size: 0.8125rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1;
    color: var(--primary-accent-color, #782DB6);
    transition: color 0.2s ease;
}

.balance__checkbox--pill .material-switch-control-input:checked ~ .currency-pill-toggle .currency-pill-toggle__option--gc,
.balance__checkbox--pill .material-switch-control-input:not(:checked) ~ .currency-pill-toggle .currency-pill-toggle__option--sc {
    color: #fff;
}

/* Balance stack — selected on top (large), other below (small/muted) */
.app-header__balances {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
    min-width: 0;
    flex: 0 1 auto;
    line-height: 1;
}

.app-header__balance-line {
    margin: 0;
    padding: 0;
    font-family: var(--font-numbers, var(--body-font));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header__balance-line.is-primary {
    order: 1;
    font-size: 1.125rem;
    font-weight: 800;
    line-height: 1.15;
    color: var(--color-body-text, #240629);
    opacity: 1;
}

.app-header__balance-line.is-secondary {
    order: 2;
    margin-top: 0.1rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.15;
    color: #6F6875;
    opacity: 1;
}

.side-menu__user-username {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

/* Desktop: keep control on the right with spacing from the header edge */
@media (min-width: 1025px) {
    .app-header__wallet--improved {
        max-width: 20rem;
        margin-inline-end: calc(var(--spacing) * 4);
    }
}
