/* ==========================================================================
   «Tilbud i kassen» — the offer row under the order total in the cart and
   checkout blocks (assets/js/shop-offer.js, Krem Innstillinger → Butikk).
   ========================================================================== */

.krem-shop-offer {
	container-type: inline-size;
	display: grid;
	grid-template-columns: var(--wp--custom--sizes--thumbnail-sidebar) 1fr auto;
	align-items: center;
	gap: var(--wp--custom--spacing--sm) var(--wp--custom--spacing--md);
	margin: var(--wp--custom--spacing--md) 0;
	padding: var(--wp--custom--spacing--md);
	background: var(--wp--preset--color--cream);
	border: 2px dashed var(--wp--preset--color--accent-light);
	border-radius: var(--wp--custom--border-radius--lg);
}

/* WC pads every child of the order-summary slot `16px 0`
   (.wc-block-components-totals-wrapper.slot-wrapper > * > *), which wipes the
   side padding above — body + the slot's class outranks it. */
body .wc-block-components-order-meta .krem-shop-offer {
	padding: var(--wp--custom--spacing--md);
}

.krem-shop-offer__image {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	object-fit: cover;
	border-radius: var(--wp--custom--border-radius--default);
	background: var(--wp--preset--color--white);
}

.krem-shop-offer__body {
	min-width: 0;
}

.krem-shop-offer__body p {
	margin: 0;
}

.krem-shop-offer__heading {
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--wp--preset--color--primary);
}

.krem-shop-offer__name {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 700;
	line-height: 1.25;
	color: var(--wp--preset--color--text);
}

.krem-shop-offer__price {
	margin-top: var(--wp--custom--spacing--xs);
	font-weight: 700;
	color: var(--wp--preset--color--primary);
}

.krem-shop-offer__price del {
	font-weight: 400;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--text-muted);
}

.krem-shop-offer__price ins {
	text-decoration: none;
}

.krem-shop-offer__text {
	margin-top: var(--wp--custom--spacing--xs);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--text-light);
}

.krem-shop-offer__button[disabled] {
	cursor: progress;
}

.krem-shop-offer__error {
	grid-column: 1 / -1;
	flex-basis: 100%; /* Own row in the «added» (flex) state too. */
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--primary-dark);
}

/* --- After «Legg til»: confirmation + «Angre» --- */

.krem-shop-offer--added {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	background: var(--wp--preset--color--background-alt);
	border-style: solid;
	border-color: var(--wp--preset--color--border);
}

.krem-shop-offer__status {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	color: var(--wp--preset--color--text);
}

.krem-shop-offer__undo {
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	color: var(--wp--preset--color--primary);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.krem-shop-offer__undo:hover {
	color: var(--wp--preset--color--primary-dark);
}

/* --- In the mini-cart drawer: between the items and the subtotal,
   lined up with the items (same side padding as .mini-cart-items). --- */

.krem-mini-cart__inner .krem-shop-offer {
	margin: 0 var(--wp--custom--spacing--lg) var(--wp--custom--spacing--md);
}

/* WooCommerce's AJAX button: busy while adding; its «Vis handlekurv» link
   would flash in for a moment before the drawer refreshes. */
.krem-shop-offer__button.loading {
	pointer-events: none;
	cursor: progress;
}

.krem-shop-offer .added_to_cart {
	display: none;
}

@media (max-width: 480px) {
	.krem-mini-cart__inner .krem-shop-offer {
		margin-left: var(--wp--custom--spacing--md);
		margin-right: var(--wp--custom--spacing--md);
	}
}

/* Narrow summary (phones, slim sidebars): button gets its own full-width row. */
@container (max-width: 340px) {
	.krem-shop-offer__button {
		grid-column: 1 / -1;
		width: 100%;
	}
}
