/* ============================================================
   TsGym Language Switcher
   - .site-lang-switch  → main site header (horizontal pill)
   - .panel-lang-switch → user panel (compact vertical)
   ============================================================ */

/* ---- Main site: horizontal segmented pill ---- */
.tsgym-lang-switch.site-lang-switch {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    margin: 0;
    padding: 4px;
    min-width: 0;
    height: 42px;
    border-radius: 12px;
    background: #eef2f7;
    border: 1px solid #dbeafe;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
    flex-shrink: 0;
}

.site-lang-switch .tsgym-lang-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 34px;
    padding: 0 13px;
    border-radius: 9px;
    text-decoration: none;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1;
    white-space: nowrap;
    opacity: 1;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.site-lang-switch .tsgym-lang-item:hover {
    color: #334155;
    background: rgba(255, 255, 255, 0.55);
}

.site-lang-switch .tsgym-lang-item.active {
    color: #1d4ed8;
    background: #ffffff;
    box-shadow:
        0 2px 8px rgba(37, 99, 235, 0.16),
        0 1px 2px rgba(15, 23, 42, 0.06);
}

.site-lang-switch .tsgym-flag {
    width: 22px;
    height: 15px;
    border-radius: 3px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
    background: #fff;
}

.site-lang-switch .tsgym-lang-code {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

/* Dark mode — main site */
body.dark .site-lang-switch {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

body.dark .site-lang-switch .tsgym-lang-item {
    color: #94a3b8;
}

body.dark .site-lang-switch .tsgym-lang-item:hover {
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.08);
}

body.dark .site-lang-switch .tsgym-lang-item.active {
    color: #93c5fd;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

body.dark .site-lang-switch .tsgym-flag {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Panel top navbar — slightly wider pill */
body.panel-app .top-navbar .site-lang-switch {
    min-width: 132px;
}

/* Mobile header bar alignment */
.icon-tsgym-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.tsgym-dark-light-mobile {
    margin-left: 0;
}

.site-lang-switch--mobile {
    height: 36px;
    padding: 3px;
    border-radius: 10px;
}

.site-lang-switch--mobile .tsgym-lang-item {
    height: 30px;
    padding: 0 9px;
    gap: 5px;
    font-size: 10px;
}

.site-lang-switch--mobile .tsgym-flag {
    width: 18px;
    height: 13px;
}

/* Tablet: slightly compact */
@media (max-width: 992px) and (min-width: 769px) {
    .site-lang-switch .tsgym-lang-item {
        padding: 0 10px;
        gap: 5px;
    }
}

/* ---- Panel: compact vertical stack ---- */
.tsgym-lang-switch.panel-lang-switch {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: stretch;
    margin: 0;
    padding: 4px;
    min-width: 76px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--panel-border, #e2e8f0);
    box-shadow: none;
    height: auto;
}

.panel-lang-switch .tsgym-lang-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 9px;
    border-radius: 7px;
    text-decoration: none;
    color: var(--panel-text-main, #1e293b);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1;
    white-space: nowrap;
    opacity: 1;
    transition: background 0.18s ease, color 0.18s ease;
}

.panel-lang-switch .tsgym-lang-item:hover {
    background: rgba(37, 99, 235, 0.08);
}

.panel-lang-switch .tsgym-lang-item.active {
    background: rgba(37, 99, 235, 0.14);
    color: var(--ts-blue, #2563eb);
    box-shadow: none;
}

.panel-lang-switch .tsgym-flag {
    width: 24px;
    height: 16px;
    border-radius: 3px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    background: #fff;
}

body.dark .panel-lang-switch {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark .panel-lang-switch .tsgym-lang-item {
    color: var(--panel-text-main, #e2e8f0);
}

body.dark .panel-lang-switch .tsgym-lang-item.active {
    background: rgba(37, 99, 235, 0.22);
    color: #93c5fd;
}

@media (max-width: 640px) {
    .panel-lang-switch {
        min-width: 68px;
    }

    .panel-lang-switch .tsgym-lang-item {
        padding: 4px 7px;
        font-size: 10px;
    }

    .panel-lang-switch .tsgym-flag {
        width: 20px;
        height: 14px;
    }
}
