/**
 * Drawer de recherche produit indexée.
 * Markup : templates/search-drawer.php — Comportement : assets/js/bs-search.js
 * La grille de résultats hérite du style des product-cards (product-cards.css).
 */

/* Verrouille le scroll de la page quand le drawer est ouvert */
html.bs-search-locked {
	overflow: hidden;
}

/* Conteneur racine (caché par défaut) */
.bs-search {
	position: fixed;
	inset: 0;
	z-index: 100000;
	visibility: hidden;
	pointer-events: none;
}

.bs-search.is-open {
	visibility: visible;
	pointer-events: auto;
}

/* Voile sombre */
.bs-search__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.bs-search.is-open .bs-search__overlay {
	opacity: 1;
}

/* Panneau qui descend du haut */
.bs-search__panel {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	flex-direction: column;
	max-height: 90vh;
	background: #fff;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
	transform: translateY(-100%);
	transition: transform 0.3s ease;
}

.bs-search.is-open .bs-search__panel {
	transform: translateY(0);
}

/* Barre de recherche (sticky en haut du panneau) */
.bs-search__bar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 18px 24px;
	border-bottom: 1px solid #ececec;
	flex: 0 0 auto;
}

.bs-search__icon {
	display: inline-flex;
	flex: 0 0 auto;
	width: 22px;
	height: 22px;
}

.bs-search__icon svg {
	width: 100%;
	height: 100%;
}

/* Même style que .bs-vp-search__input (page détail produit) — volontairement
   dupliqué ici, pas factorisé : chaque CSS reste dans son fichier. */
#bs-search-drawer .bs-search__input {
	flex: 1 1 auto;
	width: 100%;
	height: 40px;
	border: 0;
	border-bottom: 1px solid #000000;
	padding: 0 34px 0 4px;
	background: transparent;
	outline: none;
	font-family: 'Inter', sans-serif;
	font-weight: 400;
	font-size: 16px;
	line-height: 24px;
	color: #1F1F1F;
	box-shadow: none;
}

#bs-search-drawer .bs-search__input:focus {
	background: transparent;
}

#bs-search-drawer .bs-search__input::placeholder {
	color: #9a9a9a;
}

.bs-search__close {
	flex: 0 0 auto;
	border: 0;
	background: transparent;
	cursor: pointer;
	font-size: 30px;
	line-height: 1;
	color: #444;
	padding: 0 4px;
}

.bs-search__close:hover {
	color: #000;
}

/* Corps : zone scrollable des résultats */
.bs-search__body {
	flex: 1 1 auto;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 24px;
}

.bs-search__hint,
.bs-search__empty {
	margin: 24px 0;
	text-align: center;
	color: #8a8a8a;
	font-size: 15px;
}

/* Spinner */
.bs-search__spinner {
	margin: 32px auto;
	width: 34px;
	height: 34px;
	border: 3px solid #e6e6e6;
	border-top-color: #999;
	border-radius: 50%;
	animation: bs-search-spin 0.8s linear infinite;
}

@keyframes bs-search-spin {
	to {
		transform: rotate(360deg);
	}
}

/* La grille hérite de product-cards.css ; on neutralise juste les marges externes */
.bs-search__results .bs-search-results__grid {
	margin: 0;
}

.bs-search__results ul.products {
	margin: 0;
}

/* Mobile */
@media (max-width: 767px) {
	.bs-search__panel {
		max-height: 100vh;
		height: 100vh;
	}

	.bs-search__bar {
		padding: 14px 16px;
	}

	.bs-search__input {
		font-size: 16px;
	}

	.bs-search__body {
		padding: 16px;
	}
}
