/* ===== LANGUAGE SELECTOR ===== */
.lang-selector {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-block;
    z-index: 1001;
}

.lang-selector-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.lang-selector-btn:hover {
    background: rgba(0, 102, 255, 0.2);
    border-color: rgba(0, 102, 255, 0.5);
}

.lang-selector-btn .lang-flag {
    font-size: 1.1rem;
    line-height: 1;
}

.lang-selector-btn .lang-arrow {
    font-size: 0.6rem;
    transition: transform 0.3s;
    margin-left: 2px;
    opacity: 0.7;
}

.lang-selector:hover .lang-arrow {
    transform: rotate(180deg);
}

/* Dropdown */
.lang-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(10, 22, 40, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    min-width: 200px;
    border-radius: 14px;
    padding: 8px 0;
    z-index: 1100;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    animation: langDropIn 0.2s ease-out;
}

@keyframes langDropIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lang-selector:hover .lang-dropdown {
    display: block;
}

/* Hover Bridge for Lang Selector */
.lang-dropdown::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    width: 100%;
    height: 12px;
    background: transparent;
}

.lang-dropdown a {
    color: #ffffff !important;
    padding: 11px 18px !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    font-size: 0.88rem !important;
    font-weight: 500 !important;
    transition: background 0.2s !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    margin: 0 !important;
    white-space: nowrap !important;
}

.lang-dropdown a:last-child {
    border-bottom: none !important;
}

.lang-dropdown a:hover {
    background: rgba(0, 102, 255, 0.15) !important;
    color: #4d9fff !important;
}

.lang-dropdown a.active-lang {
    background: rgba(0, 102, 255, 0.1) !important;
    color: #4d9fff !important;
    position: relative;
}

.lang-dropdown a.active-lang::after {
    content: '✓';
    position: absolute;
    right: 16px;
    font-size: 0.85rem;
    color: #4d9fff;
}

.lang-dropdown .lang-flag {
    font-size: 1.25rem;
    line-height: 1;
}

.lang-dropdown .lang-name {
    flex: 1;
}

/* ===== MOBILE ADJUSTMENTS =====
   Fix: hamburger and language selector must NOT overlap.
   The header-container uses position:relative + flex center.
   On mobile we put the lang-selector to the right of center
   and the hamburger at the absolute far-right (right:15px).
   ============================== */
@media (max-width: 991px) {
    .header-container {
        padding-right: 80px !important; /* space for the hamburger + extra gap */
    }

    .lang-selector {
        position: absolute;
        right: 80px; /* Increased from 60px for better clearance */
        margin: 0;
        top: 50%;
        transform: translateY(-50%);
    }

    .lang-selector-btn {
        padding: 5px 10px;
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.1);
    }

    /* Hide the short text label on very small screens, keep flag + arrow */
    @media (max-width: 480px) {
        .lang-selector-btn span:not(.lang-flag):not(.lang-arrow) {
            display: none !important;
        }
        .lang-selector {
            right: 70px; /* Increased from 50px */
        }
        .mobile-menu-toggle {
            right: 15px !important;
        }
    }

    /* Global fix for the hamburger menu position to avoid overlap */
    .mobile-menu-toggle {
        position: absolute !important;
        right: 15px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        margin: 0 !important;
        z-index: 1100 !important;
    }

    .lang-dropdown {
        display: none !important;
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        background: rgba(10, 22, 40, 0.98);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        z-index: 2000;
        width: 170px;
        flex-direction: column;
    }

    .lang-selector:hover .lang-dropdown {
        display: block !important;
    }

    .lang-dropdown a {
        padding: 10px 15px !important;
        justify-content: flex-start !important;
        flex-direction: row !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
        font-size: 0.85rem !important;
        text-transform: none !important;
        letter-spacing: 0 !important;
    }

    .lang-dropdown a:last-child {
        border-bottom: none !important;
    }

    .lang-dropdown .lang-flag {
        font-size: 1.1rem;
    }
}
