/* ===== 语言切换下拉菜单 ===== */
/* 触发器：当前语言名 + 小箭头，无边框；菜单为白色卡片 */

/* 顶栏 nav 排成一行，让 <ul class="nav-links"> 与语言触发器、汉堡按钮并排 */
.glass-header nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.lang-switcher {
  position: relative;
  z-index: 1001; /* 高于移动端侧边栏(.nav-links z-index:99)，触发器与菜单始终可点可显 */
  display: inline-flex;
}

/* ===== 触发器 ===== */
.lang-switcher__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: white;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

/* 滚动态：深色文字 */
.glass-header.scrolled .lang-switcher__trigger {
  color: var(--text-primary);
}

/* 悬停淡底（透明态半透明白 / 滚动态半透明黑） */
.lang-switcher__trigger:hover {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

.glass-header.scrolled .lang-switcher__trigger:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--primary-color);
}

/* 打开态：保持底色，避免悬停闪烁 */
.lang-switcher.active .lang-switcher__trigger {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

.glass-header.scrolled .lang-switcher.active .lang-switcher__trigger {
  background: rgba(15, 23, 42, 0.06);
  color: var(--primary-color);
}

.lang-switcher__label {
  line-height: 1;
}

.lang-switcher__caret {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

/* 打开时箭头旋转 180° */
.lang-switcher.active .lang-switcher__caret {
  transform: rotate(180deg);
}

/* ===== 下拉菜单卡片 ===== */
/* 始终浅底深字，保证在透明顶栏与白色顶栏下都可读 */
.lang-switcher__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 148px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  pointer-events: none;
}

.lang-switcher.active .lang-switcher__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* 选项行 */
.lang-switcher__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-switcher__option:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary-color);
  text-decoration: none;
}

/* 当前语言项：主色 + 对勾，不可点（避免重载当前页） */
.lang-switcher__option.is-active {
  color: var(--primary-color);
  background: rgba(37, 99, 235, 0.08);
  cursor: default;
}

.lang-switcher__check {
  font-size: 0.75rem;
  color: var(--primary-color);
}

/* 桌面端：与导航项保持间距 */
@media (min-width: 769px) {
  .lang-switcher {
    margin-left: 12px;
  }
}

/* 移动端：触发器常驻顶栏，紧凑 */
@media (max-width: 768px) {
  .lang-switcher__trigger {
    padding: 0.4rem 0.55rem;
  }
}
