/**
 * 全域語系切換器樣式
 * Global Language Switcher Styles
 */

/* === 基本樣式 === */
.global-language-switcher {
    position: relative;
    display: inline-block;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
}

.global-language-switcher * {
    box-sizing: border-box;
}

/* === 語言按鈕 === */
.language-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    background: #ffffff;
    color: #606266;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    user-select: none;
}

.language-button:hover {
    border-color: #c0c4cc;
    background: #f5f7fa;
}

.language-button:active {
    border-color: #409eff;
}

.language-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.language-button.switching {
    background: #f0f9ff;
    border-color: #409eff;
}

/* === 語言元素 === */
.language-flag {
    font-size: 16px;
    line-height: 1;
    display: inline-block;
}

.language-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
    color: #a8abb2;
}

.language-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.loading-spinner {
    font-size: 12px;
    animation: spin 1s linear infinite;
    color: #409eff;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* === 下拉選單 === */
.language-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #ffffff;
    border: 1px solid #e4e7ed;
    border-radius: 4px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    z-index: 2000;
    min-width: 120px;
    max-height: 200px;
    overflow-y: auto;
}

.language-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    border-bottom: 1px solid #f5f7fa;
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    background: #f5f7fa;
}

.language-option.active {
    background: #ecf5ff;
    color: #409eff;
}

.language-option .language-flag {
    font-size: 14px;
}

.language-option .language-name {
    flex: 1;
    font-size: 13px;
}

.check-icon {
    font-size: 12px;
    color: #67c23a;
    font-weight: bold;
}

/* === Minimal主題 === */
.global-language-switcher[data-theme="minimal"] .language-button {
    padding: 4px 8px;
    border: none;
    background: transparent;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    justify-content: center;
}

.global-language-switcher[data-theme="minimal"] .language-button:hover {
    background: rgba(64, 158, 255, 0.1);
}

.global-language-switcher[data-theme="minimal"] .language-menu {
    right: -20px;
    min-width: 140px;
}

.global-language-switcher[data-theme="minimal"] .language-option {
    padding: 10px 12px;
}

/* === Icon-only主題 === */
.global-language-switcher[data-theme="icon-only"] .language-button {
    padding: 6px;
    border: none;
    background: transparent;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    justify-content: center;
}

.global-language-switcher[data-theme="icon-only"] .language-button:hover {
    background: rgba(64, 158, 255, 0.1);
}

.global-language-switcher[data-theme="icon-only"] .language-menu {
    right: -10px;
    min-width: 60px;
}

.global-language-switcher[data-theme="icon-only"] .language-option {
    justify-content: center;
    padding: 8px;
}

.global-language-switcher[data-theme="icon-only"] .language-name {
    display: none;
}

/* === 載入狀態 === */
.loading {
    font-size: 12px;
    animation: spin 1s linear infinite;
    color: #409eff;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
}

/* === 深色主題支援 === */
@media (prefers-color-scheme: dark) {
    .global-language-switcher {
        color: #e5e7eb;
    }
    
    .language-button {
        background: #374151;
        border-color: #4b5563;
        color: #e5e7eb;
    }
    
    .language-button:hover {
        background: #4b5563;
        border-color: #6b7280;
    }
    
    .language-menu {
        background: #374151;
        border-color: #4b5563;
        box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.3);
    }
    
    .language-option {
        border-bottom-color: #4b5563;
    }
    
    .language-option:hover {
        background: #4b5563;
    }
    
    .language-option.active {
        background: #1e40af;
        color: #93c5fd;
    }
}

/* === 響應式設計 === */
@media (max-width: 768px) {
    .global-language-switcher {
        font-size: 13px;
    }
    
    .language-button {
        padding: 5px 10px;
        font-size: 13px;
    }
    
    .language-name {
        font-size: 12px;
    }
    
    .language-menu {
        min-width: 100px;
        font-size: 13px;
    }
    
    .language-option {
        padding: 6px 10px;
    }
}

/* === 高對比度支援 === */
@media (prefers-contrast: high) {
    .language-button {
        border-width: 2px;
        border-color: #000000;
    }
    
    .language-menu {
        border-width: 2px;
        border-color: #000000;
    }
    
    .language-option.active {
        background: #000000;
        color: #ffffff;
    }
}

/* === 動畫偏好設定 === */
@media (prefers-reduced-motion: reduce) {
    .language-button,
    .dropdown-arrow,
    .language-option,
    .loading-spinner {
        transition: none;
        animation: none;
    }
}