/* 类目行 */
.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-left {
  flex: 1;
  position: relative;
  overflow: hidden;
  padding-right: 23px;
}

.product-category-list {
  display: flex;
  align-items: center;
  gap: 9px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-right: 54px;
  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.active {
  width: auto;
  height: auto;
  padding: 6px 9px;
  background: #004EA2;
  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-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;
}

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

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

.product-expand-all span {
  font-family: Source Han Sans CN, Source Han Sans CN;
  font-weight: 500;
  font-size: 14px;
  color: #004EA2;
  white-space: nowrap;
  margin-bottom: 2px;
}

/* 产品网格 */
.product-grid {
  width: 100%;
  max-width: 843px;
  margin: 28px auto;
  display: flex;
  flex-wrap: wrap;
  gap: 30px 21px;
  align-content: flex-start;
  justify-content: center;
  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: 9px;
  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 {
  position: absolute;
  top: calc(100% + 27px);
  right: 0;
  width: 319px;
  height: 487px;
  background: #F8F9FA;
  border: 1px solid rgba(61, 61, 61, 0.12);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.10);
  padding: 10px 0 12px 14px;
  box-sizing: border-box;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  display: none;
}

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

.category-popup.visible {
  display: block;
  animation: categoryPopupDrawer 0.25s ease-out;
}

.category-popup.closing {
  animation: categoryPopupDrawerUp 0.25s ease-in;
}

@keyframes categoryPopupDrawer {
  from { clip-path: inset(0 0 100% 0); }
  to { clip-path: inset(0 0 0% 0); }
}

@keyframes categoryPopupDrawerUp {
  from { clip-path: inset(0 0 0% 0); }
  to { clip-path: inset(0 0 100% 0); }
}

.category-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.category-popup-title {
  font-family: Source Han Sans CN, Source Han Sans CN;
  font-weight: 500;
  font-size: 15px;
  color: #3D3D3D;
  line-height: 1;
}

.category-popup-close {
  width: 23px;
  height: 23px;
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 10px;
}

.category-popup-grid {
  display: flex;
  flex-wrap: wrap;
  column-gap: 11px;
}

.category-popup-item {
  width: 90px;
  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: 90px;
  height: auto;
}

.category-popup-item.active .category-popup-img-wrapper::after {
  content: '';
  position: absolute;
  inset: -3px;
  border: 3px solid #004EA2;
  border-radius: 12px;
  pointer-events: none;
}

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

.category-popup-name {
  margin-top: 4px;
  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: #004EA2;
}

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

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

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

.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: 10;
}

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

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

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

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

.detail-main-area {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 35px;
  gap: 20px;
  min-height: 0;
}

.detail-nav-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s;
}

.detail-nav-btn.disabled {
  visibility: hidden;
}

.detail-img-wrap {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.detail-main-img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
}

.detail-thumb-bar {
  height: 67px;
  background: #000000;
  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-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
}

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

.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;
}
