/* 语言切换器样式 */
.language-label {
    color: var(--text-muted) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    margin-right: 4px;
    display: inline-block !important;
    vertical-align: middle;
    line-height: 1.4 !important;
}

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

.language-btn {
    display: flex;
    align-items: center;
    gap: 0.5px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    min-width: 120px;
    justify-content: space-between;
}

.language-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

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

.language-icon {
    font-size: 16px;
    line-height: 1;
}

.language-text {
    flex: 1;
    text-align: left;
    font-weight: 500;
}

.dropdown-arrow {
    transition: transform 0.2s ease;
    opacity: 0.7;
}

.dropdown-arrow.rotated {
    transform: rotate(180deg);
}

.language-dropdown {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 4px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    min-width: 280px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid rgba(0, 0, 0, 0.1);
    animation: dropdownFadeInUp 0.2s ease;
}

@keyframes dropdownFadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.language-group {
    padding: 0;
}

.language-group-title {
    padding: 12px 16px;
    background: #f8f9fa;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e9ecef;
}

.language-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease;
    color: #333;
    position: relative;
}

.language-option:hover {
    background: #f8f9fa;
}

.language-option.active {
    background: #e3f2fd;
    color: #1976d2;
}

.language-option.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #1976d2;
}

.flag-icon {
    font-size: 18px;
    line-height: 1;
    min-width: 20px;
}

.language-name {
    font-weight: 500;
    font-size: 14px;
    min-width: 120px;
}

.language-name-en {
    font-size: 12px;
    color: #666;
    font-weight: 400;
}

.language-option.active .language-name-en {
    color: #1565c0;
}

.check-icon {
    margin-left: auto;
    color: #1976d2;
    opacity: 0.8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .language-switcher {
        position: static;
    }
    
    .language-dropdown {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        right: auto;
        margin-top: 0;
        max-width: 90vw;
        max-height: 70vh;
        z-index: 10000;
    }
    
    .language-dropdown::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }
    
    .language-btn {
        min-width: 100px;
        font-size: 13px;
        padding: 6px 10px;
    }
    
    .language-text {
        display: none;
    }
    
    .language-icon {
        font-size: 18px;
    }
}

/* 深色主题适配 */
@media (prefers-color-scheme: dark) {
    .language-dropdown {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .language-group-title {
        background: #4a5568;
        color: #a0aec0;
        border-color: #4a5568;
    }
    
    .language-option {
        color: #e2e8f0;
    }
    
    .language-option:hover {
        background: #4a5568;
    }
    
    .language-option.active {
        background: #2b6cb0;
        color: #90cdf4;
    }
    
    .language-name-en {
        color: #a0aec0;
    }
    
    .language-option.active .language-name-en {
        color: #90cdf4;
    }
}

/* 滚动条样式 */
.language-dropdown::-webkit-scrollbar {
    width: 6px;
}

.language-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.language-dropdown::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.language-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* RTL 语言支持 */
body[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

body[dir="rtl"] .language-switcher .language-dropdown {
    right: auto;
    left: 0;
}

body[dir="rtl"] .language-option {
    text-align: right;
    flex-direction: row-reverse;
}

body[dir="rtl"] .check-icon {
    margin-left: 0;
    margin-right: auto;
}

/* RTL 语言的特殊布局调整 */
body[dir="rtl"] .nav-links {
    flex-direction: row-reverse;
}

body[dir="rtl"] .footer-content {
    flex-direction: row-reverse;
}

body[dir="rtl"] .language-name {
    text-align: right;
}

body[dir="rtl"] .language-name-en {
    text-align: left;
}