/**
 * FaraCart storefront progress widgets.
 *
 * Scoped under.faracart-widget / #faracart-floating so styles never
 * leak into the theme. RTL-aware (logical properties), responsive, and
 * themeable through a small set of CSS custom properties (Appearance overrides the same tokens).
 *
 * Tokens:
 *   --faracart-accent        primary bar/reward color
 *   --faracart-bg            widget surface
 *   --faracart-border        hairline borders
 *   --faracart-text          primary text
 *   --faracart-text-muted    secondary text
 *   --faracart-radius        corner radius
 *   --faracart-shadow        card elevation
 *   --faracart-bar-height    progress bar thickness
 *
 * The six design templates (template-1 … template-6): the mission body
 * renders per the active template variant via.faracart-template--*
 * classes, the bar reads --faracart-bar-height, and
 *.faracart-widget--no-anim /.faracart-no-anim disable the fill
 * transition. The Appearance settings override every token through an
 * inline style block printed by ProgressUI::appearance_css().
 *
 * Pluggable template engine: per-mission / per-campaign template settings
 * override the same tokens through inline CSS custom properties set by
 * the storefront JS (applyTemplateSettings) — a mission pinned to a
 * template with its own accent/bar height renders exactly that.
 *
 * @package FaraCart
 */

.faracart-widget .faracart-currency-symbol,
#faracart-floating .faracart-currency-symbol {
	display: inline-block;
	width: 1em;
	height: 1em;
	vertical-align: -0.125em;
	flex-shrink: 0;
}

.faracart-widget,
#faracart-floating {
	--faracart-accent: #2271b1;
	--faracart-bg: #ffffff;
	--faracart-border: #dcdcde;
	--faracart-text: #1d2327;
	--faracart-text-muted: #646970;
	--faracart-radius: 2px;
	--faracart-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
	--faracart-track: #f0f0f1;
	--faracart-percent-color: #2271b1;
	--faracart-percent-size: 1.75rem;
	--faracart-dot-color: #dcdcde;
	--faracart-done-color: #00a32a;
	--faracart-connector-color: #dcdcde;
	/* Design-template tokens (the six progress templates). */
	--faracart-progress-color: #f97316;
	--faracart-button-bg: #f97316;
	--faracart-button-text: #ffffff;
	--faracart-button-radius: 8px;
	--faracart-icon-bg: #ffedd5;
	--faracart-icon-color: #f97316;
	--faracart-header-bg: #2563eb;
	--faracart-ring-size: 100px;
	--faracart-ring-stroke: 8px;
	--faracart-product-image: 40px;
	--faracart-shadow-intensity: 16px;

	color: var(--faracart-text);
	font-family: inherit;
	font-size: 14px;
	line-height: 1.5;
	box-sizing: border-box;
}

.faracart-widget *,
#faracart-floating * {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------ *
 * MissionContainer
 * ------------------------------------------------------------------ */

.faracart-widget {
	width: 100%;
	max-width: 640px;
	margin: 0 auto;
}

.faracart-widget--full {
	margin-block: 1.5rem;
}

.faracart-widget--compact {
	margin-block: 0.75rem;
}

/* The stacked mission-card list: every eligible mission renders as its own
 * card, one under the other, instead of one featured card + a ladder. */

.faracart-widget__missions {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.faracart-widget--compact .faracart-widget__missions {
	gap: 0.625rem;
}

.faracart-card {
	background: var(--faracart-bg);
	border: 1px solid var(--faracart-border);
	border-radius: var(--faracart-radius);
	box-shadow: var(--faracart-shadow);
	padding: 1rem 1.125rem;
	overflow: hidden;
}

.faracart-widget--empty {
	display: none;
}

/* Live cart-change refresh: while the widgets re-fetch the progress
 * payload after an AJAX cart mutation they dim subtly (never blank or
 * flash). */

.faracart-widget--updating .faracart-widget__missions {
	opacity: 0.7;
	transition: opacity 0.15s ease;
}

/* Settings → Frontend → mobile behavior = hide. */

.faracart-widget--mobile-hidden {
	display: none;
}

.faracart-card__head {
	display: flex;
	justify-content: flex-end;
	margin-block-end: 0.5rem;
}

/* ------------------------------------------------------------------ *
 * ProgressBar
 * ------------------------------------------------------------------ */

.faracart-progress {
	position: relative;
	height: var(--faracart-bar-height, 10px);
	background: var(--faracart-track);
	border-radius: 999px;
	overflow: hidden;
}

.faracart-progress__fill {
	position: absolute;
	inset-inline-start: 0;
	inset-block-start: 0;
	height: 100%;
	width: 0;
	background: var(--faracart-accent);
	border-radius: inherit;
	transition: width 0.45s ease;
}

.faracart-progress--complete .faracart-progress__fill {
	background: #00a32a;
}

/* ------------------------------------------------------------------ *
 * Progress Templates (the six design templates)
 * ------------------------------------------------------------------ */

/* The shared icon glyph inside template bodies (mission emoji/dashicon
 * text, or the template fallback). */

.faracart-tpl-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	line-height: 1;
}

/* The shared CTA anchor — full-width, styled per template below. */

.faracart-cta {
	display: block;
	width: 100%;
	box-sizing: border-box;
	margin-block-start: 0.75rem;
	padding: 0.625rem 1rem;
	border-radius: var(--faracart-button-radius, 8px);
	font-size: 14px;
	font-weight: 700;
	text-align: center;
	text-decoration: none;
	transition: opacity 0.2s ease;
}

.faracart-cta:hover,
.faracart-cta:focus-visible {
	opacity: 0.9;
}

/* ------------------------------------------------------------------ *
 * Template 1 — Classic Progress Card (Concept 01)
 * ------------------------------------------------------------------ */

.faracart-t1__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
	margin-block-end: 0.75rem;
}

.faracart-t1__head-main {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-width: 0;
}

.faracart-t1__head-main .faracart-tpl-icon {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--faracart-icon-bg, #ffedd5);
	color: var(--faracart-icon-color, var(--faracart-accent));
	font-size: 14px;
}

.faracart-t1__head-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.faracart-t1__label {
	font-size: 12px;
	font-weight: 500;
	color: var(--faracart-text-muted);
}

.faracart-t1__title {
	font-size: 14px;
	font-weight: 700;
	color: var(--faracart-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.faracart-t1__percent {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
	padding: 0.125rem 0.5rem;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: var(--faracart-accent);
	background: color-mix( in srgb, var(--faracart-accent) 8%, transparent );
	border: 1px solid color-mix( in srgb, var(--faracart-accent) 15%, transparent );
}

.faracart-template--template-1 .faracart-progress {
	margin-block-start: 0;
}

.faracart-t1__amounts {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-block-start: 0.625rem;
	font-size: 12px;
}

.faracart-t1__current {
	color: var(--faracart-text-muted);
}

.faracart-t1__remaining {
	font-weight: 600;
	color: var(--faracart-accent);
	white-space: nowrap;
}

.faracart-t1__cta {
	background: var(--faracart-button-bg, var(--faracart-accent));
	color: var(--faracart-button-text, #ffffff);
}

/* Card density (template-1 settings): the comfortable layout is the base
 * card spacing above; the compact variant tightens the surface and the
 * vertical rhythm of the card. Mirrors the admin preview's density. */

.faracart-template--template-1.faracart-density--compact {
	padding: 0.625rem 0.875rem;
}

.faracart-template--template-1.faracart-density--compact .faracart-t1__head {
	margin-block-end: 0.375rem;
}

.faracart-template--template-1.faracart-density--compact .faracart-t1__amounts {
	margin-block-start: 0.375rem;
}

.faracart-template--template-1.faracart-density--compact .faracart-cta {
	margin-block-start: 0.5rem;
}

.faracart-template--template-1.faracart-density--compact .faracart-t1__done {
	padding: 0.625rem 0.75rem;
}

/* Completed state: green success card with a check. */

.faracart-t1--done .faracart-t1__done {
	padding: 0.75rem 1rem;
	border-radius: 0.75rem;
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
}

.faracart-t1__done-row {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	margin-block-end: 0.5rem;
}

.faracart-t1--done .faracart-tpl-icon {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #dcfce7;
	color: #16a34a;
	font-size: 14px;
}

.faracart-t1__done-info {
	display: flex;
	flex-direction: column;
}

.faracart-t1__done-label {
	font-size: 12px;
	font-weight: 500;
	color: #16a34a;
}

.faracart-t1__done-title {
	font-size: 14px;
	font-weight: 700;
	color: #166534;
}

.faracart-t1--done .faracart-progress {
	--faracart-accent: #16a34a;
	--faracart-track: #bbf7d0;
}

/* Expired state: muted clock row. */

.faracart-t1--expired {
	opacity: 0.75;
}

.faracart-t1__expired {
	display: flex;
	align-items: center;
	gap: 0.625rem;
}

.faracart-t1__expired .faracart-tpl-icon {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #e5e7eb;
	color: #9ca3af;
	font-size: 14px;
}

.faracart-t1__expired-info {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-width: 0;
}

.faracart-t1__expired-label {
	font-size: 12px;
	font-weight: 500;
	color: var(--faracart-text-muted);
}

.faracart-t1__expired-title {
	font-size: 14px;
	font-weight: 700;
	color: var(--faracart-text-muted);
}

.faracart-t1__expired-chip {
	flex-shrink: 0;
	padding: 0.125rem 0.5rem;
	border-radius: 999px;
	font-size: 12px;
	color: var(--faracart-text-muted);
	background: #e5e7eb;
}

/* ------------------------------------------------------------------ *
 * Template 2 — Minimal Inline Cart Mission (Concept 02)
 * ------------------------------------------------------------------ */

/* The card itself is the compact strip — keep its height small. */

.faracart-template--template-2 {
	padding: 0.625rem 0.875rem;
}

.faracart-t2 {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	min-width: 0;
}

.faracart-t2 .faracart-tpl-icon {
	font-size: 14px;
	color: var(--faracart-accent);
}

.faracart-t2__body {
	flex: 1 1 auto;
	min-width: 0;
}

.faracart-t2__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-block-end: 0.25rem;
	font-size: 12px;
}

.faracart-t2__title {
	font-weight: 600;
	color: var(--faracart-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.faracart-t2__remaining {
	font-weight: 700;
	color: var(--faracart-text-muted);
	white-space: nowrap;
}

.faracart-t2__done {
	font-weight: 700;
	color: #16a34a;
	white-space: nowrap;
}

.faracart-t2__cta {
	flex-shrink: 0;
	width: auto;
	margin-block-start: 0;
	padding: 0.375rem 0.625rem;
	font-size: 12px;
	font-weight: 600;
	border-radius: var(--faracart-button-radius, 8px);
	background: var(--faracart-button-bg, var(--faracart-accent));
	color: var(--faracart-button-text, #ffffff);
}

/* ------------------------------------------------------------------ *
 * Template 3 — Circular Progress (Concept 03)
 * ------------------------------------------------------------------ */

.faracart-t3__row {
	display: flex;
	align-items: center;
	gap: 1.25rem;
}

.faracart-t3__ring {
	position: relative;
	flex-shrink: 0;
	max-inline-size: 100%;
}

.faracart-t3__svg {
	display: block;
	max-inline-size: 100%;
	height: auto;
}

.faracart-t3__fill {
	transition: stroke-dashoffset 0.6s ease;
}

.faracart-widget--no-anim .faracart-t3__fill,
.faracart-no-anim .faracart-t3__fill {
	transition: none;
}

.faracart-t3__readout {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.faracart-t3__percent {
	font-size: calc( var(--faracart-ring-size, 100px) * 0.19 );
	font-weight: 900;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	color: var(--faracart-accent);
}

.faracart-t3__progress-label {
	margin-block-start: 0.125rem;
	font-size: calc( var(--faracart-ring-size, 100px) * 0.085 );
	font-weight: 500;
	color: var(--faracart-text-muted);
}

.faracart-t3__check {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: calc( var(--faracart-ring-size, 100px) * 0.28 );
	font-weight: 900;
	color: #059669;
	pointer-events: none;
}

.faracart-t3__info {
	flex: 1 1 auto;
	min-width: 0;
}

.faracart-t3__title-row {
	display: flex;
	align-items: center;
	gap: 0.375rem;
	margin-block-end: 0.25rem;
}

.faracart-t3__title-row .faracart-tpl-icon {
	font-size: 14px;
	color: var(--faracart-accent);
}

.faracart-t3__title {
	font-size: 14px;
	font-weight: 700;
	color: var(--faracart-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.faracart-t3__desc {
	margin: 0 0 0.625rem;
	font-size: 12px;
	color: var(--faracart-text-muted);
}

.faracart-t3__amount {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	font-size: 12px;
}

.faracart-t3__amount + .faracart-t3__amount {
	margin-block-start: 0.25rem;
}

.faracart-t3__amount-label {
	color: var(--faracart-text-muted);
}

.faracart-t3__amount-value {
	font-weight: 700;
	color: var(--faracart-text);
}

.faracart-t3__amount-value--accent {
	color: var(--faracart-accent);
}

.faracart-t3__cta {
	background: transparent;
	border: 1px solid var(--faracart-button-bg, var(--faracart-accent));
	color: var(--faracart-button-bg, var(--faracart-accent));
}

/* Completed circular state. */

.faracart-t3__done-row {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.faracart-t3__done-info {
	display: flex;
	flex-direction: column;
}

.faracart-t3__done-title {
	font-size: 14px;
	font-weight: 800;
	color: #166534;
}

.faracart-t3__done-sub {
	font-size: 12px;
	color: #15803d;
}

/* ------------------------------------------------------------------ *
 * Template 4 — Product Recommendation + Mission (Concept 07)
 * ------------------------------------------------------------------ */

/* Flush header: the card surface is the template's own (no card padding). */

.faracart-template--template-4 {
	padding: 0;
	overflow: hidden;
}

.faracart-t4__header {
	padding: 0.875rem 1rem;
	color: #ffffff;
}

.faracart-t4__header-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-block-end: 0.5rem;
}

.faracart-t4__title {
	font-size: 12px;
	font-weight: 700;
	opacity: 0.9;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.faracart-t4__chip {
	flex-shrink: 0;
	padding: 0.125rem 0.5rem;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	white-space: nowrap;
	background: rgba(255, 255, 255, 0.2);
}

.faracart-t4__header .faracart-progress {
	--faracart-track: rgba(255, 255, 255, 0.25);
}

.faracart-t4__header .faracart-progress__fill {
	background: #ffffff;
}

.faracart-t4__header .faracart-progress--complete .faracart-progress__fill {
	background: #ffffff;
}

.faracart-t4__body {
	padding: 1rem 1.125rem;
}

.faracart-t4__heading {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	margin: 0 0 0.75rem;
	font-size: 12px;
	font-weight: 700;
	color: var(--faracart-text);
}

.faracart-t4__heading-icon {
	font-size: 14px;
	color: #eab308;
}

.faracart-t4__empty {
	margin: 0;
	font-size: 12px;
	color: var(--faracart-text-muted);
}

/* One recommended product row. */

.faracart-recommend {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.5rem 0.625rem;
	border-radius: 0.625rem;
	border: 1px solid var(--faracart-border);
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.faracart-recommend + .faracart-recommend {
	margin-block-start: 0.375rem;
}

.faracart-recommend:hover {
	border-color: var(--faracart-accent);
	box-shadow: 0 0 0 2px color-mix( in srgb, var(--faracart-accent) 15%, transparent );
	transform: translateY(-1px);
}

.faracart-recommend__image {
	width: var(--faracart-product-image, 40px);
	height: var(--faracart-product-image, 40px);
	flex-shrink: 0;
	border-radius: 0.5rem;
	object-fit: cover;
	background: #f3f4f6;
}

.faracart-recommend__image--placeholder {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
}

.faracart-recommend__info {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.faracart-recommend__name {
	font-size: 12px;
	font-weight: 700;
	color: var(--faracart-text);
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.faracart-recommend__name:hover {
	color: var(--faracart-accent);
}

.faracart-recommend__price {
	font-size: 10px;
	color: var(--faracart-text-muted);
}

.faracart-recommend__add {
	flex-shrink: 0;
	padding: 0.25rem 0.5rem;
	border: 0;
	border-radius: var(--faracart-button-radius, 8px);
	background: var(--faracart-button-bg, var(--faracart-accent));
	color: var(--faracart-button-text, #ffffff);
	font-size: 11px;
	font-weight: 700;
	line-height: 1.4;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.faracart-recommend__add:hover,
.faracart-recommend__add:focus-visible {
	opacity: 0.9;
}

.faracart-recommend__add:disabled {
	opacity: 0.65;
	cursor: default;
}

/* ------------------------------------------------------------------ *
 * Template 5 — Compact Floating / Sticky Mission (Concept 08)
 * ------------------------------------------------------------------ */

.faracart-t5 {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	min-width: 0;
	border-radius: var(--faracart-radius);
	border: 1px solid var(--faracart-border);
	background: linear-gradient( 135deg, var(--faracart-bg), color-mix( in srgb, var(--faracart-bg) 85%, #0f172a ) );
	box-shadow: 0 var(--faracart-shadow-intensity, 16px) calc( var(--faracart-shadow-intensity, 16px) * 2 ) rgba(0, 0, 0, 0.35);
}

.faracart-t5__badge {
	width: 28px;
	height: 28px;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: color-mix( in srgb, var(--faracart-accent) 20%, transparent );
	color: var(--faracart-accent);
	font-size: 13px;
	line-height: 1;
}

.faracart-t5__body {
	flex: 1 1 auto;
	min-width: 0;
}

.faracart-t5__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-block-end: 0.25rem;
	font-size: 12px;
}

.faracart-t5__title {
	font-weight: 600;
	color: var(--faracart-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.faracart-t5__remaining {
	color: var(--faracart-text-muted);
	white-space: nowrap;
}

.faracart-t5__done {
	font-weight: 700;
	color: var(--faracart-accent);
	white-space: nowrap;
}

.faracart-t5__cta {
	flex-shrink: 0;
	width: auto;
	margin-block-start: 0;
	padding: 0.375rem 0.625rem;
	font-size: 11px;
	font-weight: 800;
	border-radius: var(--faracart-button-radius, 8px);
	background: var(--faracart-button-bg, var(--faracart-accent));
	color: var(--faracart-button-text, #0f172a);
}

/* ------------------------------------------------------------------ *
 * Template 6 — Premium / Elegant E-commerce Style (Concept 09)
 * ------------------------------------------------------------------ */

.faracart-t6__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding-block-end: 0.625rem;
	margin-block-end: 0.625rem;
	border-block-end: 1px solid var(--faracart-border);
}

.faracart-t6__header-main {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.faracart-t6__rail {
	width: 4px;
	height: 24px;
	border-radius: 999px;
	background: linear-gradient( to bottom, var(--faracart-accent), color-mix( in srgb, var(--faracart-accent) 60%, #000 ) );
}

.faracart-t6__eyebrow {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: #9ca3af;
}

.faracart-t6__header-icon {
	font-size: 16px;
	color: var(--faracart-border);
}

.faracart-t6__title {
	margin: 0 0 0.125rem;
	font-size: 20px;
	font-weight: 900;
	color: var(--faracart-text);
}

.faracart-t6__desc {
	margin: 0 0 0.75rem;
	font-size: 12px;
	color: var(--faracart-text-muted);
}

.faracart-t6__progress {
	position: relative;
	margin-block-end: 0.75rem;
}

.faracart-t6__progress .faracart-progress {
	--faracart-track: #f3f4f6;
}

.faracart-t6__progress .faracart-progress__fill {
	background: var(--faracart-progress-color, var(--faracart-accent));
}

.faracart-t6__progress .faracart-progress--complete .faracart-progress__fill {
	background: #00a32a;
}

.faracart-t6__dot {
	position: absolute;
	inset-block-start: 50%;
	inset-inline-start: calc( var(--faracart-t6-dot, 0%) );
	transform: translate(-50%, -50%);
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--faracart-bg);
	border: 2px solid var(--faracart-progress-color, var(--faracart-accent));
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.faracart-t6__amounts {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
	margin-block-end: 0.75rem;
}

.faracart-t6__amount {
	display: flex;
	flex-direction: column;
}

.faracart-t6__amount--end {
	text-align: end;
}

.faracart-t6__amount-label {
	font-size: 11px;
	color: var(--faracart-text-muted);
}

.faracart-t6__amount-value {
	font-size: 13px;
	font-weight: 700;
	color: var(--faracart-text);
}

.faracart-t6__amount-value--gold {
	color: color-mix( in srgb, var(--faracart-accent) 80%, #000 );
}

.faracart-t6__cta {
	background: transparent;
	border: 1px solid var(--faracart-button-bg, var(--faracart-accent));
	color: var(--faracart-button-bg, var(--faracart-accent));
	letter-spacing: 0.06em;
}

/* Button style variants (template settings → buttonStyle). The template
 * defaults above each paint one style (solid for template-1, outline for
 * templates 3 & 6); these generic modifiers switch a CTA to the other. */

.faracart-cta--outline {
	background: transparent;
	border: 1px solid var(--faracart-button-bg, var(--faracart-accent));
	color: var(--faracart-button-bg, var(--faracart-accent));
}

.faracart-cta--solid {
	background: var(--faracart-button-bg, var(--faracart-accent));
	border: 0;
	color: var(--faracart-button-text, #ffffff);
}

/* Almost-completed callout. */

.faracart-t6__callout {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-block-start: 0.75rem;
	padding: 0.5rem 0.75rem;
	border-radius: 0.5rem;
	background: #fffbeb;
	border: 1px solid #fde68a;
}

.faracart-t6__callout-icon {
	font-size: 18px;
	color: #f59e0b;
	flex-shrink: 0;
}

.faracart-t6__callout-text {
	display: flex;
	flex-direction: column;
}

.faracart-t6__callout-title {
	font-size: 12px;
	font-weight: 800;
	color: #78350f;
}

.faracart-t6__callout-sub {
	font-size: 10px;
	color: #92400e;
}

/* Message states: the payload `state` lands as a card class.
   The completed fill color is already handled by
   .faracart-progress--complete, so the state classes only refine copy. */

.faracart-state--nearly_complete .faracart-message {
	color: var(--faracart-accent);
	font-weight: 600;
}

/* Animation off: the fill snaps instead of sliding. */

.faracart-widget--no-anim .faracart-progress__fill,
.faracart-no-anim .faracart-progress__fill {
	transition: none;
}

/* ------------------------------------------------------------------ *
 * MissionMessage
 * ------------------------------------------------------------------ */

.faracart-message {
	margin: 0.625rem 0 0;
	color: var(--faracart-text);
	font-weight: 500;
}

.faracart-message:first-child {
	margin-block-start: 0;
}

/* ------------------------------------------------------------------ *
 * RewardStatus
 * ------------------------------------------------------------------ */

.faracart-reward {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.25rem 0.625rem;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
}

.faracart-reward--locked {
	background: var(--faracart-track);
	color: var(--faracart-text-muted);
}

.faracart-reward--unlocked {
	background: rgba(0, 163, 42, 0.12);
	color: #007017;
}

.faracart-reward__icon {
	font-size: 13px;
	line-height: 1;
}

/* ------------------------------------------------------------------ *
 * Campaign milestone chain (pluggable template engine, campaign scope)
 * ------------------------------------------------------------------ */

/* One connected ladder per campaign: dots joined by a connector line,
 * with optional labels / targets / rewards per step and an overall
 * progress bar underneath. */

.faracart-chain {
	background: var(--faracart-bg);
	border: 1px solid var(--faracart-border);
	border-radius: var(--faracart-radius);
	box-shadow: var(--faracart-shadow);
	padding: 1rem 1.125rem;
}

.faracart-chain__title {
	margin-block-end: 0.75rem;
	font-weight: 700;
}

.faracart-chain__steps {
	display: flex;
	align-items: flex-start;
	margin: 0 0 0.875rem;
	padding: 0;
	list-style: none;
}

.faracart-chain__step {
	position: relative;
	flex: 1 1 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.25rem;
	min-width: 0;
	text-align: center;
}

/* The connector line runs behind the dots (logical inline-start → end,
 * so it mirrors automatically in RTL). */

.faracart-chain__step:not(:first-child)::before {
	content: '';
	position: absolute;
	inset-inline-start: -50%;
	inset-inline-end: 50%;
	inset-block-start: 5px;
	height: 2px;
	background: var(--faracart-connector-color, var(--faracart-border));
	z-index: 0;
}

.faracart-chain__dot {
	position: relative;
	z-index: 1;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--faracart-dot-color, var(--faracart-border));
	transition: background 0.3s ease;
}

.faracart-chain__step--done .faracart-chain__dot {
	background: var(--faracart-done-color, var(--faracart-accent));
}

.faracart-chain__label,
.faracart-chain__target {
	font-size: 12px;
	line-height: 1.3;
}

.faracart-chain__label {
	font-weight: 600;
	color: var(--faracart-text);
}

.faracart-chain__target {
	color: var(--faracart-text-muted);
}

.faracart-chain__reward {
	display: inline-flex;
	align-items: center;
	margin-block-start: 0.125rem;
	padding: 0.125rem 0.5rem;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	background: var(--faracart-track);
	color: var(--faracart-text-muted);
}

.faracart-chain__step--done .faracart-chain__reward {
	background: rgba(0, 163, 42, 0.12);
	color: #007017;
}

.faracart-chain .faracart-progress {
	margin-block-start: 0.25rem;
}

/* ------------------------------------------------------------------ *
 * Countdown
 * ------------------------------------------------------------------ */

.faracart-countdown {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	margin-block-start: 0.75rem;
	padding: 0.25rem 0.625rem;
	border-radius: 999px;
	background: var(--faracart-track);
	color: var(--faracart-text);
	font-size: 12px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.faracart-countdown__label {
	color: var(--faracart-text-muted);
	font-weight: 500;
}

.faracart-countdown__time {
	color: var(--faracart-accent);
}

/* ------------------------------------------------------------------ *
 * Free gift picker
 * ------------------------------------------------------------------ */

.faracart-gift-picker {
	margin-block-start: 0.875rem;
	padding-block-start: 0.75rem;
	border-top: 1px dashed var(--faracart-border);
}

.faracart-gift-picker__title {
	margin-block-end: 0.5rem;
	font-weight: 700;
}

.faracart-gift-picker__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.625rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.faracart-gift-picker__item {
	flex: 1 1 150px;
	min-width: 0;
}

.faracart-gift-picker__button {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.25rem;
	width: 100%;
	padding: 0.5rem;
	border: 1px solid var(--faracart-border);
	border-radius: calc( var(--faracart-radius) * 0.6 );
	background: var(--faracart-bg);
	color: var(--faracart-text);
	text-align: start;
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.faracart-gift-picker__button:hover,
.faracart-gift-picker__button:focus-visible {
	border-color: var(--faracart-accent);
	box-shadow: 0 0 0 2px color-mix( in srgb, var(--faracart-accent) 20%, transparent );
	transform: translateY(-1px);
}

.faracart-gift-picker__button--pending {
	opacity: 0.6;
	pointer-events: none;
}

.faracart-gift-picker__image {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: calc( var(--faracart-radius) * 0.4 );
	background: var(--faracart-track);
}

.faracart-gift-picker__name {
	font-size: 12px;
	font-weight: 600;
}

.faracart-gift-picker__price {
	font-size: 12px;
	color: var(--faracart-text-muted);
}

.faracart-gift-picker--done .faracart-gift-picker__done {
	margin: 0;
	color: #007017;
	font-weight: 600;
}

/* ------------------------------------------------------------------ *
 * Celebration
 * ------------------------------------------------------------------ */

.faracart-card--celebrate {
	animation: faracart-pulse 0.6s ease;
}

@keyframes faracart-pulse {
	0% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.015);
	}
	100% {
		transform: scale(1);
	}
}

.faracart-confetti {
	position: relative;
	height: 0;
	overflow: visible;
}

.faracart-confetti__piece {
	position: absolute;
	inset-block-start: 0;
	width: 8px;
	height: 12px;
	border-radius: 2px;
	opacity: 0;
	animation: faracart-confetti-fall 1.6s ease-out forwards;
}

@keyframes faracart-confetti-fall {
	0% {
		opacity: 1;
		transform: translate3d( 0, 0, 0 ) rotate(0deg);
	}
	100% {
		opacity: 0;
		transform: translate3d( var(--faracart-confetti-x, 0px), 120px, 0 ) rotate(360deg);
	}
}

/* ------------------------------------------------------------------ *
 * Campaign progress template (campaign scope)
 * ------------------------------------------------------------------ */

.faracart-campaign {
	background: var(--faracart-bg);
	border: 1px solid var(--faracart-border);
	border-radius: var(--faracart-radius);
	box-shadow: var(--faracart-shadow);
	padding: 1rem 1.125rem;
}

.faracart-campaign__title {
	margin-block-end: 0.375rem;
	font-weight: 700;
}

.faracart-campaign__counter {
	margin-block-end: 0.75rem;
	color: var(--faracart-text-muted);
	font-size: 13px;
	font-weight: 600;
}

.faracart-campaign__rewards {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem;
	margin-block-start: 0.75rem;
}

.faracart-campaign__reward {
	display: inline-flex;
	align-items: center;
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	background: var(--faracart-track);
	color: var(--faracart-text-muted);
}

/* ------------------------------------------------------------------ *
 * UnifiedRecommendations (Suggestions + Upsells consolidation)
 * ------------------------------------------------------------------ */

.faracart-upsells {
	margin-block-start: 0.875rem;
	padding-block-start: 0.75rem;
	border-top: 1px dashed var(--faracart-border);
}

.faracart-upsells__title {
	margin-block-end: 0.5rem;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--faracart-text-muted);
}

.faracart-upsells__list {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 130px, 1fr ) );
	gap: 0.625rem;
}

.faracart-upsell {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	min-width: 0;
	padding: 0.5rem;
	border: 1px solid var(--faracart-border);
	border-radius: calc( var(--faracart-radius) * 0.6 );
	background: var(--faracart-bg);
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.faracart-upsell:hover {
	border-color: var(--faracart-accent);
	box-shadow: 0 0 0 2px color-mix( in srgb, var(--faracart-accent) 15%, transparent );
	transform: translateY(-1px);
}

.faracart-upsell__image {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: calc( var(--faracart-radius) * 0.4 );
	background: var(--faracart-track);
}

.faracart-upsell__name {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.35;
	color: var(--faracart-text);
	text-decoration: none;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.faracart-upsell__name:hover {
	color: var(--faracart-accent);
	text-decoration: underline;
}

.faracart-upsell__price {
	font-size: 13px;
	font-weight: 700;
	color: var(--faracart-accent);
}

.faracart-upsell__add {
	margin-block-start: auto;
	padding: 0.375rem 0.625rem;
	border: 1px solid var(--faracart-accent);
	border-radius: 999px;
	background: var(--faracart-accent);
	color: var(--faracart-bg);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.faracart-upsell__add:hover,
.faracart-upsell__add:focus-visible {
	background: color-mix( in srgb, var(--faracart-accent) 85%, #000 );
}

.faracart-upsell__add:disabled {
	opacity: 0.65;
	cursor: default;
}

.faracart-upsells__loading {
	color: var(--faracart-text-muted);
	font-size: 13px;
}

.faracart-upsells__empty {
	color: var(--faracart-text-muted);
	font-size: 13px;
}

/* mobile optimization: on small screens the panel becomes a
 * swipeable horizontal strip (fixed-width cards + scroll snap), the
 * standard upsell pattern that fits any theme's narrow layouts without
 * stretching the widget.
 */
@media ( max-width: 600px ) {
	.faracart-upsells__list {
		display: flex;
		overflow-x: auto;
		scroll-snap-type: x proximity;
		gap: 0.5rem;
		margin-inline: -0.25rem;
		padding-inline: 0.25rem;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: thin;
	}

	.faracart-upsell {
		flex: 0 0 132px;
		scroll-snap-align: start;
	}
}

/* ------------------------------------------------------------------ *
 * Floating widget (floating missions/campaigns button + drawer)
 * ------------------------------------------------------------------ */

/* The fixed container: its physical position (left/right/top/bottom +
 * offsets) is applied inline by the JS so the admin's chosen side keeps
 * its visual result in RTL (the axis is a physical side, not a logical
 * start/end). The button size token drives the FAB; the container itself
 * is inert until the JS flags it visible (an eligible mission exists). */

.faracart-floating {
	--faracart-floating-size: 56px;
	--faracart-floating-primary: var(--faracart-accent, #2271b1);
	--faracart-floating-icon-color: color-mix( in srgb, var(--faracart-floating-primary) 18%, #ffffff );
	position: fixed;
	z-index: 99999;
	display: none;
	pointer-events: none;
}

.faracart-floating--visible {
	display: block;
}

/* Center vertical: the JS flags the container and the offset rides on
 * --faracart-fy, so the whole block (button + drawer) stays centered on
 * the viewport midline minus the configured offset. */

.faracart-floating--center {
	transform: translateY( calc( -50% + var(--faracart-fy, 0px) ) );
}

.faracart-floating__button {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	width: var(--faracart-floating-size);
	height: var(--faracart-floating-size);
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--faracart-floating-primary, var(--faracart-accent));
	color: var(--faracart-floating-icon-color, #ffffff);
	font-size: calc( var(--faracart-floating-size) * 0.44 );
	line-height: 1;
	cursor: pointer;
	box-shadow: var(--faracart-shadow);
	pointer-events: auto;
	transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.faracart-floating__button:hover,
.faracart-floating__button:focus-visible {
	transform: translateY(-1px);
	background: color-mix( in srgb, var(--faracart-floating-primary) 86%, #000000 );
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.faracart-floating__button:active {
	transform: translateY(0);
	background: color-mix( in srgb, var(--faracart-floating-primary) 76%, #000000 );
}

.faracart-floating__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: calc( var(--faracart-floating-size) * 0.46 );
	height: calc( var(--faracart-floating-size) * 0.46 );
	line-height: 1;
}

.faracart-floating__icon > svg {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
}

/* Normalize pasted SVG dimensions (some icon exports use 800×800) to the
 * FAB and let the selected color control both fill and stroke. */
.faracart-floating__icon .faracart-floating__custom-svg {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	fill: currentColor;
	stroke: currentColor;
}

.faracart-floating__icon .faracart-floating__custom-svg * {
	fill: currentColor;
	stroke: currentColor;
}

.faracart-floating--no-anim .faracart-floating__button,
.faracart-floating--no-anim .faracart-floating__drawer {
	transition: none;
}

/* The drawer panel: opens from the button toward the screen center —
 * the direction follows the position preset (top presets open down,
 * bottom presets open up, center presets open sideways) and up/down
 * drawers align toward the center based on which side the button hugs
 * (the JS flags it from the preset). The anchor offset rides on the
 * transform so the open/close scale animation composes with it; the
 * panel scrolls internally and never exceeds the viewport. */

.faracart-floating__drawer {
	position: absolute;
	z-index: 1;
	min-width: 260px;
	max-width: min( 340px, calc( 100vw - 2rem ) );
	max-height: 220px;
	overflow: auto;
	/* Scrolling inside the drawer must never scroll the page behind it. */
	overscroll-behavior: contain;
	padding: 1rem;
	background: var(--faracart-bg);
	border: 1px solid var(--faracart-floating-primary, var(--faracart-border));
	border-radius: var(--faracart-radius);
	box-shadow: var(--faracart-shadow);
	pointer-events: auto;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.faracart-floating--dir-left .faracart-floating__drawer {
	right: calc( 100% + 0.75rem );
	top: 50%;
	transform: translateY(-50%) scale(0.94);
}

.faracart-floating--dir-right .faracart-floating__drawer {
	left: calc( 100% + 0.75rem );
	top: 50%;
	transform: translateY(-50%) scale(0.94);
}

.faracart-floating--dir-up .faracart-floating__drawer {
	bottom: calc( 100% + 0.75rem );
	transform: scale(0.94);
}

.faracart-floating--dir-down .faracart-floating__drawer {
	top: calc( 100% + 0.75rem );
	transform: scale(0.94);
}

/* Up/down drawers align toward the screen center: a button on the left
 * side extends its drawer rightward, a button on the right side
 * leftward (the JS flags the side from the position preset). */

.faracart-floating--button-left.faracart-floating--dir-up .faracart-floating__drawer,
.faracart-floating--button-left.faracart-floating--dir-down .faracart-floating__drawer {
	left: calc( 100% + 0.75rem );
}

.faracart-floating--button-right.faracart-floating--dir-up .faracart-floating__drawer,
.faracart-floating--button-right.faracart-floating--dir-down .faracart-floating__drawer {
	right: calc( 100% + 0.75rem );
}

.faracart-floating--open .faracart-floating__drawer {
	opacity: 1;
	visibility: visible;
	transform: scale(1);
}

/* The open-state transform must keep the vertical anchor for side
 * drawers (the generic.faracart-floating--open rule above only flips
 * the scale). */

.faracart-floating--dir-left.faracart-floating--open .faracart-floating__drawer {
	transform: translateY(-50%) scale(1);
}

.faracart-floating--dir-right.faracart-floating--open .faracart-floating__drawer {
	transform: translateY(-50%) scale(1);
}

/* The drawer title bar uses the same primary color as the FAB, making the
 * relationship between the button and its mission panel clear. */

.faracart-floating__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	min-height: 42px;
	margin: -1rem -1rem 0.75rem;
	padding: 0.625rem 0.75rem 0.625rem 1rem;
	background: var(--faracart-floating-primary, var(--faracart-accent));
	color: #ffffff;
	border-radius: var(--faracart-radius) var(--faracart-radius) 0 0;
}

.faracart-floating__title {
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
}

.faracart-floating__close {
	position: absolute;
	inset-block-start: 0.375rem;
	inset-inline-end: 0.375rem;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #ffffff;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.faracart-floating__close:hover,
.faracart-floating__close:focus-visible {
	background: rgba(255, 255, 255, 0.18);
	color: #ffffff;
}

/* The drawer hosts a real progress widget container; flatten its card
 * margins so it fills the panel cleanly. */

.faracart-floating__drawer .faracart-widget {
	max-width: none;
	margin: 0;
}

.faracart-floating__drawer .faracart-widget--full {
	margin-block: 0;
}

/* ------------------------------------------------------------------ *
 * Accessibility & motion
 * ------------------------------------------------------------------ */

@media ( prefers-reduced-motion: reduce ) {
	.faracart-progress__fill,
	.faracart-t3__fill,
	.faracart-cta,
	.faracart-recommend,
	.faracart-recommend__add,
	.faracart-floating__button,
	.faracart-floating__drawer,
	.faracart-card--celebrate,
	.faracart-confetti__piece,
	.faracart-widget--updating .faracart-widget__missions {
		transition: none;
		animation: none;
	}
}
