/* ==========================================================================
   产品中心 专属样式（对齐宣传册 21 类 / 73 款）
   ========================================================================== */

.products-page-section {
  background: var(--color-bg-soft);
  min-height: 600px;
  padding-top: var(--space-10); /* hero 到内容区间距由全局 80px 收至 40px */
}

.products-page-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

/* ===================== 侧栏 ===================== */
.products-sidebar {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-4) var(--space-4);
  position: sticky;
  top: 157px; /* 固定页头高 117px + 与顶部导航保持 40px 间距 */
  max-height: calc(100vh - 197px); /* 157 顶部 + 40 底部余量 */
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.products-sidebar h3 {
  flex-shrink: 0;
  font-size: var(--fs-md);
  color: var(--color-text);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.products-sidebar h3::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 16px;
  background-color: var(--color-primary);
  border-radius: 2px;
}

.products-sidebar-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0 -4px;
  padding: 0 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.products-sidebar-scroll::-webkit-scrollbar { width: 5px; }
.products-sidebar-scroll::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}
.products-sidebar-scroll::-webkit-scrollbar-track { background: transparent; }

.cat-list,
.cat-group-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cat-group-list { padding-left: 28px; }

/* 分组标题 */
.cat-group { margin-top: var(--space-2); }

.cat-group-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: none;
  border: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: var(--fw-medium);
  color: var(--color-text);
  position: relative;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.cat-group-head::before {
  content: '';
  width: 3px;
  height: 0;
  background-color: var(--color-primary);
  border-radius: 0 2px 2px 0;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  transition: height var(--transition-base);
}

.cat-group-head:hover {
  color: var(--color-primary);
  background-color: var(--color-bg-soft);
}

.cat-group-head:hover::before { height: 60%; }

/* 一级分类选中态：浅灰背景 + 红色文字 + 左侧红条 */
.cat-group-head.active {
  color: var(--color-primary);
  background-color: var(--color-bg-soft);
}

.cat-group-head.active::before { height: 60%; }

.cat-group[data-collapsed] .cat-group-list { display: none; }

/* 分类项 */
.products-sidebar ul li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  margin-bottom: 2px;
  position: relative;
}

.products-sidebar ul li a::before {
  content: '';
  width: 3px;
  height: 0;
  background-color: var(--color-primary);
  border-radius: 0 2px 2px 0;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  transition: height var(--transition-base);
}

.products-sidebar ul li a:hover,
.products-sidebar ul li a.active {
  background-color: var(--color-bg-soft);
  color: var(--color-primary);
  font-weight: var(--fw-medium);
}

.products-sidebar ul li a:hover::before,
.products-sidebar ul li a.active::before { height: 60%; }

/* 二级分类 hover 不去红条以外的交互，但去掉左侧红色竖线 */
.cat-group .cat-group-list a:hover::before { height: 0; }

/* 二级分类选中态：仅红色文字 + 中等字重，无背景、无左侧红条 */
.cat-group .cat-group-list a.active:not(:hover) {
  background-color: transparent;
  color: var(--color-primary);
  font-weight: var(--fw-medium);
}
.cat-group .cat-group-list a.active:not(:hover)::before { height: 0; }

.cat-all a { font-weight: var(--fw-medium); color: var(--color-text); }

.products-sidebar ul li a .count {
  flex-shrink: 0;
  font-size: var(--fs-xs);
  color: var(--color-text-light);
  background-color: var(--color-bg-soft);
  padding: 1px 7px;
  border-radius: 10px;
}

.products-sidebar ul li a:hover .count,
.products-sidebar ul li a.active .count {
  background-color: var(--color-primary);
  color: #fff;
}

/* ===================== 产品网格 ===================== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
}

/* 分类标题：标题已隐藏，且移出网格流（display:none），
   避免其 grid-column:1/-1 在 2 列网格中占满整行、撑出空行/单行错位 */
.product-cat-head {
  display: none;
}

.product-cat-head-top {
  display: none;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.product-cat-head h2 {
  position: relative;
  padding-left: 14px;
  margin: 0;
  font-size: 20px;
  font-weight: var(--fw-bold);
  color: var(--color-text);
  line-height: 1.4;
}

.product-cat-head h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 18px;
  background-color: var(--color-primary);
  border-radius: 2px;
}

.product-cat-head p {
  margin: 2px 0 0 0;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* ===================== 产品卡片 ===================== */
.product-card-modern {
  container-type: inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  color: inherit;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.35s ease,
              border-color 0.35s ease;
  box-shadow: var(--shadow-sm);
}

.product-card-modern:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 28px -8px rgba(0, 0, 0, 0.11),
              0 4px 8px rgba(0, 0, 0, 0.05);
  border-color: rgba(230, 0, 0, 0.28);
}

/* 媒体区 */
.product-card-modern-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background-color: #fff;
  border-bottom: 1px solid var(--color-border-light);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card-modern-media img {
  max-width: 86%;
  max-height: 86%;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: auto;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.product-card-modern:hover .product-card-modern-media img {
  transform: scale(1.05);
}

/* 卡片主体 */
.product-card-modern-body {
  padding: var(--space-4) var(--space-4) var(--space-3);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-card-modern-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--color-text);
  line-height: 1.45;
  margin: 0 0 var(--space-1) 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-modern-desc {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  line-height: 1.65;
  margin: 0 0 var(--space-2) 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-modern-scene {
  font-size: 11.5px;
  color: var(--color-text-light);
  line-height: 1.6;
  margin: 0 0 var(--space-2) 0;
}

.product-card-modern-tags {
  list-style: none;
  margin: var(--space-2) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.product-card-modern-tags li {
  font-size: 11px;
  color: var(--color-text-secondary);
  background-color: var(--color-bg-soft);
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid transparent;
  transition: all 0.25s ease;
}

.product-card-modern:hover .product-card-modern-tags li {
  border-color: var(--color-border-light);
}

/* ===== 规格参数（常显，一行两条） ===== */
.product-card-specs {
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px dashed var(--color-border-light);
  background-color: #fff;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--space-5);
  align-content: start;
}

.spec-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  min-width: 0;
  padding: 5px 0;
  border-top: 1px dashed rgba(0, 0, 0, 0.06);
}

/* 首行（两列）不画上分隔线；末行本就无下边线 */
.spec-row:nth-child(-n + 2) { border-top: 0; padding-top: 0; }

/* 卡片本身够窄时（平板/窄桌面 2 列），参数改为一列一条，避免数值被挤断 */
@container (max-width: 400px) {
  .product-card-specs { grid-template-columns: minmax(0, 1fr); }
  .spec-row:nth-child(-n + 2) { border-top: 1px dashed rgba(0, 0, 0, 0.06); padding-top: 5px; }
  .spec-row:first-child { border-top: 0; padding-top: 0; }
}

.spec-key {
  font-size: 12px;
  color: var(--color-text-light);
  white-space: nowrap;
}

.spec-val {
  font-size: 12.5px;
  color: var(--color-text);
  font-weight: var(--fw-medium);
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}

.spec-more {
  grid-column: 1 / -1;
  display: inline-block;
  margin-top: var(--space-3);
  font-size: 12.5px;
  font-weight: var(--fw-medium);
  color: var(--color-primary);
}

.spec-more:hover { text-decoration: underline; }

/* ===================== 筛选条 ===================== */
.products-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 40px;
  padding: 0 var(--space-4);
  margin-bottom: var(--space-4);
  background: var(--color-bg-soft, #f7f8fa);
  box-shadow: 0 6px 16px rgba(26, 35, 50, .06);
}
.products-filter-label {
  font-size: 16px;
  font-weight: var(--fw-semibold, 600);
  color: var(--color-text, #1A2332);
  white-space: nowrap;
}
.products-filter-count {
  font-size: var(--fs-sm, 13px);
  color: var(--color-text-muted, #8a93a3);
  white-space: nowrap;
}
.products-filter-clear {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  font-size: var(--fs-sm, 13px);
  font-family: inherit;
  color: var(--color-primary, #E60000);
  background: #fff;
  border: 1px solid var(--color-primary, #E60000);
  border-radius: 100px;
  cursor: pointer;
  transition: background var(--transition-fast, .2s);
}
.products-filter-clear:hover { background: rgba(230, 0, 0, .06); }
.products-filter-clear[hidden] { display: none; }

/* ===================== 响应式 ===================== */
@media (max-width: 991px) {
  .products-page-layout { grid-template-columns: minmax(0, 1fr); }
  .products-sidebar {
    position: static;
    max-height: none;
    padding: var(--space-4);
  }
  .products-sidebar-scroll { overflow: visible; margin: 0; padding: 0; }
  .cat-list { display: block; }
}

@media (max-width: 767px) {
  .products-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  .product-cat-head h2 { font-size: 18px; }
  .product-card-modern-body { padding: var(--space-4) var(--space-4) var(--space-3); }
  .product-card-modern-desc { -webkit-line-clamp: 4; }
}
