/* Language Switcher Styles */
.language-switcher-container {
    position: relative;
    z-index: 1000;
    margin-left: 30px;
}

.language-dropdown {
    position: relative;
    display: inline-block;
}

.language-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--card-background);
    border: 1px solid var(--lighter-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    color: var(--light);
    min-width: 120px;
    justify-content: space-between;
}

.language-trigger:hover {
    background: var(--lighter-overlay);
    border-color: var(--base-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.language-trigger .fa-chevron-down {
    transition: transform 0.3s ease;
    font-size: 12px;
    color: var(--greyish);
}

.language-dropdown.open .language-trigger .fa-chevron-down {
    transform: rotate(180deg);
}

.language-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-background);
    border: 1px solid var(--lighter-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--shadow-strong);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1001;
    margin-top: 4px;
    width: 200px !important;
    overflow-x: hidden !important;
}

.language-dropdown.open .language-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--lighter-border);
    position: relative;
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    background: var(--lighter-overlay);
}

.language-option.active {
    background: var(--base-color-light);
    color: var(--base-color);
}

/* Flag Icons using flag-icons library */
.language-option .fi {
    width: 20px;
    height: 15px;
    border-radius: 2px;
    box-shadow: 0 1px 3px var(--shadow-color);
    flex-shrink: 0;
}

.language-trigger .fi {
    width: 18px;
    height: 13px;
    border-radius: 2px;
    flex-shrink: 0;
}

.language-option .language-name {
    flex: 1;
    font-size: 14px;
    color: var(--light) !important;
    font-weight: 500;
}

.language-option .fa-check {
    color: var(--base-color);
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.language-option.active .fa-check {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .language-switcher-container {
        margin-left: 10px;
    }
    
    .language-trigger {
        min-width: 100px;
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .language-trigger .language-name {
        display: none;
    }
    
    .language-options {
        min-width: 200px;
        left: auto;
        right: 0;
    }
    
    .language-option {
        padding: 10px 12px;
    }
}

/* Light mode support */
:root[data-theme="light"] .language-trigger {
    background: var(--card-background);
    border-color: var(--lighter-border);
    color: var(--dark);
}

:root[data-theme="light"] .language-trigger:hover {
    background: var(--lighter-overlay);
    border-color: var(--base-color);
}

:root[data-theme="light"] .language-options {
    background: var(--card-background);
    border-color: var(--lighter-border);
}

:root[data-theme="light"] .language-option:hover {
    background: var(--lighter-overlay);
}

:root[data-theme="light"] .language-option.active {
    background: var(--base-color-light);
    color: var(--base-color);
}

:root[data-theme="light"] .language-option .language-name {
    color: var(--dark) !important;
}

/* Animation for option hover */
.language-option {
    transform: translateX(0);
    transition: all 0.2s ease;
}

.language-option:hover {
    transform: translateX(4px);
}

/* Loading state */
.language-trigger.loading {
    opacity: 0.7;
    pointer-events: none;
}

.language-trigger.loading .fa-chevron-down {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
