/**
 * Calio MobilePay Express — buttons + summary modal.
 * Typography inherits from the theme kit (Buddy font, #333 text); we only set
 * layout/box props, plus explicit colors on the MobilePay-blue brand buttons
 * (deliberate override: white text on #5A78FF must not follow the kit).
 */

.calio-mpx-hidden { display: none !important; }

/* ---------------- A/B test gate (bt-bb-ab split test 49427) ----------------
 * Variant test-css-49427-2 is the control arm WITHOUT MobilePay Express. Hide
 * every trace of the module — the product-page buttons + "eller" divider, the
 * cart / fly-cart express button slot, and the summary modal — so that arm
 * sees the store exactly as it was before express launched. Buttons are the
 * only express UI on the page (the plugin's own express buttons are already
 * removed in PHP), so these three wrappers cover it all. Remove this block
 * when the test concludes. */
body.test-css-49427-2 .calio-mpx-product-buttons,
body.test-css-49427-2 .calio-mpx-slot,
body.test-css-49427-2 .calio-mpx-overlay {
	display: none !important;
}

/* ---------------- buttons ---------------- *
 * One shared branded pill: MobilePay blue, white wordmark. Colors are a
 * deliberate brand override (must NOT inherit the theme's green button). Sized
 * to sit next to the theme's add-to-cart / checkout buttons without dwarfing
 * them. */

.calio-mpx-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 52px;
	padding: 12px 22px;
	border-radius: 30px;
	background: #5A78FF;
	color: #fff;
	line-height: 1.2;
	cursor: pointer;
	text-decoration: none;
	box-sizing: border-box;
	transition: background .15s ease, transform .15s ease;
}

.calio-mpx-btn:hover,
.calio-mpx-btn:focus {
	background: #4a66e8;
	color: #fff;
	transform: translateY(-1px);
}

.calio-mpx-btn-prefix {
	color: #fff;
	font-weight: 500;
	font-size: 17px;
	line-height: 1.2;
	white-space: nowrap;
}

/* Price mirrored from the add-to-cart button (product page, engangskøb). */
.calio-mpx-btn-price {
	color: #fff;
	font-weight: 500;
	font-size: 17px;
	line-height: 1.2;
	white-space: nowrap;
}
.calio-mpx-btn-price:empty { display: none; }

/* Loading state: hide the label/logo and show a spinner until the modal opens. */
.calio-mpx-btn.calio-mpx-loading {
	opacity: 1;
	pointer-events: none;
	position: relative;
}
.calio-mpx-btn.calio-mpx-loading .calio-mpx-btn-prefix,
.calio-mpx-btn.calio-mpx-loading .calio-mpx-btn-logo,
.calio-mpx-btn.calio-mpx-loading .calio-mpx-btn-price {
	visibility: hidden;
}
.calio-mpx-btn.calio-mpx-loading::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 20px;
	margin: -10px 0 0 -10px;
	border: 2.5px solid rgba(255, 255, 255, .45);
	border-top-color: #fff;
	border-radius: 50%;
	animation: calio-mpx-spin .7s linear infinite;
}
@keyframes calio-mpx-spin { to { transform: rotate(360deg); } }

/* White MobilePay wordmark. Aspect ratio ~5.6:1; height drives the size.
   !important defends against theme/global `img { height:auto }` rules that
   otherwise stretch the wordmark. */
.calio-mpx-btn .calio-mpx-btn-logo {
	display: block;
	height: 17px !important;
	width: auto !important;
	max-width: none !important;
	min-height: 0 !important;
	margin: 0 !important;
	flex: 0 0 auto;
	align-self: center;
}

.calio-mpx-product-buttons { margin-top: 12px; width: 100%; }

/* "eller" divider tying the express button to the add-to-cart button. */
.calio-mpx-or {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 14px auto 12px;
	max-width: 360px;
}
.calio-mpx-or::before,
.calio-mpx-or::after {
	content: "";
	flex: 1 1 auto;
	height: 1px;
	background: #E9EEE8;
}
.calio-mpx-or span {
	color: #7A7A7A;
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
}

/* Desktop: don't let the express buttons run the full content width. */
@media (min-width: 601px) {
	.calio-mpx-buy-now,
	.calio-mpx-cart-btn {
		max-width: 360px;
		margin-left: auto;
		margin-right: auto;
	}
}

.calio-mpx-slot { margin-top: 10px; width: 100%; }
/* No MobilePay button for empty / subscription carts. */
.calio-mpx-slot[data-state="none"],
.calio-mpx-slot[data-state="subscription"] { display: none; }

/* Fly-cart / cart footer: a touch more compact than the product page. */
.calio-mpx-cart-btn { min-height: 48px; }
.calio-mpx-cart-btn .calio-mpx-btn-prefix { font-size: 15.5px; }
.calio-mpx-cart-btn .calio-mpx-btn-logo { height: 15px !important; }

/* Cart PAGE: put the express button on its own row BELOW "Fortsæt til kassen"
   (the theme lays Shop videre + checkout in a flex row; we wrap ours under). */
.woocommerce-cart .wc-proceed-to-checkout { flex-wrap: wrap; }
.woocommerce-cart .wc-proceed-to-checkout .calio-mpx-slot {
	flex-basis: 100%;
	width: 100%;
	order: 10;
	margin-top: 8px;
}
/* Cart PAGE mobile: express sits right under "Fortsæt til kassen" (grouped),
   with "Shop videre" moved below both and given breathing room. */
@media (max-width: 768px) {
	.woocommerce-cart .wc-proceed-to-checkout .calio-mpx-slot { order: 1; margin-top: 8px; }
	.woocommerce-cart .wc-proceed-to-checkout a.shop-videre { order: 2; margin-top: 14px; }
}

/* Fly-cart footer layout: stack checkout + express + payment icons. The checkout
   button keeps its own 10px bottom margin, so the express slot needs no top
   margin (tighter gap); it just holds space down to the payment badges. */
.fly-cart-footer .woocommerce-mini-cart__buttons.buttons { flex-wrap: wrap; }
.fly-cart-footer .calio-mpx-slot {
	flex-basis: 100%;
	margin-top: 0;
	margin-bottom: 14px;
}

/* loading state */
.calio-mpx-loading {
	opacity: .55;
	pointer-events: none;
	position: relative;
}

/* ---------------- modal ---------------- */

/* Scroll lock — pin the body (mobile ignores plain overflow:hidden). JS restores
   the scroll position on close via body.style.top. */
body.calio-mpx-modal-open {
	position: fixed;
	width: 100%;
	overflow: hidden;
}

.calio-mpx-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	background: rgba(20, 24, 31, .5);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 18px;
}

.calio-mpx-modal {
	position: relative;
	width: 100%;
	max-width: 500px;
	max-height: min(92vh, 860px);
	overflow-y: auto;
	background: #fff;
	border-radius: 20px;
	padding: 26px 24px 22px;
	box-shadow: 0 18px 60px rgba(0, 0, 0, .22);
}

.calio-mpx-close {
	position: absolute;
	top: 12px;
	right: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	font-size: 32px;
	line-height: 1;
	cursor: pointer;
	color: #d63638;
}
.calio-mpx-close:hover { color: #b32d2e; }

.calio-mpx-head { margin-bottom: 16px; padding-right: 26px; }
.calio-mpx-head-title {
	display: block;
	font-weight: 600;
	font-size: 20px;
	line-height: 1.3;
}
.calio-mpx-head-sub {
	display: block;
	margin-top: 3px;
	font-size: 14px;
	line-height: 1.5;
	color: #7A7A7A;
}

/* items */
.calio-mpx-items {
	border-top: 1px solid #E9EEE8;
	border-bottom: 1px solid #E9EEE8;
	padding: 6px 0;
	margin-bottom: 12px;
}

/* Row layout: image | title | quantity (own column) | price + remove. */
.calio-mpx-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 0;
}

.calio-mpx-item-img { flex: 0 0 48px; }
.calio-mpx-item-img img {
	display: block;
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: 10px;
	background: #FAF9F7;
}

.calio-mpx-item-main {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.calio-mpx-item-name {
	font-weight: 500;
	font-size: 14px;
	line-height: 1.3;
	/* wrap to at most two lines, then ellipsis */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.calio-mpx-item-giftbadge {
	font-size: 12px;
	font-weight: 500;
	color: #55B607;
}

/* quantity stepper — its own column, with clear separation from the price. */
.calio-mpx-qty {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	margin-right: 8px;
	border: 1px solid #E9EEE8;
	border-radius: 20px;
	overflow: hidden;
}
.calio-mpx-qty-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	font-size: 17px;
	line-height: 1;
	color: #333;
	cursor: pointer;
	user-select: none;
}
.calio-mpx-qty-btn:hover { background: #FAF9F7; }
.calio-mpx-qty-val {
	min-width: 26px;
	text-align: center;
	font-size: 13.5px;
	font-weight: 600;
}

.calio-mpx-item-right {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0;
	line-height: 1.2;
}
.calio-mpx-item-total {
	font-weight: 500;
	font-size: 14px;
	line-height: 1.2;
	white-space: nowrap;
}
.calio-mpx-item-remove {
	margin-top: 3px;
	font-size: 12.5px;
	line-height: 1.2;
	color: var(--e-global-color-ec74859, #18564B);
	cursor: pointer;
	text-decoration: underline;
}
.calio-mpx-item-remove:hover { color: var(--e-global-color-ec74859, #18564B); }

/* the editable region shows a subtle busy state while an edit is in flight */
.calio-mpx-refresh.calio-mpx-loading { opacity: .55; pointer-events: none; }

/* totals */
.calio-mpx-totals { margin-bottom: 14px; }

.calio-mpx-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	font-size: 14px;
	line-height: 1.6;
}

.calio-mpx-discount { color: #55B607; }
.calio-mpx-muted { color: #7A7A7A; }

.calio-mpx-grand {
	margin-top: 6px;
	padding-top: 8px;
	border-top: 1px solid #E9EEE8;
	font-weight: 600;
	font-size: 16px;
}

/* Free shipping: no subtotal row and no divider line above the total. */
.calio-mpx-totals--free .calio-mpx-row-subtotal { display: none; }
.calio-mpx-totals--free .calio-mpx-grand {
	margin-top: 0;
	padding-top: 0;
	border-top: none;
}

/* coupon — compact "Har du en rabatkode?" that expands to an input. */
.calio-mpx-coupon { margin-bottom: 14px; }
.calio-mpx-coupon-toggle {
	display: inline-block;
	font-size: 13.5px;
	font-weight: 500;
	color: var(--e-global-color-ec74859, #18564B);
	cursor: pointer;
	text-decoration: underline;
}
.calio-mpx-coupon-form {
	display: flex;
	gap: 8px;
	margin-top: 4px;
}
.calio-mpx-coupon-input {
	flex: 1 1 auto;
	min-width: 0;
	height: 42px;
	padding: 0 14px;
	border: 1px solid #E9EEE8;
	border-radius: 10px;
	font-size: 14px;
	background: #fff;
}
.calio-mpx-coupon-apply {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	padding: 0 18px;
	border-radius: 10px;
	background: var(--e-global-color-ec74859, #18564B);
	color: #fff;
	font-size: 13.5px;
	font-weight: 500;
	cursor: pointer;
}
.calio-mpx-coupon-apply:hover { opacity: .92; }
.calio-mpx-coupon-applied {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 8px 12px;
	border-radius: 10px;
	background: #FAF9F7;
	font-size: 13.5px;
}
.calio-mpx-coupon-tag { font-weight: 600; color: #55B607; }
.calio-mpx-coupon-remove {
	font-size: 12.5px;
	color: var(--e-global-color-ec74859, #18564B);
	cursor: pointer;
	text-decoration: underline;
}
.calio-mpx-coupon-msg {
	margin-top: 5px;
	font-size: 12.5px;
	color: #d63638;
	line-height: 1.4;
}

.calio-mpx-vat-note {
	font-size: 12px;
	line-height: 1.5;
	color: #7A7A7A;
	text-align: right;
}

/* app-note (replaces the 1-2-3 steps): one concise reassurance line. */
.calio-mpx-appnote {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #FAF9F7;
	border-radius: 14px;
	padding: 12px 14px;
	margin-bottom: 14px;
	font-size: 13.5px;
	line-height: 1.45;
	color: #333;
}
.calio-mpx-appnote-icon {
	flex: 0 0 auto;
	display: inline-flex;
	color: #5A78FF;
}
.calio-mpx-appnote-icon svg { width: 22px; height: 22px; display: block; }

/* newsletter + terms consent (mirrors the checkout boxes). No divider between
   them — just spacing (2px extra above the top box, 5px below the bottom box).
   The theme skins native checkboxes via :before/:after pseudo-elements and mobile
   browsers ignore width/height on native checkboxes — so we build our OWN box
   (appearance:none) at a fixed size, consistent on desktop AND mobile. */
.calio-mpx-newsletter,
.calio-mpx-terms {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	font-size: 13.5px;
	line-height: 1.5;
	cursor: pointer;
}
.calio-mpx-newsletter { margin-top: 2px; margin-bottom: 12px; }
.calio-mpx-terms { margin-bottom: 9px; }

.calio-mpx-modal input[type="checkbox"].calio-mpx-newsletter-box,
.calio-mpx-modal input[type="checkbox"].calio-mpx-terms-box {
	flex: 0 0 auto !important;
	-webkit-appearance: none !important;
	-moz-appearance: none !important;
	appearance: none !important;
	box-sizing: border-box !important;
	width: 22px !important;
	height: 22px !important;
	min-width: 22px !important;
	min-height: 22px !important;
	margin: 1px 0 0 !important;
	padding: 0 !important;
	position: relative !important;
	border: 2px solid #C9C9C9 !important;
	border-radius: 5px !important;
	background: #fff !important;
	cursor: pointer;
}
.calio-mpx-modal input[type="checkbox"].calio-mpx-newsletter-box:checked,
.calio-mpx-modal input[type="checkbox"].calio-mpx-terms-box:checked {
	background: var(--e-global-color-ec74859, #18564B) !important;
	border-color: var(--e-global-color-ec74859, #18564B) !important;
}
.calio-mpx-modal input[type="checkbox"].calio-mpx-newsletter-box::before,
.calio-mpx-modal input[type="checkbox"].calio-mpx-terms-box::before {
	content: "" !important;
	display: none !important;
}
.calio-mpx-modal input[type="checkbox"].calio-mpx-newsletter-box:checked::after,
.calio-mpx-modal input[type="checkbox"].calio-mpx-terms-box:checked::after {
	content: "" !important;
	display: block !important;
	position: absolute !important;
	left: 6px;
	top: 2px;
	width: 6px;
	height: 11px;
	border: solid #fff !important;
	border-width: 0 2px 2px 0 !important;
	transform: rotate(45deg);
}

.calio-mpx-terms-warn {
	display: block;
	font-size: 12.5px;
	color: #d63638;
	margin-bottom: 4px;
}

@keyframes calio-mpx-bounce {
	0%, 100% { transform: translateX(0); }
	25% { transform: translateX(-4px); }
	75% { transform: translateX(4px); }
}
.calio-mpx-bounce { animation: calio-mpx-bounce .3s ease 2; display: inline-block; }

/* CTA + cancel — a bit more air above the pay button (below the terms box). */
.calio-mpx-continue { margin-top: 18px; }

.calio-mpx-cancel {
	display: block;
	margin-top: 10px;
	text-align: center;
	font-size: 13.5px;
	color: #7A7A7A;
	cursor: pointer;
	text-decoration: underline;
}
.calio-mpx-cancel:hover { color: #333; }

/* in-modal terms reader — hide the close "X" here so the prominent "Tilbage"
   button is the obvious (and only) way back. */
.calio-mpx-modal.calio-mpx-viewing-terms .calio-mpx-close { display: none; }

.calio-mpx-terms-back {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin-bottom: 16px;
	padding: 9px 18px;
	border-radius: 30px;
	background: var(--e-global-color-ec74859, #18564B);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}
.calio-mpx-terms-back:hover { background: #123f37; color: #fff; }
.calio-mpx-terms-body {
	font-size: 13.5px;
	line-height: 1.6;
	color: #333;
	overflow-wrap: break-word;
}
.calio-mpx-terms-body > :first-child { margin-top: 0; }
.calio-mpx-terms-body img,
.calio-mpx-terms-body table { max-width: 100%; height: auto; }

/* trust banner — flush to the modal's bottom + side edges (cancels the modal
   padding via negative margins). Dark-green band, white text, compact. */
.calio-mpx-trust {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 10px -24px -22px;
	padding: 8px 18px;
	background: var(--e-global-color-ec74859, #18564B);
	border-radius: 0 0 20px 20px;
}
.calio-mpx-trust-stars { height: 16px; width: auto; display: block; }
.calio-mpx-trust-text {
	font-size: 13px;
	font-weight: 500;
	color: #fff;
	white-space: nowrap;
}
.calio-mpx-trust-sep { color: rgba(255, 255, 255, .5); margin: 0 2px; }

/* mobile: bottom-sheet feel */
@media (max-width: 600px) {
	.calio-mpx-overlay { padding: 0; align-items: flex-end; }
	.calio-mpx-modal {
		max-width: none;
		border-radius: 20px 20px 0 0;
		max-height: 92vh;
		padding: 22px 18px 18px;
	}
	.calio-mpx-trust {
		margin: 16px -18px -18px;
		border-radius: 0;
	}
}

/* ---------------- woo-vipps express landing overlay ----------------
 * The plugin's own "preparing your order" interstitial (/vipps-express-checkout/)
 * shows its .vippsoverlay spinner at opacity .5 over the page, so the themed page
 * bleeds through and looks half-broken. Make it a solid full-screen cover with a
 * crisp spinner (opacity applies to the spinner child too) that sits above the
 * sticky header. On failure the plugin removes body.processing, which hides the
 * overlay and reveals the error underneath — so this never masks a real error. */
.vippsoverlay {
	opacity: 0.95 !important;
	background: #fff !important;
	z-index: 99999 !important;
}
