/* =============================================================================
 * LUMIA WISHLIST - INTERFACE
 *
 * Tout est piloté par variables CSS. Pour adapter à la charte du site,
 * il suffit de redéfinir les variables --lumwl-* dans votre feuille de style,
 * sans toucher à ce fichier.
 *
 * Les pastilles de filtres, le slider de prix et l'habillage des popups
 * reprennent le design des filtres boutique (mêmes tokens --principale-*
 * et --neutral-*), pour une cohérence visuelle entre les deux pages.
 * ========================================================================== */

.lumwl-ui {
	--lumwl-accent: var(--principale-5, #f97316);
	--lumwl-accent-soft: var(--principale-1, #fff3e8);
	--lumwl-accent-contrast: #fff;
	--lumwl-ink: var(--neutral-900, #1a1a1a);
	--lumwl-muted: var(--neutral-500, #8a8a8a);
	--lumwl-line: var(--neutral-300, #d4d4d4);
	--lumwl-line-strong: var(--neutral-400, #c8cace);
	--lumwl-surface: var(--white, #fff);
	--lumwl-surface-alt: var(--neutral-100, #f6f6f6);
	--lumwl-radius: 1rem;
	--lumwl-radius-sm: 10px;
	--lumwl-pill: 100vmax;
	--lumwl-shadow: 0 1.25rem 2.5rem rgba(0, 0, 0, 0.12), 0 0.25rem 0.75rem rgba(0, 0, 0, 0.06);
	--lumwl-font: inherit;
}

/* ---- Voile ---------------------------------------------------------------- */

.lumwl-backdrop {
	position: fixed;
	inset: 0;
	z-index: 99998;
	background: rgba(0, 0, 0, 0.25);
	opacity: 0;
	transition: opacity 0.16s ease-out;
}

.lumwl-backdrop[data-open="true"] {
	opacity: 1;
}

.lumwl-backdrop--light {
	background: rgba(0, 0, 0, 0.12);
}

/* ---- Enveloppe commune ---------------------------------------------------- */

.lumwl-panel {
	position: fixed;
	z-index: 99999;
	background: var(--lumwl-surface);
	border-radius: var(--lumwl-radius);
	box-shadow: var(--lumwl-shadow);
	font-family: var(--lumwl-font);
	color: var(--lumwl-ink);
	opacity: 0;
	transform: translateY(-0.375rem);
	transition: opacity 0.16s ease-out, transform 0.16s ease-out;
	max-height: calc(100vh - 40px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.lumwl-panel[data-open="true"] {
	opacity: 1;
	transform: translateY(0);
}

.lumwl-panel__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.25rem 1.25rem 0;
	margin-bottom: 1.25rem;
}

.lumwl-panel__title {
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.2;
	margin: 0;
	color: var(--neutral-900, #1a1a1a);
}

.lumwl-panel__body {
	padding: 0 1.25rem 1.25rem;
	overflow-y: auto;
	flex: 1 1 auto;
}

.lumwl-panel__foot {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 0 1.25rem 1.25rem;
	background: var(--lumwl-surface);
}

.lumwl-panel__foot-spacer {
	flex: 1 1 auto;
	font-size: 0.8125rem;
	color: var(--lumwl-muted);
}

.lumwl-close {
	display: grid;
	place-content: center;
	width: 1.5rem;
	height: 1.5rem;
	margin: -0.25rem -0.25rem 0 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--lumwl-muted);
	cursor: pointer;
	flex: 0 0 auto;
	transition: color 0.15s ease;
}

.lumwl-close:hover {
	color: var(--lumwl-ink);
}

.lumwl-close svg {
	width: 0.875rem;
	height: 0.875rem;
}

/* ---- Boutons -------------------------------------------------------------- */

.lumwl-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 0.625rem 1.5rem;
	border-radius: var(--lumwl-pill);
	border: 1px solid transparent;
	font-size: 0.9375rem;
	font-weight: 500;
	font-family: inherit;
	line-height: 1.2;
	cursor: pointer;
	transition: opacity 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
	white-space: nowrap;
}

.lumwl-btn:disabled {
	opacity: 0.5;
	pointer-events: none;
}

.lumwl-btn:focus-visible {
	outline: 2px solid var(--lumwl-accent);
	outline-offset: 2px;
}

.lumwl-btn--ghost {
	background: var(--lumwl-surface);
	border-color: var(--lumwl-line);
	color: var(--lumwl-ink);
}

.lumwl-btn--ghost:hover {
	border-color: var(--lumwl-line-strong);
	background: var(--lumwl-surface-alt);
}

.lumwl-btn--text {
	background: none;
	border: 0;
	padding: 0.5rem 8px;
	color: var(--lumwl-accent);
}

.lumwl-btn--text:hover {
	text-decoration: underline;
}

/* Masqué tant qu'aucun filtre n'est actif (desktop uniquement : en mobile il
   reste en place pour ne pas décaler le pied du panneau, voir plus bas). */
.lumwl-btn[data-lumwl-hidden="true"] {
	display: none;
}

.lumwl-btn--primary {
	background: var(--lumwl-accent);
	border-color: var(--lumwl-accent);
	color: var(--lumwl-accent-contrast);
}

.lumwl-btn--primary:hover {
	filter: brightness(0.94);
}

.lumwl-btn--dark {
	background: var(--lumwl-ink);
	border-color: var(--lumwl-ink);
	color: #fff;
}

.lumwl-btn--dark:hover {
	filter: brightness(1.15);
}

/* =============================================================================
 * MODALE DE CONFIRMATION
 * ========================================================================== */

.lumwl-confirm {
	top: 50%;
	left: 50%;
	transform: translate(-50%, calc(-50% + 6px));
	width: min(420px, calc(100vw - 32px));
	border-radius: 18px;
}

.lumwl-confirm[data-open="true"] {
	transform: translate(-50%, -50%);
}

.lumwl-confirm__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	padding: 20px 20px 0;
	margin-bottom: 0;
}

.lumwl-confirm__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: 1px solid var(--lumwl-line);
	border-radius: var(--lumwl-radius-sm);
	color: var(--lumwl-ink);
}

.lumwl-confirm__body {
	padding: 16px 20px 0;
}

.lumwl-confirm__title {
	margin: 0 0 4px;
	font-size: 15px;
	font-weight: 600;
}

.lumwl-confirm__text {
	margin: 0;
	font-size: 13.5px;
	line-height: 1.5;
	color: var(--lumwl-muted);
}

.lumwl-confirm__actions {
	display: flex;
	gap: 12px;
	padding: 20px;
}

.lumwl-confirm__actions .lumwl-btn {
	flex: 1 1 0;
}

/* =============================================================================
 * POPUPS ANCRÉES (tri, filtres)
 * ========================================================================== */

.lumwl-pop {
	width: min(460px, calc(100vw - 24px));
}

.lumwl-pop--sort {
	width: min(340px, calc(100vw - 24px));
}

/* ---- Sections ------------------------------------------------------------- */

.lumwl-section + .lumwl-section {
	margin-top: 1.375rem;
}

.lumwl-section__title {
	margin: 0 0 0.75rem;
	font-size: 1rem;
	font-weight: 500;
	color: var(--marron-fonce, var(--lumwl-ink));
}

.lumwl-section__label {
	margin: 0 0 10px;
	font-size: 12.5px;
	color: var(--lumwl-muted);
}

/* ---- Chips (design pills des filtres boutique) ----------------------------
   Mêmes tokens et mêmes états visuels que .filter--custom .checkboxes,
   appliqués ici sur la structure lumwl-chip (état piloté par le JS via
   data-checked, plutôt que par le sélecteur CSS :checked + label). ---- */

.lumwl-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.lumwl-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0.5rem 1rem;
	border: 1px solid var(--neutral-300, var(--lumwl-line));
	border-radius: 100vmax;
	background: var(--white, var(--lumwl-surface));
	font-size: 0.9375rem;
	line-height: 1.3;
	cursor: pointer;
	user-select: none;
	transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.lumwl-chip input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	padding: 0;
	overflow: hidden;
	white-space: nowrap;
	border: 0;
	clip-path: inset(50%);
}

.lumwl-chip:hover {
	border-color: var(--neutral-400, var(--lumwl-line-strong));
	background: var(--neutral-100, #f6f6f6);
}

.lumwl-chip:active {
	transform: scale(0.97);
}

.lumwl-chip:has(input:focus-visible) {
	outline: 2px solid var(--principale-5, var(--lumwl-accent));
	outline-offset: 2px;
}

.lumwl-chip__count {
	color: var(--lumwl-muted);
	font-size: 0.8125rem;
}

.lumwl-chip[data-checked="true"] {
	border-color: var(--principale-5, var(--lumwl-accent));
	background: var(--principale-1, var(--lumwl-accent-soft));
	color: var(--principale-5, var(--lumwl-accent));
}

/* Le hover ne doit pas écraser l'état sélectionné */
.lumwl-chip[data-checked="true"]:hover {
	border-color: var(--principale-5, var(--lumwl-accent));
	background: var(--principale-1, var(--lumwl-accent-soft));
}

.lumwl-chip[data-checked="true"] .lumwl-chip__count {
	color: inherit;
	opacity: 0.75;
}

@media (prefers-reduced-motion: reduce) {
	.lumwl-chip {
		transition: none;
	}
	.lumwl-chip:active {
		transform: none;
	}
}

/* ---- Slider de prix (double-slider-wrap, partagé avec la boutique) -------
   Structure et logique pilotées par le script commun slider-prix.js, qui
   met à jour --low et --high (pourcentages 0-100) sur ce wrapper. La
   wishlist se contente d'écouter les évènements "input" pour synchroniser
   son propre état (voir lumia-wishlist-ui.js). ---------------------------- */

.double-slider-wrap {
	--track-h: 0.5rem;
	--thumb-size: 1.375rem;
	--track-bg: var(--neutral-200, #e4e4e4);
	--fill-bg: var(--principale-5, var(--lumwl-accent));
	--low: 0;
	--high: 100;

	position: relative;
	display: flex;
	flex-direction: column;
	padding-bottom: var(--thumb-size);
}

.double-slider-wrap > label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	white-space: nowrap;
	clip-path: inset(50%);
}

.double-slider-wrap .value-wrap {
	order: -1;
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	margin-bottom: 0.75rem;
	font-size: 0.875rem;
	color: var(--neutral-700, var(--lumwl-muted));
}

.double-slider-wrap::before,
.double-slider-wrap::after {
	content: "";
	position: absolute;
	bottom: calc((var(--thumb-size) - var(--track-h)) / 2);
	height: var(--track-h);
	border-radius: 100vmax;
	pointer-events: none;
}

.double-slider-wrap::before {
	left: 0;
	right: 0;
	background: var(--track-bg);
	z-index: 1;
}

.double-slider-wrap::after {
	left: calc(var(--thumb-size) / 2 + (100% - var(--thumb-size)) * var(--low) / 100);
	right: calc(var(--thumb-size) / 2 + (100% - var(--thumb-size)) * (100 - var(--high)) / 100);
	background: var(--fill-bg);
	z-index: 2;
}

.double-slider-wrap input[type="range"] {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	height: var(--thumb-size);
	margin: 0;
	padding: 0;
	background: transparent;
	border: 0;
	-webkit-appearance: none;
	appearance: none;
	pointer-events: none;
	touch-action: none;
}

.double-slider-wrap input[type="range"].lower {
	z-index: 3;
}
.double-slider-wrap input[type="range"].upper {
	z-index: 4;
}

.double-slider-wrap input[type="range"]::-webkit-slider-runnable-track {
	height: var(--thumb-size);
	background: transparent;
	border: 0;
}
.double-slider-wrap input[type="range"]::-moz-range-track {
	height: var(--thumb-size);
	background: transparent;
	border: 0;
}

.double-slider-wrap input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: var(--thumb-size);
	height: var(--thumb-size);
	border: 2px solid var(--fill-bg);
	border-radius: 50%;
	background: var(--white, #fff);
	cursor: grab;
	pointer-events: auto;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.double-slider-wrap input[type="range"]::-moz-range-thumb {
	width: var(--thumb-size);
	height: var(--thumb-size);
	box-sizing: border-box;
	border: 2px solid var(--fill-bg);
	border-radius: 50%;
	background: var(--white, #fff);
	cursor: grab;
	pointer-events: auto;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.double-slider-wrap input[type="range"]::-webkit-slider-thumb:hover {
	transform: scale(1.08);
}
.double-slider-wrap input[type="range"]::-moz-range-thumb:hover {
	transform: scale(1.08);
}
.double-slider-wrap input[type="range"]:active::-webkit-slider-thumb {
	cursor: grabbing;
}
.double-slider-wrap input[type="range"]:active::-moz-range-thumb {
	cursor: grabbing;
}

.double-slider-wrap input[type="range"]:focus {
	outline: none;
}
.double-slider-wrap input[type="range"]:focus-visible::-webkit-slider-thumb {
	box-shadow: 0 0 0 4px var(--principale-1, var(--lumwl-accent-soft));
}
.double-slider-wrap input[type="range"]:focus-visible::-moz-range-thumb {
	box-shadow: 0 0 0 4px var(--principale-1, var(--lumwl-accent-soft));
}

@media (prefers-reduced-motion: reduce) {
	.double-slider-wrap input[type="range"]::-webkit-slider-thumb,
	.double-slider-wrap input[type="range"]::-moz-range-thumb {
		transition: none;
	}
	.double-slider-wrap input[type="range"]::-webkit-slider-thumb:hover,
	.double-slider-wrap input[type="range"]::-moz-range-thumb:hover {
		transform: none;
	}
}

/* ---- Étoiles -------------------------------------------------------------- */

.lumwl-stars {
	display: flex;
	gap: 6px;
}

.lumwl-star {
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	color: var(--lumwl-line-strong);
	line-height: 0;
	transition: color 0.12s ease;
}

.lumwl-star[data-on="true"] {
	color: #eab308;
}

.lumwl-star svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
}

.lumwl-star[data-filled="true"] svg {
	fill: currentColor;
}

/* ---- Interrupteurs et cases ----------------------------------------------- */

.lumwl-check {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 0;
	font-size: 14px;
	cursor: pointer;
}

.lumwl-check input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.lumwl-check__box {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	border: 1px solid var(--lumwl-line-strong);
	border-radius: 5px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: transparent;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.lumwl-check__box--round {
	border-radius: 50%;
}

.lumwl-check[data-checked="true"] .lumwl-check__box {
	border-color: var(--principale-5, var(--lumwl-accent));
	background: var(--principale-5, var(--lumwl-accent));
	color: #fff;
}

.lumwl-check__box svg {
	width: 12px;
	height: 12px;
	stroke: currentColor;
	stroke-width: 3;
	fill: none;
}

.lumwl-list {
	display: flex;
	flex-direction: column;
}

/* ---- Compteur de filtres -------------------------------------------------- */

.lumwl-count-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	margin-left: 6px;
	border-radius: var(--lumwl-pill);
	background: var(--principale-5, var(--lumwl-accent));
	color: var(--lumwl-accent-contrast);
	font-size: 11px;
	font-weight: 600;
	line-height: 1;
}

/* ---- Toast ---------------------------------------------------------------- */

.lumwl-toast {
	position: fixed;
	left: 50%;
	bottom: 28px;
	z-index: 100000;
	transform: translate(-50%, 12px);
	background: var(--lumwl-ink);
	color: #fff;
	font-size: 13.5px;
	padding: 12px 20px;
	border-radius: var(--lumwl-pill);
	box-shadow: var(--lumwl-shadow);
	opacity: 0;
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
	max-width: calc(100vw - 32px);
	text-align: center;
}

.lumwl-toast[data-open="true"] {
	opacity: 1;
	transform: translate(-50%, 0);
}

.lumwl-toast[data-tone="error"] {
	background: #b42318;
}

/* ---- État occupé sur les déclencheurs ------------------------------------- */

[data-lumwl-busy="true"] {
	opacity: 0.55;
	pointer-events: none;
}

/* ---- Mobile ----------------------------------------------------------------
   Deux comportements distincts, alignés sur la boutique :
   - .lumwl-pop (filtres)      -> feuille plein écran ancrée en bas
                                  (comme .filter-popup en mobile_portrait)
   - .lumwl-pop--sort (tri)    -> carte flottante ancrée en bas avec marges
                                  (comme .sort-select__popup)
------------------------------------------------------------------------- */

@media (max-width: 640px) {
	.lumwl-pop {
		top: auto !important;
		bottom: 0;
		left: 0 !important;
		right: 0;
		width: 100%;
		max-height: 86vh;
		border-radius: 1.5rem 1.5rem 0 0;
		transform: translateY(0.875rem);
	}

	.lumwl-pop[data-open="true"] {
		transform: translateY(0);
	}

	/* Pied du panneau de filtres : on ne garde que « Tout effacer » et
	   « Valider ». Le bouton « Annuler » fait doublon avec la croix et le
	   voile, et le compteur de filtres pousse « Valider » hors de l'écran. */
	.lumwl-pop:not(.lumwl-pop--sort) .lumwl-panel__foot {
		justify-content: space-between;
	}

	.lumwl-pop:not(.lumwl-pop--sort) .lumwl-panel__foot .lumwl-btn--ghost,
	.lumwl-pop:not(.lumwl-pop--sort) .lumwl-panel__foot .lumwl-panel__foot-spacer {
		display: none;
	}

	/* « Tout effacer » reste en place même sans filtre actif : sans lui, le
	   pied ne contient plus que « Valider » et la mise en page saute. */
	.lumwl-pop:not(.lumwl-pop--sort) .lumwl-panel__foot .lumwl-btn[data-lumwl-hidden="true"] {
		display: inline-flex;
	}

	.lumwl-pop--sort {
		position: fixed;
		top: auto !important;
		right: 1rem;
		bottom: 1rem;
		left: 1rem !important;
		width: auto;
		max-width: none;
		border-radius: var(--lumwl-radius);
		transform: translateY(0.5rem);
	}

	.lumwl-pop--sort[data-open="true"] {
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.lumwl-panel,
	.lumwl-backdrop,
	.lumwl-toast {
		transition: none;
	}
}
