/**
 * Language Switcher Component
 * Netflix-style dropdown for selecting interface language
 */

.language-switcher {
    position: relative;
    display: inline-block;
}

.language-switcher-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    line-height: 1;
}

.language-switcher-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #e50914;
    box-shadow: 0 0 0 1px rgba(229, 9, 20, 0.3);
}

.language-switcher-toggle:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: #e50914;
    box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.5);
}

.language-switcher.active .language-switcher-toggle {
    background: rgba(229, 9, 20, 0.1);
    border-color: #e50914;
}

.language-switcher-toggle i {
    font-size: 1rem;
    color: #e5e5e5;
}

.language-switcher-toggle .lang-code {
    font-weight: 500;
    text-transform: uppercase;
    min-width: 2ch;
    color: #ffffff;
}

.language-switcher-toggle .dropdown-arrow {
    margin-left: 0.25rem;
    font-size: 0.75rem;
    transition: transform 0.3s ease;
    color: #e50914;
}

.language-switcher.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.language-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 220px;
    background: #1a1a1a;
    border: 1px solid rgba(229, 9, 20, 0.3);
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
}

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

.language-dropdown-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    font-weight: 600;
    color: #b3b3b3;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(229, 9, 20, 0.05);
}

.language-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #e5e5e5;
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    background: rgba(255, 255, 255, 0.1);
    padding-left: 1.25rem;
}

.language-option:focus {
    outline: none;
    background: rgba(229, 9, 20, 0.2);
    border-left: 3px solid #e50914;
    padding-left: calc(1rem - 3px);
}

.language-option:focus:hover {
    padding-left: calc(1.25rem - 3px);
}

.language-option.active {
    background: linear-gradient(135deg, #e50914 0%, #b20710 100%);
    color: #ffffff;
    border-left: 3px solid #ffffff;
    padding-left: calc(1rem - 3px);
}

.language-option.active:hover {
    padding-left: calc(1.25rem - 3px);
}

.language-option.active .lang-flag {
    filter: brightness(1.2) drop-shadow(0 0 4px rgba(255, 255, 255, 0.3));
}

.lang-flag {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    font-size: 1rem;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.lang-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.lang-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #ffffff;
}

.lang-native {
    font-size: 0.8rem;
    color: #b3b3b3;
}

.language-option:hover .lang-native {
    color: #e5e5e5;
}

.language-option.active .lang-name,
.language-option.active .lang-native {
    color: #ffffff;
}

.language-option.active .lang-native {
    opacity: 0.95;
}

.lang-check {
    color: #ffffff;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.language-option.active .lang-check {
    opacity: 1;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .language-dropdown {
        right: auto;
        left: 0;
        min-width: 100%;
    }

    .language-switcher-toggle .lang-name {
        display: none; /* Hide language name on mobile, show only code */
    }
}

/* Loading State */
.language-switcher.loading .language-switcher-toggle {
    opacity: 0.6;
    cursor: wait;
}

.language-switcher.loading .dropdown-arrow {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Scrollbar Styling for Dropdown */
.language-dropdown::-webkit-scrollbar {
    width: 8px;
}

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

.language-dropdown::-webkit-scrollbar-thumb {
    background: rgba(229, 9, 20, 0.5);
    border-radius: 4px;
}

.language-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(229, 9, 20, 0.7);
}

/* Compact Mode (for navigation bar) */
.language-switcher.compact .language-switcher-toggle {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

.language-switcher.compact .lang-flag {
    width: 20px;
    height: 20px;
    font-size: 0.9rem;
}

.language-switcher.compact .lang-name {
    font-size: 0.9rem;
}

.language-switcher.compact .lang-native {
    font-size: 0.75rem;
}
