/* 移动端样式 (默认) */
.collection-with-product__section {
  margin: 0 auto;
  padding: var(--mobile-padding-top) var(--mobile-padding-right) var(--mobile-padding-bottom)
    var(--mobile-padding-left);
}

.collection-with-product__layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9375rem;
}

.collection-with-product__collection {
  display: flex;
}

.collection-with-product__collection-link {
  display: block;
  width: 100%;
  text-decoration: none;
}

.collection-with-product__product-wrapper,
.collection-with-product__product-layout,
.collection-with-product__product {
  width: 100%;
}

.collection-with-product__product .swiper-wrapper {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.625rem;
}

.collection-with-product__card {
  background: var(--card-background-color, #fff);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.collection-with-product__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.collection-with-product__image {
  width: 100%;
  overflow: hidden;
  background: #f5f5f5;
}

.collection-with-product__image img {
  width: 100%;
  height: auto;
  display: block;
}

/* 移动端显示移动端图片，隐藏PC图片 */
.collection-with-product__image-mobile {
  display: block;
}

.collection-with-product__image-pc {
  display: none;
}

.collection-with-product__product .collection-with-product__image img {
  height: 100%;
  object-fit: cover;
}

.collection-with-product__info {
  text-align: center;
  padding: 0.625rem;
}

.collection-with-product__title {
  font-size: 0.875rem;
  color: var(--title-color, #666);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.collection-with-product__price {
  font-size: 1.375rem;
  color: var(--price-color, #ff69b4);
  font-weight: bold;
  margin: 0.3125rem 0;
}

.collection-with-product__button {
  background: var(--button-background-color, #8b7355);
  color: var(--button-text-color, #fff);
  border: none;
  padding: 0.5rem 1.875rem;
  border-radius: 1.25rem;
  cursor: pointer;
  font-size: 0.875rem;
}

/* 导航按钮 - 移动端隐藏 */
.collection-with-product__nav-prev,
.collection-with-product__nav-next {
  display: none;
}

/* 移动端展开按钮 */
.collection-with-product__expand-wrapper {
  display: flex;
  justify-content: center;
}

.collection-with-product__expand-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  width: 40%;
}

.collection-with-product__expand-btn img {
  display: block;
  width: 100%;
  height: auto;
}

/* 移动端默认只显示4个产品 */
.collection-with-product__product .swiper-wrapper .collection-with-product__card:nth-child(n + 5) {
  display: none;
}

/* 展开后显示所有产品 */
.collection-with-product__product.expanded .swiper-wrapper .collection-with-product__card {
  display: flex;
}

/* 展开后隐藏按钮 */
.collection-with-product__product.expanded ~ .collection-with-product__expand-wrapper,
.collection-with-product__product-wrapper:has(.collection-with-product__product.expanded)
  ~ .collection-with-product__expand-wrapper {
  display: none;
}

/* 如果产品数量<=4，隐藏展开按钮 */
.collection-with-product__product-wrapper:has(
    .swiper-wrapper .collection-with-product__card:nth-child(-n + 4):last-child
  )
  ~ .collection-with-product__expand-wrapper {
  display: none;
}

/* PC端样式 */
@media (min-width: 769px) {
  .collection-with-product__section {
    padding: var(--pc-padding-top) var(--pc-padding-right) var(--pc-padding-bottom)
      var(--pc-padding-left);
  }

  /* PC端 hover 效果 */
  .collection-with-product__collection-link {
    transition: opacity 0.3s ease;
  }

  .collection-with-product__collection-link:hover {
    opacity: 0.9;
  }

  .collection-with-product__card {
    transition: transform 0.3s ease;
  }

  .collection-with-product__card:hover {
    transform: translateY(-5px);
  }

  .collection-with-product__button {
    transition: opacity 0.3s ease;
  }

  .collection-with-product__button:hover {
    opacity: 0.8;
  }

  /* PC端隐藏展开按钮 */
  .collection-with-product__expand-wrapper {
    display: none;
  }

  /* PC端显示所有产品 */
  .collection-with-product__product .swiper-wrapper .collection-with-product__card {
    display: flex !important;
  }

  .collection-with-product__layout {
    grid-template-columns: 1fr 3fr;
    gap: 10px;
    align-items: start;
  }

  .collection-with-product__product-wrapper,
  .collection-with-product__product-layout {
    position: relative;
    height: 100%;
    overflow: hidden;
  }

  .collection-with-product__product-layout {
    position: absolute;
  }

  .collection-with-product__product {
    height: 100%;
  }

  .collection-with-product__product .swiper-wrapper {
    display: flex;
    gap: 0;
  }

  .collection-with-product__info {
    padding: 10px;
  }

  /* PC端显示PC图片，隐藏移动端图片 */
  .collection-with-product__image-mobile {
    display: none;
  }

  .collection-with-product__image-pc {
    display: block;
  }

  .collection-with-product__title {
    font-size: 17px;
  }

  .collection-with-product__price {
    font-size: 27px;
    margin: 5px 0;
  }

  .collection-with-product__button {
    padding: 8px 30px;
    border-radius: 20px;
    font-size: 15px;
  }

  /* 导航按钮 */
  .collection-with-product__nav-prev,
  .collection-with-product__nav-next {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 10;
    opacity: 0.6;
    transition: opacity 0.3s ease;
  }

  .collection-with-product__nav-prev:hover,
  .collection-with-product__nav-next:hover {
    opacity: 1;
  }

  .collection-with-product__product.show-navigation
    .collection-with-product__nav-prev.swiper-button-disabled,
  .collection-with-product__product.show-navigation
    .collection-with-product__nav-next.swiper-button-disabled {
    display: none;
  }

  .collection-with-product__nav-prev {
    left: 6px;
    transform: translateY(-50%) rotate(180deg);
  }

  .collection-with-product__nav-next {
    right: 6px;
  }

  .collection-with-product__nav-prev img,
  .collection-with-product__nav-next img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  /* 当产品数量大于3时显示导航按钮 */
  .collection-with-product__product.show-navigation .collection-with-product__nav-prev,
  .collection-with-product__product.show-navigation .collection-with-product__nav-next {
    display: block;
  }
}
