/* 语言切换器样式 */
.language-switcher-container {
    position: relative;
    z-index: 1000;
}

.language-switcher .dropdown-toggle {
    min-width: 90px;
    border-color: #dee2e6;
    color: #6c757d;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    background-color: transparent;
}

/* 只显示图标的按钮样式 */
.language-switcher .dropdown-toggle.icon-only {
    min-width: 40px;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
    font-size: 18px;
}

.language-switcher .dropdown-toggle.icon-only:hover {
    background-color: rgba(108, 117, 125, 0.1);
    color: #495057;
    transform: scale(1.1);
}

.language-switcher .dropdown-toggle.icon-only:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    background-color: rgba(108, 117, 125, 0.1);
    outline: none;
}

.language-switcher .dropdown-toggle.icon-only::after {
    display: none;
}

.language-switcher .dropdown-toggle:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    color: #495057;
    transform: translateY(-1px);
}

.language-switcher .dropdown-toggle:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    border-color: #80bdff;
}

.language-switcher .dropdown-toggle::after {
    margin-left: 0.5rem;
}

.language-switcher .dropdown-menu {
    min-width: 140px;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    animation: fadeInDown 0.3s ease;
}

.language-switcher .dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #495057;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    border: none;
    background: none;
    width: 100%;
}

.language-switcher .dropdown-item:hover {
    background-color: #f8f9fa;
    color: #16181b;
    transform: translateX(2px);
}

.language-switcher .dropdown-item.active {
    background-color: #0d6efd;
    color: #fff;
    font-weight: 500;
}

.language-switcher .dropdown-item.active::after {
    content: '✓';
    margin-left: auto;
    font-weight: bold;
}

/* 简单国旗图标样式 */
.language-switcher .flag-icon {
    width: 18px;
    height: 12px;
    margin-right: 8px;
    background-size: cover;
    background-position: center;
    border-radius: 2px;
    flex-shrink: 0;
    display: inline-block;
}

/* 中国国旗 */
.flag-icon-cn {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxOCAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjE4IiBoZWlnaHQ9IjEyIiBmaWxsPSIjREUyOTEwIi8+CjxzdGFyIGN4PSI0IiBjeT0iMyIgcj0iMS4yIiBmaWxsPSIjRkZERTAwIi8+CjxzdGFyIGN4PSI3IiBjeT0iMS41IiByPSIwLjQiIGZpbGw9IiNGRkRFMDAiLz4KPHN0YXIgY3g9IjguNSIgY3k9IjIuNSIgcj0iMC40IiBmaWxsPSIjRkZERTAwIi8+CjxzdGFyIGN4PSI4LjUiIGN5PSI0IiByPSIwLjQiIGZpbGw9IiNGRkRFMDAiLz4KPHN0YXIgY3g9IjciIGN5PSI0LjUiIHI9IjAuNCIgZmlsbD0iI0ZGREUwMCIvPgo8L3N2Zz4=');
}

/* 美国国旗 */
.flag-icon-us {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxOCAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjE4IiBoZWlnaHQ9IjEyIiBmaWxsPSIjRkZGRkZGIi8+CjxyZWN0IHdpZHRoPSIxOCIgaGVpZ2h0PSIxIiBmaWxsPSIjQjIyMjM0Ii8+CjxyZWN0IHk9IjIiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxIiBmaWxsPSIjQjIyMjM0Ii8+CjxyZWN0IHk9IjQiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxIiBmaWxsPSIjQjIyMjM0Ii8+CjxyZWN0IHk9IjYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxIiBmaWxsPSIjQjIyMjM0Ii8+CjxyZWN0IHk9IjgiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxIiBmaWxsPSIjQjIyMjM0Ii8+CjxyZWN0IHk9IjEwIiB3aWR0aD0iMTgiIGhlaWdodD0iMSIgZmlsbD0iI0IyMjIzNCIvPgo8cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSI3IiBmaWxsPSIjM0MzQjZFIi8+Cjwvc3ZnPg==');
}

/* 按钮组样式（备选方案） */
.language-buttons .btn-group {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 0.375rem;
    overflow: hidden;
}

.language-buttons .btn-group .btn {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    min-width: 50px;
    border: none;
    background-color: #f8f9fa;
    color: #6c757d;
    transition: all 0.3s ease;
}

.language-buttons .btn-group .btn:hover {
    background-color: #e9ecef;
    color: #495057;
    transform: translateY(-1px);
}

.language-buttons .btn-group .btn.active {
    background-color: #0d6efd;
    color: #fff;
    font-weight: 500;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* 淡入动画 */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .language-switcher .dropdown-toggle {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        min-width: 70px;
    }
    
    .language-switcher .dropdown-menu {
        min-width: 120px;
    }
    
    .language-switcher .dropdown-item {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .flag-icon {
        width: 16px;
        height: 10px;
        margin-right: 6px;
    }
}

@media (max-width: 480px) {
    .language-switcher .dropdown-toggle {
        min-width: 60px;
        padding: 0.25rem 0.375rem;
    }
    
    .language-switcher .dropdown-toggle .fas {
        display: none;
    }
    
    .language-switcher .dropdown-menu {
        min-width: 100px;
    }
}

/* 深色主题适配 */
@media (prefers-color-scheme: dark) {
    .language-switcher .dropdown-toggle {
        background-color: #343a40;
        border-color: #495057;
        color: #f8f9fa;
    }
    
    .language-switcher .dropdown-toggle:hover {
        background-color: #495057;
        border-color: #6c757d;
    }
    
    .language-switcher .dropdown-menu {
        background-color: #343a40;
        border-color: #495057;
    }
    
    .language-switcher .dropdown-item {
        color: #f8f9fa;
    }
    
    .language-switcher .dropdown-item:hover {
        background-color: #495057;
        color: #fff;
    }
    
    .language-buttons .btn-group .btn {
        background-color: #495057;
        color: #f8f9fa;
    }
    
    .language-buttons .btn-group .btn:hover {
        background-color: #6c757d;
    }
}

/* 在导航栏中的特殊样式 */
.navbar .language-switcher-container {
    margin-left: 0.5rem;
}

.navbar .language-switcher .dropdown-toggle {
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.navbar .language-switcher .dropdown-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

/* 在侧边栏中的特殊样式 */
.sidebar .language-switcher-container {
    margin: 1rem 0;
}

.sidebar .language-switcher .dropdown-toggle {
    width: 100%;
    justify-content: space-between;
}

/* 加载状态 */
.language-switcher.loading .dropdown-toggle {
    opacity: 0.6;
    pointer-events: none;
}

.language-switcher.loading .dropdown-toggle::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #6c757d;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

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