/* Language switcher dropdown (scoped - do not override global nav/layout) */
.lang-switcher {
    position: relative;
    z-index: 60;
    flex-shrink: 0;
}

.lang-switcher-toggle {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #e2e8f0;
    user-select: none;
}

.lang-switcher-toggle .lang-chevron {
    font-size: 0.65em;
    opacity: 0.55;
    margin-left: 2px;
}

.lang-switcher-label {
    max-width: 7.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lang-switcher-flag {
    width: 22px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.lang-switcher-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 200px;
    max-height: min(70vh, 420px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 70;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    padding: 6px 0;
}

.lang-switcher-panel a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    color: #cbd5e1 !important;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none !important;
    line-height: 1.3;
}

.lang-switcher-panel a:hover {
    background: rgba(99, 102, 241, 0.15);
    color: #e0e7ff !important;
}

.lang-switcher-panel a.is-current {
    background: rgba(99, 102, 241, 0.22);
    color: #fff !important;
}

@media (min-width: 768px) {
    .lang-switcher-label {
        max-width: 9rem;
    }
}

/* Mobile: avoid clipping inside tight flex rows (header menu, nav bar) */
@media (max-width: 767px) {
    .lang-switcher {
        position: static;
    }

    .lang-switcher-toggle {
        width: 100%;
        justify-content: space-between;
    }

    .lang-switcher-panel {
        position: fixed;
        left: 1rem;
        right: 1rem;
        top: auto;
        bottom: auto;
        width: auto;
        min-width: 0;
        max-width: none;
        max-height: min(65vh, 400px);
        z-index: 120;
        margin-top: 0;
    }

    .lang-switcher-panel a {
        min-height: 44px;
        padding: 10px 16px;
    }

    .lang-switcher--stacked {
        width: 100%;
        flex: 1 1 100%;
    }

    .lang-switcher--stacked .lang-switcher-toggle {
        width: auto;
        justify-content: flex-start;
    }
}
