/*
 * 购物车页（WooCommerce 块购物车）样式 —— 0.5.11 新增。
 *
 * 用户 2026-10-30 18:0x 原话：手机端购物车页「显示不居中、可随便滑动（横向溢出）」，
 * 视觉外观按结账页；代码放进 wp-otp-account。
 *
 * 真站形态（Lead 2026-10-30 实测，390 视口）：
 *   .ast-container             x=0  w=390 padding 20
 *   .elementor.elementor-7      x=20 w=350
 *   .e-con.e-con-boxed          x=70 w=350  margin-left/right 50（Elementor 生成）
 *   .e-con-inner                x=80 w=330  （外层 padding 10）
 *   .wp-block-woocommerce-cart  x=80 w=330  → 右缘 410 > 390，docScrollW 421
 *
 * 做法与结账页 0.5.10 phase 5 同一套：外层容器左右内边距归零，留白由本插件
 * 一次性给出；Elementor 容器的 50px 外边距必须显式归零（它的宽度是 100%，
 * 只清 padding 会把整块往右推）。
 *
 * 视觉（圆角 10 / 描边 #e3e6eb / 无卡片 / 按钮同套）与结账页 5.2 同值，
 * 不改变任何 Woo 购物车逻辑，纯 CSS，可整文件回滚。
 */

/* ---------------------------------------------------------------------------
 * 1. 视觉：与结账页/账户页同一套（圆角 10、hairline 描边、去卡片、无阴影）
 * ------------------------------------------------------------------------- */

/* 1.1 去卡片：容器链背景/边框/圆角/阴影全清（live 上块购物车本身无卡片，
    但有第三方优惠券小部件与 Elementor 包装层会带白底/描边）。 */
body.woocommerce-cart .site-content,
body.woocommerce-cart #primary,
body.woocommerce-cart .entry-content,
body.woocommerce-cart .elementor-element,
body.woocommerce-cart .elementor-widget-container,
body.woocommerce-cart .e-con,
body.woocommerce-cart .e-con-inner,
body.woocommerce-cart .wp-block-woocommerce-cart,
body.woocommerce-cart .wc-block-cart,
body.woocommerce-cart .wc-block-components-sidebar-layout {
	background: transparent !important;
	background-color: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
}

/* 1.2 商品图：圆角 10、hairline 描边（只管图片本身，不给单元格画框）。 */
body.woocommerce-cart .wc-block-cart-item__image img {
	border-radius: 10px;
	border: 1px solid #e3e6eb;
}

body.woocommerce-cart .wc-block-cart-item__image a {
	border-radius: 10px;
	overflow: hidden;
}

/* 1.3 数量框：圆角 10、hairline 描边（Woo 原生组件，只改外观）。 */
body.woocommerce-cart .wc-block-components-quantity-selector {
	border: 1px solid #e3e6eb;
	border-radius: 10px;
	background: #fff;
	overflow: hidden;
}

body.woocommerce-cart .wc-block-components-quantity-selector__input {
	border: 0;
	background: transparent;
}

body.woocommerce-cart .wc-block-components-quantity-selector__button {
	border: 0;
	background: transparent;
	color: #14161a;
}

body.woocommerce-cart .wc-block-components-quantity-selector__button:focus-visible {
	outline: 2px solid #1a73e8;
	outline-offset: -2px;
}

/* 1.4 按钮：与结账页同一套圆角/描边语言（不换颜色，颜色仍由主题决定）。 */
body.woocommerce-cart .wc-block-components-button,
body.woocommerce-cart .wc-block-components-button:not(.is-link),
body.woocommerce-cart .wc-block-cart__submit-button,
body.woocommerce-cart .wc-block-components-totals-coupon__button,
body.woocommerce-cart button.button,
body.woocommerce-cart .button,
body.woocommerce-cart input[type="submit"] {
	border-radius: 10px !important;
}

body.woocommerce-cart .wc-block-components-button:focus-visible,
body.woocommerce-cart .wc-block-cart__submit-button:focus-visible {
	outline: 3px solid rgba(26, 115, 232, 0.35);
	outline-offset: 2px;
}

/* 1.5 文本输入（优惠券、备注）：圆角 10、hairline 描边、聚焦环同账户页。 */
body.woocommerce-cart .wc-block-components-text-input input,
body.woocommerce-cart .wc-block-components-combobox .wc-block-components-combobox-control input.components-combobox-control__input,
body.woocommerce-cart .wc-block-components-totals-coupon__form input[type="text"],
body.woocommerce-cart input[type="text"],
body.woocommerce-cart input[type="email"],
body.woocommerce-cart textarea,
body.woocommerce-cart select {
	border: 1px solid #e3e6eb;
	border-radius: 10px;
	background-color: #fff;
	box-shadow: none;
}

body.woocommerce-cart .wc-block-components-text-input input:focus,
body.woocommerce-cart .wc-block-components-totals-coupon__form input[type="text"]:focus,
body.woocommerce-cart input[type="text"]:focus,
body.woocommerce-cart input[type="email"]:focus,
body.woocommerce-cart textarea:focus,
body.woocommerce-cart select:focus {
	border-color: #1a73e8;
	box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.14);
	outline: none;
}

/* 1.6 商品行分隔线用 hairline，不用卡片描边。 */
body.woocommerce-cart .wc-block-cart-items__row td {
	border-color: #e3e6eb;
}

body.woocommerce-cart .wc-block-components-totals-item,
body.woocommerce-cart .wc-block-components-order-summary-item__description {
	border-color: #e3e6eb;
}

/* ---------------------------------------------------------------------------
 * 2. 手机档几何：左右各 25、零横向滚动
 * ---------------------------------------------------------------------------
 * 真站 390 横向溢出 31（docScrollW 421）：Elementor `.e-con-boxed` 的
 * margin-left/right 50 在 width:100% 下把右缘推到 420。
 * 这里：外层 padding 归零 → Elementor 50px 外边距归零 → `.e-con-inner`
 * 统一给 25（这样同一容器里的标题/优惠券/购物车块全部对齐 25，而不是只有
 * 购物车块缩进）；非 Elementor 形态则由块自己给 25 兜底。
 * 桌面（>768）几何一个字节不动。
 * ------------------------------------------------------------------------- */
@media (max-width: 768px) {
	body.woocommerce-cart .site-content .ast-container,
	body.woocommerce-cart .site-content .entry-content,
	body.woocommerce-cart .site-content .elementor-element,
	body.woocommerce-cart .site-content .elementor-widget-container,
	body.woocommerce-cart #primary {
		padding-left: 0 !important;
		padding-right: 0 !important;
	}

	body.woocommerce-cart .site-content .e-con-boxed,
	body.woocommerce-cart .site-content .e-con {
		margin-left: 0 !important;
		margin-right: 0 !important;
	}

	body.woocommerce-cart .site-content .e-con-inner {
		padding-left: 25px !important;
		padding-right: 25px !important;
	}

	/* Elementor 形态：间距已由 .e-con-inner 的 25 给出，块自己不再缩进。 */
	body.woocommerce-cart .e-con-inner .wp-block-woocommerce-cart {
		margin-left: 0 !important;
		margin-right: 0 !important;
		width: 100% !important;
		max-width: 100% !important;
		box-sizing: border-box;
	}

	/* 兜底（无 Elementor 的经典建站）：块自己给左右 25。 */
	body.woocommerce-cart .wp-block-woocommerce-cart {
		margin-left: 25px !important;
		margin-right: 25px !important;
		width: auto !important;
		max-width: none !important;
		box-sizing: border-box;
	}

	/* 结账按钮与订单摘要等块内部组件不得把容器撑出屏幕。 */
	body.woocommerce-cart .wp-block-woocommerce-cart * {
		min-width: 0;
	}

	body.woocommerce-cart .wp-block-woocommerce-cart img {
		max-width: 100%;
		height: auto;
	}
}

/* ---------------------------------------------------------------------------
 * Astra 手机端头部购物车按钮（2026-10-30 用户 iPhone 15 报「看得到点不到」）。
 *
 * 根因（生产站实测）：Astra 输出 `#ast-mobile-header .ast-site-header-cart-li a
 * { pointer-events: none; }`，把点击交给侧滑小购物车（flyout）；但 /cart/ 与
 * /checkout/ 页面上主题**不输出** `.astra-cart-drawer` 抽屉节点，于是点击落在
 * 外层 div 上、没有任何 JS 响应 —— 按钮可见但点不动。
 *
 * 修法：只在这两个页面（各自作用域已经限定）把链接的可点区域还回去，点击即跳
 * 购物车页。选择器比主题那条多一个 body 类与一个类型选择器，优先级更高，且不与
 * 首页/其它页的侧滑行为冲突（那些页面没有 body.woocommerce-cart）。
 * ------------------------------------------------------------------------- */
body.woocommerce-cart #ast-mobile-header .ast-site-header-cart-li a,
body.woocommerce-cart .ast-header-woo-cart .cart-container {
	pointer-events: auto;
}

/* ---------------------------------------------------------------------------
 * 0.5.13：手机端购物车页「继续结账」下面的底部大白边。
 *
 * 真站结构（Elementor 模板）：.e-con-inner 是 flex 列容器，里面只有一个
 * Text Editor 小组件；小组件被 flex 拉伸到 995px，而购物车块只有 396px
 * —— 390 视口实测「按钮→页脚」空白 481px（2026-10-31 生产实测）。
 *
 * 与结账页 0.5.12 同一条思路：窄档把容器还原成普通块级流，再让 Elementor
 * 容器的 50px 下外边距和购物车块自己的 16px 下外边距归零。实测 390：
 * 空白 481 → 107px，文档 1238 → 844px（= 一屏），购物车内容与按钮位置不变。
 *
 * 只作用于 ≤1024px：桌面购物车页（1440）本体没有这条拉伸，一个字节不动。
 * ------------------------------------------------------------------------- */
@media (max-width: 1024px) {
	body.woocommerce-cart .site-content .e-con-inner {
		display: block !important;
	}

	body.woocommerce-cart .site-content .e-con {
		margin-bottom: 0 !important;
	}

	body.woocommerce-cart .wc-block-cart {
		margin-bottom: 0 !important;
	}
}
/* =========================================================================
 * 0.5.20（用户 2026-11-01，AMENDMENT 3）：购物车「继续结账」圆角改药丸
 * -------------------------------------------------------------------------
 * 只换圆角：高度 / 字号 / 内边距 / 颜色 / 底色一行不动（Lead 生产实测高度 44px，
 * 本批不写任何 height / min-height）。上面 1.4 的旧分组规则保持原样、一个字不改，
 * 这条独立规则只命中提交按钮。
 *
 * 为什么选择器要带 .wc-block-components-button：旧组里那条
 * body.woocommerce-cart .wc-block-components-button:not(.is-link) 的特异性是
 * 0-3-1，比 body.woocommerce-cart .wc-block-cart__submit-button（0-2-1）高 ——
 * 实测只写后一条时圆角仍是 10px（scripts/_probe-0520-cart2.mjs 输出 radius=10px）。
 * 把同一组类并列进来（0-3-1）后靠「顺序在后 + !important」压过旧组，仍然只命中
 * 提交按钮；对照节点（不含 submit 类）实测仍是 10px。
 * ========================================================================= */
body.woocommerce-cart .wc-block-components-button.wc-block-cart__submit-button,
body.woocommerce-cart .wc-block-cart__submit-button {
	border-radius: 999px !important;
}

/* =========================================================================
 * account 0.9.17（INBOX 项 2）：块购物车数量步进器 —— 数字旁空白收窄、
 * 加减号不再被挤压
 * -------------------------------------------------------------------------
 * 归因（2026-11-08 真 Chrome 实测，390 / 1440）：
 *   - 改前输入框是 flex-grow:1 的宽盒（390 实测 69.3–86.7px 宽、padding
 *     12px 16px），数字墨迹居中后左右各留 ~35–40px 空白，加减号被推到两边；
 *   - ≤768 的 `body.woocommerce-cart .wp-block-woocommerce-cart * { min-width:0 }`
 *     还会让按钮被压到 7.13px 宽（Woo 原生 30px）。
 *   - 运行期删掉本文件后 1440 的盒子宽度不变（145px）——宽输入框来自
 *     Woo/Astra 原生 flex-grow，不是我们旧规则；按钮被压扁才是上面那条
 *     min-width:0 的连带。
 * 修法：容器 inline-flex / width:auto 且不 grow；输入框固定 32、text-align
 * center、padding 0；两个按钮固定 32 且显式 min-width:32（压过 min-width:0）。
 * 桌面与手机同一套；只改外观，不改 Woo 组件结构与任何购物车逻辑。
 * ========================================================================= */
body.woocommerce-cart .wc-block-components-quantity-selector {
	display: inline-flex;
	align-items: stretch;
	width: auto;
	min-width: 0;
	max-width: 100%;
	height: 43px;
	flex-grow: 0;
	flex-shrink: 0;
	overflow: hidden;
	box-sizing: border-box;
}

body.woocommerce-cart .wc-block-components-quantity-selector__input {
	flex: 0 0 32px;
	width: 32px;
	min-width: 32px;
	height: 41px;
	padding: 0 0 0 1px;
	text-align: center;
	-moz-appearance: textfield;
}

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

body.woocommerce-cart .wc-block-components-quantity-selector__button {
	flex: 0 0 32px;
	width: 32px;
	min-width: 32px;
	height: 41px;
	padding: 0;
}
