/**
 * Yilan DQ Commerce — parity CSS for hybrid Astra pages.
 * Scope: body.yilan-dq-woo-chrome only. Do not restyle logged-out Yilan account.
 *
 * Header/Footer: let themes/yilan/assets/css/main.css own chrome.
 * Only neutralize Astra collisions that would break Yilan markup.
 */

/* ---- Kill Astra sticky-footer stretch (huge white gap on short pages) ---- */
body.yilan-dq-woo-chrome #page {
	min-height: 0 !important;
	height: auto !important;
}

body.yilan-dq-woo-chrome #content,
body.yilan-dq-woo-chrome .site-content {
	flex: 0 0 auto !important;
	flex-grow: 0 !important;
	min-height: 0 !important;
}

/* ---- Footer: neutralize Astra only; Yilan main.css owns layout/colors ---- */
body.yilan-dq-woo-chrome footer.site-footer {
	float: none !important;
	clear: both !important;
	width: 100% !important;
	max-width: none !important;
	border: 0 !important;
	/* Do NOT override background / height / inner grid — match other Yilan pages */
}

body.yilan-dq-woo-chrome footer.site-footer .ast-builder-grid-row,
body.yilan-dq-woo-chrome footer.site-footer .site-primary-footer-wrap,
body.yilan-dq-woo-chrome footer.site-footer .site-below-footer-wrap,
body.yilan-dq-woo-chrome .ast-footer-overlay {
	display: none !important;
}

/* ---- Astra Pro Woo content: undo Yilan main.css collisions only ---- */
body.yilan-dq-woo-chrome.woocommerce-cart #content,
body.yilan-dq-woo-chrome.woocommerce-checkout #content,
body.yilan-dq-woo-chrome.woocommerce-account #content {
	background: #fff;
}

body.yilan-dq-woo-chrome #primary,
body.yilan-dq-woo-chrome #main,
body.yilan-dq-woo-chrome article.ast-article-single,
body.yilan-dq-woo-chrome .entry-content {
	width: 100% !important;
	max-width: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
	border: 0 !important;
	background: transparent !important;
	box-sizing: border-box;
}

body.yilan-dq-woo-chrome.woocommerce-cart #primary,
body.yilan-dq-woo-chrome.woocommerce-checkout #primary,
body.yilan-dq-woo-chrome.woocommerce-account.logged-in #primary {
	min-height: 0 !important;
	padding: 24px 0 48px !important;
}

/* WC clearfix pseudo-elements break Astra Pro flex layouts */
body.yilan-dq-woo-chrome .woocommerce::before,
body.yilan-dq-woo-chrome .woocommerce::after {
	display: none !important;
	content: none !important;
}

/* DQ cart rules (tmp/dq-astra-custom-css.css) scoped to hybrid Woo content */
body.yilan-dq-woo-chrome.woocommerce-cart .wc-proceed-to-checkout a.checkout-button {
	font-size: 15px;
	line-height: 15px;
}

body.yilan-dq-woo-chrome.woocommerce-cart .cart-collaterals .cart_totals > h2 {
	background-color: var(--ast-global-color-secondary, var(--ast-global-color-4));
	border-bottom: 1px solid var(--ast-border-color);
	font-size: 20px;
	font-weight: 400;
}

body.yilan-dq-woo-chrome table.shop_table thead th {
	border-width: 0;
	font-size: 15px;
	font-weight: 400;
}

/* Cart shipping block — match #shipping_method label typography */
body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals tr.woocommerce-shipping-totals td #shipping_method label,
body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals tr.woocommerce-shipping-totals td .woocommerce-shipping-destination,
body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals tr.woocommerce-shipping-totals td .shipping-calculator-button,
body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals .woocommerce-shipping-calculator label,
body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals .woocommerce-shipping-calculator .input-text,
body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals .woocommerce-shipping-calculator button.button,
body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals .woocommerce-shipping-calculator .select2-container .select2-selection__rendered {
	font-size: 14px !important;
	line-height: 20px !important;
	font-weight: 500;
}

body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals tr.woocommerce-shipping-totals td .woocommerce-shipping-destination,
body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals tr.woocommerce-shipping-totals td .shipping-calculator-button {
	color: #111827;
}

/* Cart totals table: wider value column on desktop sidebar (keeps 360px sidebar, avoids flex wrap) */
@media (min-width: 761px) {
	body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals table.shop_table th {
		width: 28% !important;
		text-align: left;
	}

	body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals table.shop_table td {
		width: 72% !important;
		text-align: right !important;
	}

	body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals tr.woocommerce-shipping-totals td {
		text-align: left !important;
	}
}

@media (max-width: 760px) {
	body.yilan-dq-woo-chrome.woocommerce-cart #ast-cart-wrapper .cart-collaterals,
	body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals {
		width: 100% !important;
		max-width: 100% !important;
	}

	body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals {
		padding-left: 0 !important;
		padding-right: 0 !important;
	}

	body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals table.shop_table,
	body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals table.shop_table th,
	body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals table.shop_table td {
		width: 100% !important;
		max-width: 100% !important;
		box-sizing: border-box;
	}
}

body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals tr.woocommerce-shipping-totals td .woocommerce-shipping-destination {
	white-space: nowrap;
	padding-left: 22px;
}

/* Match destination text inset (block + padding, not inline padding shift) */
body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals tr.woocommerce-shipping-totals td .shipping-calculator-button {
	display: block;
	padding-left: 22px;
	box-sizing: border-box;
}

body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals tr.woocommerce-shipping-totals td .woocommerce-shipping-calculator #shipping-calculator-form {
	padding-left: 22px;
}

body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals .woocommerce-shipping-calculator .select2-container .select2-selection--single {
	min-height: 32px;
	height: auto;
}

body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals .woocommerce-shipping-calculator .select2-container .select2-selection--single .select2-selection__rendered {
	padding-top: 5px;
	padding-bottom: 5px;
}

body.yilan-dq-woo-chrome.woocommerce-cart .cart_totals .woocommerce-shipping-calculator .input-text {
	min-height: 32px;
	padding-top: 5px;
	padding-bottom: 5px;
}

/* Invoice / checkout field widths (snippet #37 intent) */
body.yilan-dq-woo-chrome.woocommerce-checkout #invoice-type_field,
body.yilan-dq-woo-chrome.woocommerce-checkout #individual-invoice_field,
body.yilan-dq-woo-chrome.woocommerce-checkout #carrier-number_field,
body.yilan-dq-woo-chrome.woocommerce-checkout #company-name_field,
body.yilan-dq-woo-chrome.woocommerce-checkout #taxid-number_field,
body.yilan-dq-woo-chrome.woocommerce-checkout #donate-number_field {
	width: 100%;
	max-width: 100%;
}

body.yilan-dq-woo-chrome.woocommerce-checkout .woocommerce-billing-fields__field-wrapper .form-row {
	box-sizing: border-box;
}

/*
 * Astra theme sets `.woocommerce-error { display: flex }`.
 * Modern checkout leaves an empty `.ast-customer-info__notice.woocommerce-error`
 * in the DOM for AJAX login errors — hide until `.active` has a message.
 */
body.yilan-dq-woo-chrome.ast-modern-checkout .woocommerce form.woocommerce-checkout .ast-customer-info__notice:not(.active) {
	display: none !important;
}

/*
 * Astra dynamic CSS hides `.ast-mobile-order-review-wrap` from tablet-up (922px).
 * Forced `modern-checkout.min.css` sets it to `display:block` globally — restore
 * mobile-only behaviour for the collapsible order summary toggle.
 */
@media (min-width: 922px) {
	body.yilan-dq-woo-chrome.ast-modern-checkout .woocommerce .ast-mobile-order-review-wrap {
		display: none !important;
	}

	/*
	 * Astra Pro checkout-order-review-sticky — use CSS with Yilan fixed header offset
	 * (sticky-section.min.js targets Astra headers and sets top: 1em on hybrid chrome).
	 */
	body.yilan-dq-woo-chrome.woocommerce-checkout.ast-modern-checkout #ast-order-review-wrapper {
		position: sticky;
		top: calc(var(--header-height, 84px) + 24px);
		align-self: flex-start;
		z-index: 2;
	}
}

/*
 * CVS compat moves `#ast-order-review-wrapper` into additional-fields on mobile
 * and forces thead/tbody `display:table !important` for shipping UI. Override
 * with equal-or-higher specificity so the product table stays collapsed; the
 * Astra `#ast-order-review-toggle` summary remains the product reveal.
 */
@media (max-width: 768px) {
	body.yilan-dq-woo-chrome.woocommerce-checkout.ast-modern-checkout #customer_details .woocommerce-additional-fields #ast-order-review-wrapper #order_review_heading {
		display: none !important;
	}

	body.yilan-dq-woo-chrome.woocommerce-checkout.ast-modern-checkout #customer_details .woocommerce-additional-fields #ast-order-review-wrapper .woocommerce-checkout-review-order-table thead,
	body.yilan-dq-woo-chrome.woocommerce-checkout.ast-modern-checkout #customer_details .woocommerce-additional-fields #ast-order-review-wrapper .woocommerce-checkout-review-order-table tbody {
		display: none !important;
	}
}

/* ---- Woo accent: Astra yellow (#fafa5a) → Yilan green (#008549) ---- */
/*
 * Scope accent tokens to WooCommerce main content (and mini-cart drawer),
 * not site chrome — body-level vars made Astra `button:hover` hit back-to-top,
 * cookie banner, etc.
 */
body.yilan-dq-woo-chrome #primary,
body.yilan-dq-woo-chrome .astra-cart-drawer {
	--ast-global-color-0: #008549;
	--ast-global-color-1: #008549;
}

body.yilan-dq-woo-chrome .woocommerce-message,
body.yilan-dq-woo-chrome .woocommerce-info,
body.yilan-dq-woo-chrome .entry-content .woocommerce-message,
body.yilan-dq-woo-chrome .entry-content .woocommerce-info {
	border-top-color: #008549;
}

body.yilan-dq-woo-chrome .woocommerce-message::before,
body.yilan-dq-woo-chrome .woocommerce-info::before {
	color: #008549;
}

body.yilan-dq-woo-chrome .woocommerce-MyAccount-navigation-link::after {
	background-color: #008549;
}

body.yilan-dq-woo-chrome .woocommerce-MyAccount-navigation-link.is-active a,
body.yilan-dq-woo-chrome .woocommerce-MyAccount-navigation-link:hover a {
	color: #008549;
}

/* Astra dynamic CSS sets black text on green button hover — use white for contrast */
body.yilan-dq-woo-chrome #primary .woocommerce :is(
	a.button,
	button.button,
	input.button,
	input[type="submit"],
	input[type="button"]
):is(:hover, :focus, :focus-visible),
body.yilan-dq-woo-chrome .astra-cart-drawer :is(
	a.button,
	button.button,
	.checkout
):is(:hover, :focus, :focus-visible) {
	color: #ffffff !important;
}

/* Site chrome: never apply Astra button hover fill (e.g. back-to-top) */
body.yilan-dq-woo-chrome .back-to-top:is(:hover, :focus, :focus-visible) {
	background: transparent !important;
	background-color: transparent !important;
	border-color: transparent !important;
	box-shadow: none !important;
	color: inherit !important;
}

body.yilan-dq-woo-chrome .back-to-top:is(:hover, :focus, :focus-visible) .back-to-top__label {
	color: #008549 !important;
}
