/* ========================================
   LANGUAGE SWITCHER - Matching Site Theme
   Dark Glass Morphism • Blue Accents
   ======================================== */

.language-switcher {
    position: relative;
    display: inline-block;
    margin-left: 16px;
}

/* ========== LANGUAGE BUTTON ========== */
.language-btn {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted, #94a3b8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-family: inherit;
}

.language-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--text, #f8fafc);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15);
}

.language-btn:active {
    transform: translateY(0);
}

.language-btn:focus-visible {
    outline: 2px solid var(--primary, #3b82f6);
    outline-offset: 2px;
}

.language-btn svg {
    opacity: 0.6;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.language-btn:hover svg {
    opacity: 1;
}

.language-dropdown.active + .language-btn svg,
.language-switcher:has(.language-dropdown.active) .language-btn svg {
    transform: rotate(180deg);
}

.globe-icon {
    font-size: 1.1em;
    filter: grayscale(0.3);
    transition: filter 0.3s ease;
}

.language-btn:hover .globe-icon {
    filter: grayscale(0);
}

/* ========== DROPDOWN PANEL ========== */
.language-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: linear-gradient(
        180deg,
        rgba(10, 22, 40, 0.95) 0%,
        rgba(3, 7, 18, 0.98) 100%
    );
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 -1px 0 rgba(255, 255, 255, 0.05) inset;
    padding: 16px;
    min-width: 360px;
    max-height: 420px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10001;
}

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

/* ========== DROPDOWN HEADER ========== */
.language-dropdown-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========== LANGUAGE GRID ========== */
.language-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

/* ========== LANGUAGE OPTIONS ========== */
.language-option {
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    text-decoration: none;
    color: var(--text-muted, #94a3b8);
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-option:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--text, #f8fafc);
    transform: translateX(2px);
}

.language-option.current {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(29, 78, 216, 0.1));
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--primary-light, #60a5fa);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

.language-option.current::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary, #3b82f6);
    border-radius: 0 2px 2px 0;
    opacity: 0;
}

.language-option {
    position: relative;
}

.language-option.current::before {
    opacity: 1;
}

.language-code {
    font-size: 0.7em;
    font-weight: 600;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    min-width: 28px;
    text-align: center;
}

/* ========== CUSTOM SCROLLBAR ========== */
.language-dropdown::-webkit-scrollbar {
    width: 6px;
}

.language-dropdown::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

.language-dropdown::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.language-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

/* Firefox scrollbar */
.language-dropdown {
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.3) rgba(255, 255, 255, 0.02);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
    .language-btn {
        padding: 9px 14px;
        font-size: 0.85rem;
    }

    .language-dropdown {
        min-width: 320px;
    }
}

@media (max-width: 768px) {
    .language-switcher {
        margin-left: 10px;
    }

    .language-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        gap: 6px;
        border-radius: 10px;
    }

    .language-btn span:not(.globe-icon) {
        display: none;
    }

    .language-btn svg {
        display: none;
    }

    .language-dropdown {
        min-width: 300px;
        max-width: calc(100vw - 24px);
        right: -8px;
        padding: 14px;
    }

    .language-grid {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .language-option {
        padding: 12px 14px;
    }
}

@media (max-width: 480px) {
    .language-btn {
        padding: 8px 10px;
        border-radius: 8px;
    }

    .globe-icon {
        font-size: 1.2em;
    }

    .language-dropdown {
        right: -12px;
        min-width: 280px;
        padding: 12px;
        max-height: 360px;
        border-radius: 14px;
    }

    .language-dropdown-header {
        font-size: 0.75rem;
        margin-bottom: 10px;
        padding-bottom: 10px;
    }

    .language-option {
        padding: 11px 12px;
        font-size: 0.85rem;
        border-radius: 8px;
    }
}

/* ========== RTL SUPPORT ========== */
[dir="rtl"] .language-dropdown {
    right: auto;
    left: 0;
}

[dir="rtl"] .language-option:hover {
    transform: translateX(-2px);
}

[dir="rtl"] .language-option.current::before {
    left: auto;
    right: 0;
    border-radius: 2px 0 0 2px;
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
    .language-btn,
    .language-dropdown,
    .language-option {
        transition: none;
    }

    .language-btn:hover,
    .language-option:hover {
        transform: none;
    }
}
