/* ============================================
   旺质康官网 - 产品图片显示优化 v1
   - 统一卡片图片比例
   - 加载占位符 + 骨架屏动画
   - 图片淡入效果
   - 错误回退（产品名首字+品牌色）
   - 响应式适配
   ============================================ */

/* ===== 产品卡片图片容器 ===== */
.pdd-product-image,
.product-card img[src*="/images/"],
.product-card img[src*="zhigao"],
.product-card img[alt] {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  width: 100%;
  background: linear-gradient(135deg, #f0faf5 0%, #e8f5f0 100%);
  transition: transform 0.3s var(--ease-out, ease), opacity 0.4s ease;
}

/* ===== 图片懒加载淡入 ===== */
.pdd-product-image[loading],
.product-card img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.4s ease;
}
.pdd-product-image[loading].wzk-img-loaded,
.product-card img[loading="lazy"].wzk-img-loaded {
  opacity: 1;
}

/* ===== 骨架屏加载动画 ===== */
.wzk-img-placeholder {
  aspect-ratio: 1 / 1;
  width: 100%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: wzkShimmer 1.5s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

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

/* ===== 错误回退：品牌色背景+产品首字 ===== */
.wzk-img-fallback {
  aspect-ratio: 1 / 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.wzk-img-fallback .fallback-bg {
  position: absolute;
  inset: 0;
  opacity: 0.12;
  border-radius: inherit;
}

.wzk-img-fallback .fallback-text {
  font-size: 36px;
  font-weight: 800;
  color: var(--pdd-primary, #02bd6c);
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.05);
  line-height: 1;
}

.wzk-img-fallback .fallback-subtext {
  position: absolute;
  bottom: 8px;
  left: 0; right: 0;
  text-align: center;
  font-size: 11px;
  color: #999;
  z-index: 1;
  padding: 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 品牌系列颜色 ===== */
.wzk-brand-fulisuan .fallback-bg { background: linear-gradient(135deg, #02bd6c, #00d26a); }
.wzk-brand-fulisuan .fallback-text { color: #02bd6c; }

.wzk-brand-wosheng .fallback-bg { background: linear-gradient(135deg, #ff6700, #ff8533); }
.wzk-brand-wosheng .fallback-text { color: #ff6700; }

.wzk-brand-guangyutong .fallback-bg { background: linear-gradient(135deg, #1890ff, #40a9ff); }
.wzk-brand-guangyutong .fallback-text { color: #1890ff; }

/* ===== 产品网格图片列间距优化 ===== */
.product-grid .product-card,
.pdd-product-grid .product-card {
  break-inside: avoid;
  overflow: hidden;
}

.product-grid .product-card img,
.pdd-product-grid .product-card img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  width: 100%;
  display: block;
}

/* ===== 产品详情页图片画廊 ===== */
.product-detail-gallery img,
.product-gallery img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  width: 100%;
  border-radius: var(--radius-md, 12px);
  background: #f8f9fa;
}

.product-detail-gallery .gallery-thumb img,
.product-gallery .gallery-thumb img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.product-detail-gallery .gallery-thumb.active img,
.product-gallery .gallery-thumb.active img {
  border-color: var(--pdd-primary, #02bd6c);
}

/* ===== 购物车/结算弹窗图片 ===== */
.wzk-checkout-item-img,
.wzk-cart-added-preview-img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #f8f9fa;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .wzk-img-fallback .fallback-text {
    font-size: 28px;
  }
  .wzk-img-fallback .fallback-subtext {
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .wzk-img-fallback .fallback-text {
    font-size: 24px;
  }
  .product-detail-gallery img,
  .product-gallery img {
    border-radius: 8px;
  }
}

/* ===== 图片加载优化动画 ===== */
@keyframes wzkImgFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.wzk-img-animate-in {
  animation: wzkImgFadeIn 0.4s ease forwards;
}
