.country-switcher {
    position: relative;
    min-width: 0;
}

.country-switcher .country-select[hidden] {
    display: none !important;
}

.market-switcher {
    position: relative;
    width: 180px;
    max-width: 100%;
    font-family: Cairo, sans-serif;
}

.market-switcher__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 40px;
    padding: 7px 13px;
    border: 1px solid var(--border-gold);
    border-radius: 12px;
    background: var(--bg2);
    color: var(--text);
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1.4;
    cursor: pointer;
    list-style: none;
}

.market-switcher__trigger::-webkit-details-marker {
    display: none;
}

.market-switcher__trigger:is(:hover, :focus-visible),
.market-switcher[open] .market-switcher__trigger {
    border-color: var(--gold);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.13);
}

.market-switcher__current {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-switcher__chevron {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-right: 2px solid var(--gold);
    border-bottom: 2px solid var(--gold);
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.18s ease;
}

.market-switcher[open] .market-switcher__chevron {
    transform: rotate(225deg) translateY(-2px);
}

.market-switcher__menu {
    position: absolute;
    z-index: 120;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    width: min(250px, calc(100vw - 24px));
    max-height: min(430px, calc(100dvh - 82px));
    padding: 7px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--bg2);
    box-shadow: 0 18px 45px rgba(24, 31, 43, 0.18);
}

html[data-theme="night"] .market-switcher__menu {
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.4);
}

.market-switcher__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 40px;
    padding: 7px 11px;
    border-radius: 9px;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.4;
    text-decoration: none;
}

.market-switcher__link bdi {
    color: var(--text-muted);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
}

.market-switcher__link:is(:hover, :focus-visible) {
    outline: 0;
    background: var(--bg3);
}

.market-switcher__link:focus-visible {
    box-shadow: inset 0 0 0 2px var(--gold);
}

.market-switcher__link.is-current {
    background: color-mix(in srgb, var(--gold) 12%, var(--bg2));
    color: var(--text);
    font-weight: 900;
}

.market-switcher__link.is-current::before {
    content: '✓';
    order: 3;
    color: var(--gold);
    font-size: 0.8rem;
}

.market-switcher__group-label {
    display: block;
    margin: 6px 4px 3px;
    padding: 9px 7px 2px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 800;
}

@media (max-width: 640px) {
    .market-switcher {
        width: 100%;
    }

    .market-switcher__trigger {
        min-height: 32px;
        gap: 5px;
        padding: 5px 8px;
        border-radius: 9px;
        font-size: 0.7rem;
    }

    .market-switcher__menu {
        width: min(250px, calc(100vw - 16px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .market-switcher__chevron {
        transition: none;
    }
}
