/* ============================================================
   KINGRAYS — Products page styles
   ============================================================ */

/* ---------------- page header ---------------- */
.page-head {
  position: relative;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--line);
  min-height: 500px;
  display: flex;
  align-items: center;
  padding: 56px 0;
  /* 产品陈列横幅背景图 */
  background-image: url("../assets/products-head-bg.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* 浅色遮罩：仅中间文字区加很淡的一层，保证文字可读；两侧完全露出产品图（保持清晰） */
.page-head::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0) 30%, rgba(255,255,255,.42) 42%, rgba(255,255,255,.5) 50%, rgba(255,255,255,.42) 58%, rgba(255,255,255,0) 70%, rgba(255,255,255,0) 100%);
  pointer-events: none;
}

.page-head .wrap {
  position: relative;
  z-index: 1;
  /* 页头文字整体居中 */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.page-head .kicker {
  font-size: 12px;
  letter-spacing: .18em;
  font-weight: 600;
  color: var(--red);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.page-head h1 {
  font-family: var(--font-head);
  font-size: 44px;
  font-weight: 600;
  letter-spacing: -.02em;
  margin-bottom: 12px;
}

.page-sub {
  font-size: 16px;
  color: var(--ink-2);
  max-width: 560px;
  line-height: 1.7;
}

/* ---------------- search box ---------------- */
.search-box {
  position: relative;
  margin-top: 24px;
  max-width: 520px;
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 52px;
  padding: 0 8px 0 16px;
  transition: border-color .2s, box-shadow .2s;
}

.search-box:focus-within {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(248, 92, 44, .08);
}

.search-ic {
  width: 20px;
  height: 20px;
  color: var(--ink-3);
  flex-shrink: 0;
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  padding: 0 12px;
  height: 100%;
  background: transparent;
}

.search-box input::placeholder { color: #aaa; }

.search-clear {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  font-size: 14px;
  background: var(--bg-alt);
  transition: background-color .2s, color .2s;
}

.search-clear:hover { background: var(--line); color: var(--ink); }

.search-go {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: var(--red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color .2s;
}

.search-go:hover { background: var(--red-deep); }
.search-go .ic { width: 20px; height: 20px; }

/* 搜索建议下拉 */
.search-suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-width: 520px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .12);
  overflow: hidden;
  z-index: 50;
  max-height: 420px;
  overflow-y: auto;
}

.search-suggest-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background-color .15s;
}

.search-suggest-item:hover { background: var(--bg-alt); }

.search-suggest-item .s-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-suggest-item .s-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.search-suggest-item .s-info { flex: 1; min-width: 0; }

.search-suggest-item .s-code {
  font-size: 11.5px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--ink-3);
}

.search-suggest-item .s-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-suggest-empty {
  padding: 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
}

.search-suggest .suggest-all {
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--red);
  background: var(--red-soft);
  text-align: center;
  cursor: pointer;
}

.search-suggest .suggest-all:hover { background: #fff0ea; }

.search-suggest .hl { color: var(--red); font-weight: 600; }

/* ---------------- layout ---------------- */
.products-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px 40px;
  /* 覆盖 .wrap 的 116px 左右边距，内容区整体更往里收，3 列卡片缩小到约 3/4 */
  padding: 40px 300px 80px;
  align-items: start;
}

/* 搜索框放在产品分类区顶部，横跨侧栏 + 产品区两栏 */
.products-search {
  grid-column: 1 / -1;
  margin-top: 0;
  max-width: none;
  width: 100%;
}

/* ---------------- sidebar ---------------- */
.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  /* 侧栏内容较长时，自身内部滚动，而不是依赖页面滚到底部 */
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  padding-right: 6px;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #d8d5d0; border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: #bbb; }

.sidebar-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 14px;
}

.cat-nav { display: flex; flex-direction: column; gap: 2px; }

.cat-group { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 10px; }

.cat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  transition: background-color .18s, color .18s;
  cursor: pointer;
}

.cat-link:hover { background: var(--bg-alt); color: var(--red); }

.cat-link.active { background: var(--red-soft); color: var(--red); }

/* subcategories */
.cat-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px 7px 28px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--ink-2);
  transition: background-color .18s, color .18s;
  cursor: pointer;
}

.cat-sub:hover { background: var(--bg-alt); color: var(--red); }

.cat-sub.active { background: var(--red-soft); color: var(--red); }

/* ---------------- toolbar ---------------- */
.products-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.breadcrumb {
  font-size: 13.5px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--ink-3); transition: color .18s; }
.breadcrumb a:hover { color: var(--red); }
.breadcrumb .sep { color: var(--line); }

.toolbar-right { display: flex; align-items: center; gap: 16px; }

.result-count { display: none; }

.mobile-filter-btn {
  display: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

/* ---------------- grid ---------------- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.product-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .08);
  border-color: #d8d5d0;
}

.product-card .thumb {
  aspect-ratio: 1 / 1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px;
}

.product-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform .3s;
}

.product-card:hover .thumb img { transform: scale(1.05); }

.product-card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; flex: 1; }

.product-card .code {
  font-size: 11px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--ink-3);
  margin-bottom: 5px;
}

.product-card .name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 37px;
}

.product-card .specs {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.45;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card .card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.product-card .view-link {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--red);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.product-card .view-link .ic { width: 14px; height: 14px; }

/* 收藏按钮（卡片右下角）：矩形 + 文字 */
.fav-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: var(--ink-2);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  transition: background-color .2s, color .2s, border-color .2s, transform .15s;
  flex-shrink: 0;
  white-space: nowrap;
}

.fav-btn .fav-ic {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: fill .2s, stroke .2s;
  flex-shrink: 0;
}

.fav-btn:hover {
  color: var(--red);
  border-color: var(--red);
  transform: translateY(-1px);
}

.fav-btn.is-active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.fav-btn.is-active .fav-ic {
  fill: #fff;
  stroke: #fff;
}

/* ---------------- favorites page ---------------- */
.favorites-content {
  padding-top: 40px;
  padding-bottom: 80px;
}

.favorites-content .empty-state {
  padding: 80px 0;
  font-size: 16px;
}

/* ---------------- empty state ---------------- */
.empty-state {
  text-align: center;
  padding: 60px 0;
  color: var(--ink-3);
  font-size: 15px;
}

/* ---------------- pagination ---------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .18s, color .18s, border-color .18s;
}

.page-btn:hover:not(.is-disabled):not(.is-active) {
  border-color: var(--red);
  color: var(--red);
}

.page-btn .ic {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-btn.is-active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.page-btn.is-disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}

.page-ellipsis {
  min-width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  font-size: 14px;
  user-select: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1240px) {
  .products-layout { padding: 40px 64px 80px; }
}
@media (max-width: 1080px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .products-layout { grid-template-columns: 1fr; gap: 24px; padding: 32px 32px 64px; }
  .sidebar {
    position: static;
    display: none;
  }
  .sidebar.is-open { display: block; }
  .mobile-filter-btn { display: inline-block; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

@media (max-width: 520px) {
  .products-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 34px; }
  .products-layout { padding: 24px 18px 48px; }
}

/* Enlarge this white-margin source without cropping the lamps or remote. */
.product-card .thumb img[src="assets/products/L260093-updated.png"] {
  object-fit: contain;
  transform: scale(1.15);
}
