/* ============================================================
   eSIM Theme — 购物车页(蓝白品牌风,两栏布局,移动端堆叠)
   作用域:.woocommerce-cart  —— 与结账页风格统一
   ============================================================ */

.woocommerce-cart .site-main { background: var(--surface); }
.woocommerce-cart .page-wrap { padding: 28px 0 56px; }
.woocommerce-cart .page-wrap .entry-title { text-align: center; font-size: 26px; margin: 0 0 22px; }

/* WC 默认提示条(加券成功 / 数量已更新)做成轻卡片 */
.woocommerce-cart .woocommerce-message,
.woocommerce-cart .woocommerce-info,
.woocommerce-cart .woocommerce-error {
  max-width: 1040px; margin: 0 auto 16px; background: #fff;
  border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm); padding: 13px 18px; font-size: 14px; list-style: none;
}
.woocommerce-cart .woocommerce-error { border-left-color: #D63638; }

/* ---------- 两栏布局 ---------- */
.esim-cart-wrap {
  max-width: 1040px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr; gap: 20px;
}
.esim-cart-wrap .woocommerce-cart-form { min-width: 0; }

/* 商品列表卡片容器 */
.esim-cart-items {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(15, 23, 42, .05); padding: 8px 22px;
}

/* 单个商品卡片(沿用结账页 .esim-citem 层级) */
.esim-cart-items .esim-citem { display: block; padding: 16px 0; border-bottom: 1px solid var(--surface); }
.esim-cart-items .esim-citem:last-of-type { border-bottom: none; }
.esim-cart-items .ci-cell { display: block; }

.ci-top { display: flex; align-items: flex-start; gap: 10px; }
.ci-info { flex: 1; min-width: 0; }
.ci-name { font-size: 15px; font-weight: 700; line-height: 1.4; }
.ci-name a { color: var(--text); text-decoration: none; }
.ci-name a:hover { color: var(--primary); }
.ci-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.ci-unit { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ci-unit-label { margin-left: 1px; }

/* 删除:垃圾桶图标 + 文字,默认灰 hover 红(覆盖 WC 原生 .remove) */
.esim-cart-items .ci-remove,
.esim-cart-items a.remove.ci-remove {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  background: none !important; border: none; cursor: pointer; color: var(--muted);
  font-size: 12px; padding: 4px 2px; line-height: 1; text-decoration: none;
  width: auto; height: auto; border-radius: 0;
}
.esim-cart-items .ci-remove svg { display: block; }
.esim-cart-items .ci-remove span { line-height: 1; }
.esim-cart-items a.remove.ci-remove:hover { color: #D63638 !important; background: none !important; }

/* 底部:数量步进器 ←→ 小计 */
.ci-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }

/* 数量步进器 */
.qty-stepper { position: relative; display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.qty-stepper .qstep {
  width: 34px; height: 36px; border: none; background: #fff; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--primary); display: flex; align-items: center; justify-content: center;
}
.qty-stepper .qstep:hover { background: var(--primary-light); }
.qty-stepper .qnum {
  width: 44px; height: 36px; border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  text-align: center; font-size: 14px; font-weight: 700; color: var(--text); -moz-appearance: textfield; background: #fff;
}
.qty-stepper .qnum::-webkit-outer-spin-button,
.qty-stepper .qnum::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-stepper .qnum:focus { outline: none; background: var(--primary-light); }
.qty-spin { display: none; }
.qty-stepper.is-loading .qstep, .qty-stepper.is-loading .qnum { visibility: hidden; }
.qty-stepper.is-loading .qty-spin {
  display: block; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%;
  animation: esim-spin .6s linear infinite;
}
@keyframes esim-spin { to { transform: rotate(360deg); } }

.ci-sub { font-size: 17px; font-weight: 800; color: var(--text); white-space: nowrap; }

/* ---------- 操作区:优惠码 + 更新购物车 ---------- */
.esim-cart-actions {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 18px 0 6px; border-top: 1px solid var(--surface); margin-top: 4px;
}
.esim-cart-coupon { display: flex; gap: 10px; align-items: center; flex: 1; min-width: 240px; }
.esim-cart-coupon input.input-text {
  flex: 1; min-width: 120px; min-height: 46px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 15px;
}
.esim-cart-coupon input.input-text:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.esim-cart-coupon button {
  min-height: 46px; padding: 0 22px; border: none; border-radius: 999px;
  background: var(--primary); color: #fff; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.esim-cart-coupon button:hover { background: var(--primary-dark); }
.esim-update-cart {
  min-height: 46px; padding: 0 22px; border: 1px solid var(--border); border-radius: 999px;
  background: #fff; color: var(--text); font-weight: 700; cursor: pointer; white-space: nowrap;
}
.esim-update-cart:hover { border-color: var(--primary); color: var(--primary); }
.esim-update-cart[disabled] { opacity: .5; cursor: default; }

/* ---------- 订单摘要(右栏)---------- */
.cart-collaterals { min-width: 0; }
.cart-collaterals .cross-sells { display: none; } /* 暂不展示交叉销售 */
.esim-cart-totals {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(15, 23, 42, .05); padding: 22px; width: auto; float: none;
}
.esim-cart-totals h2 { font-size: 18px; margin: 0 0 16px; padding: 0; }
.esim-totals-table { width: 100%; border: none; border-collapse: collapse; margin: 0 0 16px; }
.esim-totals-table tr { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border: none; }
.esim-totals-table th { font-weight: 600; color: var(--muted); font-size: 14px; text-align: left; padding: 0; border: none; }
.esim-totals-table td { font-weight: 700; font-size: 15px; text-align: right; padding: 0; border: none; }
.esim-totals-table .cart-discount td { color: #0F9D58; }
.esim-totals-table .cart-discount th { font-weight: 600; }
.esim-totals-table .order-total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 15px; }
.esim-totals-table .order-total th { color: var(--text); font-size: 16px; }
.esim-totals-table .order-total td { font-size: 24px; color: var(--primary); }
.esim-totals-table .order-total .woocommerce-Price-amount { color: var(--primary); }

/* 去结账主按钮 */
.esim-cart-totals .wc-proceed-to-checkout { padding: 0; }
.esim-cart-totals .wc-proceed-to-checkout a.checkout-button,
.esim-cart-totals .wc-proceed-to-checkout a.button {
  display: block; width: 100%; min-height: 50px; line-height: 50px; box-sizing: border-box;
  text-align: center; padding: 0; margin: 0 0 12px;
  background: linear-gradient(135deg, #2080F8, #1259C9); color: #fff;
  border: none; border-radius: 999px; font-size: 16px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(26, 115, 232, .32); text-decoration: none;
}
.esim-cart-totals .wc-proceed-to-checkout a.checkout-button:hover { filter: brightness(1.05); }
/* PayPal 智能按钮:与去结账及彼此留白,避免重叠 */
.esim-cart-totals .wc-proceed-to-checkout .ppc-button-wrapper { margin: 0 0 8px; }
.esim-cart-totals .wc-proceed-to-checkout .paypal-buttons { display: block; margin: 0 auto; }
.esim-cart-totals .wc-proceed-to-checkout .ppcp-messages { margin: 6px 0 0; }
/* 继续购买次按钮 */
.esim-continue-shopping {
  display: block; width: 100%; box-sizing: border-box; text-align: center; margin-top: 10px;
  min-height: 46px; line-height: 44px; padding: 0; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text); background: #fff; font-weight: 700; text-decoration: none;
}
.esim-continue-shopping:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- 空购物车 ---------- */
.woocommerce-cart .cart-empty.woocommerce-info { display: none; } /* 隐藏 WC 默认空文案,用自定义卡片 */
.cart-empty-box { max-width: 460px; margin: 30px auto; text-align: center;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 40px 24px; }
.cart-empty-box .ce-title { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.cart-empty-box .ce-sub { color: var(--muted); margin: 0 0 20px; }
.woocommerce-cart .return-to-shop { display: none; } /* 隐藏 WC 默认返回按钮 */

/* 加载态:整个表单变暗 */
.esim-cart-wrap.is-busy { position: relative; opacity: .55; pointer-events: none; transition: opacity .15s; }

/* ---------- 桌面端 ≥ 860px:左商品 + 右摘要(吸顶)---------- */
@media (min-width: 860px) {
  .esim-cart-wrap {
    grid-template-columns: minmax(0, 65fr) minmax(0, 35fr);
    align-items: start;
  }
  .esim-cart-totals { position: sticky; top: 84px; }
}
