/**
 * ChatSell Moneris Gateway Pro — checkout styles for Apple Pay, Google Pay and the
 * 3-D Secure challenge modal. Loaded alongside the core plugin's checkout.css.
 */

/* --- Apple Pay ------------------------------------------------------------ */

.moneris-api-applepay-fields {
	margin-top: 0.75em;
}

.moneris-api-applepay-note {
	margin: 0 0 12px;
	color: #50575e;
	font-size: 0.92em;
	line-height: 1.5;
}

/* Spans the payment box, like the note and the gate prompt above it; a narrower button
   reads as a layout fault beside them. */
.moneris-api-applepay-button-wrap {
	width: 100%;
}

/* Apple requires the button to be drawn by the system rather than imitated, which is what
   the -apple-pay-button appearance does: the browser paints the mark, the wording and the
   localisation. It renders as nothing at all where Apple Pay is unavailable, so the wrapper
   stays hidden until the session core confirms support. */
/* Selected through the wrapper (and again for the interaction states) so it outranks the
   site-wide `button` rules themes ship — Elementor's kit, for one, gives every button a pill
   radius, a border and hover colours at higher specificity than a lone class. */
.moneris-api-applepay-button-wrap .moneris-api-applepay-button,
.moneris-api-applepay-button-wrap .moneris-api-applepay-button:hover,
.moneris-api-applepay-button-wrap .moneris-api-applepay-button:focus,
.moneris-api-applepay-button-wrap .moneris-api-applepay-button:active {
	-webkit-appearance: -apple-pay-button;
	appearance: -apple-pay-button;
	-apple-pay-button-type: buy;
	-apple-pay-button-style: black;
	display: block;
	width: 100%;
	/* Apple's minimum touch target for the button. */
	min-height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: none;
	box-shadow: none;
	cursor: pointer;
}

.moneris-api-applepay-fields[data-button-style="white"] .moneris-api-applepay-button {
	-apple-pay-button-style: white;
}

.moneris-api-applepay-fields[data-button-style="white-outline"] .moneris-api-applepay-button {
	-apple-pay-button-style: white-outline;
}

/* Blocks only: the sheet and the order are two steps there, so the shopper needs telling
   that the first one landed. */
.moneris-api-applepay-authorized {
	margin: 0 0 8px;
	padding: 10px 12px;
	border-radius: 6px;
	background: #edfaef;
	color: #1e4620;
	font-size: 0.92em;
	line-height: 1.4;
}

.moneris-api-applepay-again {
	background: none;
	border: 0;
	padding: 0;
	color: #50575e;
	font-size: 0.88em;
	text-decoration: underline;
	cursor: pointer;
}

.moneris-api-applepay-again:hover,
.moneris-api-applepay-again:focus {
	color: #1e1e1e;
}

/* --- Google Pay ----------------------------------------------------------- */

.moneris-api-googlepay-fields {
	margin-top: 0.75em;
}

.moneris-api-googlepay-note {
	margin: 0 0 12px;
	color: #50575e;
	font-size: 0.92em;
	line-height: 1.5;
}

/* Google draws the button itself, in "fill" size mode — it takes the size of this wrapper,
   so the wrapper is the only place its dimensions can come from. It spans the payment box
   like the Apple Pay button; 44px matches the minimum touch target used there. */
.moneris-api-googlepay-button-wrap {
	width: 100%;
	min-height: 44px;
}

.moneris-api-googlepay-button-wrap > div {
	min-height: 44px;
}

/* Google's stylesheet styles its button by class alone, so any theme rule on `button` that
   carries more weight (Elementor's kit: padding, a 25px pill radius, a border, hover colours)
   wins over it. The padding is the visible damage — the frame that holds the wording is laid
   out from the content box, so it shifts right by the padding and the label sits off-centre —
   but the radius, border and hover colour also break Google's brand requirements. Put back
   what Google's own rules would have produced, at a weight the theme cannot reach. Values
   are Google's: 4px is the default button radius, the greys are its hover/pressed shades. */
.moneris-api-googlepay-button-wrap button.gpay-card-info-container,
.moneris-api-googlepay-button-wrap button.gpay-card-info-container:hover,
.moneris-api-googlepay-button-wrap button.gpay-card-info-container:focus,
.moneris-api-googlepay-button-wrap button.gpay-card-info-container:active {
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 4px;
	text-transform: none;
	letter-spacing: normal;
}

.moneris-api-googlepay-button-wrap button.gpay-card-info-container.black:focus {
	background-color: #000;
}

.moneris-api-googlepay-button-wrap button.gpay-card-info-container.black:hover {
	background-color: #3c4043;
}

.moneris-api-googlepay-button-wrap button.gpay-card-info-container.black:active {
	background-color: #5f6368;
}

.moneris-api-googlepay-button-wrap button.gpay-card-info-container.white:focus,
.moneris-api-googlepay-button-wrap button.gpay-card-info-container.white:active {
	background-color: #fff;
}

.moneris-api-googlepay-button-wrap button.gpay-card-info-container.white:hover {
	background-color: #f8f8f8;
}

/* Blocks only: the sheet and the order are two steps there, so the shopper needs telling
   that the first one landed. */
.moneris-api-googlepay-authorized {
	margin: 0 0 8px;
	padding: 10px 12px;
	border-radius: 6px;
	background: #edfaef;
	color: #1e4620;
	font-size: 0.92em;
	line-height: 1.4;
}

/* --- 3-D Secure challenge modal ------------------------------------------ */

.moneris-api-3ds-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.55);
	padding: 16px;
}

.moneris-api-3ds-modal {
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
	width: 100%;
	max-width: 440px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	/* Never taller than the viewport: the iframe shrinks (min 200px) before anything clips. */
	max-height: calc(100vh - 32px);
}

.moneris-api-3ds-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	flex: 0 0 auto;
	padding: 12px 16px;
	border-bottom: 1px solid #e0e0e0;
	font-size: 0.95em;
	font-weight: 600;
	color: #1e1e1e;
}

.moneris-api-3ds-close {
	flex: 0 0 auto;
	background: none;
	border: 0;
	padding: 0 4px;
	font-size: 22px;
	line-height: 1;
	color: #50575e;
	cursor: pointer;
}

.moneris-api-3ds-close:hover,
.moneris-api-3ds-close:focus {
	color: #1e1e1e;
}

/* Holds the frame and the busy layer stacked on top of each other. */
.moneris-api-3ds-body {
	position: relative;
	display: flex;
	flex-shrink: 1;
	min-height: 200px;
}

.moneris-api-3ds-modal iframe {
	display: block;
	width: 100%;
	height: 440px;
	flex-shrink: 1;
	min-height: 200px;
	border: 0;
	background: #fff;
}

/* Shown while the ACS page loads and again while the challenge result is being resolved —
   both are stretches where the frame is blank and the shopper needs telling to wait. */
.moneris-api-3ds-busy {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 16px;
	background: #fff;
	color: #50575e;
	font-size: 0.92em;
	text-align: center;
}

.moneris-api-3ds-busy[hidden] {
	display: none;
}

.moneris-api-3ds-spinner,
.moneris-api-spinner {
	display: block;
	width: 28px;
	height: 28px;
	border: 3px solid rgba(0, 0, 0, 0.15);
	border-top-color: #2271b1;
	border-radius: 50%;
	animation: moneris-api-spin 0.8s linear infinite;
}

@keyframes moneris-api-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.moneris-api-3ds-spinner,
	.moneris-api-spinner {
		animation-duration: 2.4s;
	}
}
