/**
 * Product Recommendation Waterfall Section Styles
 * 瀑布流商品推荐组件样式
 *
 * 布局特性：
 * - 两列 CSS Grid 布局（非横向滚动）
 * - 纵向滚动加载更多
 * - 响应式设计（断点 959px）
 */

/* ===== 容器布局 ===== */
.product-recommendation-waterfall {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: var(--page-width);
  margin-inline: auto;
  padding-inline: var(--page-width-spacing);
  background-color: #fff;
}

/* PC 端隐藏整个组件 */
@media (min-width: 960px) {
  .product-recommendation-waterfall {
    display: none;
  }
}

.product-recommendation-waterfall__container {
  display: block;
}

/* ===== 标题区域 ===== */
.product-recommendation-waterfall__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  /* 去掉横线 */
}

.product-recommendation-waterfall__title {
  margin: 0;
  font-family: "Open Sans", sans-serif;
  font-size: 24px;
  font-weight: 700;
  line-height: normal;
  color: #c68635;
}

/* ===== 商品网格布局 ===== */
.product-recommendation-waterfall__grid {
  display: grid;
  /* 固定两列布局 */
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ===== 商品卡片 ===== */
.product-recommendation-waterfall__item {
  display: block;
}

.product-recommendation-waterfall__card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.product-recommendation-waterfall__card-image {
  position: relative;
  width: 100%;
  /* 固定高度 233px */
  height: 233px;
  overflow: hidden;
  background-color: #f5f5f5;
  border-radius: 4px;
}

.product-recommendation-waterfall__card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-recommendation-waterfall__card:hover .product-recommendation-waterfall__card-image img {
  transform: scale(1.05);
}

.product-recommendation-waterfall__card-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-recommendation-waterfall__card-title {
  /* 隐藏商品名称 */
  display: none;
}

.product-recommendation-waterfall__card-price {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Open Sans", sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: normal;
  /* 默认主题色 */
  color: #c68635;
}

/* 有优惠时，现价显示红色 */
.product-recommendation-waterfall__card-price--sale {
  color: #e53935;
}

/* 原价（划线价）样式 */
.product-recommendation-waterfall__card-price-compare {
  font-size: 14px;
  font-weight: 400;
  color: #999;
  text-decoration: line-through;
}

/* 无图片占位 */
.product-recommendation-waterfall__placeholder-image {
  width: 100%;
  height: 100%;
  background-color: #f5f5f5;
}

/* ===== 加载指示器 ===== */
.product-recommendation-waterfall__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 0;
  min-height: 80px;
}

.product-recommendation-waterfall__progress {
  text-align: center;
}

.product-recommendation-waterfall__progress-text {
  font-family: "Open Sans", sans-serif;
  font-size: 14px;
  color: #666;
}

/* Spinner 动画 */
.product-recommendation-waterfall__spinner {
  display: none;
  width: 24px;
  height: 24px;
}

.product-recommendation-waterfall__spinner-icon {
  width: 100%;
  height: 100%;
  color: #c68635;
  animation: recommendation-waterfall-spin 1s linear infinite;
}

@keyframes recommendation-waterfall-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 加载中状态 */
.product-recommendation-waterfall__loading.is-loading .product-recommendation-waterfall__spinner {
  display: block;
}

/* 加载完成后隐藏加载指示器 */
.product-recommendation-waterfall__loading.is-complete {
  display: none;
}

/* ===== 完成提示 ===== */
.product-recommendation-waterfall__complete {
  display: none;
  text-align: center;
  padding: 20px 0;
  font-family: "Open Sans", sans-serif;
  font-size: 14px;
  color: #999;
}

.product-recommendation-waterfall__complete.is-visible {
  display: block;
}

/* ===== 骨架屏加载动画 ===== */
.product-recommendation-waterfall__item--skeleton .product-recommendation-waterfall__card {
  pointer-events: none;
}

.product-recommendation-waterfall__skeleton-image {
  width: 100%;
  /* 固定高度 233px */
  height: 233px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: recommendation-waterfall-shimmer 1.5s infinite;
  border-radius: 4px;
}

.product-recommendation-waterfall__skeleton-title {
  width: 80%;
  height: 14px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: recommendation-waterfall-shimmer 1.5s infinite;
  border-radius: 4px;
}

.product-recommendation-waterfall__skeleton-price {
  width: 50%;
  height: 16px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: recommendation-waterfall-shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes recommendation-waterfall-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ===== 响应式设计（移动端） ===== */
@media (max-width: 959px) {
  .product-recommendation-waterfall {
    gap: 16px;
    padding-inline: 16px;
  }

  .product-recommendation-waterfall__title {
    font-size: 16px;
  }

  .product-recommendation-waterfall__grid {
    gap: 12px;
  }

  .product-recommendation-waterfall__card {
    gap: 8px;
  }

  .product-recommendation-waterfall__card-price {
    font-size: 14px;
  }

  .product-recommendation-waterfall__loading {
    padding: 16px 0;
    min-height: 60px;
  }

  .product-recommendation-waterfall__progress-text {
    font-size: 12px;
  }

  .product-recommendation-waterfall__complete {
    padding: 16px 0;
    font-size: 12px;
  }
}
