/* 导航栏 */
header {
  background-color: var(--bg-color);
  background-image: url("../images/header-bg.png");
  background-size: auto 100%; /* 宽度自适应，高度填满容器 */
  background-position: center; /* 水平居中（垂直也居中，如需顶部对齐可改为 center top） */
  background-repeat: no-repeat; /* 防止重复 */
  border-bottom: 1px solid #e0e0e0;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.nav-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  position: relative;
}
.logo {
  height: 44px;
  flex-shrink: 0; /* 防止被压缩 */
}
.logo img {
  height: 100%;
  width: auto;
}

/* 折叠容器（包裹导航菜单和操作区） */
.nav-collapse {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 24px;
  transition: all 0.3s ease;
}
.nav-menu {
  display: flex;
  justify-content: space-between;
  flex: 1;
  max-width: 420px;
  font-size: 16px;
  font-weight: 500;
  list-style: none;
  margin: 0 auto;
  padding: 0;
  align-items: center;
}
.nav-item {
  position: relative;
}
.nav-item {
  color: var(--text-primary-color);
  transition: color 0.3s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
}
.nav-item:hover,
.nav-item.active {
  color: var(--primary-color);
}
.nav-item.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary-color);
}
.nav-actions {
  display: flex;
  gap: 24px;
  padding: 5px 0;
}
.nav-btn {
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 14px;
}
.nav-btn.hot {
  background: url("../images/header-hot-btn.png") no-repeat;
  background-size: 100% 100%;
  width: 87px;
  height: 50px;
  box-sizing: border-box;
  padding: 24px 13px 6px 18px;
  margin-top: -17px;
  color: var(--text-white-color);
  border: none;
  border-radius: unset;
  cursor: pointer;
}

.dropdown .dropdown-menu > li > a {
  width: 100%;
}

.lang-dropdown > .nav-btn {
  background-color: transparent;
}

#username > .dropdown-trigger span {
  display: inline-block;
  width: 85px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#username > .dropdown-menu > p {
  margin: 0;
  white-space: nowrap;
  padding: 5px 20px 10px;
  border-bottom: 1px solid #eeeeee;
  cursor: auto;
}

/* 右侧区域（语言切换 + 汉堡） */
.nav-right {
  display: none; /* 桌面隐藏，移动端显示 */
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  margin-left: 16px;
}
/* 汉堡按钮 */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  cursor: pointer;
  padding: 2px 0;
  flex-shrink: 0;
  z-index: 1001;
  transition: all 0.3s ease;
}
.hamburger span {
  display: block;
  height: 2.5px;
  width: 100%;
  background: var(--text-primary-color);
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}
.hamburger.active span:nth-child(1) {
  transform: translateY(8.75px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger.active span:nth-child(3) {
  transform: translateY(-8.75px) rotate(-45deg);
}

/* 页脚 */
footer {
  background: var(--text-primary-color);
  color: var(--text-disabled-color);
  padding: 40px 0;
  font-size: 14px;
}
.footer-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.footer-grid h5 {
  font-size: 14px;
}

/* ========== 响应式：屏幕宽度 < 1024px ========== */
@media (max-width: 1023px) {
  .nav-right,
  .hamburger {
    display: flex;
  }

  .nav-collapse {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    background: var(--bg-color);
    flex-direction: column;
    align-items: stretch;
    padding: 16px 20px 24px;
    gap: 0;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
    border-radius: 0 0 16px 16px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.98);
    transition: all 0.25s ease;
    z-index: 999;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
  }
  .nav-collapse.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
  }

  /* 导航菜单垂直排列 */
  .nav-menu {
    flex-direction: column;
    align-items: stretch;
    max-width: none;
    margin: 0 0 16px 0;
    gap: 2px;
    width: 100%;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 12px;
  }
  .nav-item {
    padding: 12px 14px;
    font-size: 16px;
    border-radius: 8px;
    justify-content: space-between;
    white-space: normal;
  }
  .nav-item.active::after {
    display: none;
  }
  .nav-item.active {
    background: var(--primary-color-light-9);
    color: var(--primary-color);
    border-radius: 8px;
  }
  .nav-item > a,
  .nav-item > .dropdown {
    width: 100%;
  }

  .nav-collapse .dropdown {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
  }
  .nav-collapse .dropdown .dropdown-menu {
    margin-top: 8px;
    border-left: 2px solid var(--primary-color);
  }
  #username {
    flex: 1;
    width: 0;
  }
  #username > .dropdown-trigger > span {
    width: auto;
  }
  #username > .dropdown-menu > p {
    display: none;
  }

  .nav-actions > .lang-dropdown {
    display: none; /* 隐藏桌面版语言切换 */
  }

  /* 对语言切换（位于 .nav-right 中）的特殊处理，使dropdown-menu仍显示为浮层 */
  .nav-right .dropdown .dropdown-menu {
    position: absolute;
    left: auto;
    right: 0;
    background: var(--bg-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #eee;
    padding: 10px 0;
    margin-top: 8px;
    min-width: 120px;
    display: none;
    border-radius: 8px;
  }
  .nav-right .dropdown.open .dropdown-menu {
    display: block;
  }
}

/* 小屏进一步适配（<480px） */
@media (max-width: 479px) {
  .logo {
    height: 36px;
  }
  .hamburger {
    width: 24px;
    height: 17px;
  }
  .hamburger.active span:nth-child(1) {
    transform: translateY(7.25px) rotate(45deg);
  }
  .hamburger.active span:nth-child(3) {
    transform: translateY(-7.25px) rotate(-45deg);
  }
  .nav-collapse {
    padding: 12px 16px 20px;
  }
  .nav-item {
    padding: 10px 12px;
    font-size: 15px;
  }
  .nav-btn {
    padding: 8px 14px;
    font-size: 14px;
  }
}
