/* =========================================================
   仓鼠优车 · 语言切换器（desktop 顶部条下拉 + 移动菜单网格）
   仅新增 .lang-* 类，不修改 base.css / public.css
   ========================================================= */

/* ------------------------- 桌面：顶部条右侧 ------------------------- */

.lang-switch {
  position: relative;
}

.lang-switch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.86);
  font-size: 12.5px;
  line-height: 1;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
}

.lang-switch-toggle::-webkit-details-marker {
  display: none;
}

.lang-switch-toggle::marker {
  content: "";
}

.lang-switch-toggle:hover {
  border-color: rgba(249, 115, 22, 0.55);
  background: rgba(249, 115, 22, 0.16);
  color: #fff;
}

.lang-switch-toggle svg {
  width: 13px;
  height: 13px;
  opacity: 0.75;
}

.lang-switch-caret {
  transition: transform 0.2s var(--ease);
}

.lang-switch[open] > .lang-switch-toggle {
  border-color: rgba(249, 115, 22, 0.55);
  background: rgba(249, 115, 22, 0.16);
  color: #fff;
}

.lang-switch[open] .lang-switch-caret {
  transform: rotate(180deg);
}

.lang-switch-code {
  min-width: 24px;
  padding: 3px 5px;
  border-radius: 5px;
  background: var(--brand);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
}

.lang-switch-label {
  max-width: 128px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lang-switch-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 130;
  width: 216px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: #121826;
  box-shadow: 0 26px 54px -22px rgba(0, 0, 0, 0.6);
}

.lang-switch-panel::before {
  content: "";
  position: absolute;
  top: -10px;
  right: 0;
  left: 0;
  height: 10px;
}

.lang-switch-title {
  padding: 6px 10px 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13.5px;
  line-height: 1.4;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}

.lang-option:hover,
.lang-option:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.lang-option.is-current {
  background: rgba(249, 115, 22, 0.18);
  color: #fff;
  font-weight: 600;
}

.lang-option-code {
  width: 24px;
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.4);
}

.lang-option.is-current .lang-option-code {
  color: #fdba74;
}

.lang-option-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lang-option-check {
  display: inline-flex;
  flex-shrink: 0;
  color: #fdba74;
}

.lang-option-check svg {
  width: 15px;
  height: 15px;
}

/* 中等宽度桌面：只保留语言代码，避免顶部条拥挤 */
@media (max-width: 1080px) {
  .topbar .lang-switch-label {
    display: none;
  }

  .lang-switch-toggle {
    padding: 5px 8px 5px 5px;
  }
}

/* ------------------------- 移动菜单内的语言网格 ------------------------- */

.mobile-menu-langs {
  padding: 4px 14px 18px;
  border-top: 1px solid var(--line-soft);
}

.mobile-menu-langs-title {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 16px 10px 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.mobile-menu-langs-title svg {
  width: 15px;
  height: 15px;
  color: var(--brand-strong);
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.lang-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.3;
  transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease), color 0.18s var(--ease);
}

.lang-chip:hover,
.lang-chip:focus-visible {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.lang-chip.is-current {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--brand-strong);
  font-weight: 600;
}

.lang-chip-code {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--muted-2);
}

.lang-chip.is-current .lang-chip-code {
  color: var(--brand-strong);
}

.lang-chip-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lang-chip svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin-left: auto;
  color: var(--brand-strong);
}

/* ------------------------- 顶部横向语言切换 ------------------------- */
.lang-bar {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lang-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
}

.lang-pill:hover,
.lang-pill:focus-visible {
  border-color: rgba(249, 115, 22, 0.7);
  background: rgba(249, 115, 22, 0.18);
  color: #fff;
}

.lang-pill.is-current {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
.lang-bar {
  direction: ltr;
}
