/* 语言切换器（i18n switcher）
 * 复用 .user-account 下拉外观（用户中心），并提供 .i18n-switcher--home 变体（首页导航）
 */

.i18n-switcher {
    position: relative;
}

.i18n-switcher__trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    padding: 4px 8px;
    border-radius: 8px;
    white-space: nowrap;
}

.i18n-switcher__trigger:hover {
    background: rgba(22, 93, 255, 0.06);
}

.i18n-switcher__trigger svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #4e5969;
}

/* Tailwind 环境下防样式重置导致的尺寸失控 */
.i18n-switcher--home .i18n-switcher__trigger,
.i18n-switcher--home .i18n-switcher__trigger svg {
    max-width: 18px;
}

.i18n-switcher--home .i18n-switcher__trigger {
    max-width: none;
}

.i18n-switcher--home .i18n-switcher__current {
    max-width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.i18n-switcher__current {
    font-size: 13px;
    font-weight: 600;
}

.i18n-switcher__caret {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #86909c;
    transition: transform 0.2s ease;
}

.i18n-switcher.open .i18n-switcher__caret {
    transform: rotate(180deg);
}

.i18n-switcher__menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 148px;
    background: #fff;
    border: 1px solid #e5e6eb;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    padding: 6px;
    z-index: 1200;
}

.i18n-switcher.open .i18n-switcher__menu {
    display: block;
}

.i18n-switcher__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    color: #1d2129;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
}

.i18n-switcher__item:hover {
    background: #f2f3f5;
}

.i18n-switcher__item.active {
    color: var(--sk-brand, #165dff);
    font-weight: 600;
}

.i18n-switcher__check {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    position: relative;
}

.i18n-switcher__item.active .i18n-switcher__check::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0;
    width: 5px;
    height: 9px;
    border: solid var(--sk-brand, #165dff);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* 用户中心语言切换：保持为紧凑的顶栏胶囊按钮 */
.i18n-switcher--user .i18n-switcher__trigger {
    min-height: 36px;
    padding: 0 11px;
    gap: 7px;
    border: 1px solid #e1e7ef;
    border-radius: 999px;
    background: #fff;
    color: #526078;
    transition: border-color .16s ease, background-color .16s ease, color .16s ease;
}

.i18n-switcher--user .i18n-switcher__trigger:hover,
.i18n-switcher--user.open .i18n-switcher__trigger {
    border-color: #b9ccef;
    background: #f8faff;
    color: #2458a6;
}

.i18n-switcher--user .i18n-switcher__trigger svg { color: inherit; }
.i18n-switcher--user .i18n-switcher__current { color: inherit; font-size: 12px; font-weight: 600; }
.i18n-switcher--user .i18n-switcher__caret { border-top-color: currentColor; }
.i18n-switcher--user .i18n-switcher__menu { right: 0; left: auto; }

/* 首页导航变体：融入白色导航栏 */
.i18n-switcher--home .i18n-switcher__trigger {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #e5e6eb;
    background: #fff;
    color: #4e5969;
    font-size: 13px;
}

.i18n-switcher--home .i18n-switcher__trigger:hover {
    border-color: var(--sk-brand, #165dff);
    color: var(--sk-brand, #165dff);
}

.i18n-switcher--home .i18n-switcher__trigger svg {
    color: inherit;
}

/* 登录/注册等独立页面顶栏使用浅色主题 */
.auth-lang-switch {
    position: absolute;
    top: 14px;
    right: 66px;
    z-index: 20;
}

.auth-lang-switch .i18n-switcher__trigger {
    border: 1px solid #e5e6eb;
    background: #fff;
    color: #1d2129;
}

@media (max-width: 900px) {
    .auth-lang-switch {
        top: 8px;
        right: 56px;
    }
}
