/*
 * Kartra's bump box (pictures P113, P115).
 *
 * ONE stylesheet for ONE piece of markup: Bump_Offers::box_html() draws the box on the hosted
 * checkout page and inside the product editor's Preview, so both surfaces load this file. A second
 * copy of these rules in the admin bundle would be a preview that drifts from the page it previews.
 *
 * The accent is the checkout's own --eb-accent where the page sets one (the Design tab's colour);
 * everywhere else it falls back to the blue Kartra draws the price and the border in.
 */

.eb-bump {
	--eb-bump-accent: var(--eb-accent, #2563eb);
	border: 2px solid var(--eb-bump-accent);
	border-radius: 10px;
	padding: 16px 18px;
	margin: 18px 0;
	background: #fff;
}

.eb-bump-head {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-bottom: 12px;
	border-bottom: 1px solid #e5e7eb;
}

.eb-bump-header {
	font-size: 17px;
	font-weight: 600;
	color: #1f2937;
}

/* The toggle: a real checkbox, drawn as Kartra's switch. */
.eb-bump-switch {
	position: relative;
	display: inline-flex;
	align-items: center;
	cursor: pointer;
	flex: none;
}

.eb-bump-switch input {
	position: absolute;
	opacity: 0;
	width: 44px;
	height: 24px;
	margin: 0;
	cursor: pointer;
}

.eb-bump-slider {
	display: inline-block;
	width: 44px;
	height: 24px;
	border-radius: 12px;
	background: #cbd5e1;
	transition: background .15s ease-in-out;
	position: relative;
}

.eb-bump-slider::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	transition: transform .15s ease-in-out;
}

.eb-bump-switch input:checked + .eb-bump-slider {
	background: var(--eb-bump-accent);
}

.eb-bump-switch input:checked + .eb-bump-slider::after {
	transform: translateX(20px);
}

.eb-bump-switch input:focus-visible + .eb-bump-slider {
	outline: 2px solid var(--eb-bump-accent);
	outline-offset: 2px;
}

/* The switch's accessible name. Visible only to a screen reader — the header line is the label
   a sighted buyer reads, and repeating it beside the switch is noise. */
.eb-bump-switchlab {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* Kartra's bouncing arrow, pointing down at the toggle. */
.eb-bump-arrow {
	position: absolute;
	right: 12px;
	top: -22px;
	width: 2px;
	height: 20px;
	background: #d33;
	animation: eb-bump-bounce 1s ease-in-out infinite;
}

.eb-bump-arrow::after {
	content: "";
	position: absolute;
	bottom: -6px;
	left: -4px;
	border-left: 5px solid transparent;
	border-right: 5px solid transparent;
	border-top: 7px solid #d33;
}

@keyframes eb-bump-bounce {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(5px); }
}

@media (prefers-reduced-motion: reduce) {
	.eb-bump-arrow { animation: none; }
}

.eb-bump-body {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding-top: 12px;
}

.eb-bump-name {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #1f2937;
}

.eb-bump-price {
	margin: 4px 0 8px;
	font-size: 15px;
	font-weight: 600;
	color: var(--eb-bump-accent);
}

.eb-bump-desc {
	margin: 0;
	font-size: 14px;
	line-height: 1.45;
	color: #374151;
}

.eb-bump-thumb {
	margin: 0;
	flex: none;
}

.eb-bump-thumb img {
	width: 84px;
	height: 84px;
	border-radius: 50%;
	object-fit: cover;
	display: block;
}

/* The editor's sample: the same box, with a toggle nobody can flip. */
.eb-bump.is-preview {
	cursor: default;
}

.eb-bump.is-preview .eb-bump-switch,
.eb-bump.is-preview .eb-bump-switch input {
	cursor: default;
}
