/**
 * Gift Progress Bar Styles
 *
 * Every rule is scoped under .stgp-gift-progress and resets the properties
 * Woodmart sets on p / ol / li / img, so the theme cannot reshape the bar.
 *
 * @package SynergyTherm_Gift_Progress
 * @since 1.0.0
 * @version 1.1.0
 */

/* Container
   ============================================ */
.stgp-gift-progress {
	/* Decorative colours (fills, borders). */
	--stgp-primary: #c8a86b;
	--stgp-primary-light: #f1e8d8;
	--stgp-success: #4caf50;
	--stgp-success-light: #dcefdc;
	--stgp-track-bg: #ece5da;
	/* Text colours: >= 4.5:1 on white. */
	--stgp-text: #333333;
	--stgp-text-muted: #666666;
	--stgp-primary-text: #8a6a2e;
	--stgp-success-text: #2e7d32;
	--stgp-dot-size: 28px;
	--stgp-bar-height: 8px;
	--stgp-inset: 14px;

	box-sizing: border-box;
	width: 100%;
	margin: 0 0 20px;
	padding: 16px 0 4px;
	font-family: inherit;
	color: var(--stgp-text);
	text-align: left;
}

.stgp-gift-progress *,
.stgp-gift-progress *::before,
.stgp-gift-progress *::after {
	box-sizing: border-box;
}

.stgp-progress-wrapper:empty {
	display: none;
}

/* Message
   ============================================ */
.stgp-gift-progress .stgp-message {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 0 0 18px;
	padding: 0;
	font-size: 14px;
	line-height: 1.45;
	color: var(--stgp-text);
}

.stgp-gift-progress .stgp-icon {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin-top: 1px;
}

.stgp-gift-progress .stgp-icon-gift {
	color: var(--stgp-primary-text);
}

.stgp-gift-progress .stgp-message-text {
	flex: 1 1 auto;
	min-width: 0;
}

.stgp-gift-progress .stgp-message .amount,
.stgp-gift-progress .stgp-message strong {
	font-weight: 700;
	color: inherit;
	white-space: nowrap;
}

.stgp-gift-progress .stgp-message strong {
	white-space: normal;
}

.stgp-gift-progress.stgp-is-complete .stgp-message {
	color: var(--stgp-success-text);
	font-weight: 600;
}

/* Track & fill
   ============================================ */
.stgp-gift-progress .stgp-bar-container {
	position: relative;
	padding: 0 var(--stgp-inset);
}

.stgp-gift-progress .stgp-bar-track {
	position: relative;
	width: 100%;
	height: var(--stgp-bar-height);
	overflow: hidden;
	background: var(--stgp-track-bg);
	border-radius: 999px;
}

.stgp-gift-progress .stgp-bar-fill {
	height: 100%;
	max-width: 100%;
	background: linear-gradient(90deg, var(--stgp-primary-light), var(--stgp-primary));
	border-radius: 999px;
	transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stgp-gift-progress.stgp-is-complete .stgp-bar-fill {
	background: linear-gradient(90deg, var(--stgp-success-light), var(--stgp-success));
}

/* Tier markers (dots on the bar)
   ============================================ */
.stgp-gift-progress .stgp-tier-markers {
	position: absolute;
	top: 0;
	right: var(--stgp-inset);
	left: var(--stgp-inset);
	height: var(--stgp-bar-height);
	pointer-events: none;
}

.stgp-gift-progress .stgp-tier-marker {
	position: absolute;
	top: 50%;
	display: block;
	transform: translate(-50%, -50%);
	pointer-events: auto;
}

.stgp-gift-progress .stgp-tier-dot {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--stgp-dot-size);
	height: var(--stgp-dot-size);
	background: #ffffff;
	border: 2px solid var(--stgp-track-bg);
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
	color: var(--stgp-text-muted);
	transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.stgp-gift-progress .stgp-tier-dot svg {
	display: block;
	flex: 0 0 auto;
	width: 14px;
	height: 14px;
}

.stgp-gift-progress .stgp-state-earned .stgp-tier-dot {
	background: var(--stgp-success);
	border-color: var(--stgp-success);
	color: #ffffff;
}

.stgp-gift-progress .stgp-state-passed .stgp-tier-dot {
	background: var(--stgp-success-light);
	border-color: var(--stgp-success-light);
	color: var(--stgp-success-text);
}

.stgp-gift-progress .stgp-state-next .stgp-tier-dot {
	border-color: var(--stgp-primary);
	color: var(--stgp-primary-text);
	animation: stgp-pulse 2s ease-out infinite;
}

@keyframes stgp-pulse {
	0%,
	100% {
		box-shadow: 0 0 0 0 rgba(200, 168, 107, 0.45);
	}
	50% {
		box-shadow: 0 0 0 6px rgba(200, 168, 107, 0);
	}
}

/* Tier labels (below the bar)
   Columns are sized per segment (inline grid-template-columns), so each label
   sits in the space that ends at its own dot and labels can never overlap.
   ============================================ */
.stgp-gift-progress .stgp-tier-labels {
	display: grid;
	grid-auto-flow: column;
	gap: 0;
	margin: calc(var(--stgp-dot-size) / 2 + 10px) 0 0;
	padding: 0 var(--stgp-inset);
	list-style: none;
}

.stgp-gift-progress .stgp-tier-label {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	min-width: 0;
	margin: 0;
	padding: 0 0 0 6px;
	list-style: none;
	text-align: right;
	background: none;
	border: 0;
}

.stgp-gift-progress .stgp-tier-label::before,
.stgp-gift-progress .stgp-tier-label::marker {
	content: none;
}

.stgp-gift-progress .stgp-label-threshold {
	display: block;
	margin: 0 0 4px;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--stgp-text-muted);
	white-space: nowrap;
}

.stgp-gift-progress .stgp-label-image {
	display: block;
	width: 32px;
	max-width: 32px;
	height: 32px;
	margin: 0 0 4px;
	object-fit: cover;
	border-radius: 4px;
}

.stgp-gift-progress .stgp-label-name {
	display: -webkit-box;
	max-width: 100%;
	overflow: hidden;
	font-size: 11px;
	line-height: 1.3;
	color: var(--stgp-text-muted);
	overflow-wrap: anywhere;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
}

.stgp-gift-progress .stgp-state-earned .stgp-label-threshold,
.stgp-gift-progress .stgp-state-earned .stgp-label-name {
	color: var(--stgp-success-text);
}

.stgp-gift-progress .stgp-state-earned .stgp-label-name,
.stgp-gift-progress .stgp-state-next .stgp-label-name {
	font-weight: 600;
}

.stgp-gift-progress .stgp-state-passed .stgp-label-image {
	opacity: 0.55;
}

.stgp-gift-progress .stgp-state-next .stgp-label-threshold,
.stgp-gift-progress .stgp-state-next .stgp-label-name {
	color: var(--stgp-primary-text);
}

.stgp-gift-progress .stgp-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Mini-cart (compact: message + bar, no labels)
   ============================================ */
.stgp-context-mini-cart .stgp-gift-progress {
	--stgp-dot-size: 20px;
	--stgp-bar-height: 6px;
	--stgp-inset: 10px;

	margin: 0 0 14px;
	padding: 12px 0 14px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.stgp-context-mini-cart .stgp-gift-progress .stgp-message {
	margin-bottom: 14px;
	font-size: 13px;
}

.stgp-context-mini-cart .stgp-gift-progress .stgp-tier-dot svg {
	width: 11px;
	height: 11px;
}

/* Small screens
   ============================================ */
@media (max-width: 600px) {
	.stgp-gift-progress {
		--stgp-dot-size: 24px;
		--stgp-bar-height: 6px;
		--stgp-inset: 12px;
	}

	.stgp-gift-progress .stgp-tier-dot svg {
		width: 12px;
		height: 12px;
	}

	.stgp-gift-progress .stgp-message {
		font-size: 13px;
	}

	.stgp-gift-progress .stgp-label-threshold {
		font-size: 11px;
	}

	.stgp-gift-progress .stgp-label-image {
		width: 28px;
		max-width: 28px;
		height: 28px;
	}
}

/* Motion & print
   ============================================ */
@media (prefers-reduced-motion: reduce) {
	.stgp-gift-progress .stgp-bar-fill,
	.stgp-gift-progress .stgp-tier-dot {
		transition: none;
	}

	.stgp-gift-progress .stgp-state-next .stgp-tier-dot {
		animation: none;
	}
}

@media print {
	.stgp-progress-wrapper {
		display: none !important;
	}
}
