.block-product-card .product-card-style--card {
  background-color: rgb(var(--color-background));
}

/* 卡片内容容器布局 */
.block-product-card > a {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto auto;
  grid-template-areas:
    "image image"
    "swatches swatches"
    "title title"
    "price rating";
  row-gap: 8px;
}

.block-product-card .block-product-card__layer-image-wrapper {
  grid-area: image;
}

.block-product-card .block-product-card__swatches {
  grid-area: swatches;
}

.block-product-card .block-product-card__title {
  grid-area: title;
}

.block-product-card .block-product-card__price-row {
  grid-area: price;
}

.block-product-card .block-product-card__rating {
  grid-area: rating;
  margin-left: 0;
  display: none; /* 暂时隐藏评分区域 */
}

/* 图片容器 */
.block-product-card__layer-image-wrapper {
  position: relative;
  display: flex;
  width: 100%;
  padding: var(--padding);
  overflow: hidden;
}

@media (min-width: 960px) {
  /* 悬停时显示第二张图：当前结构为 image-wrapper > .block-product-card__media-item，第二项默认 display:none，悬停时显示并置于上层 */
  .block-product-card__layer-image-wrapper.hover:hover
    .block-product-card__image-wrapper > .block-product-card__media-item:nth-child(2) {
    display: block !important;
    opacity: 1;
    z-index: 2;
  }
}

.block-product-card__image-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  aspect-ratio: var(--aspect-ratio);
  overflow: hidden;
  background-color: rgb(243 243 243 / 100%);
  border-radius: var(--border-radius);
}

.block-product-card__image-wrapper > svg {
  width: 100%;
  height: 100%;
}

.block-product-card__image-wrapper > .block-product-card__image {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: var(--fit-type);
  transition: 1s;
}

.block-product-card__image-wrapper > .block-product-card__image:nth-of-type(1) {
  opacity: 1;
}

.block-product-card__image-wrapper > .block-product-card__image:nth-of-type(2) {
  opacity: 0;
}

/* 颜色切换图片容器样式 */
.block-product-card__image-wrapper > .block-product-card__media-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.block-product-card__image-wrapper > .block-product-card__media-item[style*="display: none"] {
  display: none !important;
}

.block-product-card__image-wrapper > .block-product-card__media-item .block-product-card__image {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: var(--fit-type);
  opacity: 1 !important;
}

/* 视频样式：.block-product-card__video 在 media-item 内，用后代选择器；封面需填满并可见 */
.block-product-card__image-wrapper .block-product-card__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.block-product-card__image-wrapper .block-product-card__video theme-video-media {
  width: 100%;
  height: 100%;
  display: block;
}

/* 覆盖组件内联 aspect-ratio（用 unset），使视频区域填满卡片，封面才能铺满显示 */
.block-product-card__image-wrapper .block-product-card__video .theme-video-media {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
  aspect-ratio: unset;
}

/* 封面层：强制可见、填满容器、置于最上（未播放时） */
.block-product-card__image-wrapper .block-product-card__video .theme-video-media__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}

.block-product-card__image-wrapper .block-product-card__video .theme-video-media__poster img,
.block-product-card__image-wrapper .block-product-card__video .theme-video-media__poster svg {
  width: 100%;
  height: 100%;
  object-fit: var(--fit-type);
  display: block;
}

.block-product-card__image-wrapper .block-product-card__video .theme-video-media__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.block-product-card__image-wrapper .block-product-card__video .theme-video-media__media.active {
  opacity: 1;
  z-index: 2;
}

.block-product-card__image-wrapper .block-product-card__video .theme-video-media__media video,
.block-product-card__image-wrapper .block-product-card__video .theme-video-media__media iframe {
  width: 100%;
  height: 100%;
  object-fit: var(--fit-type);
}

.block-product-card__image-wrapper .block-product-card__video .theme-video-media__play-button {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
}

.block-product-card__layer-wrapper {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.block-product-card__layer-wrapper > * {
  pointer-events: auto;
}

/* Sale标签 - 左上角 */
.block-product-card__sale-tag {
  position: absolute;
  top: 0;
  left: 0;
  padding: 1px 16px;
  color: rgb(var(--color-tag-text));
  background-color: #c68635;
  border-radius: 0 0 10px 0;
  z-index: 20;
}

@media (max-width: 959px) {
  .block-product-card__sale-tag {
    padding: 2px 8px;
  }
}

/* 心愿单图标 - 右上角 */
.block-product-card__wishlist {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: #c68635;
  cursor: pointer;
  background: transparent;
  border: none;
  border-radius: 50%;
}

.block-product-card__wishlist:hover {
  transform: scale(1.15);
  transition: transform 0.2s ease;
}

/* 心愿单激活状态（已收藏） */
.block-product-card__wishlist--active svg path {
  fill: #c68635;
}

.block-product-card__wishlist svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 959px) {
  .block-product-card__wishlist {
    width: 28px;
    height: 28px;
  }
  .block-product-card__wishlist svg {
    width: 20px;
    height: 20px;
  }
}

/* 底部操作区 - 始终显示 */
.block-product-card__bottom-actions {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

/* Quick View 按钮 */
.block-product-card__quick-view-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  background-color: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 10px;
  z-index: 20;
}

.block-product-card__quick-view-button:hover {
  background-color: #c68635;
}

@media (max-width: 959px) {
  .block-product-card__quick-view-button {
    height: 36px;
    padding: 0 16px;
    font-size: 12px;
  }
}

/* Quick Add 按钮 */
.block-product-card__quick-add {
  margin-left: 8px;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 10px;
  color: rgba(0, 64, 96, 0.9);
  cursor: pointer;
  background-color: #fff;
  border: none;
  border-radius: 100%;
  background-color: #d09d5b;
  z-index: 20;
}

.block-product-card__quick-add:hover {
  background-color: #d09d5b;
  color: #fff;
}

.block-product-card__quick-add svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 959px) {
  .block-product-card__quick-add {
    width: 36px;
    height: 36px;
  }
  .block-product-card__quick-add svg {
    width: 20px;
    height: 20px;
  }
}

.block-product-card__quick-add .icon-loading {
  display: none;
  margin: 8px;
  color: rgba(0, 64, 96, 0.9);
  animation: animation-button-loading linear 1.5s infinite;
}

.block-product-card__quick-add.loading {
  pointer-events: none;
}

.block-product-card__quick-add.loading .icon-quick-add {
  display: none;
}

.block-product-card__quick-add.loading .icon-loading {
  display: block;
}

/* Modal - 桌面端 */
.block-product-card__modal-content {
  width: 86vw;
  max-width: 1600px;
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 16px;
}

.block-product-card__modal-content .quick-add-hidden {
  display: none;
}

.block-product-card__modal-content theme-product-detail {
  --page-padding: 40px;
  --detail-padding-inline-start: 0px !important;
  --detail-padding-inline-end: 0px !important;
  --detail-padding-block-start: 0px !important;
  --detail-padding-block-end: 0px !important;

  padding: var(--page-padding);
}

.block-product-card__modal-close {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-end: 15px;
  /* color: #fff; */
  background: white;
}

/* Modal - 移动端：底部弹出式弹窗 */
@media (max-width: 959px) {
  /* 覆盖 Modal 基类的 center 定位，改为底部滑出 */
  body > [data-mount-modal] > summary + .block-product-card__modal {
    inset: auto 0 0 0;
    width: 100vw;
    height: auto;
    max-height: 85vh;
    transform: none;
    border-radius: 16px 16px 0 0;
    --modal-animation-name: animation-slide-in-bottom;
    background: #fff;
  }

  /* 弹窗内容区域 */
  .block-product-card__modal-content {
    width: 100%;
    max-height: calc(85vh - 20px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 弹窗内产品详情间距 */
  .block-product-card__modal-content theme-product-detail {
    --page-padding: 16px;
  }

  /* 隐藏移动端弹窗内全屏媒体画廊，使用 sticky-bar 的缩略图代替 */
  .block-product-card__modal-content
    theme-product-detail
    theme-product-media-gallery {
    display: none;
  }

  /* 产品详情信息区域在弹窗中全宽 */
  .block-product-card__modal-content .product-detail__info {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* 隐藏弹窗中不需要的产品详情元素 */
  .block-product-card__modal-content .product-detail__sticky-bar,
  .block-product-card__modal-content .product-detail__description,
  .block-product-card__modal-content .product-detail__share {
    display: none;
  }

  /* 关闭按钮样式调整：深色图标，去掉背景 */
  .block-product-card__modal .block-product-card__modal-close {
    inset-block-start: 14px;
    inset-inline-end: 14px;
    width: 32px;
    height: 32px;
    color: #333;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .block-product-card__modal .block-product-card__modal-close:hover {
    background: transparent;
  }

  /* ===== 移动端快捷加购弹窗头部（缩略图 + 标题 + 价格） ===== */
  .quick-add-mobile-header {
    display: flex;
    gap: 12px;
    padding: 16px 16px 12px;
    /* border-bottom: 1px solid rgba(0, 0, 0, 0.06); */
  }

  /* 缩略图容器 */
  .quick-add-mobile-header__thumb {
    flex-shrink: 0;
    width: 120px;
    height: 160px;
    overflow: hidden;
    border-radius: 8px;
    background-color: #f5ede6;
  }

  .quick-add-mobile-header__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* 标题 + 价格信息区域 */
  .quick-add-mobile-header__info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    padding-right: 32px; /* 为关闭按钮留出空间 */
  }

  .quick-add-mobile-header__info .product-detail__title {
    display: block !important;
    overflow: visible;
    white-space: normal;
    font-size: 14px;
    line-height: 1.4;
  }

  .quick-add-mobile-header__info .product-detail__title.title3 {
    display: block !important;
    overflow: visible;
    white-space: normal;
    /* color: #5c3c30 !important; */
  }

  .quick-add-mobile-header__info .product-detail__price {
    display: flex !important;
  }

  /* 弹窗内产品详情去掉顶部间距（头部已在外层处理） */
  .block-product-card__modal-content theme-product-detail {
    padding-top: 0;
  }
}

/* 颜色色块 */
.block-product-card__swatches {
  display: flex;
  gap: 6px;
  align-items: center;
  padding-block: 8px;
}

.block-product-card__swatch--selected {
  border: 2px solid #ddd !important;
}

.block-product-card__swatch {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 50%;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease;
}

/* 色块hover效果 */
.block-product-card__swatch:hover:not(.block-product-card__swatch--selected) {
  border-color: #5c3c30;
  transform: scale(1.1);
}

.block-product-card__swatch-inner {
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 100%;
}

/* "+x Colors" 右对齐 */
.block-product-card__swatch-more {
  margin-left: auto;
  font-size: 14px;
  color: #c68635;
}

/* 移动端最多显示 3 个色块 */
@media (max-width: 959px) {
  .block-product-card__swatch--desktop-only {
    display: none !important;
  }
  .block-product-card__swatch-more--desktop {
    display: none !important;
  }
}
@media (min-width: 960px) {
  .block-product-card__swatch-more--mobile {
    display: none !important;
  }
}

/* 商品标题 */
.block-product-card__title {
  display: -webkit-box;
  flex-shrink: 0;
  padding-block: 4px;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: rgba(51, 51, 51, 0.8);
  text-overflow: ellipsis;
  -webkit-line-clamp: var(--max-row);
  -webkit-box-orient: vertical;
}

.block-product-card__title.product-card-style--card {
  padding-inline: 8px;
}

/* normal 样式单行省略 */
.block-product-card__title.product-card-style--normal {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 价格和评分行 */
.block-product-card__price-rating-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding-block: 4px;
}

.block-product-card__price-rating-row.product-card-style--card {
  padding-inline: 8px;
}

/* 价格区域 */
.block-product-card__price-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.block-product-card__price-row.product-card-style--card {
  padding-inline: 8px;
}

.block-product-card__price-current {
  font-family: "Open Sans", sans-serif;
  font-weight: 700;
  /* 默认使用主题色（无折扣时） */
  color: #c68635;
}

/* 有折扣时使用折扣色 */
.block-product-card__price-current.has-discount {
  color: #fa3e3e;
}

.block-product-card__price-current .price-symbol {
  font-size: 14px;
}

.block-product-card__price-current .price-value {
  font-size: 18px;
}
.product-list-collect-btn {
  z-index: 21  !important;
}

/* 隐藏第三方 App（预计配送时间插件）注入到产品卡片中的元素 */
.block-product-card .ot-estimated-shipping {
  display: none !important;
}

@media (max-width: 959px) {
  .block-product-card__price-current .price-symbol {
    font-size: 12px;
  }
  .block-product-card__price-current .price-value {
    font-size: 16px;
  }
}

.block-product-card__price-original {
  font-size: 12px;
  color: #999;
  text-decoration: line-through;
}

.block-product-card__discount-tag {
  padding: 2px 10px;
  font-size: 12px;
  height: 22px;
  line-height: 16px;
  color: #fa3e3e;
  background-color: transparent;
  border: 1px solid #fa3e3e;
  border-radius: 2px;
}

@media (max-width: 959px) {
  .block-product-card__discount-tag {
    padding: 1px 6px;
    font-size: 12px;
  }
}

/* 评分区域 */
.block-product-card__rating {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: auto;
}

.block-product-card__stars {
  display: flex;
  gap: 1px;
  color: #ffb800;
}

.block-product-card__stars svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 959px) {
  .block-product-card__stars svg {
    width: 14px;
    height: 14px;
  }
}

.block-product-card__review-count {
  font-size: 14px;
  color: #c68635;
}

@media (max-width: 959px) {
  .block-product-card__review-count {
    font-size: 12px;
  }
}

/* Sold Out 标签 */
.block-product-card__sold-out {
  padding: 4px 12px;
  color: #fff;
  background-color: #c68635;
  border-radius: 0 0 10px 0;
}

@media (max-width: 959px) {
  .block-product-card__sold-out {
    padding: 2px 8px;
  }
}

/* 层级布局 - 作为 layer-wrapper flex 子元素，margin-top: auto 使其定位到底部 */
.block-product-card__layer {
  display: flex;
  align-items: center;
  margin-top: auto;
  opacity: 1;
  padding: 12px;
  transition: opacity 0.3s ease;
}

.block-product-card__quick-view-button {
  opacity: 0;
}

/* 加购按钮始终靠右：margin-left:auto 使其在 flex 行中推到右边 */
.block-product-card__layer theme-quick-add-modal,
.block-product-card__layer theme-product-form {
  margin-left: auto;
}

/* Hover 时显示 layer 内容 */
/* 注意：layer-wrapper 设置了 pointer-events: none，所以需要在父容器上触发 hover */
@media (min-width: 960px) {
  .block-product-card__layer-image-wrapper:hover
    .block-product-card__layer-wrapper
    .block-product-card__quick-view-button {
    opacity: 1;
  }
  
  /* 备用方案：如果上面的选择器不工作，使用 card hover */
  .block-product-card:hover
    .block-product-card__layer-wrapper
    .block-product-card__quick-view-button {
    opacity: 1;
  }
}

/* 移动端始终显示 */
@media (max-width: 959px) {
  .block-product-card__layer {
    opacity: 1;
    /* 加购按钮靠右对齐 */
    justify-content: flex-end;
  }

  /* 移动端隐藏 Quick View 按钮，避免占据布局空间导致加购按钮被 overflow:hidden 裁剪 */
  .block-product-card__quick-view-button {
    display: none;
  }

  /* 移动端隐藏心愿单按钮（主题自带 + 平台注入） */
  .block-product-card__wishlist,
  .product-list-collect-btn {
    display: none;
  }
}

/* ==================== Quick View Modal 样式 ==================== */

/* Quick View 容器在 layer flex 行中撑满剩余空间，使按钮宽度延伸到加购按钮左侧 */
.block-product-card__layer theme-quick-view-modal {
  flex: 1 1 0%;
  min-width: 0;
}

/* theme-quick-view-modal summary 样式 */
theme-quick-view-modal > details > summary {
  list-style: none;
}

theme-quick-view-modal > details > summary::-webkit-details-marker {
  display: none;
}

/* Quick View Modal 容器
   注意：不设置 position: relative，因为 Modal 基类的 CSS（@layer component）
   会在挂载到 body 后设置 position: fixed，而无层级的 position: relative 会覆盖它。
   position: fixed 同样可以作为 absolute 子元素的包含块，关闭按钮定位不受影响。 */
.quick-view-modal {
  display: flex;
  flex-direction: column;
  width: 90vw;
  max-width: 400px;
  max-height: 90vh;
  overflow: hidden;
  border-radius: 10px;
  background-color: #fff;
}

@media (max-width: 959px) {
  .quick-view-modal {
    width: 100%;
    max-width: none;
    max-height: 85vh;
  }
}

/* 关闭按钮 */
.quick-view-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  width: 32px;
  height: 32px;
  padding: 0;
  color: #333;
  cursor: pointer;
  border-radius: 50%;
  background: none;
  border: none;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-view-modal__close .icon-close {
  width: 16px;
  height: 16px;
}

/* Modal 内容区域 */
.quick-view-modal__content {
  display: flex;
  flex-direction: column;
}

/* 图片轮播区域 */
.quick-view-modal__gallery {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background-color: #f5ede6;
}

/* 图片容器 */
.quick-view-modal__images {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
}

/* 单个图片项 */
.quick-view-modal__image-item {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.quick-view-modal__image-item.active {
  opacity: 1;
}

/* 图片样式 */
.quick-view-modal__image {
  height: 100%;
  width: 100%;
  object-fit: cover;
}

/* 导航箭头按钮 */
.quick-view-modal__nav {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: #fff;
  cursor: pointer;
  background-color: rgba(0, 0, 0, 0.2);
  border: none;
  border-radius: 100%;
  transform: translateY(-50%);
  transition: background-color 0.2s ease;
}

.quick-view-modal__nav:hover {
  background-color: rgba(0, 0, 0, 0.35);
}

.quick-view-modal__nav--prev {
  left: 10px;
}

.quick-view-modal__nav--next {
  right: 10px;
}

/* 箭头图标旋转 */
.quick-view-modal__nav--prev .icon-arrow {
  transform: rotate(180deg);
}

.quick-view-modal__nav .icon-arrow {
  width: 20px;
  height: 20px;
}

@media (max-width: 959px) {
  .quick-view-modal__nav {
    width: 36px;
    height: 36px;
  }

  .quick-view-modal__nav .icon-arrow {
    width: 16px;
    height: 16px;
  }
}

/* 底部信息区域 */
.quick-view-modal__info {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  padding: 20px;
  background-color: #fff;
}

/* 颜色选择器容器 */
.quick-view-modal__swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* 单个颜色选择器 */
.quick-view-modal__swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 50%;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease;
}

.quick-view-modal__swatch:hover {
  transform: scale(1.1);
}

.quick-view-modal__swatch--selected {
  border-color: #c68635;
}

/* 颜色内圈 */
.quick-view-modal__swatch-inner {
  width: 20px;
  height: 20px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
}

/* 查看详情链接 */
.quick-view-modal__details-link {
  font-size: 14px;
  font-weight: 500;
  color: #c68635 !important;
  text-decoration: none;
  transition: color 0.2s ease;
}

.quick-view-modal__details-link:hover {
  color: #a56e2a !important;
  text-decoration: underline;
}
