/* WooCommerce Partial Payments — payment mode choices (native radios; CSS variables from inline style). */

.wppp-payment-ui {
	--wppp-accent: #2563eb;
	--wppp-accent-muted: color-mix(in srgb, var(--wppp-accent) 14%, transparent);
	--wppp-card-bg: #fff;
	--wppp-card-border: #e5e7eb;
	--wppp-card-radius: 10px;
	--wppp-card-padding: 12px;
	--wppp-text: #111827;
	--wppp-text-muted: #4b5563;
	--wppp-amount-color: var(--wppp-text);
	--wppp-amount-size: 14px;
	--wppp-amount-weight: 700;
	--wppp-badge-partial-bg: #fef3c7;
	--wppp-badge-partial-fg: #92400e;
	--wppp-badge-full-bg: #d1fae5;
	--wppp-badge-full-fg: #065f46;
	--wppp-badge-radius: 6px;
	--wppp-badge-font-size: 12px;
	--wppp-sticky-dock-bottom: 5.5rem;
	box-sizing: border-box;
	margin: 0 0 0.5rem;
	color: var(--wppp-text);
	width: 100%;
	max-width: 100%;
	min-width: 0;
}

.wppp-payment-ui *,
.wppp-payment-ui *::before,
.wppp-payment-ui *::after {
	box-sizing: border-box;
}

.wppp-payment-ui__legend {
	font-weight: 600;
	font-size: 0.95rem;
	margin: 0 0 0.4rem;
	padding: 0;
	color: var(--wppp-text);
}

.wppp-payment-ui__fieldset {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.wppp-payment-ui__choices {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	align-items: stretch;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
}

.wppp-payment-ui__choice.wppp-payment-ui__card {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 0.5rem;
	margin: 0;
	flex: 1;
	min-width: 0;
	padding: 0.55rem 0.6rem;
	border: 1px solid var(--wppp-card-border);
	border-radius: var(--wppp-card-radius);
	background: var(--wppp-card-bg);
	cursor: pointer;
	position: relative;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	-webkit-tap-highlight-color: transparent;
}

.wppp-payment-ui__choice.wppp-payment-ui__card--active,
.wppp-payment-ui__choice:has(input[type='radio']:checked) {
	border-color: var(--wppp-accent);
	box-shadow: 0 0 0 1px color-mix(in srgb, var(--wppp-accent) 28%, transparent);
}

/* Native radio inputs only — no appearance/size overrides. */

.wppp-payment-ui__choice-main {
	display: block;
	min-width: 0;
	flex: 1;
	text-align: left;
}

.wppp-payment-ui__card-title {
	font-weight: 600;
	font-size: 0.95rem;
	display: block;
	margin-bottom: 0;
	color: var(--wppp-text);
}

.wppp-payment-ui__badge-slot {
	display: block;
	margin-top: 0.35rem;
}

.wppp-payment-ui__badge {
	display: inline-block;
	max-width: 100%;
	padding: 0.2em 0.55em;
	border-radius: var(--wppp-badge-radius);
	font-size: var(--wppp-badge-font-size);
	font-weight: 600;
	line-height: 1.35;
	word-break: break-word;
}

.wppp-payment-ui__badge--partial {
	background: var(--wppp-badge-partial-bg);
	color: var(--wppp-badge-partial-fg);
}

.wppp-payment-ui__badge--full {
	background: var(--wppp-badge-full-bg);
	color: var(--wppp-badge-full-fg);
}

.wppp-payment-ui__badge-text .woocommerce-Price-amount {
	font-weight: inherit;
}

.wppp-payment-ui__card-desc {
	font-size: 0.8rem;
	color: var(--wppp-text-muted);
	line-height: 1.35;
	display: block;
}

.wppp-payment-ui__selected-desc {
	font-size: 0.8rem;
	color: var(--wppp-text-muted);
	line-height: 1.35;
	margin: 0 0 0.4rem;
	padding: 0.4rem 0.55rem;
	border: 1px solid color-mix(in srgb, var(--wppp-card-border) 78%, var(--wppp-accent) 22%);
	border-radius: 6px;
	background: color-mix(in srgb, var(--wppp-accent) 8%, transparent);
}

.wppp-payment-ui__amounts {
	font-size: 0.875rem;
	line-height: 1.45;
	border-top: 1px solid var(--wppp-card-border);
	padding-top: 0.65rem;
	margin-top: 0.15rem;
}

/* When the amounts wrapper has no amount rows (product/sticky context — it only carries
 * the shipping note) drop the divider line + top padding/margin. They paint a visible
 * empty band between the description box and the "Shipping will be free…" line; without
 * the amount rows there's nothing meaningful to separate. */
.wppp-payment-ui__amounts:not(:has(.wppp-payment-ui__amount-row)) {
	border-top: 0;
	padding-top: 0;
	margin-top: 0;
}

.wppp-payment-ui__amount-row {
	display: flex;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0.35rem;
}

.wppp-payment-ui__amount-row:last-child {
	margin-bottom: 0;
}

.wppp-payment-ui__amount-label {
	color: var(--wppp-text-muted);
}

.wppp-payment-ui__amount-value {
	font-weight: var(--wppp-amount-weight, 600);
	font-size: var(--wppp-amount-size, inherit);
	color: var(--wppp-amount-color, var(--wppp-text));
	text-align: right;
}

.wppp-payment-ui__full-note {
	font-size: 0.8rem;
	color: var(--wppp-text-muted);
	margin: 0;
}

.wppp-payment-ui__full-note[hidden] {
	display: none !important;
}

/* On mobile, hide the shipping note across all space-constrained surfaces:
 * - standalone WPPP sticky dock + NASA mobile fixed strip + NASA fixed bar keeper + sticky mirrors
 * - the WC variation/cart form (NASA's slide-up `nasa-attr-ux-form` on variable products)
 * - the standalone product-page card itself (mobile is space-constrained everywhere). */
@media (max-width: 782px) {
	#wppp-sticky-payment-dock .wppp-payment-ui__full-note,
	#wppp-sticky-payment-dock [data-wppp-shipping-note="1"],
	.ns_btn-fixed .wppp-payment-ui__full-note,
	.ns_btn-fixed [data-wppp-shipping-note="1"],
	.nasa-add-to-cart-fixed .wppp-payment-ui__full-note,
	.nasa-add-to-cart-fixed [data-wppp-shipping-note="1"],
	[data-wppp-sticky-keeper="1"] .wppp-payment-ui__full-note,
	[data-wppp-sticky-keeper="1"] [data-wppp-shipping-note="1"],
	form.variations_form .wppp-payment-ui__full-note,
	form.variations_form [data-wppp-shipping-note="1"],
	form.cart .wppp-payment-ui__full-note,
	form.cart [data-wppp-shipping-note="1"],
	.nasa-attr-ux-form .wppp-payment-ui__full-note,
	.nasa-attr-ux-form [data-wppp-shipping-note="1"],
	.wppp-payment-ui--product .wppp-payment-ui__full-note,
	.wppp-payment-ui--product [data-wppp-shipping-note="1"] {
		display: none !important;
	}
}

/* Partial bank details box (checkout + thankyou; toggled via data-wppp-show-when). */
.wppp-partial-bank-details {
	margin-top: 0.75rem;
	padding: 0.75rem 0.85rem;
	border: 1px solid var(--wppp-card-border);
	border-radius: 10px;
	background: color-mix(in srgb, var(--wppp-card-bg) 92%, transparent);
	color: var(--wppp-text);
	font-size: 0.875rem;
	line-height: 1.45;
}

.wppp-partial-bank-details__due {
	margin: 0 0 0.5rem;
}

.wppp-partial-bank-details__body {
	color: var(--wppp-text);
}

.wppp-partial-bank-details a {
	color: var(--wppp-accent);
	text-decoration: underline;
}

/* Checkout block */
.wppp-payment-ui--checkout {
	margin-bottom: 1.25rem;
}

.wppp-fee-desc{
	display:inline-block;
	margin-top:2px;
	color:#6b7280;
	font-size:12px;
	line-height:1.35;
}

/* Sticky mirror: small screens only (see JS). Hidden on desktop — use in-flow payment UI in form.cart. */
#wppp-sticky-payment-dock {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 999999;
	padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom, 0));
	background: color-mix(in srgb, var(--wppp-card-bg, #fff) 94%, transparent);
	box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
	transform: translateY(110%);
	transition: transform 0.22s ease;
	pointer-events: none;
}

#wppp-sticky-payment-dock.wppp-sticky-payment-dock--visible {
	transform: translateY(0);
	pointer-events: auto;
	touch-action: manipulation;
}

/* Mobile NASA strip (.ns_btn-fixed.nasa-flex): stack payment above add-to-cart */
@media (max-width: 782px) {
	.ns_btn-fixed.nasa-flex:has(#wppp-sticky-payment-dock.wppp-sticky-payment-dock--nested-nasa),
	.ns_btn-fixed:has(#wppp-sticky-payment-dock.wppp-sticky-payment-dock--nested-nasa) {
		flex-direction: column !important;
		align-items: stretch !important;
		flex-wrap: nowrap !important;
	}

	#wppp-sticky-payment-dock.wppp-sticky-payment-dock--nested-nasa {
		position: relative !important;
		left: auto !important;
		right: auto !important;
		bottom: auto !important;
		transform: none !important;
		transition: none !important;
		pointer-events: auto !important;
		z-index: auto !important;
		width: 100%;
		max-width: 100%;
		flex: 0 0 auto;
		padding: 0.45rem 0.65rem;
		margin: 0;
		box-shadow: none !important;
		border-bottom: 1px solid rgba(15, 23, 42, 0.1);
		background: color-mix(in srgb, var(--wppp-card-bg, #fff) 96%, transparent);
	}
}

#wppp-sticky-payment-dock .wppp-payment-ui {
	margin: 0;
	position: relative;
	z-index: 1;
}

@media (max-width: 420px) {
	.wppp-payment-ui__choices {
		flex-direction: column;
	}
}

/* Payment block lives inside form.cart — full width, clear floats */
.woocommerce div.product form.cart .wppp-payment-ui--product {
	clear: both;
	width: 100%;
	max-width: 100%;
	margin-top: 0;
	margin-bottom: 0.5rem;
}

/* Variation product + NASA quick-add / quickview / popup containers (desktop + mobile):
 * the card sits between WC's variation table (color swatches row, etc.) and the qty +
 * ADD TO CART row — both have their own generous rhythm. Pull the card up to claw back
 * the airy gap above and tighten the gap below. Matches/beats the (0,4,2) selector
 * above so it wins on the standalone product page form too. */
.woocommerce div.product form.variations_form .wppp-payment-ui--product,
.woocommerce div.product .nasa-add-to-cart-fixed .wppp-payment-ui--product,
.woocommerce div.product .nasa-attr-ux-form .wppp-payment-ui--product,
form.variations_form .wppp-payment-ui--product,
.nasa-add-to-cart-fixed .wppp-payment-ui--product,
.nasa-attr-ux-form .wppp-payment-ui--product,
[class*="quickview"] .wppp-payment-ui--product,
[class*="quickadd"] .wppp-payment-ui--product,
[class*="popup"] .wppp-payment-ui--product {
	margin-top: -0.5rem;
	margin-bottom: 0.25rem;
}

/* Mobile (≤782px) fix for the NASA "quick add" slide-up + sticky bar + quickview popups +
 * variation/cart forms. The slide-up panel clones the main product form, so the higher-
 * specificity rule above (`.woocommerce div.product form.cart .wppp-payment-ui--product`,
 * specificity 0,4,2) forces the card to full width. We use selectors at the same (or
 * higher) specificity so the inset wins, and we also constrain the wrapper itself so it
 * can't paint past its visible parent on widths where NASA positions the panel a few
 * pixels wider than its container. */
@media (max-width: 782px) {
	form.variations_form:has(.wppp-payment-ui),
	form.cart:has(.wppp-payment-ui),
	.nasa-attr-ux-form:has(.wppp-payment-ui),
	.nasa-add-to-cart-fixed:has(.wppp-payment-ui) {
		max-width: 100%;
		box-sizing: border-box;
		overflow-x: clip;
	}

	/* Side gutter — selectors match (or exceed) line 315's specificity (0,4,2) so they win. */
	.woocommerce div.product form.cart .wppp-payment-ui--product,
	.woocommerce div.product .wppp-payment-ui--product,
	.nasa-add-to-cart-fixed .wppp-payment-ui--product,
	.nasa-add-to-cart-fixed .wppp-payment-ui,
	.ns_btn-fixed .wppp-payment-ui--product,
	.nasa-attr-ux-form .wppp-payment-ui--product,
	.nasa-attr-ux-form .wppp-payment-ui,
	form.variations_form .wppp-payment-ui--product,
	form.cart .wppp-payment-ui--product,
	[class*="quickview"] .wppp-payment-ui--product,
	[class*="quickadd"] .wppp-payment-ui--product,
	[class*="popup"] .wppp-payment-ui--product,
	.wppp-payment-ui--product {
		width: auto;
		max-width: calc(100% - 1.5rem);
		min-width: 0;
		margin-top: 0;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 0.5rem;
		box-sizing: border-box;
		overflow-x: hidden;
	}

	/* Sticky dock already provides its own horizontal padding — don't compound gutters
	 * (the keeper card inside the dock should occupy the dock's full inner width). */
	#wppp-sticky-payment-dock .wppp-payment-ui,
	.ns_btn-fixed #wppp-sticky-payment-dock .wppp-payment-ui {
		max-width: 100%;
		margin-left: 0;
		margin-right: 0;
	}

	/* Tighten the gap BELOW the payment block before the +/− qty / ADD TO CART row
	 * (`.ns-info-btns`) inside NASA's quick-add / quickview panels — NASA's row rhythm
	 * is generous on mobile. (The card's top tightening is handled by the universal
	 * variation-form rule outside this @media block.) */
	.nasa-add-to-cart-fixed .ns-info-btns,
	.nasa-attr-ux-form .ns-info-btns,
	[class*="quickview"] .ns-info-btns,
	[class*="quickadd"] .ns-info-btns,
	[class*="popup"] .ns-info-btns {
		margin-top: 0.25rem;
	}

	/* Inner element containment (keeps long labels + amount values from forcing a wider
	 * intrinsic min-width that would cause horizontal overflow). */
	.nasa-add-to-cart-fixed .wppp-payment-ui *,
	.ns_btn-fixed .wppp-payment-ui *,
	form.variations_form .wppp-payment-ui *,
	form.cart .wppp-payment-ui *,
	.nasa-attr-ux-form .wppp-payment-ui *,
	[class*="quickview"] .wppp-payment-ui *,
	[class*="quickadd"] .wppp-payment-ui *,
	[class*="popup"] .wppp-payment-ui * {
		min-width: 0;
		max-width: 100%;
		box-sizing: border-box;
	}
}

/* When the only thing inside `.wppp-payment-ui__amounts` is the (hidden on mobile) shipping
 * note, the wrapper still paints its border-top + top padding/margin and creates a visible
 * empty band under the cards. Hide the wrapper itself in those cases. */
@media (max-width: 782px) {
	#wppp-sticky-payment-dock .wppp-payment-ui__amounts:not(:has(.wppp-payment-ui__amount-row)),
	.ns_btn-fixed .wppp-payment-ui__amounts:not(:has(.wppp-payment-ui__amount-row)),
	.nasa-add-to-cart-fixed .wppp-payment-ui__amounts:not(:has(.wppp-payment-ui__amount-row)),
	[data-wppp-sticky-keeper="1"] .wppp-payment-ui__amounts:not(:has(.wppp-payment-ui__amount-row)),
	form.variations_form .wppp-payment-ui__amounts:not(:has(.wppp-payment-ui__amount-row)),
	form.cart .wppp-payment-ui__amounts:not(:has(.wppp-payment-ui__amount-row)),
	.nasa-attr-ux-form .wppp-payment-ui__amounts:not(:has(.wppp-payment-ui__amount-row)),
	.wppp-payment-ui--product .wppp-payment-ui__amounts:not(:has(.wppp-payment-ui__amount-row)) {
		display: none !important;
	}
}

/* Stack the two payment-mode cards as soon as the form is narrow enough that side-by-side
 * pushes them past the form wrapper. 600px covers most mobile slide-ups. */
@media (max-width: 600px) {
	.wppp-payment-ui__choices {
		flex-direction: column;
	}
}

/* NASA desktop sticky: keep same full-width card sizing as product page, placed after product info. */
@media (min-width: 783px) {
	/* Theme clones payment UI into the button row on variation change — hide there so only keeper in .payment-options-wrap shows (no flash). */
	.nasa-add-to-cart-fixed.nasa-not-show-mobile .nasa-fixed-product-btn .wppp-payment-ui {
		display: none !important;
	}

	.nasa-add-to-cart-fixed.nasa-not-show-mobile .payment-options-wrap {
		width: 560px;
		max-width: 560px;
		min-width: 560px;
	}
	.nasa-add-to-cart-fixed.nasa-not-show-mobile .payment-options-wrap .wppp-payment-ui {
		width: 100%;
		max-width: 100%;
		min-width: 0;
		margin: 0.35rem 0 0;
	}
	.nasa-add-to-cart-fixed.nasa-not-show-mobile .payment-options-wrap .wppp-payment-ui--product {
		display: block;
		clear: both;
	}
}

/* Mobile: sticky dock uses transform + pointer-events; JS toggles --visible. */
@media (min-width: 783px) {
	#wppp-sticky-payment-dock {
		display: none !important;
	}
}
