/* Final purchase-flow safeguards. Kept last in the cascade intentionally. */
.zc-commerce-hero {
	min-height: 150px !important;
	padding: clamp(22px, 3vw, 36px) !important;
}

.zc-commerce-hero h1,
.woocommerce-shell main h1.entry-title,
.woocommerce-shell h1.entry-title {
	max-width: 22ch !important;
	margin: 0 !important;
	font-size: clamp(1.55rem, 2.6vw, 2.2rem) !important;
	line-height: 1.35 !important;
	letter-spacing: -.025em !important;
}

/* Cart, checkout and order-pay are WordPress pages, so their visible title is
   emitted by page.php (.zc-page-header), not by the WooCommerce hero. */
.zc-page > .zc-page-content > .zc-page-header {
	margin: 0 0 clamp(18px, 2vw, 26px) !important;
}

.zc-page > .zc-page-content > .zc-page-header h1 {
	max-width: none !important;
	margin: 0 !important;
	font-size: clamp(1.55rem, 2.2vw, 2rem) !important;
	line-height: 1.35 !important;
	letter-spacing: -.035em !important;
}

body.woocommerce-cart main.zc-page,
body.woocommerce-checkout main.zc-page {
	padding-top: clamp(20px, 2.4vw, 34px) !important;
}

body.woocommerce-checkout .zc-checkout-intro {
	margin-bottom: 20px !important;
	padding: 16px 18px !important;
	border-radius: 16px !important;
	box-shadow: none !important;
}

body.woocommerce-checkout .zc-checkout-intro ul {
	gap: 6px 14px !important;
}

.product-name .zc-checkout-product__content {
	display: flex !important;
	flex-flow: column nowrap !important;
	align-items: flex-start !important;
	gap: 8px !important;
}

.zc-checkout-product__title {
	order: 1 !important;
	display: block !important;
	width: 100% !important;
}

.zc-checkout-item-quantity {
	order: 2 !important;
	align-self: flex-start !important;
	display: inline-flex !important;
	width: max-content !important;
	max-width: 100% !important;
	margin: 0 !important;
	padding: 3px 9px !important;
}

.zc-order-pay-quantity {
	order: 2 !important;
	display: inline-flex !important;
	align-items: center !important;
	width: max-content !important;
	max-width: 100% !important;
	margin: 0 !important;
	padding: 4px 10px !important;
	border: 1px solid #bfdbfe !important;
	border-radius: 999px !important;
	background: #eff6ff !important;
	color: #1d4ed8 !important;
	font-size: .78rem !important;
	font-weight: 850 !important;
	line-height: 1.5 !important;
}

.product-name .zc-checkout-item-details,
.product-name details {
	order: 3 !important;
	width: 100% !important;
}

@media (min-width: 1181px) {
	body.woocommerce-checkout form.checkout {
		display: grid !important;
		grid-template-columns: minmax(540px, 1.12fr) minmax(440px, .88fr) !important;
		gap: 28px !important;
	}

	body.woocommerce-checkout #customer_details {
		grid-column: 1 !important;
		grid-row: 1 !important;
		align-self: start !important;
	}

	body.woocommerce-checkout .zc-order-summary-column {
		grid-column: 2 !important;
		grid-row: 1 !important;
		position: sticky;
		top: 88px;
		align-self: start !important;
		height: auto;
		min-width: 0;
		padding: 14px !important;
		border: 1px solid #dbe4f0 !important;
		border-radius: 18px !important;
		background: #fff !important;
		box-shadow: 0 10px 28px rgba(15, 23, 42, .045) !important;
	}

	body.woocommerce-checkout #order_review_heading,
	body.woocommerce-checkout #order_review {
		grid-column: auto !important;
		grid-row: auto !important;
		align-self: start !important;
	}

	body.woocommerce-checkout #order_review_heading {
		z-index: 2 !important;
		margin: 0 0 10px !important;
		padding: 8px 10px !important;
		pointer-events: none !important;
	}

	body.woocommerce-checkout #order_review {
		padding: 0 !important;
		border: 0 !important;
		border-radius: 0 !important;
		background: transparent !important;
		box-shadow: none !important;
	}

	/* The heading and review share one surface, so both checkout columns begin
	   on the same visual baseline without another nested wrapper. */
	body.woocommerce-checkout #order_review .woocommerce-checkout-review-order-table {
		border-color: #e2e8f0 !important;
		box-shadow: none !important;
	}

	body.woocommerce-checkout :is(.woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper) {
		display: grid !important;
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 14px 16px !important;
	}

	body.woocommerce-checkout :is(.woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper) > .form-row {
		float: none !important;
		width: 100% !important;
		max-width: none !important;
		margin: 0 !important;
	}

	body.woocommerce-checkout :is(.woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper) > .form-row-wide {
		grid-column: 1 / -1 !important;
	}

	body.woocommerce-checkout .zc-address-section > :is(.woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper)[hidden] {
		display: none !important;
	}
}

body.woocommerce-checkout #customer_details {
	padding: 18px !important;
	border-radius: 18px !important;
	box-shadow: 0 10px 28px rgba(15, 23, 42, .045) !important;
}

body.woocommerce-checkout .zc-address-section {
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
}

body.woocommerce-checkout .zc-address-section + .zc-address-section {
	margin-top: 18px !important;
	padding-top: 18px !important;
	border-top: 1px solid #e2e8f0 !important;
}

body.woocommerce-checkout .zc-address-card {
	padding: 0 !important;
	border: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
}

body.woocommerce-checkout .zc-address-card > header {
	min-height: 54px;
	padding-bottom: 12px;
	border-bottom: 1px solid #e2e8f0;
}

body.woocommerce-checkout .zc-address-toggle,
body.woocommerce-checkout .zc-address-close {
	min-height: 42px !important;
	border-color: #bfdbfe !important;
	background: #fff !important;
	color: #1d4ed8 !important;
}

body.woocommerce-checkout .zc-address-summary {
	margin-top: 12px !important;
	padding: 0 !important;
	border: 0 !important;
}

body.woocommerce-checkout .zc-address-section > :is(.woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper)[hidden] {
	display: none !important;
}

body.woocommerce-checkout .zc-address-section.is-editing > :is(.woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper) {
	display: grid !important;
}

body.woocommerce-checkout .zc-address-section.is-editing .zc-address-summary,
body.woocommerce-checkout .zc-address-section.is-editing .zc-address-support {
	display: none !important;
}

body.woocommerce-checkout .zc-address-save--bottom {
	width: 100%;
	min-height: 50px;
	margin-top: 16px;
	border-radius: 11px;
}

/* Clear, field-level validation. The icon belongs to the label row and the
   actionable message remains associated with its input via aria-describedby. */
body.woocommerce-checkout .zc-address-section.is-editing :is(.woocommerce-invalid, .woocommerce-invalid-required-field) > label {
	display: flex !important;
	align-items: center !important;
	justify-content: flex-start;
	gap: 7px;
	padding-inline-start: 0 !important;
	color: #991b1b !important;
}

body.woocommerce-checkout .zc-address-section.is-editing :is(.woocommerce-invalid, .woocommerce-invalid-required-field) > label::before {
	content: "!" !important;
	position: static !important;
	inset: auto !important;
	display: inline-grid !important;
	place-items: center;
	order: 2;
	flex: 0 0 20px;
	width: 20px;
	height: 20px;
	margin: 0 !important;
	border: 1px solid #dc2626;
	border-radius: 50%;
	background: #fff;
	color: #b91c1c;
	box-shadow: 0 0 0 3px #fee2e2;
	font-size: .72rem;
	font-weight: 900;
	line-height: 1;
}

body.woocommerce-checkout .zc-field-error {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	grid-column: 1 / -1;
	width: 100%;
	margin: 7px 0 0 !important;
	padding: 9px 11px;
	border: 1px solid #fecaca;
	border-radius: 9px;
	background: #fff7f7;
	color: #991b1b;
	font-size: .72rem;
	font-weight: 650;
	line-height: 1.75;
}

body.woocommerce-checkout .zc-address-section.is-editing .zc-persian-name-error:not(:empty) {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	min-height: 0;
	width: 100%;
	margin: 7px 0 0 !important;
	padding: 9px 11px;
	border: 1px solid #fecaca;
	border-radius: 9px;
	background: #fff7f7;
	color: #991b1b;
	font-size: .72rem;
	font-weight: 650;
	line-height: 1.75;
}

body.woocommerce-checkout .zc-address-section.is-editing .zc-persian-name-error:not(:empty)::before {
	content: "";
	flex: 0 0 7px;
	width: 7px;
	height: 7px;
	margin-top: .52em;
	border-radius: 50%;
	background: #dc2626;
	box-shadow: 0 0 0 3px #fee2e2;
}

body.woocommerce-checkout .zc-field-error::before {
	content: "";
	flex: 0 0 7px;
	width: 7px;
	height: 7px;
	margin-top: .52em;
	border-radius: 50%;
	background: #dc2626;
	box-shadow: 0 0 0 3px #fee2e2;
}

body.woocommerce-checkout .zc-checkout-errors:not([hidden]) {
	display: grid;
	gap: 8px;
	padding: 14px 16px !important;
	border: 1px solid #fecaca !important;
	border-inline-start: 4px solid #dc2626 !important;
	border-radius: 12px !important;
	background: linear-gradient(135deg, #fff, #fff7f7) !important;
	box-shadow: 0 8px 24px rgba(153, 27, 27, .06);
	margin-top: 12px !important;
	font-size: .72rem !important;
	line-height: 1.75 !important;
}

body.woocommerce-checkout .zc-checkout-errors strong { margin: 0 !important; color: #7f1d1d; font-size: .78rem !important; line-height: 1.65 !important; }
body.woocommerce-checkout .zc-checkout-errors ul { display: grid; gap: 4px; margin: 0 !important; padding-inline-start: 18px !important; }
body.woocommerce-checkout .zc-checkout-errors a { color: #991b1b !important; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* One product surface, one disclosure: metadata lives inside the product
   content and no compensating margin or nested card is required. */
body.woocommerce-checkout .zc-checkout-product > .zc-checkout-item-details {
	grid-column: 1 / -1;
	width: 100% !important;
	max-width: 100% !important;
	margin: 3px 0 0 !important;
	border: 0 !important;
	border-top: 1px solid #dbe4f0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	overflow: visible !important;
}

body.woocommerce-checkout .zc-checkout-product > .zc-checkout-item-details > summary {
	width: 100% !important;
	min-height: 42px !important;
	padding: 8px 0 !important;
	border: 0 !important;
	background: transparent !important;
	color: #475569 !important;
}

body.woocommerce-checkout .zc-checkout-product > .zc-checkout-item-details > summary::after {
	position: static !important;
	inset: auto !important;
	flex: 0 0 24px !important;
	width: 24px !important;
	height: 24px !important;
	margin: 0 !important;
}

body.woocommerce-checkout .zc-checkout-product > .zc-checkout-item-details > :is(dl.variation, ul.wc-item-meta, .tc-epo-metadata, .tm-cart-edit-options) {
	margin: 0 !important;
	padding: 9px 0 2px !important;
	border: 0 !important;
	border-top: 1px dashed #dbe4f0 !important;
	border-radius: 0 !important;
	background: transparent !important;
}

/* WooCommerce replaces #order_review through AJAX. The enhancer intentionally
   unwraps the temporary .zc-checkout-products-section, therefore these rules
   target the stable table itself. The table is the single surface; its product
   rows and disclosure are plain content rather than nested cards. */
body.woocommerce-checkout #order_review > .woocommerce-checkout-review-order-table {
	overflow: hidden !important;
	margin: 0 0 16px !important;
	padding: 0 !important;
	border: 1px solid var(--zc-line, #dbe4f0) !important;
	border-radius: 16px !important;
	border-spacing: 0 !important;
	background: var(--zc-surface, #fff) !important;
	box-shadow: none !important;
}

body.woocommerce-checkout #order_review > .woocommerce-checkout-review-order-table tbody tr.cart_item {
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
}

body.woocommerce-checkout #order_review > .woocommerce-checkout-review-order-table tbody tr.cart_item > :where(th, td) {
	padding: 14px !important;
	border: 0 !important;
	border-bottom: 1px solid var(--zc-line, #dbe4f0) !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
}

body.woocommerce-checkout #order_review > .woocommerce-checkout-review-order-table tbody tr.cart_item:last-of-type > :where(th, td) {
	border-bottom: 0 !important;
}

body.woocommerce-checkout #order_review .zc-checkout-product,
body.woocommerce-checkout #order_review .zc-checkout-product__content {
	min-width: 0;
	width: 100%;
}

body.woocommerce-checkout #order_review .zc-checkout-product > .zc-checkout-item-details {
	grid-column: 1 / -1;
	min-width: 0 !important;
	width: 100% !important;
	max-width: none !important;
	margin: 4px 0 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-top: 1px solid var(--zc-line, #dbe4f0) !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	overflow: visible !important;
}

body.woocommerce-checkout #order_review .zc-checkout-product > .zc-checkout-item-details > summary {
	min-height: 44px !important;
	padding: 8px 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
}

@media (max-width: 600px) {
	body.woocommerce-checkout #order_review > .woocommerce-checkout-review-order-table {
		display: block !important;
	}

	body.woocommerce-checkout #order_review > .woocommerce-checkout-review-order-table > thead {
		display: none !important;
	}

	body.woocommerce-checkout #order_review > .woocommerce-checkout-review-order-table > tbody,
	body.woocommerce-checkout #order_review > .woocommerce-checkout-review-order-table tbody tr.cart_item {
		display: block !important;
		width: 100% !important;
	}

	body.woocommerce-checkout #order_review > .woocommerce-checkout-review-order-table tbody tr.cart_item > :where(th, td) {
		display: block !important;
		width: 100% !important;
		padding: 12px !important;
	}

	body.woocommerce-checkout #order_review > .woocommerce-checkout-review-order-table tbody tr.cart_item > .product-total {
		padding-top: 10px !important;
		border-top: 1px solid var(--zc-line, #dbe4f0) !important;
		text-align: start !important;
	}
}

@media (min-width: 1181px) {
	body.woocommerce-checkout #order_review_heading {
		position: static !important;
		z-index: auto !important;
		width: 100%;
		max-width: 100%;
		padding: 10px 12px !important;
		border-radius: 10px;
		background: rgba(255, 255, 255, .96);
		box-shadow: 0 6px 18px rgba(15, 23, 42, .06);
		backdrop-filter: blur(8px);
	}

	body.woocommerce-checkout .zc-address-section.is-editing > :is(.woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper) {
		gap: 10px 14px !important;
	}

	body.woocommerce-checkout .zc-address-section.is-editing .form-row > label {
		margin-bottom: 4px !important;
	}

	body.woocommerce-checkout .zc-address-section.is-editing :is(input.input-text, select, .select2-selection--single) {
		min-height: 44px !important;
	}

	body.woocommerce-checkout .zc-address-section.is-editing textarea {
		min-height: 84px !important;
	}

	body.woocommerce-checkout .zc-address-section.is-editing h3 {
		margin: 14px 0 10px !important;
		padding-bottom: 9px !important;
	}
}

@media (max-width: 1180px) {
	body.woocommerce-checkout .zc-order-summary-column {
		grid-column: 1 !important;
		grid-row: auto !important;
		min-width: 0;
	}
}

@media (max-width: 600px) {
	.zc-commerce-hero {
		min-height: 118px !important;
		padding: 18px 16px !important;
	}

	.zc-commerce-hero h1,
	.woocommerce-shell main h1.entry-title,
	.woocommerce-shell h1.entry-title {
		font-size: clamp(1.35rem, 7vw, 1.75rem) !important;
	}

	.zc-page > .zc-page-content > .zc-page-header {
		margin-bottom: 16px !important;
	}

	.zc-page > .zc-page-content > .zc-page-header h1 {
		font-size: clamp(1.4rem, 7vw, 1.75rem) !important;
	}

	body.woocommerce-checkout .zc-checkout-intro {
		display: grid !important;
		gap: 10px !important;
		padding: 14px !important;
	}

	body.woocommerce-checkout .zc-address-section.is-editing {
		padding: 10px 10px calc(104px + env(safe-area-inset-bottom)) !important;
		background: #f8fafc !important;
	}

	body.woocommerce-checkout .zc-address-section.is-editing .zc-address-card {
		padding: 12px !important;
		border: 1px solid #dbe4f0 !important;
		border-radius: 0 0 14px 14px !important;
		background: #fff !important;
		box-shadow: 0 8px 24px rgba(15, 23, 42, .08) !important;
	}
}
