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

.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;
}

.cart-hero picture {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.cart-hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.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;
}

.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;
  background: #e5a949;
  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 rgba(218, 213, 196, 0.7);
  color: #5a8a94;
  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 #eee;
  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__name-link {
  color: inherit;
  text-decoration: none;
}

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

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

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

.cart-item__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 變化型商品：直接在購物車換規格的下拉選單 */
.cart-item__variation {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
  min-width: 0;
}

.cart-item__variation-label {
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.2;
  color: #a09890;
}

.cart-item__variation-select {
  box-sizing: border-box;
  width: 100%;
  max-width: 180px;
  height: 28px;
  padding: 0 22px 0 8px;
  border: 1px solid #d7ccc8;
  border-radius: 5px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238a807a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  color: #595757;
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 11px;
  line-height: 1.2;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cart-item__variation-select:hover {
  border-color: var(--color-wants-accent);
}

.cart-item__variation-select:focus {
  outline: none;
  border-color: var(--color-wants-accent);
  box-shadow: 0 0 0 2px rgba(90, 138, 148, 0.14);
}

.cart-item__variation-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.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: #595757;
  margin: 0;
}

.cart-item__spec {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 12px;
  font-weight: 400;
  line-height: normal;
  color: #888;
  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;
  color: var(--color-wants-orange);
  margin: 0;
  text-align: center;
  white-space: nowrap;
  width: 50px;
  flex-shrink: 0;
}

.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 #d7ccc8;
  border-radius: 4px;
  background: #fff;
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 12px;
  line-height: 1;
  color: #5d4037;
  cursor: pointer;
  transition: background 0.2s ease;
}

.cart-item__qty-btn:hover {
  background: #fafafa;
}

.cart-item__qty-value {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 30px;
  border: 1px solid #d7ccc8;
  border-radius: 4px;
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 12px;
  color: #5d4037;
  text-align: center;
  flex-shrink: 0;
}

/* 可手動輸入的數量欄（外觀比照原本的數字框）。 */
.cart-item__qty-input {
  width: 40px;
  height: 30px;
  padding: 0;
  margin: 0;
  border: 1px solid #d7ccc8;
  border-radius: 4px;
  background: #fff;
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 12px;
  color: #5d4037;
  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, #5a8a94);
  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 img {
  display: block;
  width: 18px;
  height: 18px;
}

/* ---------- 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: #595757;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.cart-continue:hover {
  opacity: 0.85;
  color: #595757;
}

/* ---------- 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 #eee;
  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-wants-accent);
  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: #666;
}

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

/* 優惠碼使用說明（小灰字） */
.cart-summary__coupon-hint {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: #999;
}

.cart-summary__coupon-input {
  flex: 0 0 160px;
  width: 160px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #d7ccc8;
  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 #e5a949;
  outline-offset: 1px;
}

.cart-summary__coupon-btn {
  flex-shrink: 0;
  width: 70px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: #e5a949;
  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: #eee;
}

.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: #666;
}

.cart-summary__row dd {
  margin: 0;
  font-weight: 400;
  color: #595757;
  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-accent);
  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 picture {
    overflow: hidden;
  }

  .cart-hero__bg {
    inset: auto;
    left: 0;
    top: -156.92%;
    width: 100%;
    height: 288.8%;
    max-width: none;
    object-fit: cover;
    object-position: center center;
  }

  .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(68px, 21vw, 84px) minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    column-gap: clamp(8px, 2.6vw, 12px);
    row-gap: clamp(8px, 2.6vw, 10px);
    align-items: start;
    min-height: 0;
    padding: clamp(12px, 3.6vw, 14px);
    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-link {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
    width: clamp(68px, 21vw, 84px);
    height: clamp(68px, 21vw, 84px);
    border-radius: 8px;
    overflow: hidden;
  }

  .cart-item__image {
    border-radius: 8px;
  }

  /* 有規格選單的卡片：圖片跨滿整張卡，文字區才不會被壓窄 */
  .cart-item--variable .cart-item__image-link {
    grid-row: 1 / -1;
  }

  /* 文字區跨到最右欄，只保留右上角刪除鍵的位置 → 文字可用寬度大幅增加 */
  .cart-item__info {
    grid-column: 2 / -1;
    grid-row: 1;
    gap: 4px;
    padding-top: 0;
    padding-right: clamp(30px, 8.5vw, 36px);
    min-height: 0;
    min-width: 0;
  }

  /* 名稱：字級小一點，完整顯示不截斷 */
  .cart-item__name {
    font-family: 'Noto Sans TC', sans-serif;
    font-size: clamp(12px, 3.3vw, 13px);
    font-weight: 700;
    line-height: 1.45;
    color: #4a4a4a;
    overflow-wrap: anywhere;
  }

  .cart-item__variation {
    margin-top: 3px;
  }

  .cart-item__variation-select {
    max-width: clamp(150px, 46vw, 180px);
    height: clamp(26px, 7.4vw, 28px);
    padding: 0 clamp(18px, 5.2vw, 20px) 0 clamp(6px, 2vw, 8px);
    background-position: right clamp(6px, 2vw, 8px) center;
    font-size: clamp(10px, 2.9vw, 11px);
  }

  /* 規格：完整顯示不截斷 */
  .cart-item__spec {
    font-family: 'Noto Sans TC', sans-serif;
    font-size: clamp(11px, 3vw, 12px);
    font-weight: 400;
    line-height: 1.4;
    color: #8e8e8e;
    overflow-wrap: anywhere;
  }

  .cart-item__meta {
    display: contents;
  }

  /* 價格：文字下方、靠左 */
  .cart-item__price {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    align-self: center;
    width: auto;
    text-align: left;
    font-family: 'Georgia', 'Noto Sans TC', serif;
    font-size: clamp(15px, 4.4vw, 18px);
    font-weight: 700;
    line-height: 1.2;
    color: #c26b4d;
  }

  .cart-item__subtotal {
    display: none;
  }

  /* +/− 數量：文字下方、靠右 */
  .cart-item__qty {
    grid-column: 3;
    grid-row: 2;
    align-self: center;
    justify-self: end;
    width: auto;
    gap: clamp(4px, 1.8vw, 7px);
    margin: 0;
  }

  .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 #d7ccc8;
    border-radius: 6px;
    font-family: 'Noto Sans TC', sans-serif;
    font-size: clamp(14px, 3.9vw, 16px);
    font-weight: 400;
    line-height: 1;
    color: #595757;
  }

  .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: 3;
    grid-row: 1;
    align-self: start;
    justify-self: end;
    width: clamp(20px, 6vw, 24px);
    height: clamp(20px, 6vw, 24px);
    margin: 0;
  }

  .cart-item__remove img {
    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, #f6f1de);
  color: var(--color-wants-accent, #5a8a94);
  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: rgba(90, 138, 148, 0.15);
  color: var(--color-wants-accent, #5a8a94);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.cart-summary__coupon-remove:hover {
  background: rgba(90, 138, 148, 0.3);
}

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

/* 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;
}
