/* ============================================================
   Header — 顶部导航（固定 70px，移动端优先，参考原站结构，自研）
   ============================================================ */

.site-header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  height: var(--header-height);
  background: #fff;
  z-index: var(--z-sticky);
  border-bottom: var(--border-width) var(--border-style) var(--color-border-light);
  box-shadow: var(--shadow-sm);
}
.site-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
}

/* 左侧：菜单按钮 */
.header__menu {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: #f7f7f7;
  border: none;
  cursor: pointer;
  transition: background var(--duration-base) var(--ease-base);
}
.header__menu:hover {
  background: #eaeaea;
}
.header__menu svg {
  width: 22px;
  height: 22px;
  fill: var(--color-text);
}

/* 中间：Logo（绝对居中） */
.header__logo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.header__logo img {
  display: block;
  width: 100%;
  height: auto;
}
.header__logo a {
  display: block;
  width: 100%;
}

/* 右侧：消息/搜索/用户 */
.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.header__icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  background: #f7f7f7;
  border: none;
  cursor: pointer;
  position: relative;
  transition: background var(--duration-base) var(--ease-base);
}
.header__icon:hover {
  background: #eaeaea;
}
.header__icon svg {
  width: 22px;
  height: 22px;
  fill: var(--color-text);
}
.header__badge {
  position: absolute;
  top: 6px;
  right: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 10px;
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* 抽屉遮罩 */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer) - 1;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  backdrop-filter: blur(2px);
}
.drawer-overlay.open {
  display: block;
  animation: overlayFade var(--duration-base) var(--ease-base) forwards;
}
@keyframes overlayFade {
  to {
    opacity: 1;
  }
}

/* 抽屉导航 */
.drawer {
  position: fixed;
  inset-block: var(--header-height) 0;
  inset-inline-start: 0;
  width: 280px;
  max-width: 80vw;
  background: #fff;
  z-index: var(--z-drawer);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform var(--duration-base) var(--ease-out);
  box-shadow: 4px 0 12px 0 rgba(0, 0, 0, 0.12);
  display: none;
}
.drawer.open {
  display: block;
  transform: translateX(0);
}

/* 右侧抽屉（翻转） */
.drawer--right {
  inset-inline-start: auto;
  inset-inline-end: 0;
  transform: translateX(100%);
}
.drawer--right.open {
  transform: translateX(0);
}

.drawer__close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: var(--space-4);
  border-radius: var(--radius-full);
  background: #f7f7f7;
  border: none;
  cursor: pointer;
}
.drawer__close svg {
  width: 20px;
  height: 20px;
  fill: var(--color-text);
}

.drawer__nav {
  padding: 0 var(--space-4) var(--space-8);
}

.drawer__category {
  border-bottom: var(--border-width) var(--border-style) var(--color-border-light);
}
.drawer__category-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) 0;
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--color-text);
  cursor: pointer;
}
.drawer__category-title .chevron {
  width: 16px;
  height: 16px;
  fill: var(--color-text-muted);
  transition: transform var(--duration-base) var(--ease-base);
}
.drawer__category-title--open .chevron {
  transform: rotate(180deg);
}
.drawer__category-list {
  display: none;
  padding-bottom: var(--space-4);
}
.drawer__category-list.open {
  display: block;
}
.drawer__category-item {
  border-bottom: var(--border-width) var(--border-style) var(--color-border-light);
}
.drawer__category-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  font-size: var(--fs-base);
  color: var(--color-text-secondary);
}
.drawer__category-link:hover {
  color: var(--color-primary);
}
.drawer__category-link__text {
  flex: 1;
}
.drawer__category-link__arrow {
  width: 14px;
  height: 14px;
  fill: var(--color-text-muted);
  flex-shrink: 0;
}

/* 抽屉底部快捷服务 */
.drawer__service {
  position: sticky;
  top: calc(var(--header-height) + 1px);
  background: var(--color-primary);
  padding: var(--space-3);
  display: flex;
  gap: var(--space-2);
  z-index: 1;
}
.drawer__service-btn {
  flex: 1;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  cursor: pointer;
  transition: background var(--duration-base);
}
.drawer__service-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}
.drawer__service-btn svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

/* 移动端隐藏的顶部子导航（后续可展开） */
.header-subnav {
  display: none;
}

/* 桌面端导航（横向） */
@media (min-width: 1024px) {
  .header__menu,
  .drawer-overlay,
  .drawer,
  .drawer__close {
    display: none !important;
  }
  .site-header__inner {
    padding: 0 var(--space-8);
  }
  .header__logo {
    position: static;
    transform: none;
    left: auto;
    width: 140px;
    order: 1;
  }
  .header-subnav {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    order: 2;
    flex: 1;
    justify-content: center;
  }
  .header-subnav__link {
    font-size: var(--fs-base);
    color: var(--color-text-secondary);
    font-weight: var(--fw-medium);
    padding: var(--space-2) 0;
    position: relative;
  }
  .header-subnav__link:hover,
  .header-subnav__link--active {
    color: var(--color-primary);
  }
  .header-subnav__link--active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 3px;
    background: var(--color-primary);
    border-radius: var(--radius-sm);
  }
  .header__actions {
    order: 3;
    gap: var(--space-3);
  }
  .header__icon {
    width: 40px;
    height: 40px;
  }
}
