/* BOGO cart / mini cart item (border color per tier is printed in wp_head) */
.bs-bogo-item {
	position: relative;
	border: 2px solid #469ab7;
}

/* Checkout order review: rows are separated by a bottom divider, not boxed, so the
   BOGO row keeps that divider (beating the per-tier border color from wp_head) and
   is marked by its badge instead. */
.woocommerce-checkout-review-order-table .bs-bogo-item[class*="bs-bogo-tier-"] {
	border-width: 0 0 1px;
	border-color: #dfdfdf;
}

/* Mini cart items are borderless rounded cards; a border inside the 20px radius
   crowds the content, so the BOGO item is marked by its badge alone. */
.woocommerce-mini-cart li.bs-bogo-item {
	border: 0;
}

/* Matches the theme's .bs-bundle-tag pill; background is the tier color, set inline. */
.bs-bogo-badge {
	display: inline-block;
	margin-top: 4px;
	padding: 4px 10px;
	border-radius: 999px;
	background-color: #469ab7;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	white-space: nowrap;
}

/* Quantity is locked to 1 for BOGO items */
.bs-bogo-item input[type="button"]:disabled,
.bs-bogo-item button:disabled {
	background-color: #ddd;
	color: #999;
	cursor: auto;
}

.bs-bogo-item .quantity > .qty {
	background-color: #ddd;
}

/* "Free item added" animation */
.bs-bogo-lottie {
	position: absolute;
	inset: 0;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.bs-bogo-lottie dotlottie-player {
	width: 100%;
	height: 100%;
}

/* "You unlocked ..." banner (scripts.js): above the mini cart content / cart form,
   in the tier color (--bs-bogo-color, set inline), shown once per BOGO item */
.bs-bogo-unlock {
	--bs-bogo-color: #469ab7;
	position: relative;
	z-index: 20;
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 12px;
	box-sizing: border-box;
	margin: 10px 20px 1rem;
	padding: 12px 40px 12px 14px;
	border-radius: 12px;
	background: linear-gradient(135deg, var(--bs-bogo-color), color-mix(in srgb, var(--bs-bogo-color) 70%, #000));
	color: #fff;
	box-shadow: 0 8px 24px color-mix(in srgb, var(--bs-bogo-color) 45%, transparent);
	opacity: 0;
	transform: translateY(-12px) scale(.96);
	transition: opacity .35s ease, transform .35s cubic-bezier(.34, 1.56, .64, 1);
}

.bs-bogo-unlock--cart-page {
	margin: 0 0 16px;
}

.bs-bogo-unlock.is-shown {
	opacity: 1;
	transform: none;
}

/* Fades out in place; scripts.js then removes it and slides what's below up with a
   transform (no height animation, which would make the items' text jitter) */
.bs-bogo-unlock.is-leaving {
	opacity: 0;
	transform: translateY(-8px);
	transition: opacity .25s ease, transform .25s ease;
}

.bs-bogo-unlock__icon {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .2);
}

.bs-bogo-unlock.is-shown .bs-bogo-unlock__icon {
	animation: bs-bogo-wiggle .9s ease .2s 2;
}

.bs-bogo-unlock__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	font-size: 12px;
	line-height: 1.3;
}

.bs-bogo-unlock__text strong {
	font-size: 14px;
	font-weight: 700;
}

.bs-bogo-unlock__close {
	position: absolute;
	top: 6px;
	right: 8px;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font-size: 18px;
	line-height: 24px;
	opacity: .8;
	cursor: pointer;
}

.bs-bogo-unlock__close:hover {
	opacity: 1;
}

/* Confetti bursts from the banner and falls over the items below */
.bs-bogo-unlock__confetti {
	position: absolute;
	inset: 0 0 auto;
	height: 0;
	pointer-events: none;
}

.bs-bogo-unlock__confetti i {
	position: absolute;
	top: 20px;
	width: 7px;
	height: 11px;
	border-radius: 2px;
	opacity: 0;
	animation-name: bs-bogo-confetti;
	animation-timing-function: cubic-bezier(.2, .6, .4, 1);
	animation-fill-mode: forwards;
}

@keyframes bs-bogo-confetti {
	0% { opacity: 1; transform: translate(0, 0) rotate(0); }
	100% { opacity: 0; transform: translate(var(--bs-drift), 160px) rotate(var(--bs-spin)); }
}

@keyframes bs-bogo-wiggle {
	0%, 100% { transform: rotate(0); }
	25% { transform: rotate(-14deg) scale(1.1); }
	75% { transform: rotate(14deg) scale(1.1); }
}

/* The new BOGO item: a soft shadow in its tier color swells in, then pulses, and the
   badge shimmers. Only box-shadow and background animate (no transform, overflow or
   position changes), so nothing inside the item moves. The item's own overflow-hidden
   doesn't clip its own shadow. */
.bs-bogo-item--new {
	animation: bs-bogo-pop .5s ease-out, bs-bogo-glow 1.4s ease-in-out .5s 3;
}

/* A highlight sweeping across the badge's background (its color is set inline) */
.bs-bogo-item--new .bs-bogo-badge {
	background-image: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%);
	background-repeat: no-repeat;
	background-size: 250% 100%;
	background-position: 0 0;
	animation: bs-bogo-shimmer 1.4s ease-in-out 3;
}

@keyframes bs-bogo-pop {
	0% { box-shadow: 0 0 0 color-mix(in srgb, var(--bs-bogo-color, #469ab7) 0%, transparent); }
	50% {
		box-shadow: 0 8px 26px color-mix(in srgb, var(--bs-bogo-color, #469ab7) 55%, transparent);
		background-color: color-mix(in srgb, var(--bs-bogo-color, #469ab7) 14%, #fff);
	}
	100% { box-shadow: 0 2px 6px color-mix(in srgb, var(--bs-bogo-color, #469ab7) 0%, transparent); }
}

@keyframes bs-bogo-glow {
	0%, 100% { box-shadow: 0 2px 6px color-mix(in srgb, var(--bs-bogo-color, #469ab7) 0%, transparent); }
	50% {
		box-shadow: 0 6px 18px color-mix(in srgb, var(--bs-bogo-color, #469ab7) 40%, transparent);
		background-color: color-mix(in srgb, var(--bs-bogo-color, #469ab7) 10%, #fff);
	}
}

/* With the gradient 2.5x the badge's width, 100% -> 0% sweeps the highlight left to right */
@keyframes bs-bogo-shimmer {
	from { background-position: 100% 0; }
	to { background-position: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
	.bs-bogo-unlock,
	.bs-bogo-unlock.is-leaving {
		transform: none;
		transition: opacity .2s;
	}

	.bs-bogo-unlock.is-shown .bs-bogo-unlock__icon,
	.bs-bogo-item--new,
	.bs-bogo-item--new .bs-bogo-badge {
		animation: none;
	}

	.bs-bogo-item--new .bs-bogo-badge {
		background-image: none;
	}

	.bs-bogo-item--new {
		box-shadow: 0 6px 18px color-mix(in srgb, var(--bs-bogo-color, #469ab7) 40%, transparent);
		background-color: color-mix(in srgb, var(--bs-bogo-color, #469ab7) 10%, #fff);
	}
}
