/**
 * DKM Free Shipping
 *
 * Colours come from the plugin's settings screen as custom properties; sizes
 * are written inline from the widget's own settings.
 */

.wcg-fs {
	/* Diilikaubamaja Design System v2, through the shop's own Elementor
	   globals where it has them. */
	--wcg-bar-track: var(--bg-press);
	/* Not var(--wcg-accent): that is the gallery's accent, and the
	   settings screen writes every chosen colour onto every one of this
	   plugin's roots - so chaining through it made the gallery's colour
	   the free shipping bar's colour too. */
	--wcg-bar-fill: var(--action-primary);
	--wcg-bar-unlocked: var(--mark-success);
	--wcg-bar-height: 8px;
	--wcg-bar-radius: var(--radius-full);
	--wcg-fs-gap: 6px;

	/* Elementor renders this element as the flex child itself, so it has to
	   claim its width. */
	display: block;
	width: 100%;
	flex: 1 1 auto;
	align-self: stretch;
	min-width: 0;

	/* No spacing of our own: margin and padding are the Style tab's job. */
	margin: 0;
	padding: 0;
}

.wcg-fs__inner {
	display: flex;
	flex-direction: column;
	gap: var(--wcg-fs-gap);
}

.wcg-fs__inner:empty {
	display: none;
}

/* Title on the left, figures on the right, on one line. */
.wcg-fs__header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}

.wcg-fs__title {
	font-weight: 700;
}

.wcg-fs__amounts {
	white-space: nowrap;
	font-weight: 700;
}

.wcg-fs__message {
	margin: 0;
	/* Typography is the Style tab's job; only the layout is set here. */
	font: inherit;
	color: inherit;
}

.wcg-fs__track {
	position: relative;
	width: 100%;
	height: var(--wcg-bar-height);
	background: var(--wcg-bar-track);
	border-radius: var(--wcg-bar-radius);
	overflow: hidden;
}

.wcg-fs__fill {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	height: 100%;
	width: 0;
	/* Enough that the figure clears the cap the corner radius cuts out of the
	   right-hand end of the fill. */
	padding: 0 10px;
	background: var(--wcg-bar-fill);
	border-radius: inherit;
	transition: width 0.35s ease;
	overflow: hidden;
}

/* Inside the fill, so it reads against the filled colour rather than
   floating over the track. */
.wcg-fs__percent {
	font-size: 0.75em;
	line-height: 1;
	font-weight: 700;
	color: var(--wcg-bar-label, var(--text-primary));
	white-space: nowrap;
}

.wcg-fs.is-unlocked .wcg-fs__fill {
	background: var(--wcg-bar-unlocked);
}

.wcg-fs__goal {
	opacity: 0.7;
}

@media (prefers-reduced-motion: reduce) {
	.wcg-fs__fill {
		transition: none;
	}
}

/* --------------------------------------------------------- editor states */

.wcg-fs--loading .wcg-fs__inner::before {
	content: "";
	display: block;
	height: var(--wcg-bar-height);
	border-radius: var(--wcg-bar-radius);
	background: repeating-linear-gradient(135deg, var(--bg-subtle), var(--bg-subtle) 12px, var(--bg-press) 12px, var(--bg-press) 24px);
}

.wcg-fs[hidden] {
	display: none;
}
