/* 首页手机抽屉导航 */
.h5-mobile-menu-btn {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.54);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.h5-mobile-menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto;
  border-radius: 999px;
  background: #27456b;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.h5-mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 220;
}

.h5-mobile-drawer[hidden] {
  display: none !important;
}

.h5-mobile-drawer-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(10, 19, 34, 0.42);
}

.h5-mobile-drawer-panel {
  position: relative;
  width: min(82vw, 320px);
  height: 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 255, 0.98) 100%);
  box-shadow: 14px 0 30px rgba(15, 23, 42, 0.18);
  transform: translateX(0);
  overflow-y: auto;
}

.h5-mobile-drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(205, 219, 237, 0.78);
}

.h5-mobile-drawer-brand {
  font-size: 18px;
  font-weight: 700;
  color: #273f62;
}

.h5-mobile-drawer-close {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(27, 42, 70, 0.08);
  color: #5d6f8f;
  font-size: 30px;
  line-height: 1;
}

.h5-mobile-nav {
  display: flex;
  flex-direction: column;
}

.h5-mobile-nav > a,
.h5-mobile-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  border: none;
  border-bottom: 1px solid rgba(210, 222, 238, 0.9);
  background: transparent;
  color: #4b5f80;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
}

.h5-mobile-nav > a.active,
.h5-mobile-nav > a:hover,
.h5-mobile-nav-item:hover {
  color: #2b7cf0;
}

.h5-mobile-nav-arrow {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.h5-mobile-nav-item[aria-expanded='true'] .h5-mobile-nav-arrow {
  transform: rotate(225deg);
}

.h5-mobile-nav-submenu {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 18px 16px;
  background: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid rgba(210, 222, 238, 0.9);
}

.h5-mobile-nav-submenu[hidden] {
  display: none !important;
}

.h5-mobile-nav-submenu a {
  color: #5d7395;
  font-size: 14px;
}

.h5-mobile-nav-badge {
  position: absolute;
  top: -14px;
  left: 86px;
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 14px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ff5d2d 0%, #ff8211 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(255, 111, 33, 0.28);
  white-space: nowrap;
}

.h5-mobile-nav-badge::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: #ff9f1c;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}

.h5-mobile-nav-cta {
  margin-top: 8px;
  background: linear-gradient(180deg, #4996f8 0%, #2f7de6 100%) !important;
  color: #fff !important;
}

body.h5-mobile-drawer-open {
  overflow: hidden;
}

body.h5-mobile-drawer-open .h5-mobile-menu-btn span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

body.h5-mobile-drawer-open .h5-mobile-menu-btn span:nth-child(2) {
  opacity: 0;
}

body.h5-mobile-drawer-open .h5-mobile-menu-btn span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

@media (min-width: 992px) {
  .h5-mobile-menu-btn,
  .h5-mobile-drawer {
    display: none !important;
  }
}

@media (max-width: 991px) {
  .h5-header-inner {
    gap: 10px;
  }

  .h5-header-inner .h5-logo {
    display: none;
  }

  .h5-header-actions {
    gap: 8px;
  }

  .h5-header-actions .h5-link-text {
    display: none;
  }

  .h5-search {
    max-width: none;
  }
}

@media (max-width: 560px) {
  .h5-header-userbar .h5-icon-btn {
    display: none;
  }

  .h5-mobile-nav-badge {
    left: 78px;
    max-width: calc(100% - 110px);
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ========== 首页主区域：移动端纵向堆叠，PC 左栏 + 右栏 ========== */
.h5-page-home {
  min-height: 100vh;
  background: radial-gradient(1200px 520px at 55% 44%, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.22) 42%, rgba(255, 255, 255, 0) 68%),
    linear-gradient(180deg, #2f77ff 0%, #6fb2ff 40%, #e9f6ff 100%);
}

.h5-page-home::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(900px 420px at 60% 45%, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.22) 48%, rgba(255, 255, 255, 0) 75%),
    radial-gradient(520px 260px at 25% 30%, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0) 70%),
    radial-gradient(680px 300px at 80% 70%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 70%);
  opacity: 0.9;
}

.h5-page-home .h5-header {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.72);
}

.h5-page-home .h5-home-layout {
  position: relative;
  z-index: 1;
}

.h5-home-main-wrap {
  width: 100%;
}

.h5-home-layout {
  padding: 12px 12px 0;
}

/* 右侧主内容也做成卡片容器 */
.h5-home-content {
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* 移动端：分类横向滑动 */
.h5-section {
  padding-bottom: 0;
}

.h5-section-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: rgba(15, 23, 42, 0.85);
}

.h5-section--sidebar {
  margin-bottom: 0;
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.h5-section--tags {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.h5-cat-nav {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--color-border);
}

.h5-cat-nav::-webkit-scrollbar {
  display: none;
}

.h5-cat-nav a {
  flex-shrink: 0;
  padding: 10px 14px;
  font-size: 14px;
  color: #333;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.h5-cat-nav a.active {
  color: var(--color-primary);
  font-weight: 500;
  border-bottom-color: var(--color-primary);
}

/* 标签 */
.h5-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.h5-tag {
  padding: 4px 10px;
  font-size: 12px;
  color: #152833;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.h5-tag:hover,
.h5-tag.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* 排序 Tab */
.h5-sort-tabs {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 6px 0 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid transparent;
}

.h5-sort-tabs button {
  border: none;
  background: none;
  padding: 0 0 10px;
  font-size: 14px;
  color: #999;
  position: relative;
  cursor: pointer;
}

.h5-sort-tabs button.active {
  color: var(--color-text);
  font-weight: 600;
}

.h5-sort-tabs button.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--color-primary);
  border-radius: 2px;
}

/* 商品网格 */
.h5-product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 12px 0 16px;
}

.h5-card {
  background: rgba(255, 255, 255, 0.78);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: box-shadow 0.2s, transform 0.2s;
}

.h5-card:hover {
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
  transform: translateY(-2px);
}

.h5-card-img {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.55);
}

.h5-card-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.h5-card-body {
  padding: 10px 8px 14px;
  text-align: left;
}

.h5-card-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 400;
  color: #0f1111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.h5-card-price {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  color: #0f1111;
}

.h5-card-price small {
  font-size: 12px;
  font-weight: 500;
  margin-right: 2px;
}

/* 分页 */
.h5-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 8px 0 32px;
}

.h5-pagination button,
.h5-pagination span {
  min-width: 32px;
  height: 32px;
  line-height: 30px;
  text-align: center;
  font-size: 13px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #fff;
  color: var(--color-text-secondary);
}

.h5-pagination button {
  cursor: pointer;
}

.h5-pagination .current {
  border-color: var(--color-primary);
  color: var(--color-primary);
  font-weight: 500;
}

.h5-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========== PC：左约 20% 侧栏 + 右主内容 ========== */
@media (min-width: 992px) {
  .h5-home-layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 32px;
    max-width: 1408px;
    margin: 0 auto;
    padding: 24px 16px 0;
  }

  .h5-home-sidebar {
    width: 220px;
    flex: 0 0 220px;
    min-width: 0;
  }

  .h5-section--tags {
    margin-top: 24px;
    padding-top: 24px;
  }

  /* 侧栏内：分类改为纵向列表 */
  .h5-home-sidebar .h5-cat-nav {
    flex-direction: column;
    overflow: visible;
    border-bottom: none;
    padding-bottom: 0;
  }

  .h5-home-sidebar .h5-cat-nav a {
    display: block;
    padding: 8px 10px;
    margin-bottom: 0;
    border-bottom: none;
    border-left: none;
    color: #333;
    font-weight: 400;
    border-radius: 4px;
  }

  .h5-home-sidebar .h5-cat-nav a:hover {
    color: var(--color-primary);
    background: rgba(74, 144, 226, 0.08);
  }

  .h5-home-sidebar .h5-cat-nav a.active {
    color: var(--color-primary);
    font-weight: 600;
    background: #e6f4ff;
    border-bottom-color: transparent;
  }

  .h5-home-content {
    flex: 1;
    min-width: 0;
    padding-top: 4px;
  }

  .h5-sort-tabs {
    padding-top: 0;
    gap: 32px;
  }

  .h5-product-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px 20px;
    padding: 16px 0 24px;
  }

  .h5-card-body {
    padding-left: 4px;
    padding-right: 4px;
  }
}

/* 平板：两列商品 */
@media (min-width: 480px) and (max-width: 991px) {
  .h5-product-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}
