/* Переключатель языка: флаг + код в шапке, меню с флагами и самоназваниями.
   Подключается сервером (pageRenderer) на всех страницах, поверх стилей из style.css. */

.language-switcher {
    position: relative;
    z-index: 99999;
}

.language-switcher .lang-current {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px 7px 8px;
    min-height: 36px;
    background: rgba(30, 30, 50, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.92);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.language-switcher .lang-current:hover,
.language-switcher.open .lang-current {
    background: rgba(40, 40, 64, 0.95);
    border-color: rgba(99, 102, 241, 0.45);
}

.language-switcher .lang-current:focus-visible,
.language-switcher .lang-option:focus-visible {
    outline: 2px solid rgba(129, 140, 248, 0.9);
    outline-offset: 2px;
}

.lang-flag-img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.language-switcher .lang-code {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.language-switcher .lang-arrow {
    font-size: 0.75rem;
    opacity: 0.6;
    transition: transform 0.2s ease;
}

.language-switcher.open .lang-arrow {
    transform: rotate(180deg);
}

.language-switcher .lang-dropdown {
    position: fixed;
    min-width: 220px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    padding: 6px;
    background: rgba(22, 24, 38, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transform-origin: top right;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    z-index: 999999;
}

.language-switcher.open .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-switcher .lang-dropdown-title {
    padding: 10px 12px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.875rem;
    font-weight: 600;
}

.language-switcher .lang-option {
    display: grid;
    grid-template-columns: 16px 20px 1fr;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    background: transparent;
    border: none;
    border-radius: 9px;
    color: rgba(255, 255, 255, 0.85);
    font: inherit;
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}

.language-switcher .lang-option:hover {
    background: rgba(255, 255, 255, 0.06);
}

.language-switcher .lang-option.active {
    color: #fff;
    font-weight: 600;
}

.language-switcher .lang-check {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    text-align: center;
}

.language-switcher .lang-name {
    white-space: nowrap;
}

@media (max-width: 480px) {
    .language-switcher .lang-dropdown {
        min-width: 200px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .language-switcher .lang-dropdown,
    .language-switcher .lang-arrow {
        transition: none;
    }
}
