/**
 * MMOM 多语言样式文件
 * 包含语言切换器样式和RTL支持
 */

/* ===================================
   语言切换器基础样式
   =================================== */

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

.lang-switcher select,
.lang-switcher button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.lang-switcher select:hover,
.lang-switcher button:hover {
    border-color: #53FECD;
    box-shadow: 0 2px 8px rgba(83, 254, 205, 0.2);
}

.lang-switcher select:focus,
.lang-switcher button:focus {
    outline: none;
    border-color: #2C74C9;
    box-shadow: 0 0 0 3px rgba(44, 116, 201, 0.1);
}

/* ===================================
   下拉菜单样式
   =================================== */

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

.lang-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #53FECD 0%, #2C74C9 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.lang-dropdown-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(83, 254, 205, 0.3);
}

.lang-dropdown-toggle .flag {
    font-size: 18px;
}

.lang-dropdown-toggle .arrow {
    margin-left: 4px;
    transition: transform 0.3s ease;
}

.lang-dropdown.active .arrow {
    transform: rotate(180deg);
}

.lang-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.lang-dropdown.active .lang-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f5f5f5;
}

.lang-dropdown-item:last-child {
    border-bottom: none;
}

.lang-dropdown-item:hover {
    background: linear-gradient(90deg, rgba(83, 254, 205, 0.1) 0%, rgba(44, 116, 201, 0.1) 100%);
}

.lang-dropdown-item.active {
    background: linear-gradient(90deg, rgba(83, 254, 205, 0.15) 0%, rgba(44, 116, 201, 0.15) 100%);
    font-weight: 600;
}

.lang-dropdown-item .flag {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.lang-dropdown-item .name {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.lang-dropdown-item .check {
    color: #2C74C9;
    font-size: 16px;
}

/* ===================================
   按钮组样式
   =================================== */

.lang-button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.lang-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    color: #495057;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.lang-button:hover {
    background: #e9ecef;
    border-color: #53FECD;
}

.lang-button.active {
    background: linear-gradient(135deg, #53FECD 0%, #2C74C9 100%);
    border-color: #2C74C9;
    color: #fff;
}

.lang-button .flag {
    font-size: 16px;
}

/* ===================================
   RTL (Right-to-Left) 支持
   =================================== */

[dir="rtl"] {
    direction: rtl;
}

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

[dir="rtl"] .lang-dropdown-toggle .arrow {
    margin-left: 0;
    margin-right: 4px;
}

[dir="rtl"] .lang-dropdown-item .check {
    order: -1;
}

/* ===================================
   移动端响应式
   =================================== */

@media (max-width: 768px) {
    .lang-dropdown-menu {
        min-width: 180px;
        max-height: 400px;
        overflow-y: auto;
    }

    .lang-button-group {
        gap: 6px;
    }

    .lang-button {
        padding: 6px 10px;
        font-size: 12px;
    }

    .lang-dropdown-toggle {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* ===================================
   动画效果
   =================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lang-dropdown-menu.animated {
    animation: fadeInUp 0.3s ease;
}

/* ===================================
   加载状态
   =================================== */

.lang-switcher.loading {
    opacity: 0.6;
    pointer-events: none;
}

.lang-switcher.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #53FECD;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===================================
   工具类
   =================================== */

.lang-flag {
    display: inline-block;
    font-size: 20px;
    line-height: 1;
}

.lang-name {
    font-size: 14px;
    color: #333;
}

.lang-code {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
}

/* ===================================
   主题适配
   =================================== */

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .lang-dropdown-menu {
        background: #1a1a1a;
        border-color: #333;
    }

    .lang-dropdown-item {
        border-color: #2a2a2a;
    }

    .lang-dropdown-item .name {
        color: #e5e5e5;
    }

    .lang-dropdown-item:hover {
        background: rgba(83, 254, 205, 0.1);
    }

    .lang-button {
        background: #2a2a2a;
        border-color: #333;
        color: #e5e5e5;
    }

    .lang-button:hover {
        background: #333;
        border-color: #53FECD;
    }
}

/* ===================================
   可访问性
   =================================== */

.lang-switcher [role="button"]:focus-visible,
.lang-dropdown-item:focus-visible {
    outline: 2px solid #2C74C9;
    outline-offset: 2px;
}

/* 屏幕阅读器专用文本 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
