/**
 * DROIX BNPL Controller — Cards + Modal (new display mode)
 *
 * Teaser card lives inside the buy box; the modal is appended to <body> by JS so
 * it escapes the buy-box stacking/overflow context. Visuals follow the DROIX
 * theme: Ubuntu/Inter type, green #B0CB1F accent, 16/12px radii, soft shadow.
 */

:root {
	--dx-bnpl-green: #B0CB1F;
	--dx-bnpl-green-dark: #74A401;
	--dx-bnpl-ink: #0B0B0B;
	--dx-bnpl-muted: #737373;
	--dx-bnpl-line: #ECECEC;
	--dx-bnpl-radius: 16px;
	--dx-bnpl-shadow: 0px 4px 14px 0px rgba(0, 0, 0, 0.06);
}

/* ============================================================= TEASER CARD */

.dx-bnpl-card {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	margin-top: 20px;
	padding: 16px 18px;
	border: 1px solid var(--dx-bnpl-line);
	border-radius: var(--dx-bnpl-radius);
	background: #fff;
	box-shadow: var(--dx-bnpl-shadow);
	cursor: pointer;
	text-align: left;
	transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
	box-sizing: border-box;
}

.dx-bnpl-card:hover,
.dx-bnpl-card:focus-visible {
	border-color: #dfe6c2;
	box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
	outline: none;
}

.dx-bnpl-card__icon {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 12px;
	background: #F3F8DC;
	color: var(--dx-bnpl-green-dark);
}

.dx-bnpl-card__body {
	flex: 1 1 auto;
	min-width: 0;
}

.dx-bnpl-card__title {
	display: block;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.25;
	color: var(--dx-bnpl-ink);
}

.dx-bnpl-card__headline {
	margin: 2px 0 10px;
	font-size: 13.5px;
	line-height: 1.35;
	color: var(--dx-bnpl-muted);
}

.dx-bnpl-card__headline strong {
	color: var(--dx-bnpl-ink);
	font-weight: 700;
}

.dx-bnpl-card__badges {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.dx-bnpl-card__chevron {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	color: #9a9a9a;
}

/* ================================================================= BADGES */

.dx-bnpl-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	letter-spacing: -0.01em;
	border-radius: 8px;
	white-space: nowrap;
	line-height: 1;
}

.dx-bnpl-badge--sm {
	padding: 6px 10px;
	font-size: 12px;
}

/* modal-size badge */
.dx-bnpl-row .dx-bnpl-badge {
	padding: 10px 14px;
	font-size: 15px;
}

/* official logo inside a pill */
.dx-bnpl-badge__logo {
	display: block;
	width: auto;
	height: 13px;
}

.dx-bnpl-row .dx-bnpl-badge__logo {
	height: 17px;
}

/* render dark wordmarks white on dark/colour pills (affirm, Payl8r) */
.dx-bnpl-badge__logo--invert {
	filter: brightness(0) invert(1);
}

/* providers whose asset carries its own background (Super lockup): no pill chrome */
.dx-bnpl-badge--ownbg {
	background: transparent !important;
	padding: 0 !important;
	border-radius: 0;
}

.dx-bnpl-badge--ownbg .dx-bnpl-badge__logo {
	height: 26px;
}

.dx-bnpl-card__badges .dx-bnpl-badge--ownbg .dx-bnpl-badge__logo {
	height: 23px;
}

/* ================================================================== MODAL */

.dx-bnpl-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
}

/* Closed state: keep the modal RENDERED (not display:none) so adopted native
   widgets stay in the viewport and their SDKs hydrate; just make it invisible and
   click-through. Opening flips opacity + adds .is-open for the entrance animation. */
.dx-bnpl-modal[hidden] {
	opacity: 0;
	pointer-events: none;
}

.dx-bnpl-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 18, 10, 0.55);
	opacity: 0;
	transition: opacity .25s ease;
}

.dx-bnpl-modal.is-open .dx-bnpl-modal__backdrop {
	opacity: 1;
}

.dx-bnpl-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 540px;
	max-height: 90vh;
	overflow-y: auto;
	padding: 34px 36px 28px;
	background: #fff;
	border-radius: 26px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
	transform: translateY(16px) scale(0.98);
	opacity: 0;
	transition: transform .28s cubic-bezier(.2, .8, .2, 1), opacity .28s ease;
	box-sizing: border-box;
	-webkit-overflow-scrolling: touch;
}

.dx-bnpl-modal.is-open .dx-bnpl-modal__dialog {
	transform: none;
	opacity: 1;
}

.dx-bnpl-modal__close {
	position: absolute;
	top: 20px;
	left: 22px;
	display: inline-flex;
	padding: 4px;
	border: 0;
	background: transparent;
	color: #1a1a1a;
	cursor: pointer;
	border-radius: 8px;
	line-height: 0;
}

.dx-bnpl-modal__close:hover {
	background: #f3f3f3;
}

.dx-bnpl-modal__eyebrow {
	margin: 34px 0 6px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--dx-bnpl-green);
}

.dx-bnpl-modal__heading {
	margin: 0 0 8px;
	font-size: 30px;
	line-height: 1.1;
	font-weight: 800;
	color: var(--dx-bnpl-ink);
}

.dx-bnpl-modal__total {
	margin: 0 0 6px;
	font-size: 15px;
	color: var(--dx-bnpl-muted);
}

.dx-bnpl-modal__total strong {
	color: var(--dx-bnpl-ink);
	font-weight: 700;
}

/* ================================================================== ROWS */

.dx-bnpl-modal__list {
	list-style: none;
	margin: 18px 0 0;
	padding: 0;
}

.dx-bnpl-row {
	display: grid;
	grid-template-columns: 120px 1fr auto;
	align-items: start;
	gap: 18px;
	padding: 22px 0;
	border-top: 1px solid var(--dx-bnpl-line);
}

.dx-bnpl-row:first-child {
	border-top: 0;
}

.dx-bnpl-row .dx-bnpl-badge {
	align-self: start;
	justify-self: start;
}

.dx-bnpl-row__body {
	min-width: 0;
}

.dx-bnpl-row__body {
	min-width: 0;
}

/* container the provider's native widget is moved into */
.dx-bnpl-row__native > * {
	display: block;
	max-width: 100%;
}

/* skeleton shimmer while the native widget hydrates */
.dx-bnpl-row.is-loading .dx-bnpl-row__body::after {
	content: "";
	display: block;
	height: 12px;
	width: 70%;
	border-radius: 6px;
	background: linear-gradient(90deg, #eee 25%, #f6f6f6 37%, #eee 63%);
	background-size: 400% 100%;
	animation: dx-bnpl-shimmer 1.2s ease infinite;
}

.dx-bnpl-row.has-native .dx-bnpl-row__body::after {
	display: none;
}

@keyframes dx-bnpl-shimmer {
	0% { background-position: 100% 0; }
	100% { background-position: -100% 0; }
}

.dx-bnpl-modal__empty {
	margin: 18px 0 0;
	padding: 18px 0;
	font-size: 15px;
	color: var(--dx-bnpl-muted);
}

.dx-bnpl-modal__disclaimer {
	margin: 22px 0 0;
	padding-top: 18px;
	border-top: 1px solid var(--dx-bnpl-line);
	font-size: 13px;
	line-height: 1.5;
	color: #b3b3b3;
}

/* body scroll lock helper */
body.dx-bnpl-modal-open {
	overflow: hidden;
}

/* Cards mode: hide the providers' native on-site messages where the gateways
   print them on the page — bnpl-cards.js moves them into the modal (which stays
   rendered while closed, so they hydrate there). They are moved on DOM ready,
   before their async SDKs run, so this display:none does not block hydration.
   (This stylesheet only loads in cards mode.) */
.single-product klarna-placement,
.single-product .affirm-as-low-as[data-page-type="product"],
.single-product square-placement[data-page-type="product"],
.single-product #pl-calculator-light-app,
.single-product #pl-calculator-too-low,
.single-product super-product-callout,
.single-product #wc-ppcp-paylater-msg-product {
	display: none !important;
}

/* Native widget once moved into a modal row: force it back to normal, visible,
   in-flow rendering (overriding any position/size the gateway or the hide rule
   applied). Modal is in <body>, so these win by id specificity + !important. */
#dx-bnpl-modal .dx-bnpl-row__native,
#dx-bnpl-modal .dx-bnpl-row__native > *,
#dx-bnpl-modal klarna-placement,
#dx-bnpl-modal .affirm-as-low-as,
#dx-bnpl-modal square-placement,
#dx-bnpl-modal #pl-calculator-light-app,
#dx-bnpl-modal #pl-calculator-too-low,
#dx-bnpl-modal super-product-callout {
	display: block !important;
	position: static !important;
	left: auto !important;
	top: auto !important;
	right: auto !important;
	width: auto !important;
	max-width: 100% !important;
	opacity: 1 !important;
	z-index: auto !important;
	visibility: visible !important;
}

/* Flatten Klarna's own bordered OSM container so the row sits flush like the
   plain-text providers (Afterpay/Clearpay). The inner ::part rotates its tag
   suffix, so the descendant *::part() reaches it regardless. */
#dx-bnpl-modal klarna-placement::part(osm-container),
#dx-bnpl-modal klarna-placement *::part(osm-container) {
	border: none !important;
	background: transparent !important;
	padding: 0 !important;
	margin: 0 !important;
}

/* Hide Klarna's own pink "Klarna" badge inside the OSM message — our left-column
   brand pill already provides it, so this avoids a duplicate badge in the row. */
#dx-bnpl-modal klarna-placement::part(osm-badge-container),
#dx-bnpl-modal klarna-placement *::part(osm-badge-container) {
	display: none !important;
}

/* ============================================================ RESPONSIVE */

@media (max-width: 600px) {
	.dx-bnpl-modal {
		padding: 0;
		align-items: flex-end;
	}

	.dx-bnpl-modal__dialog {
		max-width: 100%;
		max-height: 92vh;
		padding: 30px 20px 24px;
		border-radius: 22px 22px 0 0;
		transform: translateY(100%);
	}

	.dx-bnpl-modal.is-open .dx-bnpl-modal__dialog {
		transform: none;
	}

	.dx-bnpl-modal__heading {
		font-size: 25px;
	}

	.dx-bnpl-row {
		grid-template-columns: 1fr;
		gap: 8px;
		padding: 18px 0;
	}

	.dx-bnpl-row__link {
		justify-self: start;
	}
}
