/* ==========================================================================
   Wizard « Compatibilité véhicule » klavkarr
   Composant de vérification de compatibilité en 3 étapes (Marque → Modèle → Voyant)
   + écran de vérification + résultat.
   Porté du legacy. Polices alignées sur les variables du projet
   (--k-font-title / --k-font-body) ; couleurs du handoff conservées.
   Composant auto-isolé (préfixe .wizard-compat, largeur verrouillée par ID).
   ========================================================================== */

/* ----- 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) ----- */

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

/* ----- Carte conteneur ----- */
.wizard-compat {
	background: #fff;
	border: 3px solid var(--k-border);
	border-radius: var(--k-r-lg);
	box-shadow: var(--k-shadow-card);
	overflow: hidden;
	font-family: var(--k-font-body);
	max-width: 800px;
	width: 100%;
	margin: 0 auto;
	color: var(--k-charcoal);
	box-sizing: border-box;
}

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

/* ----- Neutralisation défensive des styles globaux -----
   Le widget doit rester déposable sur n'importe quelle page : on réinitialise
   via :where() (spécificité de classe, réécrasable par les classes du composant)
   toute règle d'élément button/img qui étirerait les boutons ou décalerait les
   logos. La largeur du conteneur est verrouillée via l'ID (bat toute 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 var(--k-border);
	flex-wrap: wrap;
}

.wizard-compat__title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: var(--k-font-title);
	font-weight: 800;
	font-size: var(--k-text-xl);
	color: var(--k-charcoal);
	margin: 0;
	line-height: 1.2;
}

.wizard-compat__title svg { flex: none; color: var(--k-orange); }

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

/* ----- Champ de recherche (marque + modèle) ----- */
.wizard-compat__search {
	margin-bottom: 12px;
}

/* Variante « modèle » : champ mis en avant */
.wizard-compat__search_model {
	border: 2px solid var(--k-border-active);
	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: var(--k-text-l);
	font-weight: 700;
	font-family: var(--k-font-title);
}

.wizard-compat__search-clear {
	color: #A9926F;
	display: inline-flex;
	flex: none;
	cursor: pointer;
}

.wizard-compat__search-clear:hover,
.wizard-compat__search-clear:focus-visible{ color: var(--k-orange-dark); }

/* ----- Bouton retour ----- */
.wizard-compat__back {
	background: transparent;
	border: none;
	color: var(--k-soft);
	font-weight: 600;
	font-size: var(--k-text-s);
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 12px;
	cursor: pointer;
	padding: 0;
	font-family: inherit;
}

.wizard-compat__back:hover,
.wizard-compat__back:focus-visible{ color: var(--k-orange-dark); }

/* ----- 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 var(--k-border);
	border-radius: var(--k-r-tile);
	padding: 10px 6px;
	transition: all .14s;
	cursor: pointer;
}

.wizard-compat__brand:hover,
.wizard-compat__brand:focus-visible{ border-color: var(--k-orange); }

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

.wizard-compat__brand span {
	font-size: var(--k-text-xs);
	font-weight: 700;
	color: var(--k-body);
	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: var(--k-text-s);
	color: var(--k-soft);
	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 var(--k-border);
	border-radius: var(--k-r-tile);
	overflow: hidden;
	background: #fff;
}

.wizard-compat__acc-row_open { border-color: var(--k-border-active); background: var(--k-tile); }

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

.wizard-compat__acc-name {
	font-family: var(--k-font-title);
	font-weight: 700;
	font-size: var(--k-text-l);
	color: var(--k-charcoal);
}

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

.wizard-compat__acc-meta { font-size: var(--k-text-xs); font-weight: 700; color: var(--k-chevron); }

.wizard-compat__acc-caret {
	color: var(--k-gold);
	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 var(--k-border);
	border-radius: 9px;
	padding: 8px 13px;
	cursor: pointer;
	transition: all .14s;
	font-family: inherit;
}

.wizard-compat__pill:hover,
.wizard-compat__pill:focus-visible{ border-color: var(--k-orange); background: var(--k-orange-tint); }

.wizard-compat__pill-label {
	font-family: var(--k-font-title);
	font-weight: 700;
	font-size: var(--k-text-s);
	color: var(--k-charcoal);
}

/* ----- 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 var(--k-border);
	border-radius: var(--k-r-tile);
	padding: 15px 17px;
	text-align: left;
	transition: all .14s;
	cursor: pointer;
	font-family: inherit;
}

.wizard-compat__result:hover,
.wizard-compat__result:focus-visible{ border-color: var(--k-orange); background: var(--k-tile); }

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

.wizard-compat__result-name {
	font-family: var(--k-font-title);
	font-weight: 700;
	font-size: var(--k-text-l);
	color: var(--k-charcoal);
}

.wizard-compat__result-arrow { color: var(--k-orange); display: inline-flex; flex: none; }

/* ----- Message « aucun résultat » / saisie libre ----- */
.wizard-compat__empty {
	text-align: center;
	color: #9A8A72;
	font-weight: 600;
	font-size: var(--k-text-m);
	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 var(--k-border);
	background: var(--k-tile);
	border-radius: var(--k-r-tile);
	padding: 12px;
	font-size: var(--k-text-m);
	font-weight: 600;
	font-family: inherit;
}

.wizard-compat__freeform-ok {
	background: var(--k-charcoal);
	color: var(--k-dark-strong);
	font-family: var(--k-font-title);
	font-weight: 700;
	font-size: var(--k-text-m);
	padding: 12px 18px;
	border-radius: var(--k-r-tile);
	cursor: pointer;
}

/* ----- Étape voyant ----- */
.wizard-compat__step-title {
	font-family: var(--k-font-title);
	font-weight: 800;
	font-size: var(--k-text-xl);
	margin: 0 0 14px;
}

.wizard-compat__voyant-grid {
	--grid-min: 152px;
	--grid-gap: 8px;
}

.wizard-compat__voyant {
	display: flex;
	align-items: center;
	gap: 11px;
	background: var(--k-tile);
	border: 1px solid var(--k-border);
	border-radius: var(--k-r-tile);
	padding: 10px 10px;
	transition: all .14s;
	text-align: left;
	cursor: pointer;
	font-family: inherit;
}

.wizard-compat__voyant:hover,
.wizard-compat__voyant:focus-visible{ border-color: var(--k-orange); background: var(--k-orange-tint); }

.wizard-compat__voyant-icon {
	width: 53px;
	height: 53px;
	border-radius: var(--k-r-tile);
	background: #fff;
	border: 1px solid var(--k-border);
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
}

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

.wizard-compat__voyant-label {
	font-family: var(--k-font-title);
	font-weight: 700;
	font-size: var(--k-text-m);
	color: var(--k-charcoal);
	line-height: 1.15;
}

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

.wizard-compat__voyant_meta { background: #fff; }
.wizard-compat__voyant_meta:hover,
.wizard-compat__voyant_meta:focus-visible{ background: var(--k-tile); }
.wizard-compat__voyant_meta .wizard-compat__voyant-icon { background: var(--k-tile); border: none; }
.wizard-compat__voyant-icon_other { color: var(--k-orange); }
.wizard-compat__voyant-icon_none { color: var(--k-green); }

/* ----- É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 var(--k-hover);
	border-top-color: var(--k-orange);
	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: var(--k-orange);
	animation: wizard-compat-pulse 1.2s ease-in-out infinite;
}

.wizard-compat__searching-title {
	font-family: var(--k-font-title);
	font-weight: 800;
	font-size: var(--k-text-2xl);
	color: var(--k-charcoal);
}

.wizard-compat__searching-text {
	font-size: var(--k-text-s);
	color: var(--k-soft);
	font-weight: 600;
	margin-top: 5px;
	line-height: 1.45;
	max-width: 340px;
}

.wizard-compat__searching-text strong { color: var(--k-charcoal); }

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

.wizard-compat__progress-bar {
	width: 38%;
	height: 100%;
	background: var(--k-orange);
	border-radius: 999px;
	animation: wizard-compat-bar 1.1s ease-in-out infinite;
}

/* ----- Résultat : bandeau vert (compat + voyant + cartes produit) ----- */
.wizard-compat__compat {
	background: var(--k-green-tint);
	border: 1px solid var(--k-green-border);
	border-radius: var(--k-r-card);
	padding: clamp(16px, 3vw, 22px);
	margin-bottom: 14px;
}

/* Haut centré : check + titre, puis pastille voyant */
.wizard-compat__compat-top {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
}

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

.wizard-compat__compat-check {
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--k-green);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wizard-compat__compat-title {
	font-family: var(--k-font-title);
	font-weight: 800;
	font-size: var(--k-text-3xl);
	color: var(--k-charcoal);
	line-height: 1.15;
}

/* Pastille voyant (blanche, centrée) */
.wizard-compat__voyant-pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: #fff;
	border: 1px solid var(--k-border);
	border-radius: 999px;
	padding: 6px 15px 6px 7px;
}

.wizard-compat__voyant-pill-icon {
	width: 28px;
	height: 28px;
	border-radius: 7px;
	background: var(--k-charcoal);
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
}

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

.wizard-compat__voyant-pill-text {
	font-family: var(--k-font-title);
	font-weight: 700;
	font-size: var(--k-text-m);
	color: var(--k-charcoal);
}

/* Intro reco (1 ou 2 boîtiers) */
.wizard-compat__reco-intro {
	font-size: var(--k-text-m);
	color: var(--k-nav);
	font-weight: 600;
	margin: 10px 0 18px;
}

.wizard-compat__reco-intro strong { color: var(--k-charcoal); font-weight: 800; }

/* Grille des cartes produit */
.wizard-compat__products {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.wizard-compat__products_single { grid-template-columns: minmax(0, 380px); }

/* Carte produit */
.wizard-compat__product {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: #fff;
	border: 1px solid var(--k-border);
	border-radius: var(--k-r-tile);
	padding: 16px;
}

.wizard-compat__product_reco { border: 2px solid var(--k-orange); }

.wizard-compat__product-badge {
	position: absolute;
	top: -11px;
	left: 16px;
	display: inline-flex;
	align-items: center;
	background: var(--k-orange);
	color: #fff;
	font-family: var(--k-font-title);
	font-weight: 700;
	font-size: 10.5px;
	text-transform: uppercase;
	letter-spacing: .04em;
	padding: 4px 11px;
	border-radius: 999px;
}

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

.wizard-compat__product-img {
	width: 58px;
	height: 46px;
	object-fit: contain;
	flex: none;
	background: var(--k-warm-tile);
	border-radius: 9px;
	padding: 3px;
}

.wizard-compat__product-name {
	font-family: var(--k-font-title);
	font-weight: 800;
	font-size: var(--k-text-xl);
	color: var(--k-charcoal);
}

.wizard-compat__product-price {
	font-family: var(--k-font-title);
	font-weight: 700;
	font-size: var(--k-text-m);
	color: var(--k-nav);
	margin-top: 1px;
}

.wizard-compat__product-desc {
	font-size: var(--k-text-s);
	color: var(--k-nav);
	font-weight: 600;
	line-height: 1.45;
}

.wizard-compat__product-desc strong { color: var(--k-charcoal); font-weight: 800; }

/* Bouton produit */
.wizard-compat__product-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: auto;
	background: var(--k-orange);
	color: #fff;
	font-family: var(--k-font-title);
	font-weight: 700;
	font-size: var(--k-text-m);
	padding: 12px 16px;
	border-radius: var(--k-r-tile);
	text-decoration: none;
	transition: background .14s;
}

.wizard-compat__product-btn:hover,
.wizard-compat__product-btn:focus-visible{ background: var(--k-orange-hover); }

/* Variante alternative (210) : contour orange */
.wizard-compat__product-btn_alt {
	background: #fff;
	color: var(--k-orange-dark);
	border: 1.5px solid var(--k-border-active);
}

.wizard-compat__product-btn_alt:hover,
.wizard-compat__product-btn_alt:focus-visible{ background: var(--k-orange-tint); }

/* Mobile : cartes empilées */
@media (max-width: 480px) {
	.wizard-compat__products { grid-template-columns: 1fr; }
}

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

/* Enfant direct : la pastille elle-même (pas le span-icône imbriqué). */
.wizard-compat__trust > span {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: var(--k-text-xs);
	font-weight: 700;
	color: var(--k-nav);
	background: var(--k-warm-tile);
	border-radius: 999px;
	padding: 5px 11px;
}

/* Icône filaire du badge (mêmes SVG que la bande de réassurance). */
.wizard-compat__trust-ico {
	display: inline-flex;
	color: var(--k-orange);
}

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

.wizard-compat__reset {
	color: var(--k-soft);
	font-weight: 700;
	font-size: var(--k-text-s);
	padding: 6px 4px;
	cursor: pointer;
}

.wizard-compat__reset:hover,
.wizard-compat__reset:focus-visible{ color: var(--k-orange-dark); }

/* Le focus clavier vient de la règle globale de base.css. */
