/* ==========================================================================
   COSMOX Pro — WooCommerce Blocks 樣式層
   --------------------------------------------------------------------------
   為什麼需要這一層：
   本站的「購物車 / 結帳」頁面使用 WooCommerce 的 Gutenberg 區塊
   （woocommerce/cart、woocommerce/checkout），其 DOM 由 React 在前端產生，
   標記與傳統 [woocommerce_cart] 短碼完全不同，因此 assets/css/woo.css
   內針對 .woocommerce-cart-form / table.shop_table 的規則不會生效。
   本檔案補齊區塊版本的視覺，使其與主題的「深林綠 × 香檳金」語言一致。

   載入時機：僅在購物車 / 結帳 / 訂單相關頁面（見 inc/assets.php）
   索引：
   B01 區塊變數覆寫     B02 容器與佈局     B03 購物車明細列
   B04 數量選擇器       B05 訂單摘要側欄   B06 按鈕
   B07 優惠券 / 面板    B08 表單欄位       B09 提示訊息
   B10 空購物車         B11 商品網格       B12 結帳步驟
   B13 載入骨架         B14 響應式         B15 無障礙 / 列印
   ========================================================================== */

/* ==========================================================================
   B01. 區塊變數覆寫（WooCommerce Blocks 官方主題變數）
   ========================================================================== */
:root {
  --wc-primary: var(--cx-green-900);
  --wc-primary-text: var(--cx-cream);
  --wc-secondary: var(--cx-gold-500);
  --wc-secondary-text: var(--cx-green-950);
  --wc-content-bg: var(--cx-white);
  --wc-subtext: var(--cx-muted);
  --wc-strong-color: var(--cx-ink);
  --wc-strong-color-rgb: 20, 20, 15;
  --wc-black: var(--cx-ink);
  --wc-white: var(--cx-white);
  --wc-gray-0: #ffffff;
  --wc-gray-10: var(--cx-line-2);
  --wc-gray-20: var(--cx-line);
  --wc-gray-30: var(--cx-muted);
  --wc-gray-40: var(--cx-ink-2);
  --wc-gray-50: var(--cx-ink-2);
  --wc-gray-60: var(--cx-ink);
  --wc-gray-70: var(--cx-ink);
  --wc-gray-80: var(--cx-ink);
  --wc-gray-90: var(--cx-ink);
  --wc-green: var(--cx-green-600);
  --wc-red: var(--cx-danger);
  --wc-orange: var(--cx-gold-600);
  --wc-blue: var(--cx-green-700);

  --wc-border-radius-small: var(--cx-r-xs);
  --wc-border-radius-medium: var(--cx-r-sm);
  --wc-border-radius-large: var(--cx-r-lg);
  --wc-font-family: var(--cx-font-sans);
  --wc-button-border-radius: var(--cx-r-xs);
  --wc-button-font-weight: 600;
  --wc-form-border-radius: var(--cx-r-xs);
  --wc-form-border-width: 1px;
  --wc-form-border-color: var(--cx-line);
}

/* ==========================================================================
   B02. 容器與佈局
   ========================================================================== */
/* 購物車 / 結帳需要雙欄寬度，覆寫主題的窄容器 */
body.woocommerce-cart .cx-cw--narrow,
body.woocommerce-checkout .cx-cw--narrow,
body.woocommerce-cart .cx-entry,
body.woocommerce-checkout .cx-entry {
  max-width: var(--cx-cw-wide);
}

body.woocommerce-cart .cx-page,
body.woocommerce-checkout .cx-page {
  max-width: none;
  padding-inline: 0;
}

/* 讓區塊不要被 .cx-entry 的散文樣式影響 */
body.woocommerce-cart .cx-entry a,
body.woocommerce-checkout .cx-entry a {
  text-decoration: none;
}

body.woocommerce-cart .cx-entry table,
body.woocommerce-checkout .cx-entry table {
  border: 0;
  margin: 0;
}

body.woocommerce-cart .cx-entry table th,
body.woocommerce-cart .cx-entry table td,
body.woocommerce-checkout .cx-entry table th,
body.woocommerce-checkout .cx-entry table td {
  border: 0;
  padding: 0;
  text-align: left;
}

/* 移除主題給 prose 的寬度限制與字級 */
body.woocommerce-cart .cx-entry h2,
body.woocommerce-checkout .cx-entry h2,
body.woocommerce-cart .cx-entry h3,
body.woocommerce-checkout .cx-entry h3 {
  margin: 0;
  font-family: var(--cx-font-serif);
  color: var(--cx-ink);
}

/* 外層區塊 */
.wp-block-woocommerce-cart,
.wp-block-woocommerce-checkout,
.wc-block-cart,
.wc-block-checkout {
  margin: 0;
  font-family: var(--cx-font-sans);
  color: var(--cx-ink);
  font-size: var(--cx-fs-body);
  line-height: 1.7;
}

.wc-block-cart .wc-block-components-sidebar-layout,
.wc-block-checkout .wc-block-components-sidebar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
  margin: 0;
}

.wc-block-cart .wc-block-components-main,
.wc-block-checkout .wc-block-components-main {
  min-width: 0;
  padding: 0;
  width: auto;
}

.wc-block-cart .wc-block-components-sidebar,
.wc-block-checkout .wc-block-components-sidebar {
  min-width: 0;
  padding: 0;
  width: auto;
}

/* 側欄做成「卡片」 */
.wc-block-cart .wc-block-components-sidebar > .wc-block-components-totals-wrapper,
.wc-block-checkout .wc-block-components-sidebar > .wc-block-components-totals-wrapper,
.wc-block-cart .wc-block-components-sidebar > div:first-child:not(:empty) {
  position: sticky;
  top: calc(var(--cx-header-h) + 24px);
  background: var(--cx-white);
  border: 1px solid var(--cx-line);
  border-radius: var(--cx-r-md);
  box-shadow: var(--cx-sh-2);
  overflow: hidden;
}

/* ==========================================================================
   B03. 購物車明細列
   ========================================================================== */
.wc-block-cart-items {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.wc-block-cart-items__header {
  border-bottom: 1px solid var(--cx-line);
}

.wc-block-cart-items__header th {
  padding: 0 0 12px;
  font-family: var(--cx-font-sans);
  font-size: var(--cx-fs-kicker);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cx-muted);
}

.wc-block-cart-items__header-image {
  width: 96px;
}

.wc-block-cart-items__header-total,
.wc-block-cart-items__header-price {
  text-align: right;
}

.wc-block-cart-items__row {
  border-bottom: 1px solid var(--cx-line-2);
}

.wc-block-cart-items__row:last-child {
  border-bottom: 0;
}

.wc-block-cart-items__row > td {
  padding: 22px 0;
  vertical-align: middle;
}

.wc-block-cart-item__image {
  padding-right: 20px !important;
  width: 96px;
}

.wc-block-cart-item__image img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: var(--cx-r-sm);
  border: 1px solid var(--cx-line);
  background: var(--cx-cream);
}

.wc-block-cart-item__product {
  padding-right: 20px !important;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wc-block-components-product-name {
  font-family: var(--cx-font-serif);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--cx-ink);
  text-decoration: none;
  transition: color var(--cx-dur) var(--cx-ease);
}

.wc-block-components-product-name:hover {
  color: var(--cx-green-700);
}

.wc-block-cart-item__prices,
.wc-block-cart-item__total {
  text-align: right;
  white-space: nowrap;
}

.wc-block-cart-item__total-price-and-suffix {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.wc-block-components-product-price,
.wc-block-components-product-price__value {
  font-family: var(--cx-font-num);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--cx-green-900);
  letter-spacing: 0.01em;
}

.wc-block-cart-item__total .wc-block-components-product-price {
  font-size: 1.3rem;
}

.wc-block-components-product-price del,
.wc-block-components-product-price del .amount {
  color: var(--cx-muted);
  font-size: 0.82em;
  font-weight: 400;
  text-decoration: line-through;
}

.wc-block-components-product-price ins,
.wc-block-components-product-price ins .amount {
  text-decoration: none;
  color: var(--cx-danger);
}

/* 商品副資訊（SKU / 分類） */
.wc-block-cart-item__product .wc-block-components-product-details {
  margin: 0;
  font-size: var(--cx-fs-xs);
  color: var(--cx-muted);
}

/* 移除鈕 */
.wc-block-cart-item__remove-link,
.wc-block-components-product-details + .wc-block-cart-item__remove-link {
  align-self: flex-start;
  font-size: var(--cx-fs-xs);
  color: var(--cx-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--cx-dur) var(--cx-ease),
    border-color var(--cx-dur) var(--cx-ease);
}

.wc-block-cart-item__remove-link:hover {
  color: var(--cx-danger);
  border-bottom-color: var(--cx-danger);
}

/* 運送 / 額外描述 */
.wc-block-cart-item__product .wc-block-components-product-sku,
.wc-block-cart-item__product .wc-block-components-product-metadata {
  font-size: var(--cx-fs-xs);
  color: var(--cx-muted);
}

/* ==========================================================================
   B04. 數量選擇器
   ========================================================================== */
.wc-block-components-quantity-selector {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--cx-line);
  border-radius: var(--cx-r-sm);
  background: var(--cx-white);
  overflow: hidden;
  width: auto;
  max-width: 132px;
}

.wc-block-components-quantity-selector .wc-block-components-quantity-selector__button {
  width: 38px;
  height: 42px;
  min-width: 38px;
  border: 0;
  background: transparent;
  color: var(--cx-green-900);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--cx-dur) var(--cx-ease);
}

.wc-block-components-quantity-selector .wc-block-components-quantity-selector__button:hover:not(:disabled) {
  background: var(--cx-gold-100);
  color: var(--cx-green-950);
}

.wc-block-components-quantity-selector .wc-block-components-quantity-selector__button:disabled {
  color: var(--cx-line);
  cursor: not-allowed;
}

.wc-block-components-quantity-selector .wc-block-components-quantity-selector__input {
  width: 46px;
  min-width: 46px;
  height: 42px;
  border: 0;
  border-inline: 1px solid var(--cx-line);
  border-radius: 0;
  background: var(--cx-white);
  text-align: center;
  font-family: var(--cx-font-num);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--cx-ink);
  padding: 0;
  -moz-appearance: textfield;
}

.wc-block-components-quantity-selector .wc-block-components-quantity-selector__input::-webkit-outer-spin-button,
.wc-block-components-quantity-selector .wc-block-components-quantity-selector__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.wc-block-components-quantity-selector .wc-block-components-quantity-selector__input:focus {
  outline: 2px solid var(--cx-gold-400);
  outline-offset: -2px;
}

/* ==========================================================================
   B05. 訂單摘要側欄
   ========================================================================== */
.wc-block-components-totals-wrapper {
  border-bottom: 1px solid var(--cx-line-2);
}

.wc-block-components-totals-wrapper:last-child {
  border-bottom: 0;
}

.wc-block-cart__totals-title,
.wc-block-components-totals-wrapper > .wc-block-components-totals-item:first-child,
.wc-block-components-order-summary > .wc-block-components-panel > .wc-block-components-panel__button {
  font-family: var(--cx-font-serif);
}

.wc-block-cart__totals-title {
  display: block;
  padding: 22px 26px 16px;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--cx-green-900);
  border-bottom: 1px solid var(--cx-line-2);
  margin: 0;
}

.wc-block-components-totals-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 26px;
  font-size: 0.95rem;
}

.wc-block-components-totals-item__label {
  color: var(--cx-ink-2);
}

.wc-block-components-totals-item__value {
  font-family: var(--cx-font-num);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--cx-green-900);
  text-align: right;
}

.wc-block-components-totals-item__description {
  flex-basis: 100%;
  margin-top: 4px;
  font-size: var(--cx-fs-xs);
  color: var(--cx-muted);
  text-align: left;
}

/* 總計列（強調） */
.wc-block-components-totals-footer-item {
  padding: 20px 26px 22px;
  background: linear-gradient(180deg, var(--cx-cream) 0%, var(--cx-white) 100%);
  border-top: 1px solid var(--cx-line);
  align-items: center;
}

.wc-block-components-totals-footer-item .wc-block-components-totals-item__label {
  font-family: var(--cx-font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--cx-green-900);
}

.wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--cx-green-900);
}

.wc-block-components-totals-footer-item .wc-block-components-totals-item__value .wc-block-components-formatted-money-amount {
  font-size: inherit;
}

/* 運送選項 / 稅金摺疊面板 */
.wc-block-components-panel {
  border-top: 1px solid var(--cx-line-2);
}

.wc-block-components-panel__button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 26px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cx-green-900);
  text-align: left;
  transition: background var(--cx-dur) var(--cx-ease);
}

.wc-block-components-panel__button:hover {
  background: var(--cx-cream);
}

.wc-block-components-panel__content {
  padding: 4px 26px 18px;
  font-size: 0.92rem;
  color: var(--cx-ink-2);
}

/* 訂單摘要（結帳頁）*/
.wc-block-components-order-summary {
  border: 1px solid var(--cx-line);
  border-radius: var(--cx-r-md);
  background: var(--cx-white);
  overflow: hidden;
}

.wc-block-components-order-summary-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 26px;
  border-bottom: 1px solid var(--cx-line-2);
}

.wc-block-components-order-summary-item__image img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--cx-r-sm);
  border: 1px solid var(--cx-line);
}

.wc-block-components-order-summary-item .wc-block-components-product-name {
  font-size: 0.95rem;
}

.wc-block-components-order-summary-item__quantity {
  position: static;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--cx-r-pill);
  background: var(--cx-green-900);
  color: var(--cx-cream);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 22px;
  text-align: center;
}

/* ==========================================================================
   B06. 按鈕
   ========================================================================== */
.wc-block-components-button:not(.is-link) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 30px;
  border: 1px solid var(--cx-green-900);
  border-radius: var(--cx-r-xs);
  background: var(--cx-green-900);
  color: var(--cx-cream);
  font-family: var(--cx-font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background var(--cx-dur) var(--cx-ease),
    border-color var(--cx-dur) var(--cx-ease),
    color var(--cx-dur) var(--cx-ease),
    transform var(--cx-dur) var(--cx-ease);
}

.wc-block-components-button:not(.is-link):hover:not(:disabled) {
  background: var(--cx-green-700);
  border-color: var(--cx-green-700);
  color: var(--cx-white);
  transform: translateY(-1px);
}

.wc-block-components-button:not(.is-link):focus-visible {
  outline: 2px solid var(--cx-gold-500);
  outline-offset: 2px;
}

/* 主要行動：前往結帳 / 下單 → 香檳金 */
.wc-block-cart__submit-button,
.wc-block-components-checkout-place-order-button,
.wc-block-components-button.wc-block-cart__submit-button {
  width: 100%;
  min-height: 56px;
  background: var(--cx-gold-500);
  border-color: var(--cx-gold-500);
  color: var(--cx-green-950);
  font-size: 1rem;
  letter-spacing: 0.1em;
  box-shadow: var(--cx-sh-gold);
}

.wc-block-cart__submit-button:hover:not(:disabled),
.wc-block-components-checkout-place-order-button:hover:not(:disabled) {
  background: var(--cx-gold-600);
  border-color: var(--cx-gold-600);
  color: var(--cx-white);
}

.wc-block-cart__submit-container {
  padding: 20px 26px 26px;
}

.wc-block-cart__submit-container .wc-block-cart__submit-button {
  margin: 0;
}

/* 次要 / 外框按鈕 */
.wc-block-components-button.is-outlined,
.wc-block-components-button--outlined,
.wc-block-components-express-payment .wc-block-components-button {
  background: transparent;
  border-color: var(--cx-line);
  color: var(--cx-green-900);
}

.wc-block-components-button.is-outlined:hover,
.wc-block-components-button--outlined:hover {
  background: var(--cx-green-900);
  border-color: var(--cx-green-900);
  color: var(--cx-cream);
}

.wc-block-components-button.is-link,
.wc-block-components-button.is-text-button {
  min-height: 0;
  padding: 0;
  background: none;
  border: 0;
  color: var(--cx-green-700);
  text-decoration: underline;
  box-shadow: none;
  letter-spacing: 0;
}

.wc-block-components-button.is-link:hover,
.wc-block-components-button.is-text-button:hover {
  background: none;
  color: var(--cx-gold-600);
  transform: none;
}

/* 快速付款（Apple Pay / Google Pay 等）*/
.wc-block-components-express-payment {
  margin: 0;
  padding: 0 26px 6px;
  border-bottom: 1px solid var(--cx-line-2);
}

.wc-block-components-express-payment__title {
  font-size: var(--cx-fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cx-muted);
  text-align: center;
}

.wc-block-cart__accepted-payment-methods {
  padding: 14px 26px 20px;
  gap: 8px;
}

.wc-block-cart__accepted-payment-methods li {
  width: 42px;
  height: 27px;
  opacity: 0.75;
}

/* ==========================================================================
   B07. 優惠券
   ========================================================================== */
.wc-block-components-totals-coupon,
.wc-block-components-totals-coupon__form {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.wc-block-components-totals-coupon__form {
  padding: 14px 26px 16px;
}

.wc-block-components-totals-coupon .wc-block-components-text-input {
  flex: 1 1 auto;
  min-width: 0;
}

.wc-block-components-totals-coupon__button,
.wc-block-components-totals-coupon__button.wc-block-components-button {
  flex: 0 0 auto;
  min-width: 0;
  min-height: 46px;
  padding: 0 20px;
  background: var(--cx-green-900);
  border-color: var(--cx-green-900);
  color: var(--cx-cream);
  letter-spacing: 0.08em;
}

.wc-block-components-totals-coupon__button:hover:not(:disabled) {
  background: var(--cx-green-700);
  border-color: var(--cx-green-700);
}

.wc-block-components-totals-coupon__button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.wc-block-components-totals-discount__coupon-list-item {
  gap: 8px;
}

.wc-block-components-totals-discount__coupon-list-item .wc-block-components-chip {
  background: var(--cx-gold-100);
  border-color: var(--cx-gold-300);
  color: var(--cx-gold-700);
}

/* ==========================================================================
   B08. 表單欄位
   ========================================================================== */
.wc-block-components-text-input,
.wc-block-components-select,
.wc-block-components-combobox,
.wc-block-components-address-form__state {
  position: relative;
}

.wc-block-components-text-input input,
.wc-block-components-select select,
.wc-block-components-address-form input,
.wc-block-components-address-form select,
.wc-block-components-checkout-step input[type="text"],
.wc-block-components-checkout-step input[type="email"],
.wc-block-components-checkout-step input[type="tel"],
.wc-block-components-checkout-step input[type="password"],
.wc-block-components-checkout-step textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  border: 1px solid var(--cx-line);
  border-radius: var(--cx-r-xs);
  background: var(--cx-white);
  color: var(--cx-ink);
  font-family: var(--cx-font-sans);
  font-size: 0.97rem;
  line-height: 1.5;
  transition: border-color var(--cx-dur) var(--cx-ease),
    box-shadow var(--cx-dur) var(--cx-ease);
}

.wc-block-components-text-input input:focus,
.wc-block-components-select select:focus,
.wc-block-components-address-form input:focus,
.wc-block-components-address-form select:focus,
.wc-block-components-checkout-step textarea:focus {
  border-color: var(--cx-gold-400);
  box-shadow: 0 0 0 3px rgba(196, 164, 92, 0.18);
  outline: none;
}

.wc-block-components-text-input label,
.wc-block-components-select label {
  position: absolute;
  top: -9px;
  left: 10px;
  padding: 0 6px;
  background: var(--cx-white);
  font-size: var(--cx-fs-xs);
  color: var(--cx-muted);
  letter-spacing: 0.04em;
}

.wc-block-components-checkout-step .wc-block-components-text-input,
.wc-block-components-checkout-step .wc-block-components-select {
  margin-bottom: 18px;
}

/* 勾選框 */
.wc-block-components-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.wc-block-components-checkbox .wc-block-components-checkbox__input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin: 0;
  border: 1px solid var(--cx-line);
  border-radius: var(--cx-r-xs);
  appearance: none;
  background: var(--cx-white);
  cursor: pointer;
  position: relative;
  transition: background var(--cx-dur) var(--cx-ease),
    border-color var(--cx-dur) var(--cx-ease);
}

.wc-block-components-checkbox .wc-block-components-checkbox__input[type="checkbox"]:checked {
  background: var(--cx-green-900);
  border-color: var(--cx-green-900);
}

.wc-block-components-checkbox .wc-block-components-checkbox__input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fbf8f1' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 13px 13px;
  background-position: center;
  background-repeat: no-repeat;
}

.wc-block-components-checkbox .wc-block-components-checkbox__label {
  font-size: 0.9rem;
  color: var(--cx-ink-2);
  line-height: 1.7;
}

/* 電台選項（付款方式 / 運送方式）*/
.wc-block-components-radio-control {
  border: 0;
  margin: 0;
  padding: 0;
}

.wc-block-components-radio-control__option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--cx-line);
  border-radius: var(--cx-r-sm);
  background: var(--cx-white);
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color var(--cx-dur) var(--cx-ease),
    background var(--cx-dur) var(--cx-ease),
    box-shadow var(--cx-dur) var(--cx-ease);
}

.wc-block-components-radio-control__option:hover {
  border-color: var(--cx-gold-300);
}

.wc-block-components-radio-control__option:has(input:checked),
.wc-block-components-radio-control__option--checked {
  border-color: var(--cx-green-900);
  background: linear-gradient(180deg, var(--cx-cream) 0%, var(--cx-white) 100%);
  box-shadow: 0 0 0 1px var(--cx-green-900) inset;
}

.wc-block-components-radio-control__input[type="radio"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin: 1px 0 0;
  border: 1px solid var(--cx-line);
  border-radius: 50%;
  appearance: none;
  background: var(--cx-white);
  cursor: pointer;
  position: relative;
  transition: border-color var(--cx-dur) var(--cx-ease);
}

.wc-block-components-radio-control__input[type="radio"]:checked {
  border-color: var(--cx-green-900);
  border-width: 6px;
}

.wc-block-components-radio-control__label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cx-ink);
}

.wc-block-components-radio-control__description {
  font-size: var(--cx-fs-xs);
  color: var(--cx-muted);
  font-weight: 400;
}

.wc-block-components-radio-control__option-layout {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
}

/* 驗證錯誤 */
.wc-block-components-validation-error,
.wc-block-components-validation-error p {
  color: var(--cx-danger);
  font-size: var(--cx-fs-xs);
}

.wc-block-components-validation-error {
  border-left: 3px solid var(--cx-danger);
  padding-left: 10px;
  margin-top: 6px;
}

/* ==========================================================================
   B09. 提示訊息
   ========================================================================== */
.wc-block-components-notice-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 20px;
  padding: 16px 20px;
  border: 1px solid var(--cx-line);
  border-left: 3px solid var(--cx-green-600);
  border-radius: var(--cx-r-sm);
  background: var(--cx-cream);
  color: var(--cx-ink-2);
  font-size: 0.92rem;
}

.wc-block-components-notice-banner.is-error {
  border-left-color: var(--cx-danger);
  background: #fdf4f3;
}

.wc-block-components-notice-banner.is-success {
  border-left-color: var(--cx-green-600);
  background: #f2f8f4;
}

.wc-block-components-notice-banner.is-info {
  border-left-color: var(--cx-gold-500);
  background: var(--cx-gold-100);
}

.wc-block-components-notice-banner__content {
  flex: 1 1 auto;
}

.wc-block-components-notice-banner__content .wc-forward {
  color: var(--cx-green-700);
  font-weight: 600;
  text-decoration: underline;
}

/* 舊版 notice 樣式（相容）*/
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
  border-radius: var(--cx-r-sm);
  background: var(--cx-cream);
  border-top: 0;
  border-left: 3px solid var(--cx-green-600);
  color: var(--cx-ink-2);
}

/* ==========================================================================
   B10. 空購物車
   ========================================================================== */
.wc-block-cart__empty-cart__title,
.wc-block-cart__empty-cart__text {
  text-align: center;
}

.wc-block-cart__empty-cart__title {
  font-family: var(--cx-font-serif);
  font-size: clamp(1.3rem, 2.4vw, 1.8rem);
  font-weight: 600;
  color: var(--cx-green-900);
  margin: 8px 0 10px;
}

.wc-block-cart__empty-cart__text {
  color: var(--cx-muted);
  margin-bottom: 28px;
}

.wp-block-woocommerce-empty-cart-block {
  padding: clamp(28px, 5vw, 56px) 24px;
  border: 1px dashed var(--cx-line);
  border-radius: var(--cx-r-md);
  background: linear-gradient(180deg, var(--cx-cream) 0%, var(--cx-white) 100%);
}

.wp-block-woocommerce-empty-cart-block .wc-block-components-button {
  margin: 0 auto;
}

/* ==========================================================================
   B11. 商品網格（空購物車底部的「最新商品」）
   ========================================================================== */
.wc-block-grid__products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: clamp(18px, 2.4vw, 30px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.wc-block-grid__product {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  border: 0;
  text-align: left;
}

.wc-block-grid__product-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
}

.wc-block-grid__product-image {
  position: relative;
  margin: 0 0 14px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--cx-line);
  border-radius: var(--cx-r-md);
  background: var(--cx-cream);
}

.wc-block-grid__product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--cx-dur-slow) var(--cx-ease-out);
}

.wc-block-grid__product:hover .wc-block-grid__product-image img {
  transform: scale(1.06);
}

.wc-block-grid__product-title {
  font-family: var(--cx-font-serif);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--cx-ink);
  margin: 0 0 6px;
}

.wc-block-grid__product-price {
  margin: auto 0 12px;
  font-family: var(--cx-font-num);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--cx-green-900);
}

.wc-block-grid__product-add-to-cart {
  margin: 0;
}

.wc-block-grid__product-add-to-cart .wp-block-button__link,
.wc-block-grid__product-add-to-cart .wp-element-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--cx-green-900);
  border-radius: var(--cx-r-xs);
  background: transparent;
  color: var(--cx-green-900);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background var(--cx-dur) var(--cx-ease),
    color var(--cx-dur) var(--cx-ease);
}

.wc-block-grid__product-add-to-cart .wp-block-button__link:hover,
.wc-block-grid__product-add-to-cart .wp-element-button:hover {
  background: var(--cx-green-900);
  color: var(--cx-cream);
}

.wc-block-grid__product-add-to-cart .added_to_cart {
  display: block;
  margin-top: 8px;
  font-size: var(--cx-fs-xs);
  color: var(--cx-green-700);
}

.wc-block-grid__product-onsale {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 4px 10px;
  border: 0;
  border-radius: var(--cx-r-pill);
  background: var(--cx-gold-500);
  color: var(--cx-green-950);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.wc-block-grid__product-rating .star-rating span::before,
.wc-block-grid__product-rating .wc-block-grid__product-rating__stars::before {
  color: var(--cx-gold-500);
}

.wc-block-grid__products + .wc-block-grid__no-products,
.wc-block-grid__no-products {
  padding: 24px 0;
  color: var(--cx-muted);
}

/* ==========================================================================
   B12. 結帳區塊
   ========================================================================== */
.wc-block-checkout__main {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.wc-block-components-checkout-step {
  position: relative;
  padding: 0 0 8px;
  background: transparent;
}

.wc-block-components-checkout-step:not(:last-child) {
  margin-bottom: 34px;
}

.wc-block-components-checkout-step__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--cx-line);
}

.wc-block-components-checkout-step__title {
  font-family: var(--cx-font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--cx-green-900);
  margin: 0;
  letter-spacing: 0.03em;
}

.wc-block-components-checkout-step__description {
  font-size: var(--cx-fs-sm);
  color: var(--cx-muted);
  margin: 0 0 18px;
}

.wc-block-components-checkout-step__container {
  position: relative;
}

/* 步驟序號 */
.wc-block-components-checkout-step__heading::before {
  content: "";
  display: none;
}

/* 聯絡資訊 / 地址欄位群 */
.wc-block-components-address-form,
.wc-block-components-address-card {
  display: grid;
  gap: 18px;
}

.wc-block-components-address-form__first-name,
.wc-block-components-address-form__last-name {
  grid-column: span 1;
}

.wc-block-components-address-form__address-1,
.wc-block-components-address-form__address-2,
.wc-block-components-address-form__company {
  grid-column: 1 / -1;
}

/* 地址卡片（已存的收貨地址）*/
.wc-block-components-address-card {
  padding: 18px 20px;
  border: 1px solid var(--cx-line);
  border-radius: var(--cx-r-sm);
  background: var(--cx-white);
  font-size: 0.92rem;
  color: var(--cx-ink-2);
  line-height: 1.8;
}

.wc-block-components-address-card__edit {
  color: var(--cx-green-700);
  text-decoration: underline;
  font-size: var(--cx-fs-xs);
}

/* 訂單備註 */
.wc-block-components-textarea {
  width: 100%;
  min-height: 110px;
  padding: 14px 16px;
  border: 1px solid var(--cx-line);
  border-radius: var(--cx-r-xs);
  background: var(--cx-white);
  font-family: var(--cx-font-sans);
  font-size: 0.95rem;
  line-height: 1.8;
  resize: vertical;
}

.wc-block-components-textarea:focus {
  border-color: var(--cx-gold-400);
  box-shadow: 0 0 0 3px rgba(196, 164, 92, 0.18);
  outline: none;
}

/* 付款方式區 */
.wc-block-components-payment-methods {
  margin: 0;
  padding: 0;
  list-style: none;
}

.wc-block-components-payment-method-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--cx-ink);
}

.wc-block-components-payment-method-label__label {
  font-weight: inherit;
}

.wc-block-components-payment-method-icons {
  gap: 6px;
}

.wc-block-components-payment-method-icon {
  height: 24px;
  width: auto;
}

.wc-block-components-checkout-payment-method__content {
  margin-top: 12px;
  padding: 16px 18px;
  border-radius: var(--cx-r-sm);
  background: var(--cx-cream);
  font-size: var(--cx-fs-sm);
  color: var(--cx-ink-2);
  line-height: 1.8;
}

/* 條款與下單 */
.wc-block-components-checkout-place-order-button {
  margin-top: 8px;
}

.wc-block-components-checkout-return-to-cart-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: var(--cx-fs-sm);
  color: var(--cx-muted);
}

/* 訂單確認頁 */
.wc-block-order-confirmation-summary,
.wc-block-order-confirmation-totals {
  border: 1px solid var(--cx-line);
  border-radius: var(--cx-r-md);
  background: var(--cx-white);
  padding: 24px 26px;
  margin-bottom: 26px;
}

.wc-block-order-confirmation-status {
  font-family: var(--cx-font-serif);
  color: var(--cx-green-900);
}

/* ==========================================================================
   B13. 載入骨架 / 遮罩
   ========================================================================== */
.wc-block-components-skeleton,
.wc-block-components-skeleton-text,
.wc-block-cart__skeleton-item {
  border-radius: var(--cx-r-sm);
  background: linear-gradient(
    90deg,
    var(--cx-line-2) 25%,
    var(--cx-cream-2) 37%,
    var(--cx-line-2) 63%
  );
  background-size: 400% 100%;
  animation: cx-wc-shimmer 1.4s ease-in-out infinite;
}

@keyframes cx-wc-shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

.wc-block-components-loading-mask {
  position: relative;
  min-height: 120px;
}

.wc-block-components-spinner {
  color: var(--cx-gold-500);
}

.wc-block-components-spinner::after {
  border-color: var(--cx-gold-500) transparent transparent transparent;
}

/* ==========================================================================
   B14. 響應式
   ========================================================================== */
@media (max-width: 1100px) {
  .wc-block-cart .wc-block-components-sidebar-layout,
  .wc-block-checkout .wc-block-components-sidebar-layout {
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 32px;
  }
}

@media (max-width: 900px) {
  .wc-block-cart .wc-block-components-sidebar-layout,
  .wc-block-checkout .wc-block-components-sidebar-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .wc-block-cart .wc-block-components-sidebar > .wc-block-components-totals-wrapper,
  .wc-block-checkout .wc-block-components-sidebar > .wc-block-components-totals-wrapper,
  .wc-block-cart .wc-block-components-sidebar > div:first-child:not(:empty) {
    position: static;
  }

  .wc-block-components-address-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .wc-block-cart-items__header-image,
  .wc-block-cart-item__image {
    display: none;
  }

  .wc-block-cart-items__row > td {
    padding: 18px 0;
  }

  .wc-block-cart-item__product {
    padding-right: 12px !important;
  }

  .wc-block-components-quantity-selector {
    max-width: 108px;
  }

  .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button {
    width: 32px;
    min-width: 32px;
  }

  .wc-block-components-quantity-selector .wc-block-components-quantity-selector__input {
    width: 40px;
    min-width: 40px;
  }

  .wc-block-components-totals-item,
  .wc-block-cart__submit-container,
  .wc-block-components-totals-coupon__form,
  .wc-block-components-express-payment,
  .wc-block-components-panel__button,
  .wc-block-components-panel__content,
  .wc-block-components-order-summary-item,
  .wc-block-cart__totals-title {
    padding-left: 18px;
    padding-right: 18px;
  }

  .wc-block-components-order-summary-item {
    grid-template-columns: 52px 1fr;
  }

  .wc-block-components-order-summary-item__image img {
    width: 46px;
    height: 46px;
  }

  .wc-block-grid__products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .wc-block-components-radio-control__option {
    padding: 14px 14px;
  }

  .wp-block-woocommerce-empty-cart-block {
    padding: 28px 16px;
  }
}

@media (max-width: 420px) {
  .wc-block-grid__products {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   B15. 無障礙 / 列印
   ========================================================================== */
.wc-block-components-button:focus-visible,
.wc-block-components-quantity-selector__button:focus-visible,
.wc-block-components-panel__button:focus-visible,
.wc-block-components-radio-control__input:focus-visible,
.wc-block-components-checkbox__input:focus-visible {
  outline: 2px solid var(--cx-gold-500);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .wc-block-components-skeleton,
  .wc-block-components-skeleton-text,
  .wc-block-cart__skeleton-item {
    animation: none;
  }

  .wc-block-components-button:not(.is-link):hover:not(:disabled) {
    transform: none;
  }
}

@media print {
  .wc-block-cart__submit-container,
  .wc-block-components-express-payment,
  .wc-block-components-checkout-place-order-button,
  .wc-block-components-totals-coupon {
    display: none !important;
  }

  .wc-block-cart-items__row {
    break-inside: avoid;
  }
}

