/* ==========================================================================
   WS Free Shipping Notice – Floating Badge
   ========================================================================== */

.ws-free-shipping-badge {
	position: fixed;
	z-index: 99999;
	max-width: 320px;
	min-width: 200px;
	padding: 14px 40px 14px 14px; /* right padding leaves room for the close button */
	display: flex;
	align-items: flex-start;
	gap: 10px;
	/* Hidden by default; JS adds .is-visible to reveal */
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease;
}

/*
 * Appearance defaults use :where() (zero specificity) so that
 * block-support-generated classes and inline styles can always override them.
 */
:where(.ws-free-shipping-badge) {
	background: #ffffff;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 12px;
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
}

/* Bottom positions slide up on entry */
.ws-free-shipping-badge--bottom-right,
.ws-free-shipping-badge--bottom-left {
	transform: translateY(14px);
}

/* Top positions slide down on entry */
.ws-free-shipping-badge--top-right,
.ws-free-shipping-badge--top-left {
	transform: translateY(-14px);
}

.ws-free-shipping-badge.is-visible {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

/* ── Corner placement ── */
.ws-free-shipping-badge--bottom-right { bottom: 24px; right: 24px; }
.ws-free-shipping-badge--bottom-left  { bottom: 24px; left:  24px; }
.ws-free-shipping-badge--top-right    { top:    24px; right: 24px; }
.ws-free-shipping-badge--top-left     { top:    24px; left:  24px; }

/* ── Close button ── */
.ws-free-shipping-badge__close {
	position: absolute;
	top:   8px;
	right: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	width:  24px;
	height: 24px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	color: currentColor;
	line-height: 1;
	transition: background 0.15s ease, color 0.15s ease;
}
.ws-free-shipping-badge__close:hover {
	background: rgba(0, 0, 0, 0.07);
}
.ws-free-shipping-badge__close:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 1px;
}

/* ── Truck icon ── */
.ws-free-shipping-badge__icon {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	padding-top: 1px;
	color: currentColor;
	transition: color 0.2s ease;
}

/* ── Body ── */
.ws-free-shipping-badge__body {
	flex: 1;
	min-width: 0;
}

:where(.ws-free-shipping-badge__body .ws-free-shipping-notice__message) {
	font: inherit;
	font-weight: inherit;
	color: inherit;
}

.ws-free-shipping-badge__body .ws-free-shipping-notice__message {
	margin: 0;
}

/* ── Progress bar inside badge ── */
.ws-free-shipping-badge .ws-free-shipping-notice__progress {
	margin-top: 8px;
	height: 4px;
	background: #e5e5e5;
	border-radius: 2px;
	overflow: hidden;
}

.ws-free-shipping-badge .ws-free-shipping-notice__progress span {
	display: block;
	height: 100%;
	background: currentColor;
	border-radius: 2px;
	transition: width 0.4s ease;
}

/* ── Editor preview: render inline, not fixed ── */
.ws-free-shipping-badge.is-editor-preview {
	position: static;
	transform: none;
	opacity: 1;
	pointer-events: auto;
	max-width: 100%;
	min-width: 0;
}

/* ── Responsive ── */
@media (max-width: 480px) {
	.ws-free-shipping-badge {
		max-width: calc(100vw - 32px);
		min-width: 0;
	}

	.ws-free-shipping-badge--bottom-right,
	.ws-free-shipping-badge--top-right {
		right: 16px;
	}

	.ws-free-shipping-badge--bottom-left,
	.ws-free-shipping-badge--top-left {
		left: 16px;
	}

	.ws-free-shipping-badge--bottom-right,
	.ws-free-shipping-badge--bottom-left {
		bottom: 16px;
	}

	.ws-free-shipping-badge--top-right,
	.ws-free-shipping-badge--top-left {
		top: 16px;
	}
}
