/**
 * Custom Payment Workflow — cart page styles.
 *
 * Two-column cart: a 3-step progress bar on top (step 1 active), a functional
 * cart table + discount block on the left (62%) and an order-summary card with
 * the proceed button on the right (35%).
 *
 * All classes are scoped under `.cpw-cart` to avoid clashing with the theme and
 * the plugin's other `.cpw-*` styles. Reuses the same design tokens as
 * cpw-checkout.css (#f5f5f5 header, #fff7dc discount, #e8f4fc notice, gray
 * stepper circles, gray buttons).
 */

.cpw-cart {
	max-width: 1280px;
	margin: 0 auto;
	color: #111;
	font-size: 14px;
	line-height: 1.5;
}

/* ----------------------------------------------------------------
 * 3-step progress indicator
 * ---------------------------------------------------------------- */
.cpw-cart .cpw-checkout-steps {
	list-style: none;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	margin: 0 0 32px;
	padding: 0;
}

.cpw-cart .cpw-checkout-step {
	position: relative;
	flex: 1 1 0;
	max-width: 220px;
	text-align: center;
}

.cpw-cart .cpw-checkout-step + .cpw-checkout-step::before {
	content: "";
	position: absolute;
	top: 19px;
	left: -50%;
	width: 100%;
	height: 1px;
	background: #dcdcdc;
	z-index: 0;
}

.cpw-cart .cpw-checkout-step__dot {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0 auto 8px;
	border: 1px solid #dcdcdc;
	border-radius: 50%;
	background: #fff;
	color: #b0b0b0;
	font-weight: 700;
	font-size: 14px;
}

.cpw-cart .cpw-checkout-step__label {
	display: block;
	font-size: 14px;
	font-weight: 500;
	color: #9a9a9a;
}

.cpw-cart .cpw-checkout-step--active .cpw-checkout-step__dot {
	border-color: #6b6b6b;
	background: #6b6b6b;
	color: #fff;
}

.cpw-cart .cpw-checkout-step--active .cpw-checkout-step__label {
	color: #333;
}

/* ----------------------------------------------------------------
 * Two-column layout — 55% / 45% / 20px
 * ---------------------------------------------------------------- */
.cpw-cart-layout {
	display: grid;
	grid-template-columns: minmax(0, 55fr) minmax(0, 45fr);
	gap: 20px;
	align-items: start;
	margin-top: 20px;
}

.cpw-cart-selection {
	min-width: 0;
}

.cpw-cart-side {
	min-width: 0;
	position: sticky;
	top: 24px;
}

/* ----------------------------------------------------------------
 * Cards — "購物車 (N 件)" / "訂單資訊"
 * ---------------------------------------------------------------- */
.cpw-cart .cpw-card {
	background: #fff;
	border: 1px solid #e2e2e2;
	border-radius: 8px;
	overflow: hidden;
}

.cpw-cart .cpw-card__header {
	padding: 14px 20px;
	background: #f5f5f5;
	border-bottom: 1px solid #e2e2e2;
}

.cpw-cart .cpw-card__title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	color: #111;
}

.cpw-cart .cpw-card__icon {
	flex: 0 0 auto;
	color: #6b6b6b;
}

.cpw-cart .cpw-card__body {
	padding: 16px 20px;
}

/* help "?" icon next to 折抵購物金 */
.cpw-cart .cpw-help {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	margin-left: 4px;
	padding: 0;
	border: 1px solid #b5b5b5;
	border-radius: 50%;
	background: #fff;
	color: #888;
	font-size: 11px;
	font-weight: 600;
	line-height: 1;
	cursor: help;
}

.cpw-cart .cpw-help:hover {
	color: #333;
	border-color: #6b6b6b;
}

/* ----------------------------------------------------------------
 * Cart notice
 * ---------------------------------------------------------------- */
.cpw-cart-notice {
	margin-bottom: 14px;
	padding: 10px 14px;
	background: #fff7dc;
	border: 1px solid #f2e6b8;
	border-radius: 6px;
	font-size: 13px;
	color: #6b5a1f;
}

/* ----------------------------------------------------------------
 * Cart table
 * ---------------------------------------------------------------- */
.cpw-cart-table {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
	border: 1px solid #e2e2e2;
	border-radius: 8px;
	overflow: hidden;
}

.cpw-cart-table th {
	padding: 10px 12px;
	font-size: 13px;
	font-weight: 600;
	color: #555;
	text-align: left;
	border-bottom: 1px solid #e2e2e2;
	white-space: nowrap;
	background: #f5f5f5;
}

.cpw-cart-table td {
	padding: 14px 12px;
	border-bottom: 1px solid #f0f0f0;
	vertical-align: middle;
}

.cpw-cart-table tbody tr:last-child td {
	border-bottom: 0;
}

.cpw-cart-item__product {
	display: flex;
	align-items: center;
	gap: 12px;
}

.cpw-cart-item__product > a img,
.cpw-cart-item__product > img {
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 6px;
	border: 1px solid #e2e2e2;
}

.cpw-cart-item__info {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.cpw-cart-item__name {
	font-size: 14px;
	font-weight: 600;
	color: #111;
}

.cpw-cart-item__name a {
	color: #111;
	text-decoration: none;
}

.cpw-cart-item__name a:hover {
	text-decoration: underline;
}

.cpw-cart-item__info .variation,
.cpw-cart-item__info dl.variation,
.cpw-cart-item__info .wc-item-meta {
	margin: 0;
	font-size: 12px;
	color: #999;
}

.cpw-cart-item__info dl.variation dt,
.cpw-cart-item__info dl.variation dd {
	display: inline;
	margin: 0;
}

.cpw-cart-item__discount {
	color: #999;
}

.cpw-cart-item__price,
.cpw-cart-item__subtotal {
	font-weight: 600;
	color: #111;
	white-space: nowrap;
}

/* quantity selector */
.cpw-cart-item__qty .quantity {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid #d0d0d0;
	border-radius: 6px;
	overflow: hidden;
}

.cpw-cart-item__qty .quantity input.qty {
	width: 48px;
	height: 34px;
	padding: 0;
	border: 0;
	text-align: center;
	font-size: 14px;
	color: #111;
	-moz-appearance: textfield;
}

.cpw-cart-item__qty .quantity input.qty::-webkit-outer-spin-button,
.cpw-cart-item__qty .quantity input.qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.cpw-cart-item__qty .quantity button,
.cpw-cart-item__qty .quantity .qty-btn {
	width: 30px;
	height: 34px;
	border: 0;
	background: #fafafa;
	color: #555;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
}

.cpw-cart-item__qty .quantity button:hover,
.cpw-cart-item__qty .quantity .qty-btn:hover {
	background: #eee;
}

/* remove button */
.cpw-cart-item__remove a {
	display: inline-block;
	width: 24px;
	height: 24px;
	line-height: 22px;
	text-align: center;
	font-size: 18px;
	color: #999;
	text-decoration: none;
	border: 1px solid #e2e2e2;
	border-radius: 50%;
}

.cpw-cart-item__remove a:hover {
	color: #333;
	border-color: #bbb;
}

/* hidden update button — quantity changes auto-refresh via cpw-cart.js */
.cpw-cart-update {
	display: none;
}

/* ----------------------------------------------------------------
 * Discount block (#fff7dc)
 * ---------------------------------------------------------------- */
.cpw-cart-discounts {
	margin-top: 14px;
	padding: 12px 14px;
	background: #fff7dc;
	border-radius: 6px;
}

.cpw-cart-discounts__row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 4px 0;
	font-size: 13px;
	color: #6b5a1f;
}

.cpw-cart-discounts__value {
	font-weight: 600;
}

/* ----------------------------------------------------------------
 * Left — 選擇送貨及付款方式 blocks
 * ---------------------------------------------------------------- */
.cpw-cart .cpw-block {
	padding: 16px 0;
	border-top: 1px solid #f0f0f0;
}

.cpw-cart .cpw-block:first-child {
	border-top: 0;
	padding-top: 0;
}

.cpw-cart .cpw-block__title {
	margin: 0 0 14px;
	font-size: 15px;
	font-weight: 700;
	color: #111;
}

.cpw-cart .cpw-delivery-location,
.cpw-cart .cpw-shipping-method,
.cpw-cart .cpw-method-select,
.cpw-cart .cpw-pickup-cascade__select,
.cpw-cart .cpw-pickup-cascade__input {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #d0d0d0;
	border-radius: 6px;
	background: #fff;
	font-size: 14px;
	color: #111;
}

.cpw-cart .cpw-delivery-location:focus,
.cpw-cart .cpw-shipping-method:focus,
.cpw-cart .cpw-method-select:focus,
.cpw-cart .cpw-pickup-cascade__select:focus,
.cpw-cart .cpw-pickup-cascade__input:focus {
	border-color: #6b6b6b;
	outline: none;
	box-shadow: 0 0 0 2px rgba(107, 107, 107, 0.14);
}

.cpw-cart .cpw-shipping-desc {
	margin-top: 12px;
	padding: 14px 16px;
	background: #fafafa;
	border: 1px solid #eee;
	border-radius: 6px;
	font-size: 13px;
	color: #555;
	line-height: 1.7;
}

/* pickup-store cascade */
.cpw-cart .cpw-pickup-cascade {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 14px;
}

.cpw-cart .cpw-pickup-cascade__row {
	margin: 0 0 12px;
}

.cpw-cart .cpw-pickup-cascade__row label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #444;
	margin-bottom: 4px;
}

.cpw-cart .cpw-pickup-cascade__select:disabled {
	background: #f6f6f6;
	color: #aaa;
}

.cpw-cart .cpw-pickup-cascade__store {
	display: block;
	padding: 10px 12px;
	border: 1px solid #eee;
	border-radius: 6px;
	background: #fafafa;
	font-size: 14px;
	color: #111;
}

/* payee panel (以下是入數資料 + QR + warnings) */
.cpw-cart .cpw-payee {
	margin-top: 14px;
	padding: 16px;
	border: 1px solid #e2e2e2;
	border-radius: 6px;
	background: #fafafa;
}

.cpw-cart .cpw-payee__title {
	margin: 0 0 10px;
	font-size: 14px;
	font-weight: 700;
	color: #111;
}

.cpw-cart .cpw-payee__notes {
	font-size: 13px;
	color: #444;
	line-height: 1.7;
}

.cpw-cart .cpw-payee__notes p {
	margin: 0 0 8px;
}

.cpw-cart .cpw-payee__notes p:last-child {
	margin-bottom: 0;
}

.cpw-cart .cpw-payee__qr {
	margin: 14px 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
}

.cpw-cart .cpw-payee__qr img {
	max-width: 180px;
	height: auto;
	border: 1px solid #e2e2e2;
	border-radius: 6px;
}

.cpw-cart .cpw-payee__qr::before,
.cpw-cart .cpw-payee__qr::after {
	content: "";
	width: 4px;
	height: 120px;
	background: #4a90d9;
	border-radius: 2px;
}

.cpw-cart .cpw-payee__notice {
	margin-top: 12px;
}

.cpw-cart .cpw-payee__warnings {
	list-style: none;
	margin: 0;
	padding: 0;
}

.cpw-cart .cpw-payee__warnings li {
	position: relative;
	padding-left: 18px;
	margin-bottom: 6px;
	font-size: 13px;
	color: #b03a2e;
	line-height: 1.6;
}

.cpw-cart .cpw-payee__warnings li::before {
	content: "▼";
	position: absolute;
	left: 0;
	top: 0;
	font-size: 10px;
	color: #e74c3c;
}

/* ----------------------------------------------------------------
 * Right — order summary card
 * ---------------------------------------------------------------- */
.cpw-cart-totals {
	background: #fff;
	border: 1px solid #e2e2e2;
	border-radius: 8px;
	overflow: hidden;
	padding: 20px;
}

.cpw-cart-totals__row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 6px 0;
	font-size: 14px;
}

.cpw-cart-totals__label {
	color: #555;
}

.cpw-cart-totals__value {
	font-weight: 600;
	color: #111;
}

.cpw-cart-totals__row--discount .cpw-cart-totals__value {
	color: #c0392b;
}

.cpw-cart-totals__balance {
	display: block;
	margin-top: 2px;
	font-size: 12px;
	font-weight: 400;
	color: #888;
}

.cpw-cart-totals__row--coupon .cpw-cart-totals__value {
	color: #c0392b;
}

.cpw-cart-totals__row--coupon .cpw-cart-totals__label .amount {
	color: #555;
}

/* blue notice box */
.cpw-cart-totals__notice {
	margin: 10px 0;
	padding: 10px 14px;
	background: #e8f4fc;
	border: 1px solid #cfe4f2;
	border-radius: 6px;
	font-size: 13px;
	color: #27627f;
	line-height: 1.5;
}

/* coupon + referral — text link that reveals the inline input on click */
.cpw-cart-totals__coupon,
.cpw-cart-totals__referral {
	margin-top: 10px;
}

.cpw-cart-totals__toggle {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	color: #6b6b6b;
	font-size: 14px;
	line-height: 1.4;
	text-align: left;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.cpw-cart-totals__toggle:hover {
	color: #111;
}

.cpw-cart-totals__toggle-body {
	display: none; /* hidden until the container gains .is-open */
	gap: 8px;
}

/* in-place swap: the input replaces the text at the same spot, no new line */
.cpw-cart-totals__coupon.is-open .cpw-cart-totals__toggle,
.cpw-cart-totals__referral.is-open .cpw-cart-totals__toggle {
	display: none;
}

.cpw-cart-totals__coupon.is-open .cpw-cart-totals__toggle-body,
.cpw-cart-totals__referral.is-open .cpw-cart-totals__toggle-body {
	display: flex;
}

.cpw-cart-totals__coupon-input,
.cpw-cart-totals__referral-input {
	flex: 1 1 auto;
	padding: 10px 12px;
	border: 1px solid #d0d0d0;
	border-radius: 6px;
	font-size: 14px;
	color: #111;
}

.cpw-cart-totals__coupon-btn,
.cpw-cart-totals__referral-btn {
	flex: 0 0 auto;
	padding: 10px 18px;
	border: 1px solid #6b6b6b;
	border-radius: 6px;
	background: #6b6b6b;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.cpw-cart-totals__coupon-btn:hover,
.cpw-cart-totals__referral-btn:hover {
	background: #555;
	border-color: #555;
}

/* total row */
.cpw-cart-totals__row--total {
	margin-top: 8px;
	padding-top: 12px;
	border-top: 1px solid #e2e2e2;
}

.cpw-cart-totals__row--total .cpw-cart-totals__label,
.cpw-cart-totals__row--total .cpw-cart-totals__value {
	font-size: 16px;
	font-weight: 700;
	color: #111;
}

/* gift-money reward line */
.cpw-cart-totals__rewards {
	margin-top: 12px;
	font-size: 13px;
	color: #888;
	text-align: center;
}

/* proceed button — gray style */
.cpw-proceed {
	margin-top: 16px;
}

.cpw-proceed__button {
	display: block;
	width: 100%;
	padding: 13px 20px;
	border: 1px solid #6b6b6b;
	border-radius: 8px;
	background: #6b6b6b;
	color: #fff;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.cpw-proceed__button:hover {
	background: #555;
	border-color: #555;
}

/* grayed out until 送貨地點 + 取貨門市 + 付款方式 are chosen */
.cpw-proceed__button.is-disabled,
.cpw-proceed__button.is-disabled:hover {
	border-color: #b5b5b5;
	background: #d0d0d0;
	color: #6b6b6b;
	cursor: not-allowed;
}

/* ----------------------------------------------------------------
 * Cross-sells
 * ---------------------------------------------------------------- */
.cpw-cart .cart-collaterals {
	margin-top: 20px;
}

/* ----------------------------------------------------------------
 * Responsive
 * ---------------------------------------------------------------- */
@media (max-width: 1024px) {
	.cpw-cart-layout {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.cpw-cart-side {
		position: static;
	}
}

@media (max-width: 640px) {
	.cpw-cart .cpw-checkout-steps {
		margin-bottom: 22px;
	}

	.cpw-cart .cpw-checkout-step__dot {
		width: 34px;
		height: 34px;
		font-size: 13px;
	}

	.cpw-cart .cpw-checkout-step + .cpw-checkout-step::before {
		top: 16px;
	}

	.cpw-cart-table th,
	.cpw-cart-table td {
		padding: 8px 6px;
		font-size: 12px;
	}

	.cpw-cart-item__product > a img,
	.cpw-cart-item__product > img {
		width: 40px;
		height: 40px;
	}

	.cpw-cart .cpw-pickup-cascade {
		grid-template-columns: 1fr;
	}

	.cpw-cart-totals {
		padding: 14px;
	}
}

/* ----------------------------------------------------------------
 * Theme override — minimog pins .cart_totals to 360px inside its
 * "border-block" page layouts. Force it full width.
 *
 * IMPORTANT: minimog puts `.page-blocks-style-border-block-0X` on the
 * <body> element itself, so the two body classes must be chained on the
 * same element (dot, no descendant space). A descendant selector like
 * `body.woocommerce-cart .page-blocks-style-border-block-03 .cart_totals`
 * never matches and leaves the theme's 360px in effect.
 * ---------------------------------------------------------------- */
body.woocommerce-cart.page-blocks-style-border-block-02 .cart_totals,
body.woocommerce-cart.page-blocks-style-border-block-03 .cart_totals {
	width: 100%;
}
