/**
 * COD Theme - product page order area.
 *
 * Styles the space the theme gives to the order form (the form itself is
 * painted by the COD Form plugin), plus the call / WhatsApp buttons, trust
 * badges and the sticky "Order now" bar. Loaded on product pages only.
 */

/* ==========================================================================
   1. Order area
   ========================================================================== */

.cod-order-area {
	scroll-margin-block-start: calc(var(--cod-header-height) + var(--cod-space-s) + var(--wp-admin--admin-bar--height, 0px));
}

.cod-order-area:empty {
	display: none;
}

/* Order forms placed in the summary by plugins' own hooks, and Add to cart. */
.single-product .summary form.cod-form,
.single-product .summary form.cart {
	scroll-margin-block-start: calc(var(--cod-header-height) + var(--cod-space-s) + var(--wp-admin--admin-bar--height, 0px));
}

/* The plugin paints its own card; the theme only controls outer spacing. */
.single-product .summary .cod-form {
	margin-inline: 0;
	max-inline-size: none;
}

/* ==========================================================================
   2. Call / WhatsApp buttons
   ========================================================================== */

.product-contact__label {
	margin-block-end: var(--cod-space-xs);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 600;
	color: var(--cod-color-muted);
	text-align: center;
}

.product-contact__buttons {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: var(--cod-space-xs);
}

.product-contact__buttons .button {
	padding-inline: var(--cod-space-s);
}

.product-contact .product-contact__whatsapp,
.product-contact .product-contact__whatsapp:hover {
	color: #06301b;
	background-color: #25d366;
}

.product-contact .product-contact__whatsapp:hover {
	filter: brightness(0.95);
}

/* ==========================================================================
   3. Trust badges
   ========================================================================== */

.trust-badges {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
	gap: var(--cod-space-xs);
	margin: 0;
	padding: 0;
	list-style: none;
}

.trust-badges__item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: var(--cod-space-s) var(--cod-space-xs);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 600;
	line-height: 1.35;
	text-align: center;
	background: var(--cod-color-surface);
	border-radius: var(--cod-radius);
}

.trust-badges__item .cod-icon {
	color: var(--cod-color-primary);
}

/* ==========================================================================
   4. Sticky "Order now" button (phones)
   ========================================================================== */

.sticky-order {
	position: fixed;
	inset-inline: 0;
	inset-block-end: 0;
	z-index: 40;
	display: flex;
	padding: var(--cod-space-xs) var(--cod-space-s);
	padding-block-end: max(var(--cod-space-xs), env(safe-area-inset-bottom));
	background: var(--cod-color-base);
	box-shadow: 0 -2px 10px rgb(0 0 0 / 0.1);
	transition: transform 200ms ease;
}

/* DOM order is button, call, WhatsApp: reversed in RTL so the icons stay on the right. */
[dir="rtl"] .sticky-order {
	flex-direction: row-reverse;
}

.sticky-order.is-hidden {
	transform: translateY(110%);
}

.sticky-order .sticky-order__cta {
	flex: 1 1 auto;
	font-size: var(--wp--preset--font-size--large, 1.25rem);
	color: var(--cod-color-on-accent);
	background-color: var(--cod-color-accent);
}

.sticky-order .sticky-order__cta:hover {
	color: var(--cod-color-on-accent);
	background-color: var(--cod-color-accent);
	filter: brightness(0.95);
}

/* Call / WhatsApp next to the button: same height and corners as the button. */
.sticky-order {
	gap: var(--cod-space-xs);
}

.sticky-order__icon {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	inline-size: var(--cod-tap-size);
	block-size: var(--cod-tap-size);
	color: #fff;
	border-radius: var(--cod-radius);
	text-decoration: none;
}

.sticky-order__icon:hover {
	color: #fff;
	filter: brightness(1.05);
}

.sticky-order__icon--call,
.sticky-order__icon--call:hover {
	color: var(--cod-color-on-primary);
	background: var(--cod-color-primary);
}

.sticky-order__icon--whatsapp {
	background: #25d366;
}

.has-sticky-order {
	padding-block-end: calc(var(--cod-tap-size) + var(--cod-space-m));
}

/* Keep the floating call / WhatsApp buttons above the sticky bar. */
.has-sticky-order {
	--cod-floating-offset: calc(var(--cod-tap-size) + var(--cod-space-m) + var(--cod-space-s));
}

@media (min-width: 1024px) {
	.has-sticky-order {
		--cod-floating-offset: var(--cod-space-l);
	}

	.sticky-order {
		display: none;
	}

	.has-sticky-order {
		padding-block-end: 0;
	}
}
