/**
 * i18n.css - 多语言切换器样式
 * ngo100.com - 支持中文(zh)/英文(en)/俄语(ru) - 紫色渐变主题 #6366f1
 */

/* ========================================
   语言切换器 - 导航栏内嵌下拉
   ======================================== */

.nav-lang-switcher {
    display: flex;
    align-items: center;
    margin-left: 0.5rem;
    position: relative;
}

.lang-switcher {
    position: relative;
    display: inline-block;
}

.lang-current {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.9rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(139, 92, 246, 0.08) 100%);
    border: 1.5px solid rgba(99, 102, 241, 0.25);
    border-radius: 2rem;
    color: #4f46e5;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
}

.lang-current:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-color: rgba(99, 102, 241, 0.45);
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.15);
    transform: translateY(-1px);
}

.lang-current:active {
    transform: translateY(0);
}

.lang-arrow {
    transition: transform 0.25s ease;
    opacity: 0.7;
    flex-shrink: 0;
}

.lang-switcher.open .lang-arrow {
    transform: rotate(180deg);
}

/* 下拉菜单 */
.lang-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 8rem;
    background: #ffffff;
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 0.75rem;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.96);
    transform-origin: top right;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
    overflow: hidden;
    padding: 0.35rem;
}

.lang-switcher.open .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.lang-option {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.55rem 0.85rem;
    border: none;
    background: transparent;
    color: #4b5563;
    font-size: 0.85rem;
    font-weight: 400;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
    white-space: nowrap;
    line-height: 1.4;
}

.lang-option:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.05) 100%);
    color: #4f46e5;
}

.lang-option.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.08) 100%);
    color: #4f46e5;
    font-weight: 600;
}

.lang-option.active::before {
    content: '✓';
    margin-right: 0.5rem;
    font-size: 0.75rem;
    color: #6366f1;
    flex-shrink: 0;
}

/* ========================================
   导航栏滚动/深色背景适配
   ======================================== */

.navbar.scrolled .lang-current,
.navbar--dark .lang-current {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-color: rgba(255, 255, 255, 0.2);
    color: #e0e7ff;
}

.navbar.scrolled .lang-current:hover,
.navbar--dark .lang-current:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.1) 100%);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.2);
}

/* ========================================
   移动端适配
   ======================================== */

@media (max-width: 768px) {
    .nav-lang-switcher {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
    }

    .lang-switcher {
        width: 100%;
    }

    .lang-current {
        width: 100%;
        justify-content: space-between;
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
        border-radius: 0.6rem;
    }

    .lang-dropdown {
        position: static;
        width: 100%;
        margin-top: 0.35rem;
        box-shadow: 0 2px 12px rgba(99, 102, 241, 0.08);
        transform: translateY(-4px) scale(0.98);
        transform-origin: top center;
    }

    .lang-switcher.open .lang-dropdown {
        transform: translateY(0) scale(1);
    }

    .lang-option {
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
    }
}

/* ========================================
   小屏手机微调
   ======================================== */

@media (max-width: 360px) {
    .lang-current {
        padding: 0.55rem 0.75rem;
        font-size: 0.82rem;
    }
}

/* ========================================
   无障碍：减少动画偏好
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .lang-current,
    .lang-arrow,
    .lang-dropdown,
    .lang-option {
        transition: none;
    }

    .lang-switcher.open .lang-dropdown {
        transform: none;
    }
}

/* ========================================
   焦点样式（键盘导航）
   ======================================== */

.lang-current:focus-visible,
.lang-option:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* ========================================
   RTL (从右到左) 支持 - 阿拉伯语
   ======================================== */

[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .lang-dropdown {
    right: auto;
    left: 0;
    transform-origin: top left;
}

[dir="rtl"] .lang-option {
    text-align: right;
}

[dir="rtl"] .lang-option.active::before {
    margin-right: 0;
    margin-left: 0.5rem;
}

[dir="rtl"] .hero-content,
[dir="rtl"] .section-header,
[dir="rtl"] .feature-card,
[dir="rtl"] .product-card,
[dir="rtl"] .solution-card,
[dir="rtl"] .scenario-card,
[dir="rtl"] .step-card,
[dir="rtl"] .compare-table,
[dir="rtl"] .cta-content,
[dir="rtl"] .footer-content {
    text-align: right;
}

[dir="rtl"] .feature-grid,
[dir="rtl"] .product-grid,
[dir="rtl"] .solution-grid,
[dir="rtl"] .scenario-grid,
[dir="rtl"] .steps-grid {
    direction: rtl;
}

[dir="rtl"] .nav-menu {
    direction: rtl;
}

[dir="rtl"] .nav-lang-switcher {
    margin-left: 0;
    margin-right: 0.5rem;
}

[dir="rtl"] .hero-buttons {
    direction: rtl;
}

[dir="rtl"] .compare-row {
    direction: rtl;
}

[dir="rtl"] .compare-before,
[dir="rtl"] .compare-after {
    text-align: right;
}

[dir="rtl"] .step-number {
    margin-right: 0;
    margin-left: 1rem;
}

[dir="rtl"] .feature-icon,
[dir="rtl"] .product-icon,
[dir="rtl"] .scenario-icon {
    margin-right: 0;
    margin-left: 0.75rem;
}

[dir="rtl"] .footer-links {
    direction: rtl;
}

[dir="rtl"] .footer-brand {
    text-align: right;
}

@media (max-width: 768px) {
    [dir="rtl"] .nav-lang-switcher {
        margin-right: 0;
    }
}
