/**
 * Barre de recherche WLC — styles front.
 *
 * Couleurs : uniquement les presets de la charte déclarés dans le theme.json
 * du thème wlc-directory (aucune couleur de marque en dur ici, seuls des
 * neutres noir/blanc sont utilisés pour garantir les contrastes AA).
 *
 * Contrastes vérifiés (WCAG AA, règles de la charte) :
 * - étiquettes #266674 (wlc-primary-dark) sur cellule blanche : 6,5:1
 * - texte blanc sur bouton accent #B53D29 : 5,7:1 (survol #9A3222 : 7,4:1)
 * - texte blanc sur bouton mobile #266674 : 6,5:1
 * - texte #266674 sur fond clair #8ED5D9 (imposé par la charte) : 3,9:1
 */

:root {
	--wlc-search-bar-space: 120px;
	--wlc-c-primary: var(--wp--preset--color--wlc-primary, #4a919e);
	--wlc-c-primary-dark: var(--wp--preset--color--wlc-primary-dark, #266674);
	--wlc-c-accent: var(--wp--preset--color--wlc-accent, #b53d29);
	--wlc-c-accent-dark: var(--wp--preset--color--wlc-accent-dark, #9a3222);
	--wlc-c-light: var(--wp--preset--color--wlc-light, #8ed5d9);
	--wlc-c-ink: #212529;
	/* Texte sur fond accent : blanc (charte 2026-11). */
	--wlc-c-ink-accent: var(--wp--preset--color--white, #fff);
	--wlc-radius: 18px;
}

/* La place de la barre est réservée sur le PIED DE PAGE (dernier bloc), jamais
   sur le body : une règle de hauteur/overflow/padding permanente sur html ou
   body casse la propagation du défilement (double ascenseur vu le 2026-11-02).
   Le JS pose la valeur exacte en ligne ; ceci est le repli sans JavaScript. */
footer:has(.wlc-search-bar) {
	padding-bottom: var(--wlc-search-bar-space);
}

/* Panneau mobile ouvert : le fond ne défile plus (classe posée/retirée par le
   JS à l'ouverture/fermeture — overflow seulement, jamais de height). */
body.wlc-filters-lock {
	overflow: hidden;
}

/* ── Conteneur flottant ─────────────────────────────────────────────────── */

.wlc-search-bar {
	position: fixed;
	bottom: 1.25rem;
	left: 50%;
	transform: translateX(-50%);
	z-index: 1030;
	/* 100% et non 100vw : l'élément est fixed, son % se calcule sur le viewport
	   SANS la barre de défilement (100vw l'inclut et déborde de sa largeur). */
	width: min(1140px, calc(100% - 2rem));
	background: var(--wlc-c-primary);
	border-radius: var(--wlc-radius);
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28), 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* ── Bouton replié (mobile) ────────────────────────────────────────────── */

.wlc-search-bar__toggle {
	display: none;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	width: 100%;
	padding: 0.9rem 1.25rem;
	background: var(--wlc-c-primary-dark);
	color: #fff;
	border: 0;
	border-radius: var(--wlc-radius);
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
}

.wlc-search-bar__toggle-label {
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

.wlc-search-bar__chevron {
	transition: transform 0.25s ease;
	flex-shrink: 0;
}

.wlc-search-bar__toggle[aria-expanded="true"] .wlc-search-bar__chevron {
	transform: rotate(180deg);
}

/* ── Panneau / formulaire ──────────────────────────────────────────────── */

.wlc-search-bar__panel {
	padding: 0.65rem;
}

.wlc-search-bar__heading {
	margin: 0 0 0.4rem;
	padding: 0 0.35rem;
	color: #fff;
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.wlc-search-bar__form {
	position: relative;
	margin: 0;
}

.wlc-search-bar__fields {
	display: flex;
	align-items: stretch;
	gap: 0.5rem;
}

/* Cellules blanches : label + champ. */
.wlc-field {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 0.1rem;
	flex: 1 1 0;
	min-width: 0;
	padding: 0.45rem 0.9rem;
	background: #fff;
	border-radius: calc(var(--wlc-radius) - 6px);
}

.wlc-field__label {
	margin: 0;
	color: var(--wlc-c-primary-dark);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	white-space: nowrap;
	cursor: pointer;
}

.wlc-search-bar .wlc-field input[type="text"],
.wlc-search-bar .wlc-field select {
	width: 100%;
	min-width: 0;
	padding: 0;
	margin: 0;
	background: transparent;
	border: 0;
	outline: none;
	box-shadow: none;
	color: var(--wlc-c-ink);
	font-size: 0.95rem;
	line-height: 1.4;
	cursor: pointer;
}

.wlc-search-bar .wlc-field input[type="text"]:focus-visible,
.wlc-search-bar .wlc-field select:focus-visible {
	outline: 2px solid var(--wlc-c-primary-dark);
	outline-offset: 2px;
	border-radius: 4px;
}

.wlc-search-bar .wlc-field ::placeholder {
	color: #5a6268; /* 5,9:1 sur blanc */
	opacity: 1;
}

.wlc-region-select option.wlc-region-parent {
	font-weight: 700;
}

.wlc-dates-nights {
	color: var(--wlc-c-primary-dark);
	font-size: 0.75rem;
	font-weight: 600;
}

.wlc-dates-nights:empty,
.wlc-dates-msg:empty {
	display: none;
}

.wlc-dates-msg {
	color: var(--wlc-c-primary-dark);
	font-size: 0.75rem;
}

/* « Plus de filtres » : cellule-bouton. */
.wlc-field--more {
	flex: 0 0 auto;
	padding: 0;
	background: transparent;
}

.wlc-more-toggle {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	height: 100%;
	padding: 0.45rem 1rem;
	background: #fff;
	color: var(--wlc-c-primary-dark);
	border: 0;
	border-radius: calc(var(--wlc-radius) - 6px);
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}

.wlc-more-toggle:hover,
.wlc-more-toggle[aria-expanded="true"] {
	background: var(--wlc-c-light);
	color: var(--wlc-c-primary-dark); /* charte : texte sur #8ED5D9 toujours en #266674 */
}

/* Bouton principal — accent, texte gris très foncé (charte). */
.wlc-search-bar .wlc-submit {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	flex: 0 0 auto;
	padding: 0.45rem 1.4rem;
	background: var(--wlc-c-accent);
	color: var(--wlc-c-ink-accent);
	border: 0;
	border-radius: calc(var(--wlc-radius) - 6px);
	font-size: 0.95rem;
	font-weight: 700;
	cursor: pointer;
	white-space: nowrap;
	transition: filter 0.15s ease, transform 0.1s ease;
}

.wlc-search-bar .wlc-submit:hover {
	background: var(--wlc-c-accent-dark);
	color: var(--wlc-c-ink-accent);
}

.wlc-search-bar .wlc-submit:active {
	transform: scale(0.97);
}

.wlc-search-bar .wlc-submit:focus-visible,
.wlc-more-toggle:focus-visible,
.wlc-search-bar__toggle:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

/* ── Filtres rapides (dans la barre) ───────────────────────────────────── */

.wlc-search-bar__quick {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.35rem 1.5rem;
	padding: 0.55rem 0.5rem 0.15rem;
}

/* ── Cases à cocher stylées (checkbox réelle masquée visuellement) ─────── */

.wlc-check {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin: 0;
	color: var(--wlc-c-ink);
	font-size: 0.92rem;
	font-weight: 400;
	cursor: pointer;
}

.wlc-check__input,
.wlc-chip__input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
}

.wlc-check__box {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	flex-shrink: 0;
	background: #fff;
	border: 2px solid var(--wlc-c-primary);
	border-radius: 6px;
	box-sizing: border-box;
	color: #fff;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.wlc-check__box svg {
	opacity: 0;
}

.wlc-check__input:checked + .wlc-check__box {
	background: var(--wlc-c-primary);
	border-color: var(--wlc-c-primary);
}

.wlc-check__input:checked + .wlc-check__box svg {
	opacity: 1;
}

.wlc-check__input:focus-visible + .wlc-check__box {
	outline: 3px solid var(--wlc-c-primary-dark);
	outline-offset: 2px;
}

.wlc-check__icon {
	color: var(--wlc-c-primary-dark);
	flex-shrink: 0;
}

/* Variante « filtre rapide » : posée sur le fond primaire de la barre
   (charte : texte sur #4a919e toujours en blanc). */
.wlc-check--quick {
	color: #fff;
	font-size: 0.88rem;
	font-weight: 600;
}

.wlc-check--quick .wlc-check__icon {
	color: #fff;
}

.wlc-check--quick .wlc-check__box {
	background: transparent;
	border-color: #fff;
	width: 20px;
	height: 20px;
	color: var(--wlc-c-primary-dark);
}

.wlc-check--quick .wlc-check__input:checked + .wlc-check__box {
	background: #fff;
	border-color: #fff;
}

.wlc-check--quick .wlc-check__input:focus-visible + .wlc-check__box {
	outline-color: #fff;
}

/* ── Chips (choix multiples) ───────────────────────────────────────────── */

.wlc-chips {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.wlc-chips__legend {
	padding: 0;
	margin: 0 0 0.5rem;
	color: var(--wlc-c-ink);
	font-size: 0.88rem;
	font-weight: 600;
}

.wlc-chips__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.wlc-chip {
	position: relative;
	display: inline-flex;
	margin: 0;
}

.wlc-chip__text {
	display: inline-flex;
	align-items: center;
	padding: 0.45rem 0.85rem;
	background: var(--wlc-c-light);
	color: var(--wlc-c-primary-dark); /* charte : texte sur #8ED5D9 toujours en #266674 */
	border-radius: 999px;
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.wlc-chip__input:checked + .wlc-chip__text {
	background: var(--wlc-c-primary);
	color: #fff; /* charte : texte sur #4a919e toujours en blanc */
}

.wlc-chip__input:focus-visible + .wlc-chip__text {
	outline: 3px solid var(--wlc-c-primary-dark);
	outline-offset: 2px;
}

/* ── Panneau « Plus de filtres » ───────────────────────────────────────── */

.wlc-filters-panel {
	position: absolute;
	bottom: calc(100% + 0.9rem);
	left: 0;
	right: 0;
	display: flex;
	flex-direction: column;
	max-height: min(72vh, 640px);
	background: #fff;
	border-radius: var(--wlc-radius);
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

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

/* Ouverture courte (≤ 200 ms), coupée si l'utilisateur préfère moins de mouvement. */
.wlc-filters-panel:not([hidden]) {
	animation: wlc-panel-in 0.18s ease-out;
}

@keyframes wlc-panel-in {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.wlc-filters-panel__head {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	flex-shrink: 0;
	padding: 1.1rem 1.5rem 0.9rem;
}

.wlc-filters-panel__title {
	color: var(--wlc-c-primary-dark);
	font-size: 1rem;
	font-weight: 700;
}

.wlc-filters-count {
	padding: 0.2rem 0.7rem;
	background: var(--wlc-c-light);
	color: var(--wlc-c-primary-dark); /* charte : texte sur #8ED5D9 toujours en #266674 */
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 600;
	white-space: nowrap;
}

.wlc-filters-count[hidden] {
	display: none;
}

.wlc-filters-clear {
	margin-left: auto;
	padding: 0.25rem 0.25rem;
	background: none;
	border: 0;
	color: var(--wlc-c-primary-dark);
	font-size: 0.85rem;
	text-decoration: underline;
	cursor: pointer;
}

.wlc-filters-clear:hover {
	color: var(--wlc-c-primary);
}

.wlc-filters-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.2rem;
	height: 2.2rem;
	padding: 0;
	background: var(--wlc-c-primary-dark);
	color: #fff;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	flex-shrink: 0;
}

.wlc-filters-clear:focus-visible,
.wlc-filters-close:focus-visible {
	outline: 3px solid var(--wlc-c-primary-dark);
	outline-offset: 2px;
}

/* Corps : groupes titrés, séparés par de l'espace (pas de traits). */
.wlc-filters-panel__body {
	overflow-y: auto;
	padding: 0.25rem 1.5rem 0.5rem;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1.6rem 2.75rem;
	align-items: start;
}

.wlc-filters-group {
	display: flex;
	flex-direction: column;
	gap: 0.9rem;
	min-width: 0;
}

.wlc-filters-group__title {
	margin: 0;
	color: var(--wlc-c-primary-dark);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
}

.wlc-filters-group__fields {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
}

.wlc-filters-panel label {
	color: var(--wlc-c-ink);
}

/* Champs au rendu natif GeoDirectory (plages min/max, selects…). */
.wlc-filter--native .form-control,
.wlc-filter--native select,
.wlc-filter--native input[type="text"],
.wlc-filter--native input[type="number"] {
	border: 1px solid #c6d8db;
	border-radius: 8px;
	font-size: 0.9rem;
}

/* Pied : bouton secondaire + rappel de l'appel à l'action principal. */
.wlc-filters-panel__foot {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.75rem;
	flex-shrink: 0;
	padding: 1rem 1.5rem 1.25rem;
}

.wlc-filters-close--secondary {
	width: auto;
	height: auto;
	padding: 0.65rem 1.25rem;
	background: #fff;
	border: 1.5px solid var(--wlc-c-primary);
	border-radius: 12px;
	color: var(--wlc-c-primary-dark);
	font-size: 0.92rem;
	font-weight: 600;
}

.wlc-filters-panel__foot .wlc-submit--panel {
	padding: 0.7rem 1.4rem;
}

/* ── Calendrier flatpickr ──────────────────────────────────────────────── */

.flatpickr-calendar.wlc-picker {
	position: fixed;
	z-index: 1040;
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.flatpickr-calendar.wlc-picker .flatpickr-day.selected,
.flatpickr-calendar.wlc-picker .flatpickr-day.startRange,
.flatpickr-calendar.wlc-picker .flatpickr-day.endRange {
	background: var(--wlc-c-primary-dark);
	border-color: var(--wlc-c-primary-dark);
	color: #fff;
}

.flatpickr-calendar.wlc-picker .flatpickr-day.inRange {
	background: var(--wlc-c-light);
	border-color: var(--wlc-c-light);
	color: var(--wlc-c-primary-dark); /* charte : texte sur #8ED5D9 toujours en #266674 */
	box-shadow: -5px 0 0 var(--wlc-c-light), 5px 0 0 var(--wlc-c-light);
}

/* ── Badge « Dates du séjour » sur la page de résultats ────────────────── */

.gd-adv-search-label.wlc-badge-dates {
	background: var(--wlc-c-light);
	color: var(--wlc-c-primary-dark);
}

/* ── Mobile ────────────────────────────────────────────────────────────── */

@media (max-width: 991.98px) {
	.wlc-search-bar {
		width: calc(100% - 1.5rem); /* % du viewport hors barre de défilement, jamais 100vw */
		max-width: 420px;
		bottom: 0.9rem;
	}

	.wlc-search-bar__toggle {
		display: flex;
	}

	.wlc-search-bar__panel {
		display: none;
	}

	.wlc-search-bar.is-open .wlc-search-bar__panel {
		display: block;
	}

	.wlc-search-bar.is-open .wlc-search-bar__toggle {
		border-radius: var(--wlc-radius) var(--wlc-radius) 0 0;
	}

	.wlc-search-bar__fields {
		flex-direction: column;
		align-items: stretch;
	}

	.wlc-field,
	.wlc-more-toggle,
	.wlc-search-bar .wlc-submit {
		width: 100%;
	}

	.wlc-more-toggle {
		justify-content: center;
		padding: 0.7rem 1rem;
	}

	.wlc-search-bar .wlc-submit {
		padding: 0.8rem 1rem;
	}

	.wlc-search-bar__quick {
		flex-direction: column;
		align-items: stretch;
		gap: 0.7rem;
		padding: 0.35rem 0.5rem;
	}

	/* Panneau filtres plein écran : en-tête et pied fixes, corps défilant. */
	.wlc-filters-panel {
		position: fixed;
		inset: 0;
		bottom: 0;
		max-height: none;
		border-radius: 0;
		z-index: 1050;
	}

	.wlc-filters-panel__body {
		grid-template-columns: minmax(0, 1fr);
		gap: 1.75rem;
		flex-grow: 1;
	}

	.wlc-filters-panel__foot {
		box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
	}

	/* Le « width: 100% » mobile de .wlc-submit vaut pour la barre, pas pour
	   le pied du panneau : ici le bouton partage la ligne avec « Fermer ». */
	.wlc-filters-panel__foot .wlc-submit--panel {
		width: auto;
		flex-grow: 1;
		justify-content: center;
		min-width: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wlc-search-bar__chevron,
	.wlc-search-bar .wlc-submit,
	.wlc-check__box,
	.wlc-chip__text {
		transition: none;
	}

	.wlc-filters-panel:not([hidden]) {
		animation: none;
	}
}
