/**
 * 国际化UI组件样式
 */

/* 语言切换器容器 */
.language-switcher {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: linear-gradient(135deg, rgba(26, 90, 156, 0.08) 0%, rgba(42, 123, 200, 0.08) 100%);
    backdrop-filter: blur(10px);
    border-radius: 9999px;
    padding: 0.25rem;
    border: 2px solid rgba(26, 90, 156, 0.25);
    box-shadow: 0 2px 8px rgba(26, 90, 156, 0.1);
    transition: all 0.3s ease;
}

.language-switcher:hover {
    border-color: rgba(26, 90, 156, 0.4);
    box-shadow: 0 4px 12px rgba(26, 90, 156, 0.15);
}

/* 语言切换按钮 */
.language-switcher button {
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    background: transparent;
    color: #1f2937;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    letter-spacing: 0.01em;
}

/* 激活状态 */
.language-switcher button.active {
    background: linear-gradient(135deg, #1A5A9C 0%, #2A7BC8 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(26, 90, 156, 0.35);
    transform: translateY(-1px);
}

/* 悬停效果 */
.language-switcher button:not(.active):hover {
    background: rgba(26, 90, 156, 0.12);
    color: #1A5A9C;
    transform: translateY(-1px);
}

/* 固定在header中的样式 - 更紧凑 */
header .language-switcher {
    background: linear-gradient(135deg, rgba(26, 90, 156, 0.08) 0%, rgba(42, 123, 200, 0.08) 100%);
    border: 1.5px solid rgba(26, 90, 156, 0.25);
    margin-right: 0.75rem;
}

header .language-switcher button {
    color: #1f2937;
    font-weight: 500;
    min-width: 50px;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

header .language-switcher button.active {
    background: linear-gradient(135deg, #1A5A9C 0%, #2A7BC8 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(26, 90, 156, 0.3);
}

/* 桌面端大屏幕优化 */
@media (min-width: 1024px) {
    header .language-switcher {
        margin-right: 1rem;
    }

    header .language-switcher button {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* 移动端适配 - 在header中始终显示 */
@media (max-width: 1023px) {
    header .language-switcher {
        display: flex !important; /* 在移动端header中显示 */
        margin-right: 0;
        padding: 0.125rem;
        border: 1px solid rgba(26, 90, 156, 0.25);
        flex-shrink: 0; /* 防止被压缩 */
        max-width: none; /* 移除最大宽度限制 */
    }

    header .language-switcher button {
        padding: 0.3rem 0.5rem;
        font-size: 0.6875rem; /* 11px */
        min-width: 36px;
        white-space: nowrap; /* 防止文字换行 */
        overflow: visible; /* 确保文字不被裁剪 */
    }

    /* 确保汉堡菜单按钮不被挤压 */
    #mobile-menu-button {
        margin-left: 0;
        flex-shrink: 0;
        display: flex !important;
        align-items: center;
        justify-content: center;
        min-width: 36px;
        min-height: 36px;
    }

    /* 确保菜单图标显示 */
    #mobile-menu-button svg {
        display: block;
        width: 20px;
        height: 20px;
        stroke: currentColor;
    }
}

/* 小屏手机优化 */
@media (max-width: 640px) {
    header .language-switcher {
        padding: 0.125rem;
        margin-right: 0;
        gap: 0.125rem;
    }

    header .language-switcher button {
        padding: 0.25rem 0.375rem;
        font-size: 0.625rem; /* 10px */
        min-width: 30px;
        font-weight: 500;
    }

    /* 小屏手机上汉堡菜单按钮间距 */
    #mobile-menu-button {
        margin-left: 0;
        min-width: 32px;
        min-height: 32px;
    }

    #mobile-menu-button svg {
        width: 18px;
        height: 18px;
    }
}

/* 超小屏幕优化 (iPhone SE等) */
@media (max-width: 375px) {
    header .language-switcher {
        padding: 0.0625rem;
        gap: 0.0625rem;
    }

    header .language-switcher button {
        padding: 0.2rem 0.3rem;
        font-size: 0.5625rem; /* 9px */
        min-width: 28px;
    }

    #mobile-menu-button {
        min-width: 28px;
        min-height: 28px;
        padding: 0.25rem;
    }

    #mobile-menu-button svg {
        width: 16px;
        height: 16px;
    }
}

/* 移动端菜单中的语言切换器样式已移除 - 现在直接显示在header中 */

/* 移动端菜单中的分隔线 */
#mobile-menu .language-switcher + a {
    border-top: 1px solid rgba(26, 90, 156, 0.1);
    margin-top: 0.5rem;
}

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

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

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

.language-switcher.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid #1A5A9C;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* 语言切换提示 */
.language-tooltip {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.language-tooltip::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid #1f2937;
}

.language-switcher:hover .language-tooltip {
    opacity: 1;
}

/* 英文字体优化 */
html[lang="en-US"] {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html[lang="zh-CN"] {
    font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 英文版本的文本调整 */
html[lang="en-US"] body {
    letter-spacing: 0.01em;
}

html[lang="en-US"] h1,
html[lang="en-US"] h2,
html[lang="en-US"] h3,
html[lang="en-US"] h4,
html[lang="en-US"] h5,
html[lang="en-US"] h6 {
    letter-spacing: -0.02em;
}

/* 英文版按钮文本不换行 */
html[lang="en-US"] button,
html[lang="en-US"] .cta-button {
    white-space: nowrap;
}

/* 响应式调整 - 英文通常比中文长 */
@media (max-width: 768px) {
    html[lang="en-US"] .text-4xl {
        font-size: 1.875rem;
    }
    
    html[lang="en-US"] .text-3xl {
        font-size: 1.5rem;
    }
}

