/**
 * Phase 26.19.1 — shared mobile sticky primary-action footer (presentation only).
 *
 * Visual model: Woo Cart Block mobile sticky Proceed to Checkout container
 * (solid white full-width bar, inset button, padding, safe-area).
 *
 * Product: real submit lives inside `.wre-mobile-sticky-action--product`.
 * Checkout: `.wre-mobile-sticky-action--checkout` is an empty opaque surface;
 * the real Place Order button is positioned into that inset. Do not fix
 * `.wc-block-checkout__actions` (that pulled Order Summary into the bar).
 *
 * Cart Proceed to Checkout is Woo-native — do not restyle it here.
 * Additional Charges Order Pay and Order Received are excluded.
 *
 * Mobile only: max-width 767px.
 */

@media (max-width: 767px) {
	.wre-current-product,
	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) {
		--wre-mobile-sticky-pad-x: 1rem;
		--wre-mobile-sticky-pad-y: 0.75rem;
		--wre-mobile-sticky-btn-height: 48px;
		--wre-mobile-sticky-action-height: calc(
			var(--wre-mobile-sticky-pad-y) + var(--wre-mobile-sticky-btn-height)
			+ var(--wre-mobile-sticky-pad-y) + env(safe-area-inset-bottom, 0px)
		);
		--wre-mobile-sticky-action-clearance: calc(var(--wre-mobile-sticky-action-height) + 0.5rem);
		--wre-mobile-sticky-guide-stack: calc(var(--wre-mobile-sticky-action-height) + 4.75rem);
	}

	.wre-mobile-sticky-action {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 45;
		box-sizing: border-box;
		width: 100%;
		max-width: 100%;
		margin: 0;
		padding: var(--wre-mobile-sticky-pad-y, 0.75rem) var(--wre-mobile-sticky-pad-x, 1rem) calc(var(--wre-mobile-sticky-pad-y, 0.75rem) + env(safe-area-inset-bottom, 0px));
		background: #fff;
		background-color: #fff;
		opacity: 1;
		border-top: 1px solid rgba(0, 0, 0, 0.08);
		box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.08);
	}

	.wre-current-product {
		padding-bottom: var(--wre-mobile-sticky-action-clearance);
	}

	.wre-current-product--byo_package:has(.is-guide-visible) {
		padding-bottom: var(--wre-mobile-sticky-guide-stack);
	}

	/* Container is fixed. The real submit stays in normal flow inside it. */
	.wre-current-product .wre-mobile-sticky-action--product .single_add_to_cart_button,
	.wre-current-product .wre-mobile-sticky-action--product button[name="add-to-cart"] {
		position: static;
		left: auto;
		right: auto;
		bottom: auto;
		display: block;
		width: 100%;
		max-width: none;
		margin: 0;
		box-sizing: border-box;
		min-height: var(--wre-mobile-sticky-btn-height, 48px);
		border-radius: var(--wre-radius, 2px);
		box-shadow: none !important;
	}

	.wre-current-product .wre-recommendations .single_add_to_cart_button,
	.wre-current-product a.wre-recommendations__add,
	.wre-current-product .wre-recommendations__add,
	.wre-current-product .related .add_to_cart_button,
	.wre-current-product .upsells .add_to_cart_button {
		position: static !important;
		left: auto !important;
		right: auto !important;
		bottom: auto !important;
		z-index: auto !important;
	}

	.wre-current-product--byo_package .wre-byo-guide {
		bottom: calc(var(--wre-mobile-sticky-action-height) + 8px);
		z-index: 46;
	}

	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) .wp-block-woocommerce-checkout,
	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) .wc-block-checkout,
	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) form.wc-block-checkout__form,
	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) form.woocommerce-checkout,
	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) form.checkout {
		padding-bottom: var(--wre-mobile-sticky-action-clearance);
		box-sizing: border-box;
	}

	.wre-mobile-sticky-action--checkout {
		pointer-events: none;
	}

	/*
	 * Isolate the real Place Order control only. Do not position
	 * .wc-block-checkout__actions or the actions-block (Order Summary lives
	 * near those wrappers on this site).
	 */
	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) .wc-block-components-checkout-place-order-button,
	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) .wc-block-components-checkout-place-order-button.wp-element-button,
	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) form.woocommerce-checkout #place_order,
	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) form.checkout #place_order,
	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) form.woocommerce-checkout button#place_order {
		position: fixed;
		left: var(--wre-mobile-sticky-pad-x, 1rem);
		right: var(--wre-mobile-sticky-pad-x, 1rem);
		bottom: calc(var(--wre-mobile-sticky-pad-y, 0.75rem) + env(safe-area-inset-bottom, 0px));
		z-index: 46;
		width: auto;
		max-width: none;
		margin: 0;
		box-sizing: border-box;
		min-height: var(--wre-mobile-sticky-btn-height, 48px);
		border-radius: var(--wre-radius, 2px) !important;
		background: var(--wre-color-primary, #c4a35a) !important;
		background-color: var(--wre-color-primary, #c4a35a) !important;
		border: 1px solid var(--wre-color-primary, #c4a35a) !important;
		color: var(--wre-color-button-text, var(--wre-color-text-dark, #1a1a1a)) !important;
		font-weight: 600 !important;
		box-shadow: none !important;
	}

	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) .wc-block-components-checkout-place-order-button:hover,
	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) .wc-block-components-checkout-place-order-button:focus,
	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) form.woocommerce-checkout #place_order:hover,
	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) form.checkout #place_order:hover {
		background: var(--wre-color-secondary, #e0c878) !important;
		background-color: var(--wre-color-secondary, #e0c878) !important;
		border-color: var(--wre-color-secondary, #e0c878) !important;
		color: var(--wre-color-button-text, var(--wre-color-text-dark, #1a1a1a)) !important;
	}

	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) .wc-block-components-checkout-place-order-button:focus-visible,
	body.woocommerce-checkout:not(.woocommerce-order-received):not(.woocommerce-order-pay):not(.wre-charge-order-pay) form.woocommerce-checkout #place_order:focus-visible {
		outline: 3px solid var(--wre-color-focus, #c4a35a);
		outline-offset: 2px;
	}
}

@media (min-width: 768px) {
	.wre-mobile-sticky-action--product {
		display: contents;
	}

	.wre-mobile-sticky-action--checkout {
		display: none;
	}
}
