/* i18n 国际化相关样式 */

/* 语言切换器 */
.language-switcher {
    position: relative;
    display: inline-block;
}

.language-button {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
    justify-content: center;
}

.language-button:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: white;
}

.language-button .flag {
    font-size: 1.2em;
}

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 25px var(--shadow);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

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

.language-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.language-option:hover {
    background-color: var(--primary-color);
    color: white;
}

.language-option.current {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
}

.language-option .flag {
    font-size: 1.2em;
    width: 20px;
    text-align: center;
}

.language-option .name {
    flex: 1;
}

.language-option .native-name {
    font-size: 0.8em;
    opacity: 0.8;
}

/* 语言切换动画效果 */
@keyframes fadeInTranslation {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.i18n-fade-in {
    animation: fadeInTranslation 0.3s ease-out;
}

/* 不同语言的字体优化 */
[lang="zh-CN"] {
    font-family: 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
}

[lang="en-US"] {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

[lang="th-TH"] {
    font-family: 'Inter', 'Sarabun', 'Kanit', 'Prompt', sans-serif;
    line-height: 1.7;
}

/* 泰语特殊样式调整 */
[lang="th-TH"] .hero h1 {
    font-size: 2.5rem;
    line-height: 1.3;
}

[lang="th-TH"] .section-title {
    font-size: 1.8rem;
    line-height: 1.4;
}

[lang="th-TH"] .card h3 {
    line-height: 1.4;
}

[lang="th-TH"] .question-item a {
    line-height: 1.5;
}

/* 加载状态 */
.i18n-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.i18n-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .language-button {
        min-width: 100px;
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .language-dropdown {
        min-width: 160px;
        right: 0;
        left: auto;
    }
    
    .language-option {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
    
    [lang="th-TH"] .hero h1 {
        font-size: 2rem;
    }
    
    [lang="th-TH"] .section-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .language-button {
        min-width: 80px;
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .language-button .flag {
        font-size: 1em;
    }
    
    .language-dropdown {
        min-width: 140px;
    }
    
    [lang="th-TH"] .hero h1 {
        font-size: 1.8rem;
    }
}

/* 文本方向支持（为未来的RTL语言预留） */
[dir="rtl"] {
    text-align: right;
}

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

/* 辅助功能增强 */
.language-switcher:focus-within .language-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

/* 语言提示消息 */
.language-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.language-toast.show {
    transform: translateX(0);
}

.language-toast.hide {
    transform: translateX(100%);
}

@media (max-width: 768px) {
    .language-toast {
        top: 10px;
        right: 10px;
        left: 10px;
        transform: translateY(-100%);
    }
    
    .language-toast.show {
        transform: translateY(0);
    }
    
    .language-toast.hide {
        transform: translateY(-100%);
    }
} 