/* Smart Upsell — storefront styles. --smup-accent is set from the settings page. */

.smup-offers,
.smup-bumps {
	--smup-radius: 12px;
	--smup-border: rgba(0, 0, 0, 0.12);
	--smup-muted: rgba(0, 0, 0, 0.6);
	--smup-surface: #fff;
	display: grid;
	gap: 12px;
	margin: 20px 0;
}

.smup-popup {
	--smup-radius: 12px;
	--smup-border: rgba(0, 0, 0, 0.12);
	--smup-muted: rgba(0, 0, 0, 0.6);
	--smup-surface: #fff;
}

/* ---------------------------------------------------------------------
 * Offer box
 * ------------------------------------------------------------------- */

.smup-offer {
	position: relative;
	display: flex;
	gap: 16px;
	align-items: center;
	padding: 16px;
	background: var(--smup-surface);
	border: 2px dashed var(--smup-accent, #e8590c);
	border-radius: var(--smup-radius);
	text-align: start;
	transition: opacity 0.2s;
}

.smup-offer.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

.smup-offer__image {
	flex: 0 0 96px;
}

.smup-offer__image img {
	display: block;
	width: 96px;
	height: 96px;
	object-fit: cover;
	border-radius: 8px;
	margin: 0;
}

.smup-offer__body {
	flex: 1 1 auto;
	min-width: 0;
}

.smup-offer__badge {
	display: inline-block;
	margin-block-end: 6px;
	padding: 2px 10px;
	background: var(--smup-accent, #e8590c);
	color: #fff;
	border-radius: 999px;
	font-size: 0.8em;
	font-weight: 700;
	line-height: 1.8;
}

.smup-offer .smup-offer__title {
	margin: 0 0 6px;
	font-size: 1.05em;
	line-height: 1.6;
}

.smup-offer__desc {
	color: var(--smup-muted);
	font-size: 0.92em;
}

.smup-offer__desc p {
	margin: 0 0 6px;
}

.smup-offer__price {
	margin: 6px 0 10px;
	font-weight: 700;
}

.smup-offer__price del {
	opacity: 0.55;
	font-weight: 400;
	margin-inline-end: 6px;
}

.smup-offer__price ins {
	text-decoration: none;
	color: var(--smup-accent, #e8590c);
}

.smup-offer__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	align-items: center;
}

/* Three classes so theme rules like `.button.alt` (loaded after us) don't win. */
.smup-offer .smup-offer__actions .smup-accept {
	background: var(--smup-accent, #e8590c);
	border-color: var(--smup-accent, #e8590c);
	color: #fff;
}

.smup-offer .smup-offer__actions .smup-accept:hover,
.smup-offer .smup-offer__actions .smup-accept:focus-visible {
	background: var(--smup-accent, #e8590c);
	color: #fff;
	filter: brightness(0.92);
}

.smup-offer .smup-skip {
	padding: 0;
	background: none;
	border: 0;
	color: var(--smup-muted);
	font-size: 0.9em;
	text-decoration: underline;
	cursor: pointer;
}

.smup-offer__message:empty,
.smup-bump__message:empty {
	display: none;
}

.smup-offer__message,
.smup-bump__message {
	margin-top: 8px;
	font-size: 0.92em;
	color: #2b8a3e;
}

.smup-offer__message.is-error,
.smup-bump__message.is-error {
	color: #c92a2a;
}

.smup-offer__cart-link {
	font-weight: 700;
}

/* Shown on the next funnel offer after the previous one was accepted. */
.smup-offer__flash {
	margin-bottom: 10px;
	padding: 6px 10px;
	background: rgba(43, 138, 62, 0.1);
	border-radius: 6px;
	color: #2b8a3e;
	font-size: 0.9em;
}

.smup-offers--thankyou {
	margin: 0 0 24px;
}

@media (max-width: 480px) {
	.smup-offer {
		flex-direction: column;
		align-items: stretch;
		text-align: center;
	}

	.smup-offer__image {
		flex-basis: auto;
		align-self: center;
	}

	.smup-offer__actions {
		justify-content: center;
	}
}

/* ---------------------------------------------------------------------
 * Popup
 * ------------------------------------------------------------------- */

html.smup-popup-open {
	overflow: hidden;
}

.smup-popup {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.smup-popup[hidden] {
	display: none;
}

.smup-popup__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	opacity: 0;
	transition: opacity 0.2s;
}

.smup-popup__dialog {
	position: relative;
	width: 100%;
	max-width: 520px;
	max-height: calc(100vh - 32px);
	overflow: auto;
	background: var(--smup-surface);
	border-radius: var(--smup-radius);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	transition: opacity 0.2s, transform 0.2s;
	outline: none;
}

.smup-popup.is-open .smup-popup__backdrop,
.smup-popup.is-open .smup-popup__dialog {
	opacity: 1;
	transform: none;
}

.smup-popup__close {
	position: absolute;
	top: 8px;
	inset-inline-end: 8px;
	z-index: 1;
	width: 36px;
	height: 36px;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 50%;
	color: var(--smup-muted);
	font-size: 26px;
	line-height: 36px;
	cursor: pointer;
}

.smup-popup__close:hover,
.smup-popup__close:focus-visible {
	background: rgba(0, 0, 0, 0.06);
}

.smup-offer--popup {
	flex-direction: column;
	align-items: stretch;
	padding: 28px 24px 24px;
	border: 0;
	text-align: center;
}

.smup-offer--popup .smup-offer__image {
	flex-basis: auto;
	align-self: center;
}

.smup-offer--popup .smup-offer__image img {
	width: 160px;
	height: 160px;
}

.smup-offer--popup .smup-offer__actions {
	flex-direction: column;
}

.smup-offer--popup .smup-offer__actions .smup-accept {
	width: 100%;
}

@media (prefers-reduced-motion: reduce) {
	.smup-popup__backdrop,
	.smup-popup__dialog {
		transition: none;
	}
}

/* ---------------------------------------------------------------------
 * Order bump
 * ------------------------------------------------------------------- */

.smup-bump {
	border: 2px dashed var(--smup-accent, #e8590c);
	border-radius: var(--smup-radius);
	background: var(--smup-surface);
	overflow: hidden;
	transition: opacity 0.2s;
}

.smup-bump.is-checked {
	border-style: solid;
}

.smup-bump.is-loading {
	opacity: 0.6;
}

.smup-bump__head {
	display: flex;
	gap: 10px;
	align-items: center;
	margin: 0;
	padding: 12px 16px;
	background: rgba(0, 0, 0, 0.04);
	background: color-mix(in srgb, var(--smup-accent, #e8590c) 12%, transparent);
	font-weight: 700;
	cursor: pointer;
}

.smup-bump__head input {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	margin: 0;
	accent-color: var(--smup-accent, #e8590c);
}

.smup-bump__body {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	padding: 12px 16px;
}

.smup-bump__image img {
	display: block;
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 8px;
	margin: 0;
}

.smup-bump__text {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 0.92em;
}

.smup-bump__desc p {
	margin: 0 0 6px;
}

.smup-bump__price del {
	opacity: 0.55;
	margin-inline-end: 6px;
}

.smup-bump__price ins {
	text-decoration: none;
	font-weight: 700;
	color: var(--smup-accent, #e8590c);
}

.smup-bump__message {
	margin: 0;
	padding: 0 16px 12px;
}

/* ---------------------------------------------------------------------
 * Cart badge
 * ------------------------------------------------------------------- */

.smup-cart-badge {
	display: inline-block;
	margin-inline-start: 6px;
	padding: 0 8px;
	background: var(--smup-accent, #e8590c);
	color: #fff;
	border-radius: 999px;
	font-size: 0.75em;
	line-height: 1.8;
	vertical-align: middle;
}
