/* ========================================
   Cart Page – 購物車
   ======================================== */

.cart-main {
  margin-top: var(--header-height);
  background: var(--color-wants-cream);
}

/* ---------- Hero ---------- */
.cart-hero {
  position: relative;
  width: 100%;
  height: 130px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 滿版裝飾底圖，改用 CSS 背景（原本的 <img> 撐不滿，文字會被切） */
  background-color: var(--color-wants-dark, #3a3f3b);
  background-image: url('../images/cart/hero-banner.webp');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
}

.cart-hero__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 20px;
  text-align: center;
  color: #fff;
}

.cart-hero__title {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 26px;
  font-weight: 700;
  line-height: normal;
  margin: 0;
}

.cart-hero__underline {
  display: block;
  width: 40px;
  height: 5px;
  flex-shrink: 0;
  /*
   * title-underline.svg 內部把 stroke 寫死成金褐 #987B4F，壓在深色照片上看不清。
   * 設計稿量到是 #FCFAF2（白），所以改用 mask 讓顏色由 CSS 決定。
   */
  background-color: currentColor;
  -webkit-mask-image: url('../images/cart/title-underline.svg');
  mask-image: url('../images/cart/title-underline.svg');
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.cart-hero__count {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
  margin: 0;
}

/* ---------- Body ---------- */
.cart-body {
  position: relative;
  padding: 56px 20px 120px;
  overflow: hidden;
  background: var(--color-wants-cream);
}

.cart-body__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.cart-body__bg-layer {
  position: absolute;
  display: block;
  max-width: none;
  pointer-events: none;
}

.cart-body__bg-layer--1 {
  top: -2%;
  right: -5%;
  width: 50%;
  opacity: 0.3;
}

.cart-body__bg-layer--2 {
  top: 0;
  right: -3%;
  width: 48%;
  opacity: 0.3;
}

.cart-body__bg-layer--3 {
  top: 12%;
  left: -12%;
  width: 58%;
  opacity: 0.15;
}

.cart-body__bg-layer--4 {
  top: 13%;
  left: -11%;
  width: 56%;
  opacity: 0.15;
}

.cart-body__bg-layer--5 {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  min-width: 1920px;
  opacity: 1;
}

.cart-body__bg-layer--main {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  min-width: 1920px;
  height: auto;
  opacity: 1;
}

.cart-body__inner {
  position: relative;
  z-index: 1;
  max-width: 1081px;
  margin: 0 auto;
}

.cart-layout {
  display: flex;
  gap: 31px;
  align-items: flex-start;
  justify-content: center;
}

/* ---------- Product List ---------- */
.cart-list {
  flex: 0 0 750px;
  width: 750px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.cart-list__table {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.cart-list__header {
  width: 100%;
  height: 50px;
  /* 設計稿取色 #987B4F（原本是 RoRich 的琥珀 #e5a949） */
  background: var(--color-wants-gold, #987b4f);
  border-radius: 5px;
  box-shadow: 0 4px 2px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.cart-list__header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 50px;
  padding: 0 30px;
}

.cart-list__header-label {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
  color: #fff;
  white-space: nowrap;
}

.cart-item__meta {
  display: flex;
  align-items: center;
  gap: 44px;
  flex-shrink: 0;
  width: 316px;
  justify-content: flex-end;
}

.cart-list__header-meta {
  display: flex;
  align-items: center;
  gap: 44px;
  flex-shrink: 0;
  width: 316px;
  justify-content: flex-end;
}

.cart-list__items {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cart-list__empty {
  margin: 0;
  padding: 48px 24px;
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--color-divider, #afafaf) 45%, #fff);
  color: var(--color-wants-accent, #808080);
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 3px 4px rgba(61, 54, 40, 0.18);
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 130px;
  padding: 20px;
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--color-divider, #afafaf) 35%, #fff);
  box-shadow: 0 4px 2px rgba(0, 0, 0, 0.25);
}

.cart-item__product {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 280px;
  text-decoration: none;
  color: inherit;
}

.cart-item__product:hover .cart-item__name {
  color: var(--color-wants-accent);
}

.cart-item__product:focus-visible {
  outline: 2px solid var(--color-wants-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.cart-item__image {
  flex-shrink: 0;
  width: 90px;
  height: 90px;
  object-fit: cover;
  display: block;
}

.cart-item__info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding-top: 2px;
}

.cart-item__name {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 14px;
  font-weight: 700;
  line-height: normal;
  color: var(--color-wants-dark, #3a3f3b);
  margin: 0;
}

.cart-item__spec {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 12px;
  font-weight: 400;
  line-height: normal;
  color: var(--color-wants-accent, #808080);
  margin: 0;
}

.cart-list__header-meta .cart-list__header-label {
  display: block;
  text-align: center;
}

.cart-list__header-meta .cart-list__header-label:nth-child(1) {
  width: 50px;
}

.cart-list__header-meta .cart-list__header-label:nth-child(2) {
  width: 110px;
}

.cart-list__header-meta .cart-list__header-label:nth-child(3) {
  width: 50px;
}

.cart-list__header-meta .cart-list__header-label:nth-child(4) {
  width: 18px;
}

.cart-item__price,
.cart-item__subtotal {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 14px;
  font-weight: 700;
  line-height: normal;
  margin: 0;
  text-align: center;
  white-space: nowrap;
  width: 50px;
  flex-shrink: 0;
}

/* 設計稿量色：單價 #7E7E7E（灰），只有小計是主色紅 #A82022 */
.cart-item__price {
  color: var(--color-section-title, #7e7e7e);
}

.cart-item__subtotal {
  color: var(--color-wants-orange, #a82022);
}

.cart-item__qty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 110px;
  flex-shrink: 0;
}

.cart-item__qty-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--color-divider, #afafaf) 55%, #fff);
  border-radius: 4px;
  background: #fff;
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 12px;
  line-height: 1;
  color: var(--color-wants-dark, #3a3f3b);
  cursor: pointer;
  transition: background 0.2s ease;
}

.cart-item__qty-btn:hover {
  background: color-mix(in srgb, var(--color-divider, #afafaf) 12%, #fff);
}

.cart-item__qty-value {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 30px;
  border: 1px solid color-mix(in srgb, var(--color-divider, #afafaf) 55%, #fff);
  border-radius: 4px;
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 12px;
  color: var(--color-wants-dark, #3a3f3b);
  text-align: center;
  flex-shrink: 0;
}

/* 可手動輸入的數量欄（外觀比照原本的數字框）。 */
.cart-item__qty-input {
  width: 40px;
  height: 30px;
  padding: 0;
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--color-divider, #afafaf) 55%, #fff);
  border-radius: 4px;
  background: #fff;
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 12px;
  color: var(--color-wants-dark, #3a3f3b);
  text-align: center;
  flex-shrink: 0;
  box-sizing: border-box;
  -moz-appearance: textfield;
  appearance: textfield;
}
.cart-item__qty-input:focus {
  outline: none;
  border-color: var(--color-wants-accent, #808080);
  box-shadow: 0 0 0 2px rgba(90, 138, 148, 0.15);
}
.cart-item__qty-input::-webkit-outer-spin-button,
.cart-item__qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cart-item__remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  opacity: 1;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.cart-item__remove:hover {
  opacity: 0.7;
}

.cart-item__remove-icon {
  display: block;
  width: 18px;
  height: 18px;
  /*
   * icon-trash.svg 內的 stroke 是寫死的 #987B4F，<img> 載入時 CSS 蓋不掉。
   * 改用 mask：形狀來自 SVG，顏色由 background-color 決定，
   * 之後在「外觀 → 自訂 → 品牌配色」調金褐，這顆圖示會跟著變。
   */
  background-color: var(--color-wants-gold, #987b4f);
  -webkit-mask-image: url('../images/cart/icon-trash.svg');
  mask-image: url('../images/cart/icon-trash.svg');
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

/* ---------- Continue Shopping ---------- */
.cart-continue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  flex-shrink: 0;
  width: 180px;
  height: 45px;
  border: 1px solid var(--color-wants-orange);
  border-radius: 23px;
  background: transparent;
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--color-wants-dark, #3a3f3b);
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.cart-continue:hover {
  opacity: 0.85;
  color: var(--color-wants-dark, #3a3f3b);
}

/* ---------- Order Summary ---------- */
.cart-summary {
  flex: 0 0 300px;
  width: 300px;
  max-width: 100%;
}

.cart-summary__card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 61px;
  min-height: 450px;
  padding: 29px 28px;
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--color-divider, #afafaf) 35%, #fff);
  box-shadow: 0 4px 2px rgba(0, 0, 0, 0.25);
}

.cart-summary__upper {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.cart-summary__title {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 18px;
  font-weight: 700;
  line-height: normal;
  color: var(--color-section-title, #7e7e7e);
  margin: 0;
}

.cart-summary__details {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.cart-summary__coupon {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cart-summary__coupon-label {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--color-wants-dark, #3a3f3b);
}

.cart-summary__coupon-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.cart-summary__coupon-input {
  flex: 0 0 160px;
  width: 160px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--color-divider, #afafaf) 55%, #fff);
  border-radius: 4px;
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 14px;
  color: var(--color-wants-dark);
  background: #fff;
}

.cart-summary__coupon-input:focus {
  outline: 2px solid var(--color-wants-gold, #987b4f);
  outline-offset: 1px;
}

.cart-summary__coupon-btn {
  flex-shrink: 0;
  width: 70px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 4px;
  /* 設計稿取色 #7E7E7E：套用是次要動作，跟金褐的主要按鈕分開 */
  background: var(--color-section-title, #7e7e7e);
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 13px;
  font-weight: 400;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.cart-summary__coupon-btn:hover {
  opacity: 0.9;
}

.cart-summary__divider {
  display: block;
  width: 100%;
  height: 1px;
  border: none;
  margin: 0;
  background: color-mix(in srgb, var(--color-divider, #afafaf) 40%, #fff);
}

.cart-summary__rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.cart-summary__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 14px;
  line-height: normal;
}

.cart-summary__row dt {
  font-weight: 400;
  color: var(--color-wants-dark, #3a3f3b);
}

.cart-summary__row dd {
  margin: 0;
  font-weight: 400;
  color: var(--color-wants-dark, #3a3f3b);
  text-align: right;
}

.cart-summary__free-ship {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
  color: var(--color-wants-orange);
  margin: 0;
}

.cart-summary__total {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-summary__total-label {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-wants-dark);
}

.cart-summary__total-value {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--color-wants-orange);
  text-align: right;
}

.cart-summary__checkout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 40px;
  border-radius: 60px;
  background: var(--color-wants-gold, #987b4f);
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.cart-summary__checkout:hover {
  opacity: 0.9;
  color: #fff;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .cart-layout {
    flex-direction: column;
    align-items: stretch;
  }

  .cart-list,
  .cart-summary {
    flex: none;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .cart-hero {
    height: clamp(74px, 19.73vw, 74px);
    min-height: 0;
  }


  .cart-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgba(0, 0, 0, 0.3);
    pointer-events: none;
  }

  .cart-hero__content {
    z-index: 2;
    gap: 6px;
  }

  .cart-hero__title {
    font-family: 'Noto Sans TC', sans-serif;
    font-size: 16px;
    font-weight: 700;
    line-height: normal;
  }

  .cart-hero__count {
    font-family: 'Georgia', 'Noto Sans TC', serif;
    font-size: 13px;
    line-height: normal;
  }

  .cart-list__header {
    display: none;
  }

  .cart-list__items {
    gap: 16px;
  }

  .cart-item {
    display: grid;
    grid-template-columns: clamp(76px, 23.6vw, 96px) minmax(68px, 1fr) auto auto;
    grid-template-rows: auto auto;
    column-gap: clamp(7px, 2.2vw, 10px);
    row-gap: clamp(18px, 5.6vw, 22px);
    align-items: start;
    min-height: 0;
    padding: clamp(14px, 4vw, 16px);
    border: none;
    border-radius: 4px;
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.2);
  }

  .cart-item__product {
    display: contents;
    max-width: none;
  }

  .cart-item__image {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
    width: clamp(76px, 23.6vw, 96px);
    height: clamp(76px, 23.6vw, 96px);
    border-radius: 8px;
    object-fit: cover;
  }

  .cart-item__info {
    grid-column: 2;
    grid-row: 1;
    gap: 6px;
    padding-top: 0;
    min-height: 0;
  }

  .cart-item__name {
    font-family: 'Noto Sans TC', sans-serif;
    font-size: clamp(14px, 3.7vw, 15px);
    font-weight: 700;
    line-height: 1.35;
    color: var(--color-wants-dark, #3a3f3b);
  }

  .cart-item__spec {
    font-family: 'Noto Sans TC', sans-serif;
    font-size: clamp(12px, 3.2vw, 13px);
    font-weight: 400;
    line-height: 1.35;
    color: var(--color-wants-accent, #808080);
  }

  .cart-item__meta {
    display: contents;
  }

  .cart-item__price {
    grid-column: 2 / -1;
    grid-row: 2;
    justify-self: start;
    align-self: end;
    width: auto;
    text-align: left;
    font-family: 'Georgia', 'Noto Sans TC', serif;
    font-size: clamp(16px, 4.8vw, 20px);
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-wants-orange, #a82022);
  }

  .cart-item__subtotal {
    display: none;
  }

  .cart-item__qty {
    grid-column: 3;
    grid-row: 1;
    align-self: end;
    justify-self: start;
    width: auto;
    gap: clamp(4px, 1.8vw, 7px);
    margin: 0 0 1px;
  }

  .cart-item__qty-btn,
  .cart-item__qty-value,
  .cart-item__qty-input {
    box-sizing: border-box;
    height: clamp(24px, 7.2vw, 28px);
    border: 1px solid color-mix(in srgb, var(--color-divider, #afafaf) 55%, #fff);
    border-radius: 6px;
    font-family: 'Noto Sans TC', sans-serif;
    font-size: clamp(14px, 3.9vw, 16px);
    font-weight: 400;
    line-height: 1;
    color: var(--color-wants-dark, #3a3f3b);
  }

  .cart-item__qty-btn {
    width: clamp(24px, 7.2vw, 28px);
    padding: 0;
  }

  .cart-item__qty-value,
  .cart-item__qty-input {
    width: clamp(34px, 10.2vw, 40px);
  }

  .cart-item__remove {
    grid-column: 4;
    grid-row: 1;
    align-self: end;
    justify-self: start;
    width: clamp(22px, 6.7vw, 26px);
    height: clamp(22px, 6.7vw, 26px);
    margin: 0 0 2px clamp(3px, 1.1vw, 5px);
  }

  .cart-item__remove-icon {
    width: 100%;
    height: 100%;
  }

  .cart-body {
    padding: 36px 16px 60px;
  }

  .cart-continue {
    align-self: center;
  }
}

/* ============================================================
   購物車：折扣列、已套用優惠券、通知、停用狀態
   以下全部為新增樣式，未修改任何既有規則。
   ============================================================ */

/* 已套用的優惠券標籤 */
.cart-summary__coupons {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cart-summary__coupon-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 12px;
  border-radius: 60px;
  background: var(--color-wants-cream, #ffffff);
  color: var(--color-wants-accent, #808080);
  font-size: 12px;
  line-height: 1.6;
}
.cart-summary__coupon-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-wants-accent, #808080) 15%, transparent);
  color: var(--color-wants-accent, #808080);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.cart-summary__coupon-remove:hover {
  background: color-mix(in srgb, var(--color-wants-accent, #808080) 30%, transparent);
}

/* 折扣金額 */
.cart-summary__row--discount dd {
  color: var(--color-wants-orange, #a82022);
}

/* WooCommerce 通知（加入購物車、優惠券結果、庫存不足…） */
/* 沒有通知時整個容器不佔版面。用 :not(:empty) 掛 margin 而不是無條件給，
   萬一將來又有人在 div 裡留了縮排，至少不會憑空多出 20px。 */
.cart-notices:empty {
  display: none;
}
.cart-notices:not(:empty) {
  margin-bottom: 20px;
}
.cart-notices .woocommerce-message,
.cart-notices .woocommerce-info,
.cart-notices .woocommerce-error {
  margin: 0 0 10px;
  padding: 12px 16px;
  border-radius: 10px;
  list-style: none;
  font-size: 14px;
  line-height: 1.7;
  background: #fff;
  color: var(--color-wants-dark, #3a3f3b);
}
.cart-notices .woocommerce-error {
  background: #fdecea;
  color: #b3261e;
}
.cart-notices .woocommerce-message {
  background: #e6f4ea;
  color: #1e6b3a;
}

/* 空購物車時的結帳按鈕 */
.cart-summary__checkout.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}
