/* Calculateur Fuite Piscine - RÉSOBORVO
   CSS scopé, mobile-first, sans framework. */

.rsbv-calc {
	--rsbv-navy: #00205B;
	--rsbv-blue: #00205B;
	--rsbv-blue-dark: #001643;
	--rsbv-green: #017a3d;
	--rsbv-red: #D6001C;
	--rsbv-orange: #e67e00;
	--rsbv-bg: #ffffff;
	--rsbv-bg-soft: #f5f8fc;
	--rsbv-border: #e3e8ef;
	--rsbv-text: #1a2230;
	--rsbv-text-soft: #5a6573;
	--rsbv-radius: 14px;
	--rsbv-shadow: 0 4px 24px rgba(0, 32, 91, 0.08);
	--rsbv-font: "Mulish", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	font-family: var(--rsbv-font);
	color: var(--rsbv-text);
	max-width: 1080px;
	margin: 0 auto;
	padding: clamp(16px, 4vw, 32px);
	box-sizing: border-box;
}

.rsbv-calc *,
.rsbv-calc *::before,
.rsbv-calc *::after {
	box-sizing: border-box;
}

/* Intro */
.rsbv-calc__intro {
	text-align: center;
	margin-bottom: clamp(20px, 4vw, 36px);
}

.rsbv-calc__title {
	font-size: clamp(1.6rem, 4vw, 2.4rem);
	font-weight: 700;
	color: var(--rsbv-navy);
	margin: 0 0 12px;
	line-height: 1.15;
	letter-spacing: -0.01em;
}

.rsbv-calc__lead {
	font-size: clamp(0.95rem, 1.6vw, 1.05rem);
	color: var(--rsbv-text-soft);
	max-width: 780px;
	margin: 0 auto;
	line-height: 1.65;
}

.rsbv-calc__lead strong {
	color: var(--rsbv-text);
	font-weight: 600;
}

/* Grid layout */
.rsbv-calc__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: clamp(16px, 3vw, 28px);
}

@media (min-width: 820px) {
	.rsbv-calc__grid {
		grid-template-columns: 1.05fr 1fr;
		align-items: start;
	}
}

/* Form card */
.rsbv-calc__form {
	background: var(--rsbv-bg);
	border: 1px solid var(--rsbv-border);
	border-radius: var(--rsbv-radius);
	padding: clamp(16px, 3vw, 28px);
	box-shadow: var(--rsbv-shadow);
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.rsbv-calc__field {
	display: grid;
	grid-template-columns: 32px 1fr auto;
	align-items: center;
	gap: 10px 12px;
	padding: 14px 4px 18px;
	border-bottom: 1px solid var(--rsbv-border);
}

.rsbv-calc__field:last-of-type {
	border-bottom: none;
}

/* Range slider — line below the row */
.rsbv-calc__slider {
	grid-column: 1 / -1;
	width: 100%;
	margin: 6px 0 0;
	-webkit-appearance: none;
	appearance: none;
	background: transparent;
	cursor: pointer;
	height: 24px;
	padding: 0;
	border: none;
	--rsbv-progress: 0%;
}

/* Track — WebKit */
.rsbv-calc__slider::-webkit-slider-runnable-track {
	height: 6px;
	border-radius: 999px;
	background: linear-gradient(
		to right,
		var(--rsbv-blue) 0%,
		var(--rsbv-blue) var(--rsbv-progress),
		#dbe6f5 var(--rsbv-progress),
		#dbe6f5 100%
	);
}

/* Track — Firefox */
.rsbv-calc__slider::-moz-range-track {
	height: 6px;
	border-radius: 999px;
	background: #dbe6f5;
}
.rsbv-calc__slider::-moz-range-progress {
	height: 6px;
	border-radius: 999px;
	background: var(--rsbv-blue);
}

/* Thumb — WebKit */
.rsbv-calc__slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	border: 3px solid var(--rsbv-blue);
	box-shadow: 0 2px 6px rgba(0, 32, 91, 0.3);
	margin-top: -7px;
	transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.rsbv-calc__slider:hover::-webkit-slider-thumb,
.rsbv-calc__slider:focus-visible::-webkit-slider-thumb {
	transform: scale(1.15);
	box-shadow: 0 2px 10px rgba(0, 32, 91, 0.5);
}

/* Thumb — Firefox */
.rsbv-calc__slider::-moz-range-thumb {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	border: 3px solid var(--rsbv-blue);
	box-shadow: 0 2px 6px rgba(0, 32, 91, 0.3);
	cursor: pointer;
	transition: transform 0.1s ease;
}

.rsbv-calc__slider:hover::-moz-range-thumb,
.rsbv-calc__slider:focus-visible::-moz-range-thumb {
	transform: scale(1.15);
}

.rsbv-calc__slider:focus-visible {
	outline: none;
}

.rsbv-calc__icon {
	width: 28px;
	height: 28px;
	color: var(--rsbv-navy);
	flex-shrink: 0;
}

.rsbv-calc__label {
	font-size: 0.95rem;
	color: var(--rsbv-text);
	font-weight: 500;
	cursor: pointer;
	line-height: 1.3;
}

.rsbv-calc__input-wrap {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	background: var(--rsbv-bg-soft);
	border-radius: 10px;
	padding: 8px 12px;
	min-width: 110px;
	transition: box-shadow 0.15s ease, background 0.15s ease;
}

.rsbv-calc__input-wrap:focus-within {
	background: #fff;
	box-shadow: 0 0 0 2px var(--rsbv-blue);
}

.rsbv-calc__input-wrap input {
	font: inherit;
	width: 70px;
	border: none;
	background: transparent;
	color: var(--rsbv-text);
	font-weight: 600;
	font-size: 1rem;
	text-align: right;
	padding: 0;
	-moz-appearance: textfield;
}

.rsbv-calc__input-wrap input:focus {
	outline: none;
}

.rsbv-calc__input-wrap input::-webkit-outer-spin-button,
.rsbv-calc__input-wrap input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.rsbv-calc__unit {
	font-size: 0.85rem;
	color: var(--rsbv-text-soft);
	font-weight: 500;
	white-space: nowrap;
}

/* Submit */
.rsbv-calc__submit {
	margin-top: 16px;
	background: var(--rsbv-blue);
	color: #fff;
	border: none;
	border-radius: 12px;
	padding: 14px 24px;
	font: inherit;
	font-weight: 600;
	font-size: 1.05rem;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	transition: background 0.15s ease, transform 0.05s ease;
	width: 100%;
}

.rsbv-calc__submit:hover,
.rsbv-calc__submit:focus-visible {
	background: var(--rsbv-blue-dark);
	outline: none;
}

.rsbv-calc__submit:active {
	transform: translateY(1px);
}

.rsbv-calc__submit svg {
	width: 22px;
	height: 22px;
}

/* Sidebar (hero + result) */
.rsbv-calc__sidebar {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* Result card */
.rsbv-calc__result {
	background: var(--rsbv-bg);
	border: 1px solid var(--rsbv-border);
	border-radius: var(--rsbv-radius);
	padding: clamp(16px, 3vw, 22px);
	box-shadow: var(--rsbv-shadow);
	transition: border-color 0.2s ease;
}

.rsbv-calc__result-label {
	margin: 0 0 6px;
	font-size: 0.85rem;
	color: var(--rsbv-text-soft);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-weight: 600;
}

.rsbv-calc__result-headline {
	margin: 0 0 8px;
	font-size: clamp(1.3rem, 3vw, 1.7rem);
	font-weight: 700;
	color: var(--rsbv-navy);
	display: flex;
	align-items: center;
	gap: 10px;
	line-height: 1.2;
}

.rsbv-calc__result-sub {
	margin: 0;
	color: var(--rsbv-text-soft);
	font-size: 0.95rem;
	line-height: 1.55;
}

.rsbv-calc__result-figures {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px solid var(--rsbv-border);
}

.rsbv-calc__figure {
	background: var(--rsbv-bg-soft);
	border-radius: 10px;
	padding: 10px 12px;
}

.rsbv-calc__figure-label {
	display: block;
	font-size: 0.75rem;
	color: var(--rsbv-text-soft);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	font-weight: 600;
	margin-bottom: 2px;
}

.rsbv-calc__figure-value {
	display: block;
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--rsbv-text);
}

.rsbv-calc__actions {
	display: grid;
	grid-template-columns: 1fr 1fr; /* même grille que les chiffres au-dessus */
	gap: 12px;
	margin-top: 16px;
}

.rsbv-calc__actions > :only-child {
	grid-column: 1 / -1;
}

.rsbv-calc__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	box-sizing: border-box;
	width: 100%;
	background: var(--rsbv-red);
	color: #fff !important; /* !important : résiste aux règles de couleur de lien du thème */
	text-decoration: none !important;
	padding: 14px 16px;
	min-height: 52px;
	border-radius: 14px;
	font-family: "Roboto", var(--rsbv-font);
	font-weight: 700;
	font-size: 1rem;
	transition: background 0.15s ease, transform 0.15s ease;
}

.rsbv-calc__cta:hover,
.rsbv-calc__cta:focus-visible {
	background: #b80017;
	color: #fff !important;
	transform: translateY(-1px);
	outline: none;
}

/* Tailles d'icônes verrouillées (un thème peut ne pas dimensionner les SVG) */
.rsbv-calc__submit svg,
.rsbv-calc__copy svg,
.rsbv-calc__result-headline svg {
	width: 18px;
	height: 18px;
	flex: none;
}

.rsbv-calc__copy {
	margin: 0;
	background: transparent;
	border: 1px solid var(--rsbv-border);
	color: var(--rsbv-text-soft);
	padding: 12px 14px;
	min-height: 52px;
	width: 100%;
	box-sizing: border-box;
	border-radius: 14px;
	font: inherit;
	font-size: 0.95rem;
	font-weight: 600;
	text-align: center;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: border-color 0.15s ease, color 0.15s ease;
}

.rsbv-calc__copy:hover,
.rsbv-calc__copy:focus-visible {
	border-color: var(--rsbv-navy);
	color: var(--rsbv-navy);
	outline: none;
}

.rsbv-calc__copy svg {
	width: 14px;
	height: 14px;
}

.rsbv-calc__copy.is-copied {
	color: var(--rsbv-green);
	border-color: var(--rsbv-green);
}

/* Verdict states */
.rsbv-calc__result--ok {
	border-color: var(--rsbv-green);
}
.rsbv-calc__result--ok .rsbv-calc__result-headline {
	color: var(--rsbv-green);
}

.rsbv-calc__result--warn {
	border-color: var(--rsbv-orange);
}
.rsbv-calc__result--warn .rsbv-calc__result-headline {
	color: var(--rsbv-orange);
}

.rsbv-calc__result--leak {
	border-color: var(--rsbv-red);
}
.rsbv-calc__result--leak .rsbv-calc__result-headline {
	color: var(--rsbv-red);
}

.rsbv-calc__result-icon {
	width: 28px;
	height: 28px;
	flex-shrink: 0;
}

/* Error state for inputs */
.rsbv-calc__input-wrap.has-error {
	box-shadow: 0 0 0 2px var(--rsbv-red);
	background: #fff5f6;
}

/* Mobile : boutons empilés sur toute la largeur */
@media (max-width: 600px) {
	.rsbv-calc__actions {
		grid-template-columns: 1fr;
	}
}

/* Mobile refinements */
@media (max-width: 480px) {
	.rsbv-calc__field {
		grid-template-columns: 28px 1fr;
		row-gap: 8px;
	}
	.rsbv-calc__input-wrap {
		grid-column: 1 / -1;
		justify-self: stretch;
		justify-content: flex-end;
	}
	.rsbv-calc__icon {
		width: 24px;
		height: 24px;
	}
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.rsbv-calc *,
	.rsbv-calc *::before,
	.rsbv-calc *::after {
		transition: none !important;
		animation: none !important;
	}
}
