/* ==========================================================================
   Westmore —— 结账页（R15：Shopify 原生结账模板口径）
   作用域：form.checkout.wm-co 内的全部视觉；不改 Woo 结账逻辑。
   数值：容器 1080 / padding 0 16 / 栅格 1fr + clamp(320px,33%,400px) / gap clamp(32px,4vw,56px)
   ========================================================================== */

.wm-checkout-page { max-width: 1080px; margin: 0 auto; padding: 28px 16px 72px; }
.wm-checkout-page__title { font-size: 30px; text-align: center; margin-bottom: 22px; }

.wm-co {
  --wm-co-line: #e6e6e6;
  --wm-co-hair: #eeeeee;
  --wm-co-field: #d9d9d9;
  --wm-co-ink: #111111;
  --wm-co-muted: #6b6b6b;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  color: var(--wm-co-ink);
  font-family: var(--f-body);
}

/* 宽屏两栏：左表单 / 右摘要（整块白卡 sticky） */
@media screen and (min-width: 990px) {
  .wm-co {
    grid-template-columns: minmax(0, 1fr) clamp(320px, 33%, 400px);
    column-gap: clamp(32px, 4vw, 56px);
    align-items: start;
  }
  .wm-co #customer_details { grid-column: 1; grid-row: 1; }
  .wm-co #order_review { display: contents; }
  .wm-co #payment { grid-column: 1; grid-row: 2; }
  .wm-co .wm-sum {
    grid-column: 2; grid-row: 1 / span 2;
    position: sticky; top: 16px;
    background: #fff; border: 1px solid var(--wm-co-line); border-radius: 12px;
    padding: 16px;
  }
}

/* 区块 */
.wm-co-section { padding: 0 0 22px; margin: 0 0 22px; border-bottom: 1px solid var(--wm-co-hair); }
.wm-co-section:last-child { border-bottom: 0; }
.wm-co-h { font-family: var(--f-disp); font-size: 19px; font-weight: 400; margin: 0 0 12px; }
.wm-co-hint { font-size: 13px; color: var(--wm-co-muted); margin: 0; }

/* 字段基础 */
.wm-co .form-row { margin: 0 0 12px; padding: 0; }
.wm-co .form-row label {
  display: block; font-size: 13px; color: #4a4a4a; margin: 0 0 6px; font-weight: 400;
}
.wm-co .form-row .required { color: #b32d2e; text-decoration: none; }
.wm-co input.input-text,
.wm-co select,
.wm-co textarea {
  height: 48px; font-size: 16px; line-height: 46px; border: 1px solid var(--wm-co-field);
  border-radius: 8px; padding: 0 14px; width: 100%; box-sizing: border-box;
  background: #fff; color: var(--wm-co-ink); box-shadow: none;
  -webkit-appearance: none; appearance: none;
}
.wm-co input.input-text:focus,
.wm-co select:focus,
.wm-co textarea:focus { border-color: #111; outline: none; box-shadow: 0 0 0 1px #111 inset; }
.wm-co .form-row .woocommerce-input-wrapper { display: block; width: 100%; }

/* 6 栅格：每行刚好铺满（R17） */
.wm-co .woocommerce-billing-fields__field-wrapper,
.wm-co .wm-co-fields {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  column-gap: 14px !important;
  row-gap: 12px !important;
  align-items: start;
}
.wm-co .wm-co-fields .form-row {
  width: 100% !important; max-width: 100% !important; float: none !important;
  display: block !important; margin: 0 !important; padding: 0 !important; min-width: 0;
}
.wm-co .wm-co-fields .form-row-wide { grid-column: 1 / -1 !important; }
.wm-co .wm-co-fields .form-row-first,
.wm-co .wm-co-fields .form-row-last { grid-column: span 3 !important; }
.wm-co .wm-co-fields .form-row-third { grid-column: span 2 !important; }

/* Contact 行 */
.wm-co-contact-row { display: flex; align-items: flex-end; gap: 14px; }
.wm-co-contact-row .form-row { flex: 1 1 100%; margin: 0; }
.wm-co-signin { display: none !important; }

/* live tracking 勾选 */
.wm-co .form-row.wm-checkbox-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; }
.wm-co .form-row.wm-checkbox-row label { display: inline-flex; align-items: center; gap: 10px; margin: 0; font-size: 13px; color: #333; }
.wm-co .form-row.wm-checkbox-row input[type="checkbox"] {
  width: 18px; height: 18px; min-height: 0; margin: 0; border: 1px solid var(--wm-co-field); border-radius: 4px;
}

/* 右栏摘要 */
.wm-sum__item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; }
.wm-sum__item + .wm-sum__item { border-top: 1px solid var(--wm-co-hair); }
.wm-sum__thumb { position: relative; width: 48px; height: 48px; border-radius: 8px; border: 1px solid var(--wm-co-hair); background: #fafafa; }
.wm-sum__thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; display: block; }
.wm-sum__qty {
  position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px; padding: 0 5px;
  background: #6b6b6b; color: #fff; border-radius: 999px; font-size: 11px; line-height: 20px; text-align: center;
}
.wm-sum__name { font-size: 13px; line-height: 1.4; color: #333; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.wm-sum__line { font-size: 14px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wm-sum__totals { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--wm-co-hair); }
.wm-sum__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; padding: 6px 0; font-variant-numeric: tabular-nums; }
.wm-sum__row--total { border-top: 1px solid var(--wm-co-hair); margin-top: 8px; padding-top: 12px; font-size: 17px; font-weight: 700; }
.wm-sum__cur { font-size: 12px; color: var(--wm-co-muted); margin-right: 4px; font-weight: 400; }

/* 支付区 */
.wm-co #payment,
.wm-co #payment.woocommerce-checkout-payment {
  background: transparent !important; border: 0 !important; padding: 0 !important; margin: 0 !important;
}
.wm-co #payment .payment_box,
.wm-co #payment .payment_box.payment_method_wm_card {
  background: transparent !important; border: 0 !important; padding: 0 !important; margin: 0 !important;
  box-shadow: none !important;
}
.wm-co #payment .payment_box::before { display: none !important; }
.wm-co #payment ul.payment_methods { list-style: none; margin: 0 0 16px; padding: 0; }
.wm-co #payment ul.payment_methods li { margin: 0 0 12px; }
.wm-co #payment .wc_payment_method label { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; margin: 0 0 10px; }
.wm-co #payment .luckpayex-card-brands { display: inline-flex; align-items: center; gap: 6px; }
.wm-co #payment .luckpayex-card-brands img { width: 32px; height: 21px; }

/* 卡字段：卡号整行 / 有效期 + CVV 两列 */
.wm-co #payment .mvbas-card { border: 0; padding: 0; margin: 0; }
.wm-co #payment .mvbas-card__field { margin: 0 0 12px; }
.wm-co #payment .mvbas-card__field > label { display: block; font-size: 13px; color: #4a4a4a; margin: 0 0 6px; }
.wm-co #payment .mvbas-card__field input.input-text {
  height: 48px; font-size: 16px; border: 1px solid var(--wm-co-field); border-radius: 8px; padding: 0 14px; width: 100%;
  box-sizing: border-box; background: #fff;
}
.wm-co #payment .mvbas-card__field input.input-text:focus { border-color: #111; box-shadow: 0 0 0 1px #111 inset; outline: none; }
.wm-co #payment .mvbas-card__number-wrap { position: relative; }
.wm-co #payment .mvbas-card__number-wrap > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #9aa0a6; display: inline-flex; }
.wm-co #payment .mvbas-card__number-wrap input { padding-right: 46px; }
.wm-co #payment .mvbas-card__row { display: flex; gap: 12px; }
.wm-co #payment .mvbas-card__row .mvbas-card__field { flex: 1 1 50%; min-width: 0; }
.wm-co #payment .mvbas-card__field small { display: block; font-size: 12px; color: var(--wm-co-muted); margin-top: 4px; }
.wm-co #payment .mvbas-card__footer { font-size: 12px; color: var(--wm-co-muted); margin: 2px 0 14px; }

/* Place order */
.wm-co #payment #place_order {
  display: block; width: 100%; min-height: 52px; font-size: 15px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  border-radius: 10px; background: #111; color: #fff; border: 0; box-shadow: none;
}
.wm-co #payment #place_order:hover { background: #000; color: #fff; }
.wm-co .woocommerce-terms-and-conditions-wrapper { font-size: 13px; margin-bottom: 12px; }
.wm-co .woocommerce-privacy-policy-text p { font-size: 12px; color: var(--wm-co-muted); }
.wm-co #wm-shipping-hint { margin: 0 0 6px; }
.wm-co .wm-co-shipping-mirror:empty { display: none; }
.wm-co .wm-co-shipping-mirror { font-size: 14px; color: #333; }

/* Woo 默认灰盒/粗框全部停用 */
.wm-co table.shop_table { border: 0; }
.wm-co .col2-set, .wm-co #customer_details { width: 100% !important; max-width: 100% !important; float: none !important; }
.wm-co .col2-set .col-1 { width: 100% !important; max-width: 100% !important; float: none !important; padding: 0 !important; }

/* ===== 字段顺序与跨列（用 id 锁死，不依赖 DOM 顺序）=====
   Country 满行 → First/Last 3+3 → Address 满行 → Apartment 满行 → City/State/ZIP 2+2+2 → Phone 满行 */
.wm-co #billing_country_field     { order: 1; grid-column: 1 / -1 !important; }
.wm-co #billing_first_name_field  { order: 2; grid-column: span 3 !important; }
.wm-co #billing_last_name_field   { order: 3; grid-column: span 3 !important; }
.wm-co #billing_address_1_field   { order: 4; grid-column: 1 / -1 !important; }
.wm-co #billing_address_2_field   { order: 5; grid-column: 1 / -1 !important; }
.wm-co #billing_city_field        { order: 6; grid-column: span 2 !important; }
.wm-co #billing_state_field       { order: 7; grid-column: span 2 !important; }
.wm-co #billing_postcode_field    { order: 8; grid-column: span 2 !important; }
.wm-co #billing_phone_field       { order: 9; grid-column: 1 / -1 !important; }
@media screen and (max-width: 749px) {
  .wm-co #billing_first_name_field,
  .wm-co #billing_last_name_field,
  .wm-co #billing_city_field,
  .wm-co #billing_state_field,
  .wm-co #billing_postcode_field { grid-column: 1 / -1 !important; }
}

/* 窄屏：单列，摘要置顶成普通卡片 */
@media screen and (max-width: 989px) {
  .wm-co { gap: 16px; }
  .wm-co .wm-sum { background: #fff; border: 1px solid var(--wm-co-line); border-radius: 12px; padding: 14px; margin-bottom: 4px; }
  .wm-co .wm-co-fields .form-row-third { grid-column: span 2 !important; }
}
@media screen and (max-width: 749px) {
  .wm-co .woocommerce-billing-fields__field-wrapper,
  .wm-co .wm-co-fields { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .wm-co .form-row-first, .wm-co .form-row-last,
  .wm-co .form-row-third, .wm-co .form-row-wide { grid-column: 1 / -1 !important; }
  .wm-checkout-page { padding: 18px 16px 48px; }
  .wm-checkout-page__title { font-size: 24px; }
}
