/* ============================================
   Language Switcher Component Styles
   ============================================ */

.lang-switcher {
    position: relative;
}

.lang-switcher-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 6px 10px;
    color: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.lang-switcher-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.35);
}

.lang-switcher-btn i {
    font-size: 14px;
    opacity: 0.8;
}

.lang-current {
    font-size: 13px;
}

/* Dropdown - uses fixed position to escape overflow:hidden on parent headers */
.lang-dropdown {
    position: fixed;
    min-width: 160px;
    background: #2A2A2A;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 6px;
    display: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 10001;
}

/* Dropdown position is set dynamically by JS (positionDropdown) */

.lang-dropdown.open {
    display: flex;
    flex-direction: column;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: 8px;
    color: #E0E0E0;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: start;
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.lang-option.active {
    background: rgba(199, 168, 83, 0.2);
    color: #c7a853;
}

.lang-flag {
    font-size: 18px;
    line-height: 1;
}

.lang-name {
    flex: 1;
}

.lang-check {
    font-size: 11px;
    color: #c7a853;
}

/* Light theme */
[data-theme="light"] .lang-dropdown,
body:not([data-theme="dark"]) .lang-dropdown {
    background: #FFFFFF;
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .lang-option,
body:not([data-theme="dark"]) .lang-option {
    color: #333;
}

[data-theme="light"] .lang-option:hover,
body:not([data-theme="dark"]) .lang-option:hover {
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .lang-option.active,
body:not([data-theme="dark"]) .lang-option.active {
    background: rgba(199, 168, 83, 0.15);
    color: #8B7023;
}

/* Dark theme override (explicit) */
[data-theme="dark"] .lang-dropdown {
    background: #2A2A2A;
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .lang-option {
    color: #E0E0E0;
}

[data-theme="dark"] .lang-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .lang-option.active {
    background: rgba(199, 168, 83, 0.2);
    color: #c7a853;
}

/* Mobile styles */
@media (max-width: 768px) {
    .lang-switcher-btn {
        padding: 5px 8px;
        font-size: 12px;
    }

    .lang-switcher-btn i {
        font-size: 13px;
    }

    .lang-dropdown {
        min-width: 145px;
    }
}

/* ============================================
   Header placement rules
   ============================================ */

/* Mobile: lang switcher pushed to the end side (left in RTL, right in LTR) */
.header-lang-mobile {
    display: flex;
    align-items: center;
    order: 99;
    margin-inline-start: auto;
}

.header-lang-desktop {
    display: none;
}

/* Desktop: hide mobile lang switcher, show desktop one in nav */
@media (min-width: 1024px) {
    .header-lang-mobile {
        display: none;
    }

    .header-lang-desktop {
        display: flex;
        align-items: center;
    }

    .lang-switcher-btn {
        padding: 6px 12px;
    }
}
