/* Custom Search Bar Pro – tous les sélecteurs sont préfixés .cf- */

/* ======================= Barre classique ======================= */
.cf-search-form {
	position: relative;
	width: 360px;
	height: 45px;
	max-width: 100%;
}

@media (max-width: 767px) {
	.cf-search-form { width: 90%; }
}

.cf-search-box {
	display: flex;
	align-items: center;
	height: 100%;
	background-color: #ffffff;
	border: 1px solid #3c3c3c;
	border-radius: 30px;
	padding: 0 15px;
	box-sizing: border-box;
	transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Remplace l'outline supprimé de l'input : le focus reste visible (accessibilité) */
.cf-search-box:focus-within {
	border-color: #000000;
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.12);
}

.cf-search-icon {
	width: 14px;
	height: 14px;
	fill: #888888;
	flex-shrink: 0;
	margin-right: 10px;
}

.cf-search-input {
	flex-grow: 1;
	min-width: 0;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	background: transparent !important;
	font-size: 14px;
	padding: 0;
	color: #888888;
}

.cf-search-input::placeholder { color: #c8c8c8; }
.cf-search-input::-webkit-search-decoration,
.cf-search-input::-webkit-search-cancel-button { display: none; }

/* Bouton d'envoi masqué (Entrée valide le formulaire) */
.cf-search-submit { display: none; }

/* Honeypot : hors écran, sans display:none pour rester "attractif" pour les bots */
.cf-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Pop-up des suggestions */
.cf-search-dropdown {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	width: 100%;
	min-width: 260px;
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
	padding: 14px 0;
	z-index: 999999;
	display: none;
	box-sizing: border-box;
}

.cf-search-dropdown.is-active { display: block; }

.cf-dropdown-header {
	padding: 2px 18px 8px;
	font-size: 13px;
	font-weight: 700;
	color: #1a1a1a;
}

.cf-dropdown-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.cf-dropdown-item {
	display: flex;
	align-items: center;
	padding: 8px 18px;
	font-size: 15px;
	color: #333333;
	text-decoration: none;
	transition: background-color 0.15s ease;
	cursor: pointer;
}

/* Texte tronqué sur une ligne avec « … » */
.cf-dropdown-item span {
	font-weight: 400;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	min-width: 0;
}

.cf-dropdown-item:hover,
.cf-dropdown-item.is-focused {
	background-color: #f4f7f9;
	color: #000000;
}

.cf-dropdown-icon {
	width: 14px;
	height: 14px;
	fill: none;
	stroke: #666666;
	stroke-width: 2;
	margin-right: 12px;
	flex-shrink: 0;
}

/* Fiche produit : miniature (44 x 62) + titre sur 2 lignes au plus */
.cf-dropdown-thumb {
	width: 44px;
	height: 62px;
	flex-shrink: 0;
	margin-right: 12px;
	border-radius: 6px;
	object-fit: cover;
	object-position: top;
	background: #eeeeee;
}

.cf-dropdown-item.has-thumb span {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	white-space: normal;
	font-size: 14px;
	line-height: 1.35;
}

.cf-dropdown-sub {
	padding: 10px 18px 4px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #8a8a8a;
}

.cf-dropdown-all {
	margin-top: 6px;
	border-top: 1px solid #eeeeee;
	font-weight: 700;
	color: #1a1a1a;
}

@media (prefers-reduced-motion: reduce) {
	.cf-search-box,
	.cf-dropdown-item { transition: none; }
}

/* --- Correction Anti-Zoom et Anti-Décalage Mobile --- */
@media (max-width: 767px) {
	.cf-search-input {
		font-size: 16px;
	}
}

html, body {
	overflow-x: hidden;
}

/* ======================= Version HEADER : [flyer_search variant="header"] =======================
   Une loupe ronde (même look que le coeur des favoris). Au clic, un volet s'ouvre avec le champ de
   recherche et les suggestions :
   - ordinateur (1200 px et plus) : petit volet sous la loupe ;
   - en dessous de 1200 px (tablette, mobile) : volet collé en haut de l'écran, sur toute la largeur.
   ================================================================================================ */
.cf-hsearch {
	position: relative;
	flex-shrink: 0;
}

.cf-hsearch-close,
.cf-hsearch-backdrop,
.cf-hsearch-panel { display: none; }

/* Le bouton rond et la croix */
.cf-hsearch-toggle,
.cf-hsearch-close {
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0;
	border: 1px solid #e0e0e0;
	border-radius: 50%;
	background-color: #ffffff;
	cursor: pointer;
	flex-shrink: 0;
	-webkit-appearance: none;
	appearance: none;
	transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.cf-hsearch-toggle { display: flex; width: 32px; height: 32px; }
.cf-hsearch-toggle:hover { transform: scale(1.05); border-color: #cccccc; background-color: #fcfcfc; }
.cf-hsearch-toggle svg { width: 14px; height: 14px; fill: #222222; display: block; }

.cf-hsearch-close { width: 44px; height: 44px; }
.cf-hsearch-close svg { width: 20px; height: 20px; fill: none; stroke: #222222; stroke-width: 2; stroke-linecap: round; display: block; }

.cf-hsearch-toggle:focus-visible,
.cf-hsearch-close:focus-visible { outline: 2px solid #222222; outline-offset: 2px; }

/* Le volet : sous la loupe, centré par rapport à elle */
.cf-hsearch.is-open .cf-hsearch-panel {
	display: block;
	position: absolute;
	top: calc(100% + 12px);
	left: 50%;
	transform: translateX(-50%);
	z-index: 1001;
	box-sizing: border-box;
	width: 360px;
	max-width: calc(100vw - 24px);
	padding: 12px;
	background: #ffffff;
	border-radius: 20px;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.14);
}

.cf-hsearch .cf-search-form { width: 100%; height: auto; max-width: none; }
.cf-hsearch .cf-search-box { height: 44px; padding: 0 16px; }
.cf-hsearch .cf-search-icon { width: 15px; height: 15px; fill: #222222; margin-right: 10px; }
.cf-hsearch .cf-search-input { height: 100%; font-size: 15px; line-height: 1; color: #222222; }
.cf-hsearch .cf-search-input::placeholder { color: #8a8a8a; }

/* Les suggestions s'affichent dans le volet, sous le champ */
.cf-hsearch .cf-search-dropdown {
	position: static;
	width: auto;
	min-width: 0;
	margin-top: 6px;
	padding: 8px 0 2px;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
}

.cf-hsearch .cf-dropdown-header { padding: 4px 8px 6px; }
.cf-hsearch .cf-dropdown-item { padding: 9px 8px; border-radius: 10px; }
.cf-hsearch .cf-dropdown-item.has-thumb { padding-top: 6px; padding-bottom: 6px; }
.cf-hsearch .cf-dropdown-sub { padding: 10px 8px 4px; }
.cf-hsearch .cf-dropdown-all { border-radius: 0 0 10px 10px; }

/* Tablette et mobile : volet plein écran collé en haut */
@media (max-width: 1199px) {
	.cf-hsearch.is-open .cf-hsearch-backdrop {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 2147483000;
		background: rgba(0, 0, 0, 0.45);
	}

	.cf-hsearch.is-open .cf-hsearch-panel {
		display: flex;
		align-items: flex-start;
		gap: 10px;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		transform: none;
		z-index: 2147483001;
		width: 100%;
		max-width: none;
		max-height: 100vh;
		max-height: 100dvh;
		overflow-y: auto;
		padding: 14px 16px 16px;
		border-radius: 0;
		box-shadow: 0 14px 34px rgba(0, 0, 0, 0.25);
	}

	.cf-hsearch.is-open .cf-hsearch-close { display: flex; }

	.cf-hsearch.is-open .cf-search-form { flex: 1 1 auto; width: auto; min-width: 0; }
	.cf-hsearch.is-open .cf-search-input { font-size: 16px; }

	/* Les suggestions s'ouvrent dans le volet, sous le champ */
	.cf-hsearch.is-open .cf-search-dropdown {
		width: calc(100% + 54px); /* passe sous la croix : le volet est pleine largeur */
		margin-top: 10px;
		padding: 10px 0;
		max-height: calc(100dvh - 120px);
		overflow-y: auto;
		border-radius: 14px;
		background: #f7f7f8;
	}

	.cf-hsearch.is-open .cf-dropdown-item { padding: 11px 16px; border-radius: 0; }
	.cf-hsearch.is-open .cf-dropdown-item.has-thumb { padding-top: 7px; padding-bottom: 7px; }
	.cf-hsearch.is-open .cf-dropdown-sub { padding: 10px 16px 4px; }
	.cf-hsearch.is-open .cf-dropdown-header { padding: 2px 16px 8px; }

	/* le header passe au-dessus de tout le reste pendant que le volet est ouvert */
	header:has(.cf-hsearch.is-open) { z-index: 2147483000 !important; }

	html.cf-hsearch-lock,
	html.cf-hsearch-lock body { overflow: hidden; }
}
