/* FS — 语言选择器 */
.xh-lang-modal:not(.is-open) {
    position: fixed;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: -1;
}

.xh-lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    padding: 6px 12px;
    border: 1px solid rgba(91, 97, 223, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: #26233b;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(38, 35, 59, 0.07);
}

.xh-lang-trigger:hover {
    background: #fff;
    border-color: rgba(91, 97, 223, 0.45);
    color: #5b61df;
    box-shadow: 0 2px 8px rgba(91, 97, 223, 0.12);
}

.xh-lang-trigger-label {
    color: inherit;
}

.xh-lang-trigger-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(38, 35, 59, 0.12);
    box-shadow: none;
    background: #fff;
}

.xh-lang-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.xh-lang-modal.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.xh-lang-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.xh-lang-panel {
    position: relative;
    width: min(720px, 96vw);
    max-height: min(85vh, 720px);
    overflow: auto;
    padding: 24px 22px 28px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.xh-lang-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.xh-lang-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
}

.xh-lang-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: #f1f5f9;
    color: #334155;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.xh-lang-close:hover {
    background: #e2e8f0;
}

.xh-lang-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.xh-lang-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 10px 14px;
    border: 1px solid #e8ecf1;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.xh-lang-item:hover {
    border-color: rgba(91, 97, 223, 0.45);
    box-shadow: 0 4px 16px rgba(91, 97, 223, 0.1);
}

.xh-lang-item.is-active {
    border-color: #5b61df;
    background: #f5f3ff;
    box-shadow: 0 0 0 1px #5b61df;
}

.xh-lang-item.is-active .xh-lang-name {
    color: #5b61df;
}

.xh-lang-flag {
    position: relative;
    width: 48px;
    height: 48px;
}

.xh-lang-flag img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
    background: #fff;
}

.xh-lang-code {
    position: absolute;
    right: -4px;
    bottom: -2px;
    min-width: 22px;
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e2e8f0;
    font-size: 9px;
    font-weight: 800;
    color: #475569;
    text-align: center;
    line-height: 1.3;
}

.xh-lang-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
    line-height: 1.35;
}

body.xh-rtl {
    direction: rtl;
}

/* Header 保持 LTR：Logo 在左、语言切换在右，与其他语言一致 */
body.xh-rtl .header-area,
body.xh-rtl .header-area .nav-wrap,
body.xh-rtl .header-area .nav-wrap .purchase-button {
    direction: ltr;
}

body.xh-rtl .xh-lang-trigger {
    margin-left: 12px;
    margin-right: 0;
}

body.xh-rtl .xh-bg-trigger {
    margin-left: 8px;
    margin-right: 0;
}

body.xh-rtl .header-area .nav-wrap .purchase-button .navbar-toggler {
    margin-right: 20px;
    margin-left: 0;
}

@media (max-width: 640px) {
    .xh-lang-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .xh-lang-trigger-label {
        display: none;
    }
}

@media (max-width: 1199px) {
    .purchase-button {
        display: flex;
        align-items: center;
        gap: 6px;
    }
}

/* FS演示站导航栏 — 与菜单文字 #26233b 保持一致 */
.header-area .nav-wrap .purchase-button {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-area .xh-lang-trigger,
.header-area.sticky .xh-lang-trigger {
    color: #26233b;
    border-color: rgba(91, 97, 223, 0.2);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 1px 4px rgba(38, 35, 59, 0.07);
}

.header-area .xh-lang-trigger:hover,
.header-area.sticky .xh-lang-trigger:hover {
    color: #5b61df;
    border-color: rgba(91, 97, 223, 0.45);
    background: #fff;
    box-shadow: 0 2px 8px rgba(91, 97, 223, 0.12);
}
