/* 类目行 */
.product-category-row {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 843px;
  margin: 48px auto 0;
  box-sizing: border-box;
  position: relative;
}

.product-category-fixed {
  flex-shrink: 0;
  margin-right: 10px;
  display: flex;
  align-items: center;
}

.product-category-left {
  flex: 1;
  position: relative;
  overflow: hidden;
  padding-right: 23px;
}

.product-category-left.has-left-overlay {
  padding-left: 23px;
}

.product-category-list {
  display: flex;
  align-items: center;
  gap: 9px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
}

.product-category-list.dragging {
  cursor: grabbing;
  user-select: none;
}

.product-category-list::-webkit-scrollbar {
  display: none;
}

.category-item {
  flex-shrink: 0;
  min-width: 76px;
  padding: 6px 9px;
  background: #F8F9FA;
  border: 1px solid rgba(61, 61, 61, 0.12);
  border-radius: 5px;
  font-family: Source Han Sans CN, Source Han Sans CN;
  font-size: 14px;
  color: #3D3D3D;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-sizing: border-box;
  user-select: none;
}

.category-item:not(.active):hover {
  border-radius: 3px;
  border: 1px solid #307ACA;
  background: #F8F9FA;
  color: #307ACA;
}

.category-item.active {
  width: auto;
  height: auto;
  padding: 6px 9px;
  background: #307ACA;
  border: none;
  border-radius: 5px;
  color: #FFFFFF;
}

.category-scroll-overlay {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  pointer-events: none;
  height: 36px;
  z-index: 1;
}

.category-scroll-overlay.hidden {
  display: none;
}

.category-shadow {
  width: 32px;
  height: 36px;
  background: linear-gradient(270deg, #F5F6F8 0%, rgba(245, 246, 248, 0) 100%);
  border-radius: 0px;
}

.category-right-btn {
  width: 23px;
  height: 23px;
  cursor: pointer;
  pointer-events: all;
}

.category-scroll-overlay-left {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  pointer-events: none;
  height: 36px;
  z-index: 1;
}

.category-scroll-overlay-left.visible {
  display: flex;
}

.category-shadow-left {
  background: linear-gradient(90deg, #F5F6F8 0%, rgba(245, 246, 248, 0) 100%);
}

.category-left-btn {
  width: 23px;
  height: 23px;
  cursor: pointer;
  pointer-events: all;
}

.product-expand-all {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 5px;
  flex-shrink: 0;
  cursor: pointer;
}

.product-expand-all img {
  width: 30px;
  height: 30px;
}

.product-expand-all span {
  font-family: Source Han Sans CN, Source Han Sans CN;
  font-weight: 500;
  font-size: 15px;
  line-height: 1;
  color: #868687;
  white-space: nowrap;
}

/* 产品网格 */
.product-grid {
  width: 100%;
  max-width: 843px;
  margin: 28px auto;
  display: flex;
  flex-wrap: wrap;
  gap: 30px 21px;
  align-content: flex-start;
  justify-content: flex-start;
  box-sizing: border-box;
}

.product-item {
  width: 267px;
  cursor: pointer;
  overflow: hidden;
}

.product-item-img {
  width: 267px;
  height: 267px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-item:hover .product-item-img {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.product-name {
  margin-top: 11px;
  padding: 0 12px;
  width: 100%;
  font-family: Source Han Sans CN, Source Han Sans CN;
  font-weight: 500;
  font-size: 16px;
  color: #3D3D3D;
  line-height: 21px;
  text-align: left;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

/* Loading */
.product-loading {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 80px 0;
}

.product-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 78, 162, 0.15);
  border-top-color: #004EA2;
  border-radius: 50%;
  animation: productSpin 0.8s linear infinite;
}

@keyframes productSpin {
  to { transform: rotate(360deg); }
}

/* 类目弹窗（抽屉式向下展开，挤压产品列表） */
.category-popup {
  width: 100%;
  max-width: 843px;
  margin: 0 auto;
  max-height: 0;
  overflow: hidden;
  box-sizing: border-box;
  transition: max-height 0.3s ease, margin-top 0.3s ease;
}

.category-popup.visible {
  max-height: 455px;
  margin-top: 15px;
}

.category-popup-inner {
  max-height: 455px;
  background: #F8F9FA;
  border: 1px solid #E1E2E3;
  box-sizing: border-box;
  padding: 14px 0 14px 14px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.category-popup-inner::-webkit-scrollbar {
  display: none;
}

.category-popup-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 0;
}

.category-popup-item {
  width: 90.5px;
  padding: 11px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  box-sizing: border-box;
}

.category-popup-img-wrapper {
  width: 60px;
  height: 60px;
  border-radius: 9px;
  position: relative;
  flex-shrink: 0;
}

.category-popup-item.active {
  background: transparent;
  width: 90.5px;
  height: auto;
}

.category-popup-item.active .category-popup-img-wrapper::after {
  content: '';
  position: absolute;
  inset: -3px;
  border: 2px solid #307ACA;
  border-radius: 10px;
  pointer-events: none;
}

.category-popup-img {
  width: 60px;
  height: 60px;
  border-radius: 9px;
  display: block;
  object-fit: cover;
}

.category-popup-name {
  margin-top: 6px;
  font-family: Source Han Sans CN, Source Han Sans CN;
  font-weight: 400;
  font-size: 12px;
  color: #3D3D3D;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.category-popup-item.active .category-popup-name {
  color: #307ACA;
  font-weight: 500;
}

/* 产品详情弹窗 */
.detail-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  display: none;
}

.detail-modal {
  flex-direction: column;
}

.detail-modal.visible {
  display: flex;
}

.detail-scroll {
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
}

.detail-scroll.dragging {
  cursor: grabbing;
}

.detail-scroll.dragging img {
  pointer-events: none;
}

.detail-scroll::-webkit-scrollbar {
  display: none;
}

.detail-images {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 0;
}

.detail-images img {
  width: clamp(320px, 30vw, 600px);
  height: auto;
  display: block;
  user-select: none;
}

.detail-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  z-index: 2;
}

.detail-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  cursor: pointer;
  user-select: none;
  z-index: 2;
}

#detail-left-btn {
  left: 35px;
}

#detail-right-btn {
  right: 35px;
}

.detail-nav-btn.hidden {
  display: none;
}

@media (max-width: 768px) {
  .detail-nav-btn {
    display: none;
  }
}

.detail-loading-mask {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

.detail-loading-mask.hidden {
  display: none;
}

.detail-loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: productSpin 0.8s linear infinite;
}

.detail-error-tip {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: Source Han Sans CN, Source Han Sans CN;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.6);
  z-index: 3;
}

.detail-error-tip.visible {
  display: flex;
}

.detail-modal:not(.loaded) .detail-nav-btn {
  visibility: hidden;
}

.detail-thumb-bar {
  height: 67px;
  background: #000;
  display: flex;
  align-items: center;
  padding: 0 50px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-shrink: 0;
  box-sizing: border-box;
}

.detail-thumb-bar::-webkit-scrollbar {
  display: none;
}

.detail-thumb-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
}

.detail-thumb-wrapper {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  box-sizing: border-box;
}

.detail-thumb-wrapper.active::after {
  content: '';
  position: absolute;
  inset: -3px;
  border: 2px solid #307ACA;
  pointer-events: none;
}

.detail-thumb-img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  display: block;
}
