/* Language switcher (R-1). Works without JS: menu opens on hover/focus-within.
   With JS (.is-js) it is controlled by .is-open / aria-expanded. */
.tj-lang {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    z-index: 20030;
}

.tj-lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 10px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 10px;
    color: #c7cdd4;
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    letter-spacing: .04em;
    cursor: pointer;
}

.tj-lang-toggle:hover,
.tj-lang.is-open .tj-lang-toggle {
    color: #f4f6f8;
    border-color: rgba(56, 217, 150, .45);
}

.tj-lang-toggle:focus-visible,
.tj-lang-item:focus-visible {
    outline: 2px solid #38d996;
    outline-offset: 2px;
}

.tj-lang-globe {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tj-lang-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin: 0;
    padding: 6px;
    min-width: 170px;
    background: #11161c;
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .45);
}

/* invisible bridge so hover does not drop between button and menu (no-JS) */
.tj-lang-menu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -8px;
    height: 8px;
}

.tj-lang:not(.is-js):hover .tj-lang-menu,
.tj-lang:not(.is-js):focus-within .tj-lang-menu,
.tj-lang.is-js.is-open .tj-lang-menu {
    display: block;
}

.tj-lang-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    padding: 9px 10px;
    background: none;
    border: 0;
    border-radius: 8px;
    color: #c7cdd4;
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.tj-lang-item-code {
    font-size: 11px;
    color: #868d98;
}

.tj-lang-item:hover {
    background: rgba(255, 255, 255, .06);
    color: #f4f6f8;
}

.tj-lang-item.is-active {
    color: #38d996;
    background: rgba(56, 217, 150, .10);
}

.tj-lang-item.is-active .tj-lang-item-code {
    color: #38d996;
}

/* Auth page: fixed top-right corner */
.tj-lang--corner {
    position: fixed;
    top: 14px;
    right: 14px;
}

/* App header */
.main-nav .nav-right > .tj-lang {
    margin-right: 10px;
}

@media (max-width: 700px) {
    /* mobile account row: switcher + account dropdown side by side */
    .main-nav.tj-topbar-final-v3 > .nav-right {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px;
    }

    .main-nav.tj-topbar-final-v3 > .nav-right > .tj-lang {
        margin-right: 0;
    }

    .main-nav.tj-topbar-final-v3 > .nav-right > .account-dropdown {
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
    }

    .tj-lang-toggle {
        height: 36px;
    }

    .main-nav .nav-right > .tj-lang .tj-lang-menu {
        left: 0;
        right: auto;
    }
}
