/* ==========================================================================
   Wizard « Compatibilité véhicule » klavkarr
   Composant de vérification de compatibilité en 3 étapes (Marque → Modèle → Voyant)
   + écran de vérification + résultat.
   Remplace l'ancien module-recherche-vehicule. Branché sur les endpoints réels.
   Tokens issus du handoff design (hi-fi).
   ========================================================================== */

/* ----- Animations écran de vérification ----- */
@keyframes wizard-compat-bar { 0% { transform: translateX(-100%); } 100% { transform: translateX(320%); } }
@keyframes wizard-compat-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.07); opacity: .82; } }
@keyframes wizard-compat-spin { to { transform: rotate(360deg); } }

/* ----- Cartouche d'arrière-plan (fait ressortir la carte blanche) ----- */
.wizard-compat-wrap {
	background: #FFECDB;
	border-radius: 24px;
	padding: clamp(22px, 4vw, 46px);
	margin: 2.5em auto;
	max-width: 900px;
	box-sizing: border-box;
}

@media (max-width: 480px) {
	.wizard-compat-wrap {
		padding: 8px;
		margin: 1.2em auto;
		border-radius: 18px;
	}
}

/* ----- Carte conteneur ----- */
.wizard-compat {
	background: #fff;
	border: 3px solid #EFE6D8;
	border-radius: 20px;
	box-shadow: 0 18px 44px -30px rgba(40, 30, 15, .45);
	overflow: hidden;
	font-family: 'Nunito', system-ui, sans-serif;
	max-width: 800px;
	width: 100%;
	margin: 0 auto;
	color: #1E2530;
	box-sizing: border-box;
}

.wizard-compat *,
.wizard-compat *::before,
.wizard-compat *::after { box-sizing: border-box; }

/* ----- Neutralisation des styles globaux du site -----
   styles.css impose : button { width:100%; height:100%; min-height:58px }
   et img { margin:1em auto }. Ces sélecteurs d'éléments (faible spécificité)
   étirent les boutons et décalent les logos du wizard. On les réinitialise via
   :where() (spécificité de classe, réécrasable par les classes du composant).
   La largeur du conteneur est verrouillée via l'ID (bat toute règle de classe). */
#wizard-compat-root.wizard-compat {
	max-width: 800px;
	margin-left: auto;
	margin-right: auto;
}

.wizard-compat :where(button) {
	width: auto;
	height: auto;
	min-height: 0;
}

.wizard-compat :where(img) {
	margin: 0;
}

/* ----- En-tête ----- */
.wizard-compat__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px clamp(16px, 3vw, 22px);
	border-bottom: 1px solid #F2EADD;
	flex-wrap: wrap;
}

.wizard-compat__title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: 'Poppins', sans-serif;
	font-weight: 800;
	font-size: 15.5px;
	color: #1E2530;
	margin: 0;
	line-height: 1.2;
}

.wizard-compat__title svg { flex: none; color: #F29644; }

/* ----- Fil d'étapes ----- */
.wizard-compat__steps {
	display: flex;
	align-items: center;
	gap: 6px;
	font-family: 'Poppins', sans-serif;
	font-weight: 700;
	font-size: 11px;
}

.wizard-compat__step {
	padding: 4px 10px;
	border-radius: 999px;
	background: #F2EADD;
	color: #A99A82;
	white-space: nowrap;
}

.wizard-compat__step_active { background: #F29644; color: #fff; }
.wizard-compat__step_done { background: #EAF6EF; color: #2E9E6A; }

/* ----- Corps ----- */
.wizard-compat__body { padding: clamp(16px, 3vw, 22px); }

/* ----- Champ de recherche (marque + modèle) ----- */
.wizard-compat__search {
	display: flex;
	align-items: center;
	gap: 9px;
	background: #FBF6EF;
	border: 1px solid #E8DECF;
	border-radius: 12px;
	padding: 0 13px;
	margin-bottom: 12px;
}

.wizard-compat__search-icon { color: #A9B0BA; display: inline-flex; flex: none; }

.wizard-compat__search-input {
	flex: 1;
	border: none;
	background: transparent;
	padding: 12px 0;
	font-size: 14.5px;
	font-weight: 600;
	color: #1E2530;
	outline: none;
	font-family: inherit;
	min-width: 0;
}

/* Variante « modèle » : champ mis en avant */
.wizard-compat__search_model {
	border: 2px solid #F0C98A;
	border-radius: 13px;
	padding: 0 14px;
	margin-bottom: 11px;
}

.wizard-compat__search_model .wizard-compat__search-icon { color: #E0922F; }

.wizard-compat__search_model .wizard-compat__search-input {
	padding: 13px 0;
	font-size: 15px;
	font-weight: 700;
	font-family: 'Poppins', sans-serif;
}

.wizard-compat__search-clear {
	background: transparent;
	border: none;
	color: #A9926F;
	display: inline-flex;
	flex: none;
	cursor: pointer;
	padding: 0;
}

.wizard-compat__search-clear:hover { color: #B9690C; }

.wizard-compat:focus-within .wizard-compat__search-input { outline: none; }

/* ----- Bouton retour ----- */
.wizard-compat__back {
	background: transparent;
	border: none;
	color: #7A8694;
	font-weight: 600;
	font-size: 13px;
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 12px;
	cursor: pointer;
	padding: 0;
	font-family: inherit;
}

.wizard-compat__back:hover { color: #B9690C; }

/* ----- Grille des marques ----- */
.wizard-compat__brands {
	display: grid;
	/* Cartes à largeur fixe (85px, Hug) — pas d'étirement ; la grille se centre. */
	grid-template-columns: repeat(auto-fill, 85px);
	justify-content: center;
	gap: 8px;
	max-height: 322px;
	overflow-y: auto;
	padding: 2px;
}

.wizard-compat__brand {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 85px;
	min-height: 72px;
	background: #fff;
	border: 1px solid #EFE6D8;
	border-radius: 12px;
	padding: 10px 6px;
	transition: all .14s;
	cursor: pointer;
}

.wizard-compat__brand:hover { border-color: #F29644; }

.wizard-compat__brand img {
	height: 31px;
	width: auto;
	max-width: 46px;
	object-fit: contain;
}

.wizard-compat__brand span {
	font-size: 11px;
	font-weight: 700;
	color: #3A4654;
	text-align: center;
	line-height: 1.1;
}

/* Mobile : cartes marques plus compactes (plus de marques par rangée) */
@media (max-width: 480px) {
	.wizard-compat__brands {
		grid-template-columns: repeat(auto-fill, 75px);
		gap: 6px;
	}

	.wizard-compat__brand {
		width: 68px;
		min-height: 60px;
		padding: 8px 4px;
	}

	.wizard-compat__brand img {
		height: 28px;
		max-width: 40px;
	}

	.wizard-compat__brand span {
		font-size: 10px;
	}
}

/* ----- Ligne d'aide ----- */
.wizard-compat__hint {
	font-size: 12px;
	color: #7A8694;
	font-weight: 600;
	margin-bottom: 10px;
}

/* ----- Accordéon modèles ----- */
.wizard-compat__acc {
	display: flex;
	flex-direction: column;
	gap: 7px;
	max-height: 332px;
	overflow-y: auto;
	padding: 3px;
}

.wizard-compat__acc-row {
	flex: none;
	border: 1px solid #E8DECF;
	border-radius: 12px;
	overflow: hidden;
	background: #fff;
}

.wizard-compat__acc-row_open { border-color: #F0C98A; background: #FDF7EE; }

.wizard-compat__acc-head {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	background: transparent;
	border: none;
	padding: 14px 16px;
	text-align: left;
	cursor: pointer;
	font-family: inherit;
}

.wizard-compat__acc-name {
	font-family: 'Poppins', sans-serif;
	font-weight: 700;
	font-size: 15px;
	color: #1E2530;
}

.wizard-compat__acc-meta-wrap { display: flex; align-items: center; gap: 9px; }

.wizard-compat__acc-meta { font-size: 11px; font-weight: 700; color: #B3A892; }

.wizard-compat__acc-caret {
	color: #C9A063;
	display: inline-flex;
	transform: rotate(0deg);
	transition: transform .18s;
}

.wizard-compat__acc-row_open .wizard-compat__acc-caret { transform: rotate(180deg); }

.wizard-compat__acc-panel {
	display: none;
	flex-wrap: wrap;
	gap: 7px;
	padding: 2px 15px 14px;
}

.wizard-compat__acc-row_open .wizard-compat__acc-panel { display: flex; }

/* ----- Pastille d'année ----- */
.wizard-compat__pill {
	display: flex;
	align-items: baseline;
	gap: 7px;
	background: #fff;
	border: 1px solid #E8DECF;
	border-radius: 9px;
	padding: 8px 13px;
	cursor: pointer;
	transition: all .14s;
	font-family: inherit;
}

.wizard-compat__pill:hover { border-color: #F29644; background: #FDF1E1; }

.wizard-compat__pill-label {
	font-family: 'Poppins', sans-serif;
	font-weight: 700;
	font-size: 13px;
	color: #1E2530;
}

.wizard-compat__pill-sub { font-size: 10.5px; font-weight: 700; color: #B3A892; }

/* ----- Résultats de recherche modèle (liste à plat) ----- */
.wizard-compat__results {
	display: flex;
	flex-direction: column;
	gap: 9px;
	max-height: 332px;
	overflow-y: auto;
	padding: 3px;
}

.wizard-compat__result {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	background: #fff;
	border: 1px solid #E8DECF;
	border-radius: 11px;
	padding: 15px 17px;
	text-align: left;
	transition: all .14s;
	cursor: pointer;
	font-family: inherit;
}

.wizard-compat__result:hover { border-color: #F29644; background: #FDF7EE; }

.wizard-compat__result-label {
	display: flex;
	align-items: baseline;
	gap: 8px;
	min-width: 0;
	flex-wrap: wrap;
}

.wizard-compat__result-name {
	font-family: 'Poppins', sans-serif;
	font-weight: 700;
	font-size: 14.5px;
	color: #1E2530;
}

.wizard-compat__result-sub { font-size: 11.5px; font-weight: 700; color: #B3A892; }

.wizard-compat__result-arrow { color: #F29644; display: inline-flex; flex: none; }

/* ----- Message « aucun résultat » / saisie libre ----- */
.wizard-compat__empty {
	text-align: center;
	color: #9A8A72;
	font-weight: 600;
	font-size: 13.5px;
	padding: 22px 8px;
	line-height: 1.5;
}

.wizard-compat__freeform { display: flex; gap: 8px; flex-wrap: wrap; }

.wizard-compat__freeform-input {
	flex: 1;
	min-width: 160px;
	border: 1px solid #E8DECF;
	background: #FBF6EF;
	border-radius: 11px;
	padding: 12px;
	font-size: 14px;
	font-weight: 600;
	outline: none;
	font-family: inherit;
}

.wizard-compat__freeform-ok {
	background: #1E2530;
	color: #fff;
	font-family: 'Poppins', sans-serif;
	font-weight: 700;
	font-size: 14px;
	padding: 12px 18px;
	border-radius: 11px;
	border: none;
	cursor: pointer;
}

/* ----- Étape voyant ----- */
.wizard-compat__step-title {
	font-family: 'Poppins', sans-serif;
	font-weight: 800;
	font-size: 16px;
	margin: 0 0 14px;
}

.wizard-compat__voyant-group { margin-bottom: 14px; }

.wizard-compat__voyant-group-title {
	font-family: 'Poppins', sans-serif;
	font-weight: 800;
	font-size: 11.5px;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: #9A8A72;
	margin-bottom: 8px;
}

.wizard-compat__voyant-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(152px, 1fr));
	gap: 8px;
}

.wizard-compat__voyant {
	display: flex;
	align-items: center;
	gap: 11px;
	background: #FBF6EF;
	border: 1px solid #E8DECF;
	border-radius: 12px;
	padding: 10px 12px;
	transition: all .14s;
	text-align: left;
	cursor: pointer;
	font-family: inherit;
}

.wizard-compat__voyant:hover { border-color: #F29644; background: #FDF1E1; }

.wizard-compat__voyant-icon {
	width: 62px;
	height: 62px;
	border-radius: 11px;
	background: #fff;
	border: 1px solid #EFE6D8;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
}

.wizard-compat__voyant-icon img { width: 45px; height: 45px; object-fit: contain; }

.wizard-compat__voyant-label {
	font-family: 'Poppins', sans-serif;
	font-weight: 700;
	font-size: 13.5px;
	color: #1E2530;
	line-height: 1.15;
}

/* Filets de sécurité (« Vous n'êtes pas sûr ? ») */
.wizard-compat__safety-label {
	font-size: 11.5px;
	font-weight: 700;
	color: #9A8A72;
	margin: 4px 0 8px;
	padding-top: 12px;
	border-top: 1px solid #F2EADD;
}

.wizard-compat__voyant_meta { background: #fff; }
.wizard-compat__voyant_meta:hover { background: #FDF7EE; }
.wizard-compat__voyant_meta .wizard-compat__voyant-icon { background: #FBF6EF; border: none; }
.wizard-compat__voyant-icon_other { color: #F29644; }
.wizard-compat__voyant-icon_none { color: #2E9E6A; }

/* ----- Écran de vérification ----- */
.wizard-compat__searching {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	text-align: center;
	padding: 34px 16px 30px;
}

.wizard-compat__spinner { position: relative; width: 62px; height: 62px; flex: none; }

.wizard-compat__spinner-ring {
	position: absolute;
	inset: 0;
	border: 3px solid #F3E7D4;
	border-top-color: #F29644;
	border-radius: 50%;
	animation: wizard-compat-spin .9s linear infinite;
}

.wizard-compat__spinner-icon {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #F29644;
	animation: wizard-compat-pulse 1.2s ease-in-out infinite;
}

.wizard-compat__searching-title {
	font-family: 'Poppins', sans-serif;
	font-weight: 800;
	font-size: 16.5px;
	color: #1E2530;
}

.wizard-compat__searching-text {
	font-size: 13px;
	color: #7A8694;
	font-weight: 600;
	margin-top: 5px;
	line-height: 1.45;
	max-width: 340px;
}

.wizard-compat__searching-text strong { color: #1E2530; }

.wizard-compat__progress {
	width: min(280px, 80%);
	height: 6px;
	background: #F3E7D4;
	border-radius: 999px;
	overflow: hidden;
}

.wizard-compat__progress-bar {
	width: 38%;
	height: 100%;
	background: #F29644;
	border-radius: 999px;
	animation: wizard-compat-bar 1.1s ease-in-out infinite;
}

/* ----- Résultat : bandeau « bonne nouvelle » (carte verte englobante) ----- */
.wizard-compat__compat {
	background: #EAF6EF;
	border: 1px solid #CDEBDB;
	border-radius: 16px;
	padding: 14px;
	margin-bottom: 14px;
}

.wizard-compat__compat-head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 12px;
}

/* Pas d'espace bas si aucune carte voyant n'est imbriquée */
.wizard-compat__compat-head:last-child { margin-bottom: 0; }

.wizard-compat__compat-check {
	flex: none;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #2E9E6A;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wizard-compat__compat-title {
	font-family: 'Poppins', sans-serif;
	font-weight: 800;
	font-size: 17px;
	color: #1E2530;
	line-height: 1.15;
}

/* Voyant pris en charge (carte blanche imbriquée dans le bandeau vert) */
.wizard-compat__voyant-ok {
	display: flex;
	align-items: center;
	gap: 11px;
	background: #fff;
	border: 1px solid #CDEBDB;
	border-radius: 13px;
	padding: 11px 14px;
}

.wizard-compat__voyant-ok-icon {
	width: 52px;
	height: 52px;
	border-radius: 11px;
	background: #fff;
	border: 1px solid #CDEBDB;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
}

.wizard-compat__voyant-ok-icon img { width: 40px; height: 40px; object-fit: contain; }

.wizard-compat__voyant-ok-body { flex: 1; min-width: 0; }

.wizard-compat__voyant-ok-name {
	font-family: 'Poppins', sans-serif;
	font-weight: 700;
	font-size: 13.5px;
	color: #1E2530;
}

.wizard-compat__voyant-ok-row {
	display: flex;
	align-items: center;
	gap: 7px;
	flex-wrap: wrap;
	margin-top: 1px;
}

.wizard-compat__voyant-ok-text { font-size: 12px; color: #22774E; font-weight: 700; }

.wizard-compat__badge-ok {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: #2E9E6A;
	color: #fff;
	font-family: 'Poppins', sans-serif;
	font-weight: 700;
	font-size: 11px;
	padding: 3px 9px;
	border-radius: 999px;
}

/* CTA principal : page diagnostic véhicule */
.wizard-compat__cta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	background: #F29644;
	border-radius: 16px;
	padding: 16px 18px;
	text-decoration: none;
	margin-bottom: 11px;
	transition: background .14s;
}

.wizard-compat__cta:hover { background: #E47E12; }

.wizard-compat__cta-title {
	font-family: 'Poppins', sans-serif;
	font-weight: 800;
	font-size: 16.5px;
	color: #fff;
	line-height: 1.15;
}

.wizard-compat__cta-sub {
	font-size: 12.5px;
	color: #FFE7CC;
	font-weight: 600;
	margin-top: 3px;
	line-height: 1.4;
}

.wizard-compat__cta-arrow {
	flex: none;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .18);
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Action secondaire : boîtier recommandé (bloc clair) */
.wizard-compat__reco {
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #FBF6EF;
	border: 1px solid #F0E6D6;
	border-radius: 14px;
	padding: 13px 15px;
}

.wizard-compat__reco-main {
	display: flex;
	align-items: center;
	gap: 13px;
	flex-wrap: wrap;
}

.wizard-compat__reco img { height: 46px; width: auto; flex: none; }

.wizard-compat__reco-body { flex: 1; min-width: 120px; }

.wizard-compat__reco-kicker {
	font-size: 10.5px;
	font-weight: 700;
	color: #B9690C;
	text-transform: uppercase;
	letter-spacing: .05em;
}

.wizard-compat__reco-name {
	font-family: 'Poppins', sans-serif;
	font-weight: 800;
	font-size: 15px;
	color: #1E2530;
	margin-top: 1px;
}

.wizard-compat__reco-note {
	font-size: 11.5px;
	color: #7A8694;
	font-weight: 600;
	border-top: 1px solid #F0E6D6;
	padding-top: 9px;
}

.wizard-compat__reco-buy {
	flex: none;
	background: #fff;
	color: #F29644;
	border: 1.5px solid #F29644;
	font-family: 'Poppins', sans-serif;
	font-weight: 700;
	font-size: 13px;
	padding: 10px 16px;
	border-radius: 10px;
	text-decoration: none;
	transition: all .14s;
}

.wizard-compat__reco-buy:hover { background: #F29644; color: #fff; }

/* Mobile : le bouton « Voir le boîtier » passe pleine largeur */
@media (max-width: 460px) {
	.wizard-compat__reco-buy {
		width: 100%;
		text-align: center;
	}
}

/* Réassurance */
.wizard-compat__trust { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }

.wizard-compat__trust span {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 11.5px;
	font-weight: 700;
	color: #55606E;
	background: #F6EEE2;
	border-radius: 999px;
	padding: 5px 11px;
}

/* Reset */
.wizard-compat__reset-wrap { display: flex; justify-content: flex-end; margin-top: 10px; }

.wizard-compat__reset {
	background: transparent;
	border: none;
	color: #7A8694;
	font-weight: 700;
	font-size: 13px;
	padding: 6px 4px;
	cursor: pointer;
	font-family: inherit;
}

.wizard-compat__reset:hover { color: #B9690C; }

/* ----- Accessibilité : focus visible ----- */
.wizard-compat button:focus-visible,
.wizard-compat a:focus-visible,
.wizard-compat input:focus-visible {
	outline: 2px solid #F29644;
	outline-offset: 2px;
}

/* ----- Utilitaire ----- */
.wizard-compat__hidden { display: none !important; }
