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

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

/* ---------------- A/B test gate (bt-bb-ab CSS split test) ----------------
 * The gate lives in PHP, NOT here: mobilepay-express.php prints, on wp_head,
 *   body.test-css-<id>-2 .calio-mpx-slot { display:none !important }
 * reading the test id from the calio_mpx_abtest_id option (set by the probe
 * creator) so it auto-applies and can't be forgotten. Variation 1 keeps express
 * visible; the control arm (-2) hides it. Don't add a static gate here. */

/* ---------------- button ---------------- *
 * Branded MobilePay pill: MobilePay blue, white wordmark. Colors are a deliberate
 * brand override (must NOT inherit the theme's peach/navy button). Sized to sit
 * next to the theme's checkout button without dwarfing it. */

.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;
}

/* 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 {
	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;
}

/* Desktop: don't let the express button run the full content width. */
@media (min-width: 601px) {
	.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: square 4px corners (matches the theme's order buttons,
   not the base pill) and a touch smaller/less prominent than the primary buttons. */
.calio-mpx-cart-btn {
	min-height: 45px;
	border-radius: 5px;
}
.calio-mpx-cart-btn .calio-mpx-btn-prefix { font-size: 15px; }
.calio-mpx-cart-btn .calio-mpx-btn-logo { height: 14px !important; }

/* Cart PAGE: express button on its own full-width row. DESKTOP — below the theme's
   Shop videre + Gå til kassen row (order:99 = last). MOBILE — the three stack and we
   want checkout #1, MobilePay #2, Shop videre #3 (mobile block below). */
.woocommerce-cart .wc-proceed-to-checkout { flex-wrap: wrap; }
.woocommerce-cart .wc-proceed-to-checkout .calio-mpx-slot {
	flex-basis: 100%;
	width: 100%;
	order: 99;
	margin-top: 10px;
}
@media (max-width: 768px) {
	.woocommerce-cart .wc-proceed-to-checkout a.checkout-button { order: 1; margin-bottom: 0; }
	/* Even 10px gaps: the slot carries symmetric 10px top+bottom, and shop-videre's
	   theme 10px top margin is zeroed so it can't add to the gap below the slot. */
	.woocommerce-cart .wc-proceed-to-checkout .calio-mpx-slot   { order: 2; margin-top: 10px; margin-bottom: 10px; }
	.woocommerce-cart .wc-proceed-to-checkout a.shop-videre     { order: 3; margin-top: 0; }
}
/* Cart page desktop: right-align the express button under "Gå til kassen" and cap it
   at 300px to match that button's width (overrides the 360px centered rule). */
@media (min-width: 769px) {
	.woocommerce-cart .wc-proceed-to-checkout .calio-mpx-cart-btn {
		max-width: 300px;
		margin-left: auto;
		margin-right: 0;
	}
}

/* Fly-cart footer: the slot is a flex child of the theme's .buttons row. Let the
   row wrap and force the slot onto its own full-width line. DESKTOP — order:5 = last,
   below the two-button row. MOBILE — the three stack; reordered to checkout #1,
   MobilePay #2, Shop videre #3 (mobile block below). */
.fly-cart-footer .woocommerce-mini-cart__buttons.buttons { flex-wrap: wrap; }
.fly-cart-footer .calio-mpx-slot {
	order: 5;
	flex-basis: 100%;
	width: 100%;
	margin-top: 12px;
	margin-bottom: 5px;
}
/* Desktop: keep Shop videre + Gå til kurven sharing row 1. The theme sizes checkout
   at 60–80% which, once the row wraps, bumps view-cart(40%) onto its own line. Pin
   both so 40% + checkout(+its 10px margin) == 100% and they fit together; the
   slot(100%) still wraps below. High-specificity selectors (0,4,1 / 0,5,2) beat every
   theme width rule regardless of source order or whether .wp-element-button is present. */
@media (min-width: 769px) {
	.fly-cart-footer .woocommerce-mini-cart__buttons.buttons a.view-cart { flex-basis: 40%; }
	.fly-cart-footer .woocommerce-mini-cart__buttons.buttons a.button.checkout { flex-basis: calc(60% - 12px); }
	/* cap the express button at 300px too (overrides the 360px centered rule); stays centered. */
	.fly-cart-footer .calio-mpx-cart-btn { max-width: 300px; }
}
/* Mobile: all three stack full-width — order them checkout #1, MobilePay #2,
   Shop videre #3. Explicit high-specificity orders so it doesn't hinge on the
   theme's .wp-element-button order rule (which may not match this element). */
@media (max-width: 768px) {
	.fly-cart-footer .woocommerce-mini-cart__buttons.buttons a.button.checkout { order: 1; }
	/* Even 10px gaps: the slot carries symmetric 10px top+bottom, and view-cart's
	   theme 10px top margin is zeroed so it can't add to the gap below the slot. */
	.fly-cart-footer .calio-mpx-slot { order: 2; margin-top: 10px; margin-bottom: 10px; }
	.fly-cart-footer .woocommerce-mini-cart__buttons.buttons a.view-cart { order: 3; margin-top: 0; }
}

/* 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 #E7ECF3;
	border-bottom: 1px solid #E7ECF3;
	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: #F7F7F7;
}

.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 #E7ECF3;
	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: #19345C;
	cursor: pointer;
	user-select: none;
}
.calio-mpx-qty-btn:hover { background: #F7F7F7; }
.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-primary, #19345C);
	cursor: pointer;
	text-decoration: underline;
}
.calio-mpx-item-remove:hover { color: var(--e-global-color-primary, #19345C); }

/* 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 #E7ECF3;
	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-primary, #19345C);
	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 #E7ECF3;
	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-primary, #19345C);
	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: #F7F7F7;
	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-primary, #19345C);
	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: one concise reassurance line. */
.calio-mpx-appnote {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #E9F1FB;
	border-radius: 14px;
	padding: 12px 14px;
	margin-bottom: 14px;
	font-size: 13.5px;
	line-height: 1.45;
	color: #19345C;
}
.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. 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-primary, #19345C) !important;
	border-color: var(--e-global-color-primary, #19345C) !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: #19345C; }

/* 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-primary, #19345C);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}
.calio-mpx-terms-back:hover { background: #122740; 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). Navy 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-primary, #19345C);
	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;
}
