/* ========================================
   产品展示页样式 v2
   ======================================== */

/* --- 产品页顶部 padding 修正 --- */
.centerBody {
  min-height: auto;
  padding-top: var(--space-xl);
  justify-content: flex-start;
}

/* ==============================
   滚动进度条
   ============================== */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--gradient-primary);
  z-index: 9999;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.8);
  transition: width 0.1s linear;
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

/* ==============================
   产品数量徽标（标题旁）
   ============================== */
.product-count-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.10);
  border: 1px solid rgba(99, 102, 241, 0.20);
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

.product-count-badge span {
  font-family: var(--font-serif);
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
}

/* ==============================
   产品网格容器
   ============================== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: var(--space-xl);
  padding-bottom: 80px;
}

/* --- 产品卡片 --- */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  backdrop-filter: var(--blur-card);
  -webkit-backdrop-filter: var(--blur-card);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  position: relative;

  /* 入场动画初始状态 */
  opacity: 0;
  transform: translateY(24px);
}

/* 卡片序号标签 */
.product-card::before {
  content: attr(data-index);
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 2;
  font-size: 11px;
  font-weight: 500;
  color: rgba(240, 244, 255, 0.7);
  background: rgba(7, 11, 20, 0.6);
  border: 1px solid rgba(99, 140, 255, 0.2);
  border-radius: var(--radius-full);
  padding: 2px 10px;
  letter-spacing: 1px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* 入场动画激活 */
.product-card.visible {
  animation: cardIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.product-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 24px rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 140, 255, 0.35);
}

/* --- 产品图片区 --- */
.product-image {
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: var(--bg-surface);
  position: relative;
}

/* 骨架屏 shimmer */
.product-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(15, 25, 50, 0) 0%,
    rgba(99, 102, 241, 0.06) 50%,
    rgba(15, 25, 50, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmerLoad 1.8s ease-in-out infinite;
  z-index: 1;
  pointer-events: none;
}

/* 图片加载完成后移除 shimmer */
.product-image img.loaded + .shimmer-done,
.product-image.loaded::before {
  display: none;
}

@keyframes shimmerLoad {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
  display: block;
  opacity: 0;
  transition: opacity 0.4s ease, transform var(--transition-slow);
}

.product-image img.loaded {
  opacity: 1;
}

.product-card:hover .product-image img {
  transform: scale(1.08);
}

/* 悬停遮罩 */
.product-image::after {
  content: '查看详情';
  position: absolute;
  inset: 0;
  background: rgba(7, 11, 20, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: 3px;
  opacity: 0;
  transition: opacity var(--transition-base);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 3;
}

.product-card:hover .product-image::after {
  opacity: 1;
}

/* --- 产品信息 --- */
.product-info {
  padding: var(--space-md) var(--space-md) var(--space-lg);
  text-align: center;
}

.product-info h3 {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 400;
  margin-bottom: var(--space-md);
  letter-spacing: 1.5px;
  font-family: var(--font-sans);
}

/* --- 查看详情按钮 --- */
.product-btn {
  display: inline-block;
  padding: 8px 24px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--text-secondary);
  font-size: 12px;
  letter-spacing: 1.5px;
  transition: all var(--transition-base);
  cursor: pointer;
  min-height: 36px;
  min-width: 100px;
}

.product-btn:hover {
  background: var(--gradient-primary);
  border-color: transparent;
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.45);
  transform: translateY(-2px);
}

/* ==============================
   模态框（升级版）
   ============================== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(4, 7, 15, 0.9);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

.modal.active {
  animation: modalFadeIn 0.2s ease both;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  position: relative;
  margin: 5vh auto;
  max-width: 88%;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: 82vh;
  border-radius: var(--radius-md);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8), 0 0 40px rgba(99, 102, 241, 0.15);
  animation: modalImgIn 0.22s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes modalImgIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* 关闭按钮 */
.close {
  position: absolute;
  top: -52px;
  right: 0;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 26px;
  font-weight: 300;
  cursor: pointer;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid var(--bg-card-border);
  transition: all var(--transition-fast);
  line-height: 1;
  min-width: 42px;
  min-height: 42px;
}

.close:hover {
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--primary);
  transform: rotate(90deg);
}

/* 左右导航（圆形） */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  border-radius: 50%;
  background: rgba(15, 25, 50, 0.75);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all var(--transition-base);
  user-select: none;
  min-width: 50px;
  min-height: 50px;
}

.nav-btn:hover {
  background: rgba(99, 102, 241, 0.28);
  border-color: var(--primary);
  color: var(--text-primary);
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.4);
}

.prev-btn { left: -68px; }
.next-btn { right: -68px; }

/* ==============================
   回到顶部按钮
   ============================== */
#back-to-top {
  position: fixed;
  bottom: 56px;
  right: 28px;
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5);
  opacity: 0;
  transform: translateY(16px) scale(0.85);
  transition: opacity var(--transition-base), transform var(--transition-base);
  pointer-events: none;
}

#back-to-top.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

#back-to-top:hover {
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.65);
  transform: translateY(-2px) scale(1.08);
}

#back-to-top svg {
  width: 18px;
  height: 18px;
  color: white;
}

/* ==============================
   响应式
   ============================== */
@media screen and (max-width: 1100px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 700px) {
  .products-grid {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
  }

  .modal-content {
    margin: 10vh auto;
    max-width: 96%;
  }

  .prev-btn { left: 6px; }
  .next-btn { right: 6px; }

  .nav-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    font-size: 15px;
    background: rgba(15, 25, 50, 0.92);
  }

  #back-to-top {
    bottom: 72px;
    right: 16px;
  }
}
