/* recently-viewed.css - 最近浏览商品样式 */

/* ============================================
   首页横向滚动条
   ============================================ */
.recently-viewed-section {
  margin-top: 16px;
  padding: 0;
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}

.recently-viewed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.recently-viewed-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.recently-viewed-more {
  font-size: 13px;
  color: var(--muted, #9a9a9a);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  transition: color 0.15s;
}

.recently-viewed-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.recently-viewed-clear {
  font-size: 13px;
  color: var(--muted, #9a9a9a);
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  transition: color 0.15s;
}

.recently-viewed-clear:hover {
  color: var(--text);
}

.recently-viewed-more:hover {
  color: var(--text);
}

.recently-viewed-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  scrollbar-width: none; /* Firefox */
}

.recently-viewed-scroll::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.rv-card {
  flex: 0 0 auto;
  width: 120px;
  scroll-snap-align: start;
  cursor: pointer;
  transition: opacity 0.15s;
}

/* 作为链接时保持外观一致，无下划线，并让右键落在链接上 */
a.rv-card.product-card-link,
a.rv-card.product-card-link .rv-card-name {
  text-decoration: none !important;
  color: inherit;
}
a.rv-card.product-card-link .rv-card-image,
a.rv-card.product-card-link .rv-card-image img {
  pointer-events: none;
}

.rv-card:hover {
  opacity: 0.8;
}

.rv-card-image {
  width: 120px;
  height: 120px;
  background: #f4f4f4;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}

.rv-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rv-card-name {
  font-size: 12px;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.rv-card-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

/* ============================================
   /saved 完整页面 — 网格布局（仿 KREAM 我的页面）
   ============================================ */
.rv-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 40px;
}

.rv-page-header {
  padding: 32px 0 20px;
  border-bottom: 1px solid #ebebeb;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.rv-page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.rv-page-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rv-page-clear {
  font-size: 14px;
  color: var(--muted, #9a9a9a);
  cursor: pointer;
  border: none;
  background: none;
  padding: 4px 0;
  transition: color 0.15s;
}

.rv-page-clear:hover {
  color: var(--text);
}

.rv-page-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px 16px;
}

/* 单个商品卡片（大卡片，含品牌、名称、价格、统计等） */
.rv-grid-card {
  cursor: pointer;
  transition: opacity 0.15s;
}

.rv-grid-card:hover {
  opacity: 0.85;
}

.rv-grid-card-image {
  width: 100%;
  aspect-ratio: 1;
  background: #f4f4f4;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  margin-bottom: 10px;
}

.rv-grid-card-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  transition: background 0.15s;
  z-index: 1;
}

.rv-grid-card-delete:hover {
  background: rgba(0,0,0,0.75);
}

.rv-grid-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 收藏图标（右上角） */
.rv-grid-card-bookmark {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.rv-grid-card-brand {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.2;
}

.rv-grid-card-name {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 2px;
  min-height: calc(1.4em * 2);
}

.rv-grid-card-subtitle {
  font-size: 11px;
  color: #a7a7a7;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.rv-grid-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.rv-grid-card-tag {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 4px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 500;
  background: #f2f9f6;
  color: #31b46e;
}

.rv-grid-card-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.rv-grid-card-stats {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: #999;
}

/* 空状态 */
.rv-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted, #9a9a9a);
}

.rv-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.rv-empty-text {
  font-size: 14px;
}

/* ============================================
   响应式
   ============================================ */
@media (min-width: 1400px) {
  .rv-page-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 1024px) {
  .rv-page-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 768px) {
  .rv-page {
    padding: 0 20px;
  }

  .rv-page-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px 10px;
  }

  .rv-card {
    width: 100px;
  }

  .rv-card-image {
    width: 100px;
    height: 100px;
  }

  .rv-card-name {
    font-size: 11px;
  }

  .rv-card-price {
    font-size: 12px;
  }
}

@media (max-width: 768px) {
  /* 手机版显示滚动条 */
  .recently-viewed-scroll {
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
  }
  .recently-viewed-scroll::-webkit-scrollbar {
    display: block;
    height: 4px;
  }
  .recently-viewed-scroll::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
  }
  .recently-viewed-scroll::-webkit-scrollbar-track {
    background: transparent;
  }
}

@media (max-width: 640px) {
  .recently-viewed-title {
    font-size: 14px;
  }

  .rv-page {
    padding: 0 16px;
  }

  .rv-page-header {
    padding: 20px 0 14px;
  }

  .rv-page-title {
    font-size: 18px;
  }

  .rv-page-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 8px;
  }

  .rv-card {
    width: 90px;
  }

  .rv-card-image {
    width: 90px;
    height: 90px;
    border-radius: 8px;
  }

  .rv-card-name {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .rv-card {
    width: 80px;
  }

  .rv-card-image {
    width: 80px;
    height: 80px;
  }

  .rv-card-name {
    font-size: 10px;
  }

  .rv-card-price {
    font-size: 11px;
  }
}
