/* ===================================
   Language Switcher - Clean & Modern
   =================================== */

.language-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.language-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    height: 34px;
    box-sizing: border-box;
    line-height: 1;
}

.language-button:hover {
    background: var(--bg-hover);
    border-color: rgba(139, 92, 246, 0.4);
    color: var(--text-primary);
}

.language-button .flag {
    font-size: 1rem;
    line-height: 1;
}

.language-button .lang-text {
    letter-spacing: 0.01em;
}

.language-button .chevron {
    font-size: 0.55rem;
    opacity: 0.5;
    transition: transform 0.2s ease;
    margin-left: -2px;
}

.language-button.open {
    background: var(--bg-hover);
    border-color: rgba(139, 92, 246, 0.4);
}

.language-button.open .chevron {
    transform: rotate(180deg);
}

/* Dropdown */
.language-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.97);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
    overflow: hidden;
}

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

.language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    color: var(--text-secondary);
}

.language-option:first-child {
    border-radius: 11px 11px 0 0;
}

.language-option:last-child {
    border-radius: 0 0 11px 11px;
}

.language-option:hover {
    background: rgba(139, 92, 246, 0.06);
}

.language-option.active {
    background: rgba(139, 92, 246, 0.08);
    color: var(--text-primary);
}

.language-option .flag {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.language-option .info {
    flex: 1;
}

.language-option .name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.language-option .native-name {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 1px;
}

.language-option .check {
    color: rgba(139, 92, 246, 0.8);
    font-size: 0.85rem;
}

/* ---- Top-bar integration ---- */
.top-bar .language-switcher,
.top-bar-actions .language-switcher {
    margin-left: 4px;
    padding-left: 8px;
    border-left: 1px solid var(--border-color);
}

.top-bar .language-button,
.top-bar-actions .language-button {
    height: 34px;
}

/* ---- Responsive ---- */

/* 1200px: hide text, flag + chevron only */
@media (max-width: 1200px) {
    .language-button .lang-text {
        display: none;
    }

    .language-button {
        padding: 5px 8px;
        gap: 4px;
        min-width: 0;
    }

    .top-bar .language-switcher,
    .top-bar-actions .language-switcher {
        padding-left: 6px;
    }
}

/* 768px: remove separator */
@media (max-width: 768px) {
    .top-bar .language-switcher,
    .top-bar-actions .language-switcher {
        border-left: none;
        padding-left: 0;
        margin-left: 2px;
    }

    .language-button {
        height: 32px;
        padding: 4px 7px;
    }

    .language-dropdown {
        right: -8px;
        min-width: 180px;
    }
}

@media (max-width: 480px) {
    .language-dropdown {
        min-width: 170px;
        right: -12px;
    }

    .language-button .chevron {
        display: none;
    }
}
