/* ============================================================
 * Header 顶部导航组件样式
 * 包含：品牌标识、路由导航、语言切换、滚动透明过渡效果
 * ============================================================ */

/* ---------- 导航栏容器 ---------- */
/* 使用 sticky 定位：header 停留在正常文档流中，滚动时粘附在视口顶部。
   注意：sticky 受其父容器高度约束，需确保父容器包含全部滚动内容。 */
.site-header {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  background-color: #ffffff;
  transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

/* 滚动后导航栏变为半透明毛玻璃效果 */
.site-header.scrolled {
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
}

/* ---------- 导航栏内部布局 ---------- */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* max-width: 1200px; */
  margin: 0 100px;
  padding: 0 24px;
  height: 64px;
}

/* ---------- 品牌标识 ---------- */
.header-brand {
  font-size: 20px;
  font-weight: 600;
  color: #333333;
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
}

#headerBrand{
  cursor: default;
}

/* .header-brand:hover {
  color: #ff0000;
} */

/* ---------- 导航链接区域 ---------- */
.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  height:64px;
  margin-left: 180px;
}

.header-nav a {
  display: inline-block;
  padding: 20px;
  font-size: 20px;
  color: #333333;
  text-decoration: none;
  border-radius: 4px;
  position: relative;
  transition: color 0.3s ease, background-color 0.3s ease;
  white-space: nowrap;
}

/* 导航项下划线动画指示器（::after 伪元素 + scaleX 变换） */
.header-nav a::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 6px;
  height: 2px;
  background-color: rgba(255, 0, 0, 0.7);
  transform: scaleX(0);
  -webkit-transform: scaleX(0);
  transform-origin: left center;
  -webkit-transform-origin: left center;
  transition: transform 0.4s ease;
  -webkit-transition: -webkit-transform 0.4s ease;
}

/* hover时下划线从左到右平滑展开 */
.header-nav a:hover::after {
  transform: scaleX(1);
  -webkit-transform: scaleX(1);
}

.header-nav a:hover {
  color: #ff0000;
  /* background-color: rgba(192, 57, 43, 0.06); */
}

/* 当前激活的导航项：下划线常驻显示 */
.header-nav a.active {
  /* color: #ff0000; */
  color: #fff !important;
  background-color: #ff0000 !important;
}

.header-nav a.active::after {
  background-color: #ff0000;
  transform: scaleX(1);
  -webkit-transform: scaleX(1);
}

.header-nav a.active:hover {
  color: #ff0000;
  background-color: rgba(192, 57, 43, 0.06);
}

/* ---------- 语言切换区域 ---------- */
.header-lang {
  position: relative;
  flex-shrink: 0;
}

/* 语言切换按钮 */
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 16px;
  color: #333333;
  background: none;
  /* border: 1px solid #e0e0e0; */
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease;
  white-space: nowrap;
}

.lang-toggle:hover {
  border-color: #ff0000;
  color: #ff0000;
}

/* 下拉箭头图标 */
.lang-toggle .lang-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.3s ease;
}

.lang-toggle.open .lang-arrow {
  transform: rotate(180deg);
}

/* 语言下拉菜单 */
.lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 120px;
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
  z-index: 1001;
}

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

.lang-dropdown button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: 16px;
  color: #333333;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.lang-dropdown button:hover {
  background-color: rgba(192, 57, 43, 0.06);
  color: #ff0000;
}

.lang-dropdown button.current {
  color: #ff0000;
  font-weight: 600;
}

/* ---------- 移动端汉堡菜单按钮 ---------- */
.header-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.header-hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: #333333;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* 汉堡菜单展开状态 */
.header-hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.header-hamburger.open span:nth-child(2) {
  opacity: 0;
}

.header-hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* sticky 定位下 header 占据正常文档流空间，无需占位空白 */
.blankSpace {
  /* display: none; */
  height:64px;
}

/* ========== 平板/手机端适配 (max-width: 992px) ========== */
/* 参考农夫山泉移动端头部设计：右侧滑入面板 + 遮罩层 */
@media (max-width: 992px) {
  /* 头部内部布局：缩减边距 */
  .header-inner {
    margin: 0 16px;
    padding: 0 8px;
    height: 56px;
    gap: 8px;
  }

  /* 品牌标识：缩小字号 */
  .header-brand {
    font-size: 16px;
  }

  /* 语言切换：靠右排列 */
  .header-lang {
    margin-left: auto;
  }

  /* 语言切换按钮：紧凑样式 */
  .lang-toggle {
    padding: 6px 10px;
    font-size: 13px;
  }

  /* 导航面板：从顶部下拉改为右侧滑入面板 */
  .header-nav {
    position: fixed;
    top: 0;
    left: auto;
    right: 0;
    width: 75%;
    max-width: 320px;
    height: 100vh;
    flex-direction: column;
    justify-content: flex-start;
    background-color: #ffffff;
    padding: 56px 0 24px 0;
    gap: 0;
    /* box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15); */
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1002;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: 0;
  }

  /* 导航面板展开：从右侧滑入 */
  .header-nav.open {
    transform: translateX(0);
    transform: translateY(0);
  }

  /* 导航链接：全宽大触摸区 */
  .header-nav a {
    width: 100%;
    text-align: left;
    padding: 16px 24px;
    font-size: 16px;
    border-radius: 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
  }

  .header-nav.open a:nth-child(1) {
    border-top: 1px solid #f0f0f0;
  }

  /* 激活导航项：左侧红色指示条 */
  .header-nav a.active {
    background-color: #ff0000;
    color: #ffffff;
    border-left: 4px solid #8B0000;
    padding-left: 20px;
  }

  .header-nav a.active:hover {
    background-color: #a93226;
  }

  /* 汉堡菜单按钮：优化尺寸 */
  .header-hamburger {
    display: flex;
    width: 36px;
    height: 36px;
    gap: 6px;
    z-index: 1003;
    position: relative;
  }

  .header-hamburger span {
    height: 2.5px;
    border-radius: 3px;
  }

  /* 汉堡菜单展开状态（X 形态） */
  .header-hamburger.open span:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
  }

  .header-hamburger.open span:nth-child(2) {
    opacity: 0;
  }

  .header-hamburger.open span:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
  }

  /* 遮罩层：半透明黑色蒙版 */
  .header-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    z-index: 1001;
  }

  .header-overlay.show {
    opacity: 1;
    visibility: visible;
  }

  /* 占位空间适配 */
  .blankSpace {
    height: 56px;
  }
}

/* ========== 手机端适配 (max-width: 480px) ========== */
@media (max-width: 480px) {
  .header-inner {
    margin: 0 12px;
  }

  .header-brand {
    font-size: 15px;
  }

  /* 语言切换按钮：进一步紧凑 */
  .lang-toggle {
    padding: 4px 8px;
    font-size: 12px;
  }

  /* 导航面板：占更多屏幕宽度 */
  .header-nav {
    width: 85%;
    max-width: 300px;
  }

  /* 导航链接 */
  .header-nav a {
    padding: 14px 20px;
    font-size: 15px;
  }

  /* 汉堡菜单按钮 */
  .header-hamburger {
    width: 32px;
    height: 32px;
    gap: 5px;
  }

  .header-hamburger span {
    height: 2px;
  }

  .header-hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .header-hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}