/* =============================================
   CALCULATOR — base panel + v2 arc gauge
   ============================================= */

.bsa-calc-output {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	padding: 0.55rem 0;
	border-bottom: 1px solid #D4E2EF;
	gap: 0.75rem;
}

.bsa-calc-output:last-of-type { border-bottom: none; }

/* Results table row label */
.bsa-calc-output__label {
	font-size: 0.9375rem;
	color: #6B7C8D;
	flex: 1;
	line-height: 1.3;
}

/* Results table row value */
.bsa-calc-output__value {
	font-size: 0.9375rem;
	font-weight: 600;
	color: #0F1F38;
	text-align: right;
	flex-shrink: 0;
	font-variant-numeric: tabular-nums;
}

/* ---- Tablet (782–1024px): base desktop sizes apply ---- */

/* ---- Tablet/mobile layout + font scale-down (≤781px) ---- */
@media (max-width: 781px) {

	/* Gauge: scale down for tablet viewport */
	.bsa-calc-gauge         { width: 200px; }

	.bsa-calc-output__label                             { font-size: 0.875rem; }
	.bsa-calc-output__value                             { font-size: 0.875rem; }

}

/* =============================================
   CALCULATOR V2 — Arc Gauge & Cost Cards
   Supplements portal.css for bsa-calc-panel--v2
   ============================================= */

.bsa-calc-gauge {
	width: 230px;
	height: auto;
	overflow: visible;
	display: block;
}

.bsa-calc-gauge__track {
	fill: none;
	stroke: rgba(255, 255, 255, 0.1);
	stroke-width: 14;
	stroke-linecap: round;
}

.bsa-calc-gauge__fill {
	fill: none;
	stroke: #57C49F;
	stroke-width: 14;
	stroke-linecap: round;
	stroke-dasharray: 267.04;
	stroke-dashoffset: 267.04;
	transition: stroke-dashoffset 0.85s cubic-bezier(0.4, 0, 0.2, 1),
	            stroke 0.45s ease;
	transform-origin: center;
}

.bsa-calc-gauge__fill.is-low  { stroke: #E8705A; }
.bsa-calc-gauge__fill.is-mid  { stroke: #F0B429; }
.bsa-calc-gauge__fill.is-good { stroke: #57C49F; }

/* ---- Portal Col3: compact gauge for narrow viewports (≤1400px, col3 ≈ 600–750px) ---- */
/* At ≤1400px the col3 panel is narrow enough that the 230px gauge dominates the hero. */
/* Above 1400px (e.g. 15.6" FHD 1920px, col3 ≈ 1250px) the original size looks right. */
@media (min-width: 1101px) and (max-width: 1400px) {

	.bsa-portal-col3 .bsa-calc-panel .bsa-calc-gauge         { width: 160px; }

}

/* ---- Portal Col3: medium gauge for mid-range viewports (1401px–1700px, col3 ≈ 750–1050px) ---- */
@media (min-width: 1401px) and (max-width: 1700px) {

	.bsa-portal-col3 .bsa-calc-panel .bsa-calc-gauge         { width: 195px; }

}

/* ---- Range sliders ---- */
.bsa-calc-slider {
	width: 100%;
	margin-top: 0.45rem;
	-webkit-appearance: none;
	appearance: none;
	height: 4px;
	background: #D8DEE4;
	border-radius: 2px;
	outline: none;
	cursor: pointer;
	display: block;
}

.bsa-calc-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #2C5F8A;
	cursor: pointer;
	border: 2.5px solid #FFFFFF;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
	transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.bsa-calc-slider::-webkit-slider-thumb:hover {
	transform: scale(1.18);
	box-shadow: 0 2px 8px rgba(44, 95, 138, 0.4);
}

.bsa-calc-slider::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #2C5F8A;
	cursor: pointer;
	border: 2.5px solid #FFFFFF;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

.bsa-calc-slider::-moz-range-track {
	background: #D8DEE4;
	height: 4px;
	border-radius: 2px;
}

/* ---- Count-up pulse animation ---- */
@keyframes bsa-calc-pulse {
	0%   { opacity: 0.55; transform: scale(0.96); }
	100% { opacity: 1;    transform: scale(1); }
}

.bsa-calc-output__value.is-updating {
	animation: bsa-calc-pulse 0.28s ease-out both;
}

/* ---- Mobile phone (≤640px): hero shrinks + further font reduction ---- */
@media (max-width: 640px) {

	.bsa-calc-gauge         { width: 175px; }

	.bsa-calc-output__label                             { font-size: 0.8125rem; }
	.bsa-calc-output__value                             { font-size: 0.8125rem; }

}

/* ---- Reset button ---- */
.bsa-calc-reset {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	margin-top: 1rem;
	padding: 0.45rem 0.85rem;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: #6B7C8D;
	background: transparent;
	border: 1px solid #D8DEE4;
	border-radius: var(--bsa-radius, 10px);
	cursor: pointer;
	transition: color 0.15s, border-color 0.15s, background 0.15s;
	font-family: inherit;
}

.bsa-calc-reset:hover {
	color: #2C5F8A;
	border-color: #2C5F8A;
	background: #F0F5FB;
}

.bsa-calc-reset:active {
	background: #E3EDF6;
}

.bsa-calc-reset svg {
	flex-shrink: 0;
}

/* ---- Touch devices: larger interactive targets ---- */
@media (pointer: coarse) {

	/* 44px tall hit area; track stays visually thin via runnable-track */
	.bsa-calc-slider {
		height: 44px;
		background: transparent;
	}

	.bsa-calc-slider::-webkit-slider-runnable-track {
		height: 6px;
		background: #D8DEE4;
		border-radius: 2px;
	}

	.bsa-calc-slider::-webkit-slider-thumb {
		width: 32px;
		height: 32px;
		margin-top: -13px;
	}

	.bsa-calc-slider::-moz-range-thumb {
		width: 32px;
		height: 32px;
	}

}

.bsa-cost-group__header {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	cursor: pointer;
	user-select: none;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #2C5F8A;
	padding: 0.5rem 0 0.75rem;
	border-bottom: 2px solid #2C5F8A;
	margin-bottom: 1rem;
}

.bsa-cost-group__subtotal {
	font-size: 0.75rem;
	font-weight: 600;
	color: #2C5F8A;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0;
}

/* ---- Header metric tag (hidden on desktop, shown on mobile via media query) ---- */
.bsa-viewer__metric {
	display: none;
	flex-direction: column;
	align-items: flex-end;
	gap: 0.1rem;
	border-bottom: none !important;
	padding: 0 !important;
	background: none;
	margin-left: auto;
	flex-shrink: 0;
	position: relative;
	z-index: 1;
}

.bsa-viewer__metric .bsa-calc-output__value {
	font-size: 1rem;
	font-weight: 700;
	color: #FFFFFF;
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.bsa-viewer__metric .bsa-calc-output__label {
	font-size: 0.625rem;
	font-weight: 700;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.5);
	flex: unset;
	text-align: right;
}

/* Yield: metric value colour matches gauge range — overridden by JS-applied class */
.bsa-calc-panel[data-template="yield"] .bsa-viewer__metric .bsa-calc-output__value { color: rgba(255, 255, 255, 0.6); }
.bsa-calc-panel[data-template="yield"] .bsa-viewer__metric .bsa-calc-output__value.is-low  { color: #E07575; }
.bsa-calc-panel[data-template="yield"] .bsa-viewer__metric .bsa-calc-output__value.is-mid  { color: #E8B85C; }
.bsa-calc-panel[data-template="yield"] .bsa-viewer__metric .bsa-calc-output__value.is-good { color: #57C49F; }

/* ---- Slider step hint (visible on mobile only) ---- */
.bsa-calc-step-hint {
	display: none;
	font-size: 0.6875rem;
	color: #6B7C8D;
	margin-top: 0.3rem;
	line-height: 1.3;
}

@media (max-width: 640px) {

	/* Portal: header is always pinned (flex sibling of scrolling body — no sticky needed) */
	.bsa-portal-col3 .bsa-calc-panel .bsa-viewer__header { flex-wrap: wrap; }

	
	.bsa-portal-col3 .bsa-calc-panel .bsa-viewer__metric{ display: flex; }
	
	.bsa-portal-col3 .bsa-calc-panel .bsa-viewer__title{ text-align: left; }
	
	.bsa-portal-col3 .bsa-calc-panel .bsa-viewer__metric{
		min-width: 0;
		align-items: flex-end;
	}
	
	.bsa-portal-col3 .bsa-calc-panel .bsa-viewer__metric .bsa-calc-output__value{
		font-size: 0.8rem;
		white-space: nowrap;
	}
	
	.bsa-portal-col3 .bsa-calc-panel .bsa-viewer__metric .bsa-calc-output__label{
		max-width: 7rem;
		white-space: normal;
		line-height: 1.1;
	}
	.bsa-calc-panel[data-template="yield"] .bsa-viewer__metric .bsa-calc-output__value {
		font-size: 1.1rem;
		font-weight: 800;
	}

	/* Hide badge — metric carries the summary role */
	
	.bsa-portal-col3 .bsa-calc-panel .bsa-viewer__badge{ display: none; }

	/* Show step hints below sliders */
	.bsa-calc-step-hint { display: block; }

}
