/* ============================================
   惠丰索具 - 产品页样式
   ============================================ */

/* 产品中心布局 */
.products-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  padding: 40px 0 80px;
}

/* 侧边分类树 */
.sidebar {
  background: white;
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 24px;
  align-self: start;
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}
.sidebar h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent);
}
.cat-tree { font-size: 14px; }
.cat-tree-item { margin-bottom: 4px; }
/* 分类名：中英文上下两行 */
.cat-label-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}
.cat-cn {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #888;
  line-height: 1.3;
}
.cat-en {
  display: block;
  font-size: 14px;
  line-height: 1.4;
}
.cat-tree-toggle:hover .cat-cn,
.cat-tree-toggle.open .cat-cn { color: inherit; opacity: 0.75; }
.cat-sub-toggle:hover .cat-cn,
.cat-sub-toggle.active .cat-cn { color: inherit; opacity: 0.75; }
.cat-leaf:hover .cat-cn,
.cat-leaf.active .cat-cn { color: inherit; opacity: 0.75; }

.cat-tree-toggle {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-dark);
  font-weight: 600;
  transition: all 200ms;
  position: relative;
}
.cat-tree-toggle:hover { background: var(--bg-light); color: var(--primary); }
.cat-tree-toggle.open { color: var(--primary); background: rgba(0,61,122,0.06); }
.cat-tree-toggle::before {
  content: '▶';
  font-size: 10px;
  color: #aaa;
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-top: 3px;
}
.cat-tree-toggle.open::before { transform: rotate(90deg); color: var(--primary); }
.cat-sub { display: none; margin-left: 16px; margin-top: 2px; }
.cat-sub.open { display: block; }
.cat-sub-toggle {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  color: #555;
  transition: all 200ms;
  font-weight: 500;
}
.cat-sub-toggle:hover { background: var(--bg-light); color: var(--primary); }
.cat-sub-toggle.open { color: var(--primary); }
.cat-sub-toggle.active {
  background: var(--primary);
  color: white;
}
.cat-sub-toggle.active::before {
  color: white;
}
.cat-sub-toggle::before {
  content: '▶';
  font-size: 9px;
  color: #ccc;
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-top: 3px;
}
.cat-sub-toggle.open::before { transform: rotate(90deg); color: var(--accent); }
.cat-sub-sub { display: none; margin-left: 16px; margin-top: 2px; }
.cat-sub-sub.open { display: block; }
.cat-leaf {
  display: block;
  padding: 7px 12px;
  border-radius: var(--radius);
  color: #666;
  font-size: 13px;
  transition: all 200ms;
  cursor: pointer;
}
.cat-leaf:hover { background: var(--bg-light); color: var(--primary); }
.cat-leaf.active {
  background: var(--primary);
  color: white;
}

/* 产品列表区 */
.products-main {}
.products-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.products-breadcrumb {
  font-size: 14px;
  color: #888;
  display: flex;
  align-items: center;
  gap: 6px;
}
.products-breadcrumb a { color: var(--primary); }
.products-breadcrumb span { color: #ccc; }
.products-search {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: white;
}
.products-search input {
  border: none;
  padding: 8px 14px;
  font-size: 14px;
  width: 220px;
  outline: none;
}
.products-search button {
  background: var(--primary);
  color: white;
  padding: 8px 14px;
  font-size: 15px;
  cursor: pointer;
  transition: background 200ms;
}
.products-search button:hover { background: #002d5a; }
.products-count { font-size: 14px; color: #888; margin-bottom: 16px; }

/* 产品网格 */
.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  justify-items: center;
}
.product-card {
  width: 100%;
  max-width: 260px;
  background: white;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}
.product-card-img {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  overflow: hidden;
  position: relative;
}
.product-card-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.product-card-body { padding: 14px; }
.product-card-body h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0;
  line-height: 1.4;
}
.product-card-en {
  display: block;
  margin-top: 6px;
  padding: 3px 0;
  border-radius: 4px;
  font-size: 13px;
  background: transparent;
  color: var(--primary);
  font-weight: 600;
}

/* ---- 子品类详情页 ---- */
.detail-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* 区块A - 头部信息区 */
.detail-header {
  padding: 32px 36px;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--primary);
  margin-bottom: 28px;
}
.detail-header h1 {
  font-size: 32px;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 14px;
  line-height: 1.3;
}
.detail-tags { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.detail-en-name {
  display: block;
  padding: 0;
  border-radius: 0;
  font-size: 15px;
  background: transparent;
  color: var(--primary);
  font-weight: 600;
}

/* 区块B+C - 中间图片区（左右并排） */
.detail-mid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}
.detail-images, .detail-drawings {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.detail-section-title {
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-section-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
}

/* 图片展示区 */
.img-main-wrap {
  height: 420px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
  position: relative;
  transition: box-shadow 0.25s;
}
.img-main-wrap:hover {
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
}
.img-main-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}
.img-placeholder {
  font-size: 80px;
  color: #ccc;
}
/* hover 居中放大遮罩 */
.img-zoom-hint {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  color: white;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  border-radius: 6px;
}
.img-main-wrap.has-image:hover .img-zoom-hint {
  opacity: 1;
}
.img-thumbs {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.img-thumb {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #ccc;
}
.img-thumb.active { border-color: var(--primary); }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* 灯箱 */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.lightbox.open { opacity: 1; pointer-events: all; }
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  font-size: 32px;
  color: white;
  cursor: pointer;
  line-height: 1;
}
.lightbox-close:hover { color: var(--accent); }
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 36px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 12px;
  transition: color 200ms;
  user-select: none;
}
.lightbox-nav:hover { color: white; }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

/* 区块D - 规格参数区 */
.detail-specs {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 28px;
}
.specs-container {
  width: 100%;
  height: 460px;
  overflow: hidden;
  position: relative;
  background: white;
  cursor: grab;
  user-select: none;
}
.specs-container.dragging { cursor: grabbing; }
.specs-inner {
  position: absolute;
  top: 0; left: 0;
  will-change: transform;
  transform: translate(0, 0);
  transition: none;
}
.specs-inner.animate { transition: transform 0.1s ease-out; }
.specs-inner img { display: block; max-width: 100%; max-height: 410px; object-fit: contain; width: auto; height: auto; }
.specs-inner table {
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
  background: white;
}
.specs-inner table th {
  background: var(--primary);
  color: white;
  padding: 12px 20px;
  text-align: left;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.2);
}
.specs-inner table td {
  padding: 10px 20px;
  border: 1px solid var(--border);
  color: var(--text-dark);
}
.specs-inner table tr:nth-child(even) td { background: rgba(0,61,122,0.03); }
.specs-inner table tr:hover td { background: rgba(255,107,0,0.05); }
.specs-inner table .specs-header-row td { font-weight: 600; }
.specs-controls {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
}
.specs-btn {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: rgba(0,61,122,0.85);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: background 200ms;
  border: none;
  outline: none;
}
.specs-btn:hover { background: var(--primary); }
.specs-scale-indicator {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0,0,0,0.45);
  color: white;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 3px;
}
.specs-static {
  display: none;
  padding: 24px;
  background: var(--bg-light);
  height: 460px;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #aaa;
  text-align: center;
}

/* 全部产品按钮 */
.cat-all {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  color: #555;
  font-weight: 600;
  transition: all 200ms;
  margin-bottom: 8px;
  background: #f5f5f5;
}
.cat-all:hover { background: var(--bg-light); color: var(--primary); }
.cat-all.active { background: var(--primary); color: white; }

/* 分页 */
.products-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: white;
  color: #555;
  font-size: 14px;
  cursor: pointer;
  transition: all 200ms;
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-ellipsis { color: #aaa; padding: 0 4px; }

/* 空状态 */
.products-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: 40px 0;
}
.products-empty .empty-icon { font-size: 64px; margin-bottom: 16px; }
.products-empty h3 { font-size: 18px; color: var(--primary); margin-bottom: 8px; }
.products-empty p { font-size: 14px; color: #888; }

/* ---- 响应式 ---- */
@media (max-width: 1023px) {
  .products-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .products-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) {
  .products-grid { grid-template-columns: 1fr; }
  .product-card { max-width: none; }

  /* 产品详情页 - 容器 */
  .detail-container { padding: 20px 16px 40px; }

  /* 产品详情页 - 头部 */
  .detail-header { padding: 20px 24px; }
  .detail-header h1 { font-size: 22px; margin-bottom: 10px; }
  .detail-tags { margin-top: 8px; }
  .detail-en-name { font-size: 14px; }

  /* 产品详情页 - 图片区上下堆叠 */
  .detail-mid { grid-template-columns: 1fr; gap: 16px; margin-bottom: 24px; }
  .img-main-wrap { height: 260px; }
  .img-placeholder { font-size: 56px; }

  /* 产品详情页 - 规格参数 */
  .specs-container { height: 340px; }
  .specs-static { height: 340px; }
  .specs-inner table { font-size: 12px; }
  .specs-inner table th,
  .specs-inner table td { padding: 8px 12px; }
  .specs-controls { bottom: 8px; right: 8px; }
  .specs-scale-indicator { top: 8px; right: 8px; }

  /* 产品详情页 - 相关产品推荐 */
  #relatedProductsSection { margin-top: 28px; }
  #relatedProductsSection h2 { font-size: 18px; margin-bottom: 16px; }
  #relatedProducts { grid-template-columns: 1fr !important; }

  /* 分页 */
  .products-pagination { gap: 4px; }
  .page-btn { min-width: 32px; height: 32px; padding: 0 8px; font-size: 13px; }
}
