/*==============================================================
	CALCULATEUR (HE Tool) — assistant en 4 étapes
	Contrôleur Stimulus : assets/controllers/calculateur_controller.js
==============================================================*/

.calc-hero {
	padding-block: clamp(2.5rem, 5vw, 3.5rem) clamp(5rem, 9vw, 6.5rem);
	background:
		radial-gradient(800px 400px at 95% 0%, rgba(242, 101, 34, .3), transparent 60%),
		var(--navy);
	color: var(--navy-100);
}

.calc-hero h1 {
	color: var(--white);
	margin-bottom: .4rem;
}

.calc-hero .lead {
	max-width: 720px;
	margin: 0;
	color: var(--navy-100);
}

.calc-hero .breadcrumb,
.calc-hero .breadcrumb a {
	color: var(--navy-200);
}

.calc {
	margin-top: clamp(-4rem, -7vw, -3rem);
	padding-bottom: clamp(3rem, 6vw, 5rem);
	scroll-margin-top: calc(var(--header-h) + 1rem);
}

/*--- Indicateur d'étapes ------------------------------------*/
.stepper {
	position: relative;
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: .5rem;
	margin: 0 0 1.5rem;
	padding: 1rem;
	border-radius: var(--radius-lg);
	background: var(--white);
	box-shadow: var(--shadow);
	list-style: none;
}

.stepper__item {
	display: flex;
	align-items: center;
	gap: .75rem;
	padding: .5rem .6rem;
	border-radius: 12px;
	color: var(--muted);
}

.stepper__num {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 12px;
	border: 2px solid var(--line);
	font-family: var(--font-title);
	font-weight: 800;
	color: var(--muted);
	transition: background-color .25s ease, border-color .25s ease, color .25s ease;
}

.stepper__label {
	display: flex;
	flex-direction: column;
	font-family: var(--font-title);
	font-size: .9rem;
	font-weight: 700;
	line-height: 1.2;
}

.stepper__small {
	font-size: .68rem;
	font-weight: 600;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--muted);
}

.stepper__item.is-current {
	background: var(--orange-50);
	color: var(--navy);
}

.stepper__item.is-current .stepper__num {
	border-color: var(--orange);
	background: var(--orange);
	color: var(--white);
}

.stepper__item.is-done {
	color: var(--navy);
}

.stepper__item.is-done .stepper__num {
	border-color: var(--navy);
	background: var(--navy);
	color: var(--white);
}

@media (max-width: 719.98px) {
	.stepper {
		padding: .6rem;
		gap: .25rem;
	}

	.stepper__item {
		flex-direction: column;
		gap: .3rem;
		padding: .4rem .2rem;
		text-align: center;
	}

	.stepper__label {
		font-size: .72rem;
	}

	.stepper__small {
		display: none;
	}
}

/*--- Panneaux -----------------------------------------------*/
.calc-panel {
	padding: clamp(1.4rem, 3.5vw, 2.5rem);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	background: var(--white);
	box-shadow: var(--shadow-sm);
}

.calc-panel[hidden] {
	display: none;
}

.calc-panel__head {
	max-width: 820px;
	margin-bottom: 1.75rem;
}

.calc-panel__head h2 {
	font-size: clamp(1.35rem, 2.5vw, 1.75rem);
	outline: none;
}

.calc-subtitle {
	display: flex;
	align-items: center;
	gap: .5rem;
	margin: 1.5rem 0 1rem;
	font-size: .85rem;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--muted);
}

.calc-subtitle i {
	color: var(--orange);
}

.calc-nav {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	margin-top: 2rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--line);
}

.calc-chargement {
	display: grid;
	place-items: center;
	padding: 3rem 1rem;
	font-size: 2rem;
	color: var(--orange);
}

.calc-chargement[hidden] {
	display: none;
}

/*--- Étape 1 : critères -------------------------------------*/
.slots {
	display: grid;
	gap: .75rem;
	margin-bottom: 1.5rem;
}

@media (min-width: 720px) {
	.slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.slot {
	display: flex;
	align-items: center;
	gap: .9rem;
	min-height: 64px;
	padding: .75rem 1rem;
	border: 2px dashed var(--navy-200);
	border-radius: var(--radius);
	background: var(--navy-50);
	transition: border-color .2s ease, background-color .2s ease;
}

.slot__num {
	flex: 0 0 auto;
	padding: .25rem .6rem;
	border-radius: 999px;
	background: var(--white);
	font-family: var(--font-title);
	font-size: .78rem;
	font-weight: 800;
	color: var(--muted);
}

.slot__value {
	font-weight: 500;
	color: var(--muted);
}

.slot.is-filled {
	border-style: solid;
	border-color: var(--orange);
	background: var(--orange-50);
}

.slot.is-filled .slot__num {
	background: var(--orange);
	color: var(--white);
}

.slot.is-filled .slot__value {
	font-family: var(--font-title);
	font-weight: 700;
	color: var(--navy);
}

.criteres {
	display: grid;
	gap: .65rem;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
}

.critere {
	position: relative;
	display: flex;
	align-items: stretch;
	border: 1.5px solid var(--line);
	border-radius: var(--radius);
	background: var(--white);
	transition: border-color .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.critere:hover {
	border-color: var(--navy-200);
	box-shadow: var(--shadow-sm);
}

.critere__choix {
	flex: 1;
	display: flex;
	align-items: center;
	gap: .7rem;
	min-height: 56px;
	padding: .65rem .5rem .65rem .9rem;
	border: 0;
	border-radius: var(--radius) 0 0 var(--radius);
	background: none;
	font: inherit;
	font-weight: 600;
	color: var(--navy);
	text-align: left;
	cursor: pointer;
}

.critere__rang {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border: 2px solid var(--navy-200);
	border-radius: 8px;
	font-family: var(--font-title);
	font-size: .85rem;
	font-weight: 800;
	color: var(--white);
}

.critere__info {
	flex: 0 0 auto;
	width: 46px;
	border: 0;
	border-left: 1px solid var(--line);
	border-radius: 0 var(--radius) var(--radius) 0;
	background: none;
	color: var(--navy-600);
	cursor: pointer;
}

.critere__info:hover {
	background: var(--navy-50);
	color: var(--orange-600);
}

.critere.is-selected {
	border-color: var(--orange);
	background: var(--orange-50);
}

.critere.is-selected .critere__rang {
	border-color: var(--orange);
	background: var(--orange);
}

.critere.is-disabled {
	opacity: .55;
}

.critere.is-disabled .critere__choix {
	cursor: not-allowed;
}

.calc-techs {
	margin-top: 2.25rem;
	padding-top: 1.75rem;
	border-top: 1px solid var(--line);
}

.calc-techs h3 {
	margin-bottom: .2rem;
	font-size: 1.05rem;
}

.tech--button {
	font: inherit;
	cursor: pointer;
	transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.tech--button:hover {
	border-color: var(--navy-200);
	box-shadow: var(--shadow-sm);
	transform: translateY(-2px);
}

.tech--button .tech__name {
	color: var(--navy-600);
}

/*--- Étape 2 : classement -----------------------------------*/
.choix {
	display: grid;
	gap: 1rem;
}

@media (min-width: 640px) {
	.choix { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 960px) {
	.choix { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.choix:empty {
	display: none;
}

.choix__carte {
	position: relative;
	display: flex;
	flex-direction: column;
	padding: 1.1rem;
	border: 1.5px solid var(--line);
	border-radius: var(--radius-lg);
	background: var(--white);
	transition: border-color .2s ease, box-shadow .2s ease;
}

.choix__carte img {
	width: 100%;
	max-width: 170px;
	margin: .25rem auto .6rem;
	aspect-ratio: 250 / 222;
	object-fit: contain;
}

.choix__code {
	margin: 0;
	font-size: 1.1rem;
}

.choix__nom {
	margin: .1rem 0 .6rem;
	font-size: .85rem;
	line-height: 1.4;
	color: var(--muted);
}

.choix__delai {
	margin-bottom: 1rem;
	font-size: .85rem;
}

.choix__delai i {
	color: var(--orange);
}

.choix__actions {
	display: flex;
	gap: .5rem;
	margin-top: auto;
}

.choix__actions .btn {
	flex: 1;
}

.choix__rang {
	position: absolute;
	top: .9rem;
	left: .9rem;
	padding: .2rem .65rem;
	border-radius: 999px;
	background: var(--navy);
	color: var(--white);
	font-family: var(--font-title);
	font-size: .75rem;
	font-weight: 800;
}

.choix__carte.is-first {
	border-color: var(--orange);
	box-shadow: 0 10px 30px rgba(242, 101, 34, .15);
}

.choix__carte.is-first .choix__rang {
	background: var(--orange);
}

.choix--top .choix__carte {
	background: linear-gradient(180deg, var(--navy-50), var(--white) 45%);
}

.choix__carte.is-selected {
	border-color: var(--navy);
	box-shadow: 0 0 0 3px var(--navy), var(--shadow);
}

.choix__carte.is-selected [aria-pressed='true'] {
	--btn-bg: var(--orange);
}

/*--- Étape 3 : données de fonctionnement --------------------*/
.calc-tech-choisie {
	margin-bottom: 1.25rem;
}

.tabs {
	display: inline-flex;
	flex-wrap: wrap;
	gap: .35rem;
	margin-bottom: 1.5rem;
	padding: .35rem;
	border-radius: 999px;
	background: var(--navy-50);
}

.tabs__tab {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	padding: .6rem 1.1rem;
	border: 0;
	border-radius: 999px;
	background: none;
	font-family: var(--font-title);
	font-size: .88rem;
	font-weight: 700;
	color: var(--muted);
	cursor: pointer;
}

.tabs__tab[aria-selected='true'] {
	background: var(--white);
	color: var(--navy);
	box-shadow: var(--shadow-sm);
}

.tabs__tab[aria-selected='true'] i {
	color: var(--orange);
}

.process {
	width: 100%;
	min-width: 620px;
	border-collapse: separate;
	border-spacing: 0 .6rem;
}

.process th,
.process td {
	padding: .25rem .4rem;
	text-align: left;
	vertical-align: middle;
}

.process thead th {
	font-family: var(--font-title);
	font-size: .78rem;
	font-weight: 700;
	letter-spacing: .04em;
	color: var(--muted);
}

.process tbody th {
	min-width: 140px;
	font-family: var(--font-title);
	font-size: .9rem;
	color: var(--navy);
	white-space: nowrap;
}

.process__row--chaud th i { color: var(--danger); }
.process__row--froid th i { color: var(--navy-600); }

.process .input {
	min-width: 110px;
}

.input--calc {
	display: flex;
	align-items: center;
	background: var(--navy-50);
	border-style: dashed;
	font-weight: 700;
	color: var(--navy);
}

.process__extra {
	display: grid;
	gap: 1rem;
	align-items: end;
	margin-top: .5rem;
}

@media (min-width: 720px) {
	.process__extra { grid-template-columns: 220px 220px auto; }
}

.process__aide {
	justify-self: start;
}

.process__surface {
	max-width: 320px;
}

.calc-actions {
	display: grid;
	gap: 1rem;
	align-items: start;
	margin-top: 1.75rem;
	padding: 1.25rem;
	border-radius: var(--radius);
	background: var(--bg);
}

@media (min-width: 720px) {
	.calc-actions { grid-template-columns: auto 1fr; }
}

.calc-messages {
	display: grid;
	gap: .5rem;
	align-self: center;
}

.calc-messages .alert {
	padding: .7rem .9rem;
}

/* Lecture seule (récapitulatif de l'étape 4) */
.process--lecture {
	min-width: 560px;
	border-spacing: 0;
}

.process--lecture th,
.process--lecture td {
	padding: .65rem .6rem;
	border-bottom: 1px solid var(--line);
	font-variant-numeric: tabular-nums;
}

.process--lecture td {
	color: var(--ink);
	font-weight: 500;
}

/*--- Étape 4 : résultat -------------------------------------*/
.resultat {
	display: grid;
	gap: 1.25rem;
}

.resultat__techno {
	display: grid;
	gap: 1.5rem;
	align-items: center;
}

@media (min-width: 900px) {
	.resultat__techno { grid-template-columns: 170px minmax(0, 1fr); }
}

.resultat__figure {
	margin: 0;
	text-align: center;
}

.resultat__figure img {
	max-width: 150px;
}

.resultat__grid {
	display: grid;
	gap: 1.25rem;
}

@media (min-width: 960px) {
	.resultat__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.resultat__note {
	margin: 1rem 0 0;
	line-height: 1.5;
}

.resultat__encombrement {
	display: grid;
	grid-template-columns: 70px 1fr;
	gap: 1rem;
	align-items: start;
}

.resultat__delai {
	text-align: center;
}

.resultat__delai h3 {
	justify-content: center;
}

.resultat__delai .big-number {
	margin-top: .5rem;
	padding: 1rem;
	border: 2px solid var(--orange-100);
	border-radius: var(--radius);
	background: var(--orange-50);
}

/* Écran d'accès (connexion, vérification, quota) */
.gate {
	max-width: 640px;
	margin: 1rem auto;
	padding: clamp(1.5rem, 4vw, 2.5rem);
	border-radius: var(--radius-lg);
	background: var(--navy-50);
	text-align: center;
}

.gate__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 72px;
	height: 72px;
	margin-bottom: 1rem;
	border-radius: 22px;
	background: var(--white);
	color: var(--orange);
	font-size: 1.8rem;
	box-shadow: var(--shadow-sm);
}

.gate .btn-row {
	justify-content: center;
	margin-top: 1.5rem;
}

.gate__avantages {
	display: grid;
	gap: .4rem;
	margin: 1.5rem 0 0;
	padding: 0;
	list-style: none;
	font-size: .9rem;
}

.gate__avantages i {
	margin-right: .4rem;
	color: var(--success);
}

/* Fenêtres d'aide */
.dialog__image {
	float: right;
	width: 140px;
	margin: 0 0 1rem 1rem;
}

.fluides dt {
	font-family: var(--font-title);
	font-weight: 700;
	color: var(--navy);
}

.fluides dd {
	margin: .2rem 0 1rem;
	font-size: .92rem;
}

@media print {
	.calc-hero,
	.stepper,
	.calc-panel__head {
		display: none;
	}

	.calc {
		margin-top: 0;
	}

	.calc-panel {
		border: 0;
		padding: 0;
	}

	.resultat__expert {
		background: none;
		color: #000;
		border: 1px solid #ccc;
	}

	.resultat__expert h2 {
		color: #000;
	}
}
