/**
 * Side-cart progress bar + CheckoutWC header styles.
 *
 * Stop positioning formula:
 *   left% = (milestone_threshold / progress_max) * 100
 *   Example: progress_max=200, threshold=$120 → left: 60%
 *
 * Icons are centered on the bar line (bar=14px, icon=32px → top: -9px).
 * Labels appear below the icons.
 *
 * @package IC_Free_Gift_Manager
 */

/* ── CheckoutWC side-cart header ─────────────────────────────── */

#cfw-side-cart .cfw-side-cart-contents-header:before {
	display: none !important;
}

body #cfw-side-cart .cfw-side-cart-contents-header .cfw-side-cart-close-btn {
	background-image: none !important;
	top: 16px;
	right: 14px !important;
	outline: none;
}

#cfw-side-cart .cfw-side-cart-close-btn svg {
	display: flex !important;
	color: var(--nd-theme-dark) !important;
}

body #cfw-side-cart .cfw-side-cart-contents-header {
	min-height: fit-content !important;
	overflow: unset !important;
	padding: 16px;
}

#cfw-side-cart .cfw-side-cart-contents-body {
	overflow: visible !important;
}

.kt-cart-header-text {
	margin-top: 6px;
	margin-bottom: 0px;
	display: flex;
	align-items: center;
	justify-content: start;
	color: var(--nd-theme-dark);
	font-size: 18px;
	font-weight: 700;
	line-height: normal;
	text-transform: uppercase;
}

/* ── Progress bar wrapper ────────────────────────────────────── */

#cfw-side-cart .cfw-side-cart-free-shipping-progress-wrap,
.cfw-side-cart-free-shipping-progress-wrap {
	background: rgba(52, 90, 153, 0.06);
	border-radius: 8px;
	margin-bottom: 0;
	padding: 12px 0;
	overflow: visible;
}

body #cfw-side-cart .cfw-side-cart-free-shipping-progress,
.cfw-side-cart-free-shipping-progress {
	background: transparent !important;
	padding: 10px 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	position: relative;
	z-index: 0;
	overflow: visible;
}

/* ── Reward message ─────────────────────────────────────────── */

#cfw-side-cart .ic-shipping-message,
.cfw-side-cart-free-shipping-progress .ic-shipping-message {
	color: #345a99;
	text-align: center;
	font-family: var(--nd-primary-font), var(--nd-secondary-font), sans-serif;
	font-size: clamp(14px, 1.2vw, 16px);
	font-weight: 700;
	line-height: 26px;
	margin-bottom: 20px;
}

#cfw-side-cart .ic-shipping-message strong,
.cfw-side-cart-free-shipping-progress .ic-shipping-message strong {
	color: #345a99;
	font-weight: 700;
}

#cfw-side-cart .ic-shipping-message .woocommerce-Price-amount,
.cfw-side-cart-free-shipping-progress .ic-shipping-message .woocommerce-Price-amount {
	font-weight: 700;
}

/* ── Progress track (wraps bar + stops) ─────────────────────── */
/* padding-bottom reserves space below the bar for stop labels. */
/* The icons extend 9px above the track top (overflow: visible). */

.cfw-side-cart-progress-track {
	position: relative;
	width: 100%;
	padding-bottom: 50px;
	overflow: visible;
}

/* ── Bar background + fill ──────────────────────────────────── */

#cfw-side-cart .barBackground,
.cfw-side-cart-free-shipping-progress-wrap .barBackground {
	border-radius: 100px !important;
	width: 100%;
	min-height: 14px !important;
	margin-top: 0;
	margin-bottom: 0;
	border: none !important;
	box-shadow: none !important;
	background: var(--icpb-track, #dfdfdf) !important;
	position: relative;
	z-index: 0;
}

#cfw-side-cart .cfw-side-cart-free-shipping-progress-indicator,
.cfw-side-cart-free-shipping-progress-indicator {
	text-align: right;
	border-radius: 100px !important;
	min-height: 14px !important;
	height: 14px !important;
	background: var(--icpb-fill, #345a99) !important;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	margin-top: 0 !important;
	transition: width 0.3s ease;
	position: relative;
	z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
	.cfw-side-cart-free-shipping-progress-indicator {
		transition: none;
	}
}

body .cfw-side-cart-free-shipping-progress-indicator > svg {
	width: fit-content !important;
	height: fit-content !important;
	position: static !important;
	margin-top: -1px !important;
}

/* ── Cloud button ───────────────────────────────────────────── */

#cfw-side-cart .main-cloud-img-wrapper,
.cfw-side-cart-free-shipping-progress-wrap .main-cloud-img-wrapper {
	transform: scale(1.1) !important;
	top: 3px !important;
	border: 2px solid var(--nd-theme-yellow) !important;
	min-width: 30px !important;
	min-height: 15px !important;
	padding: 0;
	background: var(--nd-theme-yellow);
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	border-radius: 100px;
}

#cfw-side-cart .cfw-side-cart-free-shipping-progress-indicator .main-cloud-img-wrapper,
.cfw-side-cart-free-shipping-progress-indicator .main-cloud-img-wrapper {
	top: 0 !important;
}

#cfw-side-cart .main-cloud-img-wrapper svg,
.cfw-side-cart-free-shipping-progress-wrap .main-cloud-img-wrapper svg {
	width: 15px !important;
	height: 9px !important;
}

/* ── Milestone stops container ──────────────────────────────── */
/* Fills the entire track (including padding area).              */

.icpb-stops {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	pointer-events: none;
	z-index: 2;
}

/* ── Individual milestone stop ─────────────────────────────── */
/* top: -9px centers the 32px icon on the 14px bar.            */
/* left: X% is set per-stop via inline style.                   */

.icpb-stop {
	position: absolute;
	top: -9px;
	display: flex !important;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	pointer-events: auto;
	transform: translateX(-50%);
	z-index: 1;
}

/* ── Stop icon wrapper ──────────────────────────────────────── */

.icpb-stop__svg-wrapper {
	width: 32px !important;
	height: 32px !important;
	min-width: 32px !important;
	min-height: 32px !important;
	max-width: 32px !important;
	max-height: 32px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	border-radius: 100px;
	background: var(--nd-theme-white, #fff) !important;
	box-shadow: 0 4px 4px 0 rgba(39, 36, 36, 0.25);
	overflow: hidden;
}

.icpb-stop__svg-wrapper img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

/* ── Stop states ────────────────────────────────────────────── */

.icpb-stop:not(.passed) .icpb-stop__svg-wrapper {
	background: var(--nd-theme-white, #fff) !important;
}

.icpb-stop:not(.passed) .icpb-stop__label {
	color: var(--nd-theme-dark, #333) !important;
}

.icpb-stop:not(.passed) .icpb-stop__svg-wrapper svg,
.icpb-stop:not(.passed) .icpb-stop__svg-wrapper img {
	filter: none !important;
}

.icpb-stop.passed .icpb-stop__svg-wrapper {
	background: #008f5f !important;
}

.icpb-stop.passed .icpb-stop__label {
	color: #008f5f;
}

.icpb-stop.passed .icpb-stop__svg-wrapper svg {
	filter: brightness(0) invert(1);
}

/* ── Stop label ─────────────────────────────────────────────── */

.icpb-stop__label {
	color: var(--nd-theme-dark);
	font-family: var(--nd-primary-font), var(--nd-secondary-font), sans-serif;
	font-size: 13px;
	font-weight: 600;
	line-height: 20px;
	letter-spacing: -0.13px;
	text-transform: capitalize;
	text-align: center;
	min-width: 56px;
	max-width: 80px;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

/* ── Legacy override ────────────────────────────────────────── */
/*
 * The theme's old side-cart.css may still be loaded and contains rules that
 * force .icpb-stops into a flex container with min-width on each stop,
 * spreading them evenly regardless of calculated left positions.
 * These overrides use #cfw-side-cart for higher specificity to neutralize
 * those rules and restore absolute-position-based milestone placement.
 */

#cfw-side-cart .icpb-stops,
.cfw-side-cart-free-shipping-progress-wrap .icpb-stops {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	display: block !important;
	min-width: 0 !important;
	margin-right: 0 !important;
	justify-content: unset !important;
	align-items: unset !important;
}

#cfw-side-cart .icpb-stop,
.cfw-side-cart-free-shipping-progress-wrap .icpb-stop {
	min-width: 0 !important;
	max-width: none !important;
	border: none !important;
	width: auto;
}

/* ── Responsive ─────────────────────────────────────────────── */

@media screen and (max-width: 580px) {
	.icpb-stop__label {
		font-size: 10px !important;
		line-height: 13px !important;
	}
}

@media screen and (max-width: 520px) {
	#cfw-side-cart .cfw-side-cart-free-shipping-progress,
	.cfw-side-cart-free-shipping-progress {
		padding: 6px 8px !important;
	}

	.cfw-side-cart-progress-track {
		padding-bottom: 38px !important;
	}

	.icpb-stop {
		top: -5px;
	}

	.icpb-stop__svg-wrapper {
		width: 24px !important;
		height: 24px !important;
		min-width: 24px !important;
		min-height: 24px !important;
		max-width: 24px !important;
		max-height: 24px !important;
	}

	.icpb-stop__label {
		font-size: 9px !important;
		line-height: 12px !important;
		min-width: 0 !important;
		max-width: 40px;
	}
}

@media screen and (max-width: 400px) {
	.cfw-side-cart-progress-track {
		padding-bottom: 32px !important;
	}

	.icpb-stop {
		top: -3px;
	}

	.icpb-stop__svg-wrapper {
		width: 20px !important;
		height: 20px !important;
		min-width: 20px !important;
		min-height: 20px !important;
		max-width: 20px !important;
		max-height: 20px !important;
	}

	.icpb-stop__label {
		font-size: 8px !important;
		line-height: 11px !important;
		min-width: 40px !important;
	}
}

@media screen and (max-width: 340px) {
	.cfw-side-cart-progress-track {
		padding-bottom: 28px !important;
	}

	.icpb-stop {
		top: -2px;
		gap: 1px;
	}

	.icpb-stop__svg-wrapper {
		width: 18px !important;
		height: 18px !important;
		min-width: 18px !important;
		min-height: 18px !important;
		max-width: 18px !important;
		max-height: 18px !important;
	}

	.icpb-stop__label {
		max-width: 30px;
	}
}

