/* 整體背景 */
.cart-page {
  background-color: #f5f5f5;
}

/* ===== 進度條：基礎 ===== */
.checkout-steps {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  /* 給 ::before 用 */
  max-width: 640px;
  /* 讓整條進度條居中，不會太寬 */
  margin: 24px auto 32px;
  padding: 0;
  /* 這裡不要再加左右 padding，方便算比例 */
}

/* 中間那條線：從第 1 個圓中心 → 第 3 個圓中心 */
.checkout-steps::before {
  content: "";
  position: absolute;
  top: 16px;
  /* 對應 32px 圓圈的一半 */
  left: 16.6667%;
  /* 1/6：第 1 個步驟圓圈的中心 */
  right: 16.6667%;
  /* 1/6：第 3 個步驟圓圈的中心 */
  height: 2px;
  background-color: #e0e0e0;
  z-index: 0;
}

/* 每個步驟 */
.checkout-steps .step {
  position: relative;
  flex: 1 1 0;
  text-align: center;
  color: #999;
  font-size: 0.85rem;
  z-index: 1;
  /* 在連線上面 */
}

/* 圓圈 */
.checkout-steps .step-circle {
  width: 32px;
  height: 32px;
  margin: 0 auto 4px;
  border-radius: 50%;
  border: 2px solid #ccc;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

/* 圓下面的文字 */
.checkout-steps .step-label {
  margin-top: 2px;
}

/* 目前步驟：綠色實心 */
.checkout-steps .step.is-active .step-circle {
  border-color: #28a745;
  background-color: #28a745;
  color: #fff;
}

.checkout-steps .step.is-active .step-label {
  color: #333;
  font-weight: 600;
}

/* 之後若要做「已完成」步驟，可用 is-done */
.checkout-steps .step.is-done .step-circle {
  border-color: #28a745;
  background-color: #28a745;
  color: #fff;
}

/* ===== RWD：手機 / 平板 ===== */
@media (max-width: 991.98px) {
  .checkout-steps {
    max-width: 520px;
    margin: 16px auto 24px;
  }
}

@media (max-width: 575.98px) {
  .checkout-steps {
    max-width: 100%;
    padding: 0 8px;
    /* 手機左右留一點點空間就好，不影響比例 */
  }

  .checkout-steps .step-circle {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .checkout-steps .step-label {
    font-size: 0.8rem;
  }

  .checkout-steps::before {
    top: 14px;
    /* 對應 28px 圓圈的一半 */
  }
}

.cart-addon-row {
  margin-bottom: 4px;
}

.cart-title {
  font-weight: 500;
  line-height: 1.35;
}

.cart-badge-addon {
  display: inline-block;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  background: #111;
  color: #fff;
  line-height: 1.2;
}

.cart-product-img-link {
  display: inline-block;
}

.cart-product-img-link img {
  cursor: pointer;
}

.cart-product-img-link:hover img {
  opacity: .9;
}

/* 移除 Chrome / Edge / Safari 的數字上下箭頭 */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* 移除 Firefox 的上下箭頭 */
input[type=number] {
  -moz-appearance: textfield;
}

/* 單件價格：折扣後價格 + 刪除線原價 */
.cart-col-unit {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
}

.unit-price-new {
  font-size: 1rem;
  color: #333;
  font-weight: 600;
}

.unit-price-old {
  font-size: 0.8rem;
  margin-top: 2px;
}


/* 會員登入提示卡片 */
.cart-login-box p {
  font-size: 0.9rem;
  color: #555;
}

/* 商品下面的優惠區塊 */
.cart-item-promos {
  padding: 12px 24px 14px;
  margin: 0;
  background-color: #fff;
  border-top: 1px solid #e9ecef;
  font-size: 0.85rem;
  border-top: 0 !important;
}

.cart-item-promos .promo-title {
  color: #555;
}

/* 優惠小標籤 */
.promo-tag {
  display: inline-block;
  padding: 4px 6px;
  min-width: 72px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  align-items: center;
  text-align: center;
}

.promo-tag-green {
  background-color: #e6f6e6;
  /* 淺綠底 */
  color: #2e7d32;
  /* 深綠字 */
}

.promo-tag-orange {
  background-color: #fff2d9;
  /* 淺橘底 */
  color: #c77700;
  /* 深橘字 */
}

/* 已享用之優惠：一行排「標籤 + 文字 + 右邊數值」 */
.cart-item-promos .promo-row {
  display: flex;
  align-items: center;
  column-gap: 12px;
  row-gap: 4px;
}

/* 文字緊貼在標籤旁邊，佔掉剩下的寬度 */
.cart-item-promos .promo-text {
  flex: 1 1 auto;
}

/* 右邊的「- / +48 點」固定在最右邊 */
.cart-item-promos .promo-value {
  white-space: nowrap;
  text-align: right;
  font-weight: 600;
}

/* 未享用優惠區塊 */
.cart-unused-promos {
  background: #fff;
  border-top: 1px solid #eee;
  padding: 16px 24px;
  margin-top: 0;
}

/* 標題：目前未享用 */
.cup-title {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 12px;
}

/* 列表每一行 */
.cup-row {
  display: flex;
  align-items: center;
  column-gap: 12px;
  margin-bottom: 10px;
}

/* 左邊的灰色標籤 */
.cup-tag {
  background: #f5f5f5;
  color: #777;
  display: inline-block;
  padding: 4px 6px;
  min-width: 72px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  align-items: center;
  text-align: center;
}

/* 說明文字 */
.cup-text {
  flex: 1 1 auto;
  font-size: 0.85rem;
  color: #555;
}


/* 手機版：整段維持左對齊就好 */
@media (max-width: 767.98px) {
  .cart-item-promos .promo-row {
    align-items: flex-start;
  }

  .cart-item-promos .promo-value {
    text-align: right;
  }
}


/* 桌機版（寬度 >= 992px）表格欄位排版 */
@media (min-width: 992px) {

  /* 整列容器 */
  .cart-header-row,
  .cart-row-main {
    display: flex;
    align-items: center;
  }

  /* 商品資料欄 */
  .cart-header-row .cart-col-product,
  .cart-row-main .cart-col-product {
    flex: 0 0 35%;
  }

  /* 單件價格 */
  .cart-header-row .cart-col-unit,
  .cart-row-main .cart-col-unit {
    flex: 0 0 15%;
    justify-content: center;
    text-align: right;
    display: flex;
  }

  /* 數量 */
  .cart-header-row .cart-col-qty,
  .cart-row-main .cart-col-qty {
    flex: 0 0 15%;
    justify-content: center;
    display: flex;
  }

  /* 優惠欄 */
  .cart-header-row .cart-col-promo,
  .cart-row-main .cart-col-promo {
    flex: 0 0 10%;
    justify-content: center;
    display: flex;
  }

  /* 小計 */
  .cart-header-row .cart-col-subtotal,
  .cart-row-main .cart-col-subtotal {
    flex: 0 0 15%;
    justify-content: center;
    text-align: right;
    display: flex;
  }

  /* 刪除 */
  .cart-header-row .cart-col-remove,
  .cart-row-main .cart-col-remove {
    flex: 0 0 10%;
    justify-content: center;
    display: flex;
  }

  .cart-item-promos .promo-row {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    /* 標籤 / 說明 / 右側值 */
    align-items: center;
    column-gap: 12px;
  }
}


/* 992px 以下：手機 + 平板 的 RWD 排版 */
@media (max-width: 991.98px) {

  /* 步驟條：縮短距離 */
  .checkout-steps {
    gap: 40px;
  }

  .checkout-steps::before {
    left: 15%;
    right: 15%;
  }

  /* 會員登入提示：置中，按鈕拉滿 */
  .cart-login-box .card-body {
    text-align: center;
  }

  .cart-login-box .card-body a {
    width: 100%;
  }

  /* ===== 購物車商品區：改成手機版排版 ===== */

  /* 整個商品列預留右邊給 X */
  .cart-item-row {
    position: relative;
    padding-right: 40px;
    /* 預留空間給右上的 X */
  }

  /* 主容器改成直向排版 */
  .cart-row-main {
    display: block !important;
    /* 蓋掉桌機的 flex */
  }

  /* 商品資料：圖 + 文字並排，佔一整行 */
  .cart-row-main .cart-col-product {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
  }

  .cart-row-main .cart-col-product img {
    width: 80px;
    height: auto;
  }

  /* 優惠欄：手機版上半部不用，下面有「已享用之優惠」 */
  .cart-row-main .cart-col-promo {
    display: none;
  }

  /* 單件價格：顯示在商品下面，靠右（新價 + 舊價） */
  .cart-row-main .cart-col-unit {
    text-align: right;
    margin-bottom: 8px;
    align-items: flex-end;
  }

  /* 數量：下一行靠左 */
  .cart-row-main .cart-col-qty {
    margin-bottom: 8px;
    justify-content: flex-start;
  }

  /* 小計：再下一行靠右、加粗 */
  .cart-row-main .cart-col-subtotal {
    text-align: right;
    justify-content: flex-end;
    font-weight: 600;
    margin-top: 0.25rem;
  }

  /* X 刪除：固定在整個商品卡片右上角 */
  .cart-row-main .cart-col-remove {
    position: absolute;
    top: 14px;
    right: 14px;
    display: block;
    z-index: 2;
  }

  .cart-item-promos {
    padding: 12px 16px;
  }

  /* 手機縮一點左右距 */
  .cart-item-promos .promo-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    row-gap: 4px;
    column-gap: 12px;
  }

  .cart-item-promos .promo-tag {
  flex: 0 0 auto;        /* ← 標籤獨佔一行 */
  }

  .cart-item-promos .promo-text {
    flex: 1 1 auto;
  }

  .cart-item-promos .promo-value {
    margin-left: auto;
  }

  .cup-row {
  flex-wrap: wrap;        /* ← 允許換行 */
  }

  .cup-tag {
    flex: 0 0 auto;         /* ← 標籤獨佔一行 */
  }
}

/* ===== 購物車商品區：登入按鈕大小調整 ===== */
/* 手機 <768px：按鈕全寬 */
@media (max-width: 767.98px) {
  .cart-login-box .card-body a {
    width: 100% !important;
    display: block;
  }

  .cart-login-box .card-body {
    text-align: center;
  }
}

/* 平板 ≥768px：按鈕恢復正常寬度（不加長） */
@media (min-width: 768px) and (max-width: 991.98px) {
  .cart-login-box .card-body a {
    width: auto !important;
    display: inline-block;
  }

  .cart-login-box .card-body {
    text-align: left;
  }
}


/* 訂單資訊區塊排版 */
.order-summary-card .os-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 讓折扣碼連結看起來像圖片那樣（藍色文字、不佔整行） */
.order-summary-card .os-link {
  color: #0d6efd;
  /* bootstrap 藍 */
  text-decoration: none;
}

.order-summary-card .os-link:hover {
  text-decoration: underline;
}

/* 手機版讓整塊字稍微小一點、比較緊湊 */
@media (max-width: 767.98px) {
  .order-summary-card .card-body {
    font-size: 0.9rem;
  }
}

/* ===========Cart Upsell (加價購區塊)============== */
.cart-upsell {
  background: #fff;
  border: 1px solid #e9ecef;
  padding: 14px 14px 10px;
  margin-bottom: 20px;
}

.cart-upsell__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.cart-upsell__title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.cart-upsell__note {
  font-size: 12px;
}

.cart-upsell__notice {
  display: none;
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: 4px;
  background: #d9edf7;
  color: #31708f;
  font-size: 14px;
  line-height: 1.5;
}

.cart-upsell__track {
  display: flex;
  gap: 12px;
  overflow: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.cart-upsell__track::-webkit-scrollbar {
  height: 6px;
}

.cart-upsell__track::-webkit-scrollbar-thumb {
  background: #d7dde3;
  border-radius: 999px;
}

.upsell-card {
  flex: 0 0 240px;
  scroll-snap-align: start;
  border: 1px solid #eef1f4;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  background: #fff;
}

.upsell-img {
  width: 68px;
  height: 68px;
  border-radius: 10px;
  object-fit: cover;
  background: #f5f6f7;
  flex-shrink: 0;
}

.upsell-body {
  min-width: 0;
  flex: 1;
}

.upsell-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 6px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.upsell-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.upsell-price .new {
  font-weight: 700;
  font-size: 14px;
}

.upsell-price .old {
  font-size: 12px;
  color: #9098a1;
  text-decoration: line-through;
}

.upsell-actions {
  display: flex;
  justify-content: flex-end;
}

.upsell-actions .btn {
  padding: .25rem .55rem;
  font-size: 12px;
  border-radius: 10px;
}

/* 手機更小一點 */
@media (max-width: 576px) {
  .upsell-card {
    flex-basis: 200px;
  }

  .upsell-img {
    width: 60px;
    height: 60px;
  }
}


/* ================= 選擇優惠券 Modal：上方前往優惠券列 ================= */
.coupon-subheader {
  background: #fff;
}

.coupon-subheader .coupon-link {
  font-size: 0.9rem;
  color: #0d6efd;
  text-decoration: none;
  cursor: pointer;
  opacity: .9;
}

.coupon-subheader .coupon-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/*=====================check out========================*/
/* 外框跟之前一樣 */
.checkout-cart-box {
  border: 1px solid #ddd;
  background-color: #fff;
  border-radius: 4px;
}

/* 購物車收合按鈕：改成置中、兩行顯示 */
.checkout-cart-toggle {
  background-color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 4px;
}

.checkout-cart-toggle:hover {
  background-color: #f8f9fa;
}

/* 第 1 行：合計金額 */
.cart-total-line {
  font-weight: 600;
  font-size: 0.95rem;
}

/* 第 2 行：購物車 (X 件) + 箭頭 */
.cart-summary-line {
  font-size: 0.85rem;
  color: #666;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

/* 箭頭動畫（維持原本 rotate 效果） */
.checkout-cart-toggle i {
  transition: transform 0.25s ease;
}

.checkout-cart-toggle[aria-expanded="true"] i {
  transform: rotate(180deg);
}

/* --- 手機版：把購物車收合按鈕改成單行排版 --- */
@media (max-width: 767.98px) {

  /* 把按鈕從 flex-column 改成橫向排列 */
  .checkout-cart-toggle {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 12px 16px;
  }

  /* 合計金額 — 左側顯示，字體稍大 */
  .cart-total-line {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
  }

  /* 隱藏「購物車 (X 件)」文字 */
  .cart-summary-line {
    font-size: 0;
    /* 隱藏文字 */
    margin: 0;
  }

  /* 但保留箭頭 icon */
  .cart-summary-line i {
    font-size: 1.1rem;
    /* 顯示箭頭 */
  }
}

.pay-header-total {
  font-size: 0.875rem;
  color: #666;
  white-space: nowrap;
}

.pay-header-total i {
  font-size: 0.9rem;
}

.cart-qty-static {
  min-width: 40px;
  text-align: center;
  font-weight: 600;
}


/* ===== 訂單資訊區塊（已享用之優惠下面） ===== */
.cart-order-info {
  background: #fff;
  border-top: 1px solid #e9ecef;
  padding: 18px 24px;
}

.cart-order-info .coi-inner {
  margin-left: auto;
  /* 右對齊整塊 */
  max-width: 360px;
  /* 控制區塊寬度（可調 320~420） */
}

.cart-order-info .coi-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 6px 0;
  color: #333;
}

.cart-order-info .coi-row .label {
  color: #555;
  white-space: normal;
  word-break: break-word;
  flex: 1;
  min-width: 0;
}

.cart-order-info .coi-row .value {
  white-space: nowrap;
  flex-shrink: 0;
}

.cart-order-info .coi-row.total .label {
  font-weight: 700;
}

.cart-order-info .coi-row.total .value {
  font-weight: 800;
}

.cart-order-info .coi-row.points .label {
  font-weight: 600;
}

.cart-order-info .coi-row.points .value {
  font-weight: 700;
}

/* 手機：滿版、左右縮一點 */
@media (max-width: 991.98px) {
  .cart-order-info {
    padding: 14px 16px;
  }

  .cart-order-info .coi-inner {
    max-width: none;
  }
}



/* ============ 條款勾選區 ============ */

/* 整組靠右 */
.agree-wrapper {
  display: flex;
  align-items: center;
}

/* Checkbox 與文字間距 */
.agree-checkbox {
  margin-right: 8px;
}

/* 文字大小與間距 */
.agree-text {
  font-size: 0.875rem;
  /* small */
  margin: 0;
}

/* 文字連結顏色（藍色） */
.agree-link {
  color: #0d6efd;
  /* Bootstrap primary */
  text-decoration: none;
}

.agree-link:hover {
  text-decoration: underline;
}

/* 桌機版：讓條款區只佔右半邊，左邊起點跟按鈕對齊 */
@media (min-width: 768px) {
  .agree-row .agree-wrapper {
    max-width: 50%;
    /* 只用右半邊，對應下面 button 的 col-6 */
    margin-left: auto;
    /* 往右推到右半邊 */
    justify-content: flex-start;
  }
}

/* ============ 提交按鈕 ============ */

.submit-btn {
  width: 100%;
  padding: 0.6rem 0;
}

/* 手機版：兩個按鈕都滿版 */
@media (max-width: 767.98px) {
  .checkout-actions-row .btn {
    width: 100%;
    display: block;
    margin-bottom: 10px;
    /* 提交訂單跟返回購物車中間留一點距離 */
  }

  /* 最下面那顆「返回購物車」如果不想有空隙可以再拉掉 margin-bottom */
  .checkout-actions-row .btn-outline-secondary {
    margin-bottom: 0;
  }
}

/* =================== 訂單確認頁 ================ */

/*----成功提示------*/
.order-success .success-hero {
  width: 100%;
  /* 跟 checkout-cart-box 一樣 */
  max-width: none;
  /* 移除原本限制 */
  margin: 0 0 32px;
  /* 不再置中縮排 */
  /* 置中 + 下方留空 */
  padding: 22px 20px 24px;

  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 16px;

  text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .04);
}

.order-success .success-hero__icon {
  margin-bottom: 12px;
}

.order-success .success-hero__icon i {
  font-size: 56px;
  color: #37885a;
}

.order-success .success-hero__title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
  color: #222;
}

/* 訂單編號 */
.order-success .success-hero__order-no {
  margin: 6px 0 10px;
  font-size: 14px;
  color: #555;
}

.order-success .success-hero__order-no strong {
  font-weight: 700;
  color: #222;
}

.order-success .success-hero__text {
  margin: 0;
  font-size: 13px;
  color: #666;
  line-height: 1.6;
}

.order-success .success-hero__email {
  display: inline-block;
  margin-top: 2px;
  font-weight: 700;
  color: #222;
}

.order-success .success-banner {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid #e6e6e6;
  border-radius: 14px;
  background: #fff;
}

.order-success .success-banner i {
  font-size: 24px;
  color: #5F7F78;
}

.order-success .sb-title {
  font-weight: 700;
}

.order-success .sb-sub {
  font-size: 14px;
  color: #666;
}

/*-----訂單明細展開 / 收起------*/
.order-success .checkout-cart-head {
  width: 100%;
  background: #fff;
  border: 0;
  padding: 16px;
  text-align: center;
  cursor: pointer;
}

.order-success .checkout-cart-head:hover {
  background: #fafafa;
}

.order-success .cart-summary-line {
  margin-top: 4px;
  font-size: 14px;
  color: #666;
}

.order-success .toggle-icon {
  margin-left: 6px;
  transition: transform .25s ease;
}

/* 收起狀態 */
.order-success .checkout-cart-body {
  display: none;
}

/* 展開狀態 */
.order-success .checkout-cart-head.is-open+.checkout-cart-body {
  display: block;
}

.order-success .checkout-cart-head.is-open .toggle-icon {
  transform: rotate(180deg);
}

.order-success .cart-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #eee;
}

.order-success .cart-header-row {
  display: grid;
  grid-template-columns: 2.2fr 1fr .7fr .9fr 1fr;
  /* 跟 .cart-item 一致 */
  align-items: center;
  gap: 12px;
}

.order-success .cart-item {
  display: grid;
  grid-template-columns: 2.2fr 1fr .7fr .9fr 1fr;
  align-items: center;
  gap: 12px;
}

.order-success .cart-item,
.order-success .cart-header-row {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  gap: 12px;
}

.order-success .order-summary {
  max-width: 420px;
}

.order-success .os-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
}

.order-success .os-total strong {
  font-size: 18px;
}

/* 訂單明細下方：訂單詳情按鈕 */
.order-success .order-detail-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

/* 訂單詳情按鈕寬度 */
.order-success .order-detail-row .btn {
  padding: 8px;
  width: 240px;
  /* 你要的寬度 */
  text-align: center;
  font-weight: 600;
}

.promo-code {
  color: #1ABC9C;
  /* 你可以改成你想要的，例如綠色 */
  font-weight: 600;
}

/* ===== 訂單確認頁：已享用之優惠標籤等寬 ===== */
/* 全域：桌機版排版 */
.enjoyed-promo-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.enjoyed-promo-tag {
  display: inline-block;
  padding: 4px 10px;
  min-width: 72px;
  text-align: center;
  background: #dff3e7;
  color: #2f7d57;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.enjoyed-promo-text {
  flex: 1 1 auto;
  font-size: 0.85rem;
  color: #333;
}

.enjoyed-promo-value {
  margin-left: auto;
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

/* ================= RWD：訂單明細自動適配 ================= */

/* 讓長標題/優惠字可換行，不會把欄位撐爆 */
.order-success .cart-col-product .fw-semibold,
.order-success .cart-col-promo {
  word-break: break-word;
}

/* ---------- 平板（<= 991px）---------- */
@media (max-width: 991.98px) {

  /* 5 欄改成更適合的比例 */
  .order-success .cart-header-row {
    display: grid !important;
    grid-template-columns: 2.6fr 1.1fr .7fr 1fr 1fr;
    /* 商品/優惠/單價/數量/小計 */
    align-items: center;
    column-gap: 10px;
  }

  .order-success .cart-header-row>div {
    padding: 0;
    /* 避免原本 flex 的 padding 影響對齊 */
  }

  /* 每列同樣欄寬 */
  .order-success .cart-item {
    grid-template-columns: 2.6fr 1.1fr .7fr 1fr 1fr;
    column-gap: 10px;
  }

  /* 讓商品欄可以縮、可以換行，不要把其它欄擠爆 */
  .order-success .cart-col-product {
    min-width: 0;
  }

  .order-success .cart-col-product .fw-semibold {
    font-size: 14px;
    line-height: 1.25;
  }

  .order-success .cart-col-product .small {
    font-size: 12px;
  }

  /* 優惠欄置中像範例 */
  .order-success .cart-col-promo {
    text-align: center;
    font-size: 13px;
    white-space: normal;
  }

  /* 數量置中 */
  .order-success .cart-col-qty {
    text-align: center;
  }

  /* 單價/小計靠右更清楚 */
  .order-success .cart-col-unit,
  .order-success .cart-col-subtotal {
    text-align: right;
  }

  /* 圖片稍微小一點 */
  .order-success .cart-thumb {
    width: 52px;
    height: 52px;
  }

  /* 總計摘要改成滿版，避免右下角太擠 */
  .order-success .order-summary {
    max-width: none;
    width: 100%;
  }

  .order-success .order-detail-row {
    justify-content: stretch;
    /* 不靠右 */
  }

  .order-success .order-detail-row .btn {
    width: 100%;
    padding: 10px 16px;
    font-size: 15px;
  }
}

/* ---------- 手機（<= 575px）---------- */
@media (max-width: 575.98px) {

  /* 表頭不顯示 */
  .order-success .cart-header-row {
    display: none !important;
  }

  /* 每一筆商品：變成卡片區塊，並加上上方分隔線 */
  .order-success .cart-item {
    display: block;
    padding: 16px !important;
    border-bottom: 1px solid #e9ecef;
    /* 商品與商品之間的線 */
  }

  /* 第一筆商品上方也有線（像你圖最上面那條） */
  .order-success .checkout-cart-body>.cart-item:first-child {
    border-top: 1px solid #e9ecef;
  }

  /* 商品資料列 */
  .order-success .cart-col-product {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding-bottom: 12px;
    border-bottom: 1px solid #eef1f4;
    /* 商品資訊與下面明細的分隔線 */
    margin-bottom: 10px;
  }

  /* 優惠：做成一列（左右對齊）+ 底線 */
  .order-success .cart-col-promo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eef1f4;
    font-size: 13px;
  }

  .order-success .cart-col-promo .badge,
  .order-success .cart-col-promo .small {
    margin-left: auto;    /* ← 靠右 */
  }

  .order-success .cart-col-promo::before {
    content: "優惠";
    color: #666;
  }

  /* 單件價格 / 數量 / 小計：每列都有底線 */
  .order-success .cart-col-unit,
  .order-success .cart-col-qty,
  .order-success .cart-col-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eef1f4;
    font-size: 13px;
  }

  .order-success .cart-col-unit::before {
    content: "單件價格";
    color: #666;
  }

  .order-success .cart-col-qty::before {
    content: "數量";
    color: #666;
  }

  .order-success .cart-col-subtotal::before {
    content: "小計";
    color: #666;
  }

  /* 最後一列（小計）底線不要，讓卡片乾淨 */
  .order-success .cart-col-subtotal {
    border-bottom: 0;
    font-weight: 600;
  }

  /* 原價刪除線縮小 */
  .order-success .cart-col-unit del {
    font-size: 12px;
    margin-left: 8px;
  }

  /* 單件價格那一列 */
  .order-success .cart-col-unit {
    display: grid;
    grid-template-columns: auto 1fr;
    /* 左：名稱 / 右：金額 */
    align-items: center;
    column-gap: 12px;

    padding: 10px 0;
    border-bottom: 1px solid #eef1f4;
    font-size: 13px;
  }

  /* 左邊名稱 */
  .order-success .cart-col-unit::before {
    content: "單件價格";
    color: #666;
  }

  /* 右邊金額：整包靠右 */
  .order-success .cart-col-unit>strong,
  .order-success .cart-col-unit>del {
    grid-column: 2;
    /* 全部放到右欄 */
    justify-self: end;
    /* 靠右 */
    white-space: nowrap;
  }

  /* 覆蓋 d-block，強制同一行 */
  .order-success .cart-col-unit>del {
    display: inline !important;
    margin-left: 8px;
    font-size: 12px;
  }
}

/* ===== 訂單確認頁：已享用之優惠 手機版換行 ===== */
@media (max-width: 767.98px) {
  .enjoyed-promo-row {
    flex-wrap: wrap;
    margin-bottom: 10px;
  }

  /* 第一行：標籤 + 金額 */
  .enjoyed-promo-row .enjoyed-promo-tag {
    order: 1;
    flex: 0 0 auto;          /* 框只包文字 */
  }

  .enjoyed-promo-row .enjoyed-promo-value {
    order: 2;                /* 金額緊跟標籤 */
    flex-shrink: 0;
    margin-left: auto;       /* 金額推到最右 */
  }

  /* 第二行：說明文字獨占 */
  .enjoyed-promo-row .enjoyed-promo-text {
    order: 3;
    flex: 0 0 100%;          /* 強制換行 */
    font-size: 0.85rem;
    color: #555;
  }
}