/* ===== hero-carousel===== */
/* Hero slider：手機先用較高的視覺比例；平板/桌機再放大 */
.hero {
  background: #f6f7fb;
}

/* 用 aspect-ratio 控制輪播區高度，避免圖片載入前跳動 */
.hero-carousel {
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.hero-carousel .carousel-item {
  aspect-ratio: 4 / 5; /* mobile 高版 banner */
  background: #dde3f0;
}

.hero-carousel .carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== 輪播左右箭頭美化 ===== */
.hero-carousel .carousel-control-prev,
.hero-carousel .carousel-control-next {
  width: auto;
  opacity: 1;
}

/* ===== Hero 輪播左右按鈕 與 邊界的間距 ===== */

/* 左邊按鈕往內推 */
.hero-carousel .carousel-control-prev {
  left: 16px; /* 調整這個數字：越大越往內 */
}

/* 右邊按鈕往內推 */
.hero-carousel .carousel-control-next {
  right: 16px; /* 調整這個數字：越大越往內 */
}

/* 圓形背景按鈕 */
.hero-carousel .carousel-control-prev-icon,
.hero-carousel .carousel-control-next-icon {
  background-image: none; /* 移除 Bootstrap 預設箭頭圖 */
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.18); /*透明圓圈很輕薄、偏高級感*/
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

/* 自訂箭頭符號 */
.hero-carousel .carousel-control-prev-icon::after,
.hero-carousel .carousel-control-next-icon::after {
  content: "";
  border: solid #fff;
  border-width: 0 3px 3px 0;
  display: inline-block;
  padding: 6px;
}

.hero-carousel .carousel-control-prev-icon::after {
  transform: rotate(135deg);
  margin-left: 4px;
}

.hero-carousel .carousel-control-next-icon::after {
  transform: rotate(-45deg);
  margin-right: 4px;
}

/* hover 效果（桌機） */
.hero-carousel .carousel-control-prev-icon:hover,
.hero-carousel .carousel-control-next-icon:hover {
  background-color: rgba(0, 0, 0, 0.55);
  transform: scale(1.08);
}

/* 桌機：預設淡出，滑到輪播才顯示更明顯 */
@media (min-width: 992px) {
  .hero-carousel .carousel-control-prev-icon,
  .hero-carousel .carousel-control-next-icon {
    opacity: 0;
    transform: scale(0.96);
  }

  .hero-carousel:hover .carousel-control-prev-icon,
  .hero-carousel:hover .carousel-control-next-icon {
    opacity: 1;
    transform: scale(1);
  }
}

/* 手機：按鈕稍小，避免遮圖 */
@media (max-width: 575.98px) {
  .hero-carousel .carousel-control-prev-icon,
  .hero-carousel .carousel-control-next-icon {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 575.98px) {
  .hero-carousel .carousel-control-prev {
    left: 10px;
  }
  .hero-carousel .carousel-control-next {
    right: 10px;
  }
}

/* ===== Hero Slider 指示器改成圓形 ===== */
.hero-carousel .carousel-indicators [data-bs-target] {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.6);
  border: none;
  margin: 0 6px;
  opacity: 1;
  transition: all 0.3s ease;
}

/* hero輪播圖下方圓圈 */
.hero-carousel .carousel-indicators .active {
  background-color: #ffffff; /* hero輪播圖下方圓圈顏色 */
  transform: scale(1.3);
}

/* 平板：比例稍微變寬 */
@media (min-width: 768px) {
  .hero-carousel .carousel-item {
    aspect-ratio: 16 / 9;
  }
}

/* 桌機：再略矮一點 */
@media (min-width: 992px) {
  .hero-carousel .carousel-item {
    aspect-ratio: 21 / 9;
  }
}

/* ===== Hero 文字層 ===== */
.hero-carousel .carousel-item {
  position: relative;
}

.hero-caption {
  position: absolute;
  left: 50%;
  top: 50%; /* 改成從中間開始 */
  transform: translate(-50%, -50%); /* 真正水平＋垂直置中 */
  text-align: center;
  color: #fff;
  max-width: min(90%, 720px);
  padding: 0 16px;
}

.hero-title {
  font-size: clamp(34px, 6vw, 72px);
  font-weight: 900;
  margin-bottom: 16px;
  line-height: 1.1;
  letter-spacing: 0.5px;
  text-shadow: 0 8px 26px rgba(0, 0, 0, 0.42);
}

.hero-subtitle {
  font-size: clamp(18px, 3vw, 26px);
  margin-bottom: 26px;
  line-height: 1.4;
  text-shadow: 0 5px 16px rgba(0, 0, 0, 0.38);
}

@media (max-width: 767.98px) {
  .hero-caption {
    bottom: 14%;
    top: 56%;
  }
}

@media (max-width: 991.98px) {
  .hero-title {
    font-size: clamp(28px, 5.5vw, 48px);
  }

  .hero-subtitle {
    font-size: clamp(16px, 2.8vw, 20px);
  }
}

@media (max-width: 575.98px) {
  .hero-title {
    font-size: 28px;
  }

  .hero-subtitle {
    font-size: 16px;
  }
}

/* ===== Hot Sales Section ===== */
.hot-sales {
  padding: clamp(18px, 4vw, 36px) 0;
  background: #fff;
}

.hot-sales__title {
  text-align: center;
  font-weight: 900;
  letter-spacing: 0.5px;
  font-size: clamp(22px, 3.6vw, 34px);
  /* ✅ 關鍵：與上方 slider 保持距離 */
  margin-top: clamp(20px, 4vw, 40px);
  margin-bottom: clamp(14px, 2.5vw, 18px);
}

/* ===== Category Strip ===== */
.hot-sales__cats {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 4px 14px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}
.hot-sales__cats::-webkit-scrollbar {
  display: none;
}

.cat-chip {
  flex: 0 0 auto;
  min-width: 118px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  cursor: pointer;
  user-select: none;
  scroll-snap-align: start;
  transition:
    background-color 0.15s ease,
    transform 0.15s ease,
    border-color 0.15s ease;
}

.cat-chip i {
  font-size: 22px;
  line-height: 1;
}

.cat-chip__text {
  font-weight: 700;
  font-size: 14px;
  color: #212529;
  white-space: nowrap;
}

.cat-chip:hover {
  background: rgba(0, 0, 0, 0.03);
  transform: translateY(-1px);
}

.cat-chip.is-active {
  border-color: rgba(0, 0, 0, 0.16);
  background: rgba(0, 0, 0, 0.04);
}

/* ===== Product Layout ===== */
/* Mobile: horizontal card carousel */
.hot-sales__products {
  margin-top: 12px;
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 4px 10px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.hot-sales__products::-webkit-scrollbar {
  display: none;
}

@media (min-width: 768px) {
  /* Tablet+ : grid */
  .hot-sales__products {
    overflow: visible;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
}

@media (min-width: 992px) {
  /* Desktop: 3 columns */
  .hot-sales__products {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  /* Large desktop: 4 columns */
  .hot-sales__products {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ===== Product Card ===== */
.pcard {
  scroll-snap-align: start;
  flex: 0 0 auto;
  width: min(82vw, 360px);
  background: #fff;
  border-radius: 22px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .pcard {
    width: auto;
  }
}
/* ===== Product image link (click to product) ===== */
.pcard__media {
  position: relative;
  background: #f3f5f8;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.pcard__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pcard__mediaLink {
  display: block;
  width: 100%;
  height: 100%;
}

/* ===== Fade transition for image switch ===== */
.pcard__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;

  opacity: 1;
  transition: opacity 220ms ease; /* 淡入淡出 */
}

.pcard__img.is-fading {
  opacity: 0;
}

/* ===== Prev/Next arrows (elegant) ===== */
.pcard__img-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);

  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: none;

  background: rgba(255, 255, 255, 0.9);
  color: #212529;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  cursor: pointer;

  opacity: 0.96;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.pcard__img-nav i {
  font-size: 16px;
  line-height: 1;
}

.pcard__img-prev {
  left: 12px;
}
.pcard__img-next {
  right: 12px;
}

.pcard__img-nav:disabled {
  opacity: 0;
  pointer-events: none;
}

/* 桌機 hover 才顯示（手機/平板永遠可見） */
@media (hover: hover) and (pointer: fine) {
  .pcard__img-nav {
    opacity: 0;
    transform: translateY(-50%) scale(0.96);
  }

  .pcard__media:hover .pcard__img-nav {
    opacity: 1;
    transform: translateY(-50%) scale(1.06);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
  }
}

/* 手機尺寸微調 */
@media (max-width: 575.98px) {
  .pcard__img-nav {
    width: 30px;
    height: 30px;
  }
  .pcard__img-prev {
    left: 10px;
  }
  .pcard__img-next {
    right: 10px;
  }
  .pcard__img-nav i {
    font-size: 15px;
  }
}

.pcard__body {
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
}

/* 讓「折疊狀態」高度一致：文字區固定高度 + line clamp */
.pcard__title {
  font-weight: 900;
  font-size: 18px;
  margin: 0;
  line-height: 1.2;
}

.pcard__desc {
  margin: 0;
  color: #495057;
  font-size: 14px;
  line-height: 1.4;

  display: -webkit-box;
  -webkit-line-clamp: 2; /* 固定描述高度 */
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(14px * 1.4 * 2);
}

.pcard__priceRow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.pcard__priceLabel {
  color: #6c757d;
  font-size: 13px;
}
.pcard__price {
  font-weight: 900;
  font-size: 20px;
}

/* 折疊內容：固定高度，展開後改成可捲動（卡片高度仍一致） */
.pcard__detailsWrap {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: 10px;
}

.pcard__details {
  max-height: 56px; /* 固定高度：確保所有卡片一致 */
  overflow: hidden;
  position: relative;
  padding-right: 6px;
}

/* 折疊：維持一致高度 */
.pcard__details {
  max-height: 86px; /* 你要折疊高度一致就保留 */
  overflow: hidden;
}

/* 展開：直接放開高度，不要捲軸 */
.pcard.is-expanded .pcard__details {
  max-height: none; /* ✅ 關鍵：直接展開 */
  overflow: hidden; /* ✅ 關鍵：不出現拉霸 */
}

/* 底部淡出遮罩（折疊視覺更乾淨） */
.pcard__details::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22px;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 1)
  );
}
.pcard.is-expanded .pcard__details::after {
  display: none;
}

.pcard__bullets {
  margin: 0;
  padding-left: 18px;
  color: #495057;
  font-size: 13px;
  line-height: 1.5;
}

/* Buttons */
.pcard__actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

.pbtn {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  color: #212529;
  border-radius: 14px;
  padding: 12px 12px;
  font-weight: 800;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    transform 0.15s ease,
    border-color 0.15s ease;
}
.pbtn:hover {
  background: rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}
.pbtn:active {
  transform: translateY(0);
}

.pbtn.primary {
  border-color: transparent;
  background: #0b5ed7;
  color: #fff;
}
.pbtn.primary:hover {
  background: #0a58ca;
}

/* ===== Product Image Switch Arrow ===== */
.pcard__img-next {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);

  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;

  background: rgba(255, 255, 255, 0.9);
  color: #212529;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  cursor: pointer;

  opacity: 0.92;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.pcard__img-next i {
  font-size: 16px;
}

/* hover（桌機） */
@media (hover: hover) {
  .pcard__media:hover .pcard__img-next {
    opacity: 1;
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
  }
}

/* 手機略小 */
@media (max-width: 575.98px) {
  .pcard__img-next {
    width: 30px;
    height: 30px;
    right: 10px;
  }
}
