/*
 * Eigen live zoekfunctie voor Bakker IJlst (charliens-theme).
 * Stijl sluit aan op het mega menu. Bakker-blauw #014b9a.
 */

.bakker-search {
	--bs-main: #014b9a;
	--bs-dark: #013a78;
	--bs-border: #e6e9f0;
	--bs-muted: #8a8f9c;
	--bs-ink: #22252b;
	position: relative;
	width: 100%;
	font-family: inherit;
}

/* Ruimte tussen de categorie-knop en de zoekbalk. */
.searchwrapper {
	padding-left: 22px;
}

.bakker-search * {
	box-sizing: border-box;
}

/* ---------------------------------------------------------------------
 * Zoekveld
 * ------------------------------------------------------------------- */
.bakker-search__form {
	position: relative;
	display: flex;
	align-items: center;
	width: 100%;
	margin: 0;
}

.bakker-search__icon {
	position: absolute;
	left: 15px;
	display: inline-flex;
	color: var(--bs-muted);
	pointer-events: none;
}

.bakker-search__icon svg {
	width: 19px;
	height: 19px;
}

.bakker-search .bakker-search__input,
.searchwrapper .bakker-search__input {
	width: 100%;
	height: 46px;
	padding: 0 42px 0 44px;
	margin: 0;
	border: 1px solid var(--bs-border);
	border-radius: 10px;
	background: #fff;
	color: var(--bs-ink);
	font-family: inherit;
	font-size: 15px;
	font-weight: 500;
	line-height: normal;
	text-align: left;
	outline: none;
	box-sizing: border-box;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bakker-search__input::placeholder {
	color: var(--bs-muted);
}

.bakker-search__input:focus {
	border-color: var(--bs-main);
	box-shadow: 0 0 0 3px rgba(1, 75, 154, 0.12);
}

/* Zoek-kruisje van de browser weg (we hebben een eigen knop). */
.bakker-search__input::-webkit-search-cancel-button {
	display: none;
}

.bakker-search__clear {
	position: absolute;
	right: 10px;
	display: none;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: #eef1f6;
	color: var(--bs-muted);
	cursor: pointer;
	transition: background 0.14s ease, color 0.14s ease;
}

.bakker-search.has-value .bakker-search__clear {
	display: inline-flex;
}

.bakker-search__clear:hover {
	background: var(--bs-main);
	color: #fff;
}

.bakker-search__clear svg {
	width: 14px;
	height: 14px;
}

/* Subtiele laad-indicatie in de rand van het veld. */
.bakker-search.is-loading .bakker-search__input {
	border-color: var(--bs-main);
}

/* ---------------------------------------------------------------------
 * Resultaten-dropdown (volledige schermbreedte)
 * ------------------------------------------------------------------- */
.bakker-search__results {
	position: fixed;
	top: 120px;
	left: 0;
	right: 0;
	width: 100%;
	background: #fff;
	border-top: 1px solid var(--bs-border);
	border-bottom: 1px solid var(--bs-border);
	box-shadow: 0 24px 50px rgba(15, 23, 42, 0.18);
	max-height: 78vh;
	overflow-y: auto;
	z-index: 2147483000;
	padding: 0;
}

/* Twee kolommen: categorieen links, producttegels rechts. */
.bakker-search__layout {
	display: flex;
	align-items: stretch;
	width: 100%;
}

.bakker-search__side {
	flex: 0 0 260px;
	width: 260px;
	padding: 18px 16px 24px;
	background: #f6f9fd;
	border-right: 1px solid var(--bs-border);
}

.bakker-search__main {
	flex: 1 1 auto;
	min-width: 0;
	padding: 16px 18px 20px;
}

.bakker-search__sectiontitle {
	padding: 0 4px 10px;
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--bs-muted);
}

.bakker-search__nocats {
	padding: 4px;
	font-size: 13px;
	color: var(--bs-muted);
}

/* Categorie-resultaat */
.bakker-search__cat {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 10px;
	border-radius: 8px;
	color: var(--bs-ink) !important;
	text-decoration: none !important;
	font-size: 13.5px;
	font-weight: 600;
	transition: background 0.12s ease, color 0.12s ease;
}

.bakker-search__cat:hover,
.bakker-search__cat.is-active {
	background: rgba(1, 75, 154, 0.08);
	color: var(--bs-main) !important;
}

.bakker-search__catcount {
	margin-left: auto;
	font-size: 10.5px;
	font-weight: 700;
	color: var(--bs-muted);
	background: #eef1f6;
	border-radius: 20px;
	padding: 2px 8px;
	line-height: 1;
}

/* ---------------------------------------------------------------------
 * Producttegels
 * ------------------------------------------------------------------- */
.bakker-search__grid {
	display: grid;
	grid-template-columns: repeat(10, minmax(0, 1fr));
	gap: 10px;
}

.bakker-search__tile {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--bs-border);
	border-radius: 10px;
	padding: 8px;
	background: #fff;
	min-width: 0;
	overflow: hidden;
	transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.bakker-search__tile:hover {
	border-color: rgba(1, 75, 154, 0.35);
	box-shadow: 0 10px 26px rgba(15, 23, 42, 0.1);
	transform: translateY(-2px);
}

.bakker-search__tilelink {
	display: flex;
	flex-direction: column;
	gap: 6px;
	text-decoration: none !important;
	color: var(--bs-ink) !important;
	flex: 1 1 auto;
}

.bakker-search__tilelink.is-active {
	outline: 2px solid var(--bs-main);
	outline-offset: 4px;
	border-radius: 8px;
}

.bakker-search__thumb {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	border-radius: 8px;
	overflow: hidden;
	background: #f4f6fa;
}

.bakker-search__thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	mix-blend-mode: multiply;
}

.bakker-search__name {
	font-size: 11.5px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--bs-ink);
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}

.bakker-search__sku {
	font-size: 10px;
	color: var(--bs-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bakker-search__tilefoot {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	margin: 8px 0;
}

.bakker-search__price {
	font-size: 13px;
	font-weight: 800;
	color: var(--bs-main);
	line-height: 1.2;
}

/* "Incl. BTW" en dergelijke passen niet in een smalle tegel. */
.bakker-search__price small,
.bakker-search__price .woocommerce-Price-taxLabel {
	display: none;
}

.bakker-search__price del {
	font-size: 12px;
	font-weight: 400;
	color: var(--bs-muted);
	margin-right: 4px;
}

.bakker-search__price ins {
	text-decoration: none;
}

.bakker-search__price .woocommerce-Price-taxLabel {
	display: none;
}

.bakker-search__stock {
	font-size: 10px;
	font-weight: 700;
	border-radius: 20px;
	padding: 2px 8px;
	line-height: 1.5;
	white-space: nowrap;
}

.bakker-search__stock.is-instock {
	background: #e7f6ec;
	color: #1d7a3d;
}

.bakker-search__stock.is-outofstock {
	background: #fdecec;
	color: #b3261e;
}

/* Winkelwagen-knop in de tegel */
.bakker-search__add {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	width: 100%;
	margin-top: auto;
	padding: 8px 8px;
	border: none;
	border-radius: 8px;
	background: #22a44a;
	color: #fff !important;
	font-family: inherit;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	text-decoration: none !important;
	cursor: pointer;
	transition: background 0.14s ease, opacity 0.14s ease;
}

.bakker-search__add:hover {
	background: #1c8c3e;
}

.bakker-search__add.is-link {
	background: var(--bs-main);
}

.bakker-search__add.is-link:hover {
	background: var(--bs-dark);
}

.bakker-search__add svg {
	width: 13px;
	height: 13px;
	flex: 0 0 auto;
}

.bakker-search__add.is-busy {
	opacity: 0.6;
	pointer-events: none;
}

.bakker-search__add.is-done {
	background: #1c8c3e;
}

.bakker-search__add.is-done span::after {
	content: " toegevoegd";
}

/* Alle resultaten */
.bakker-search__all {
	display: block;
	padding: 15px;
	background: var(--bs-main);
	color: #fff !important;
	text-align: center;
	text-decoration: none !important;
	font-size: 14px;
	font-weight: 700;
	transition: background 0.14s ease;
}

.bakker-search__all:hover,
.bakker-search__all.is-active {
	background: var(--bs-dark);
}

/* Geen resultaten */
.bakker-search__empty {
	padding: 34px 14px;
	text-align: center;
	font-size: 14.5px;
	color: var(--bs-muted);
}

/* ---------------------------------------------------------------------
 * Skeleton loader
 * ------------------------------------------------------------------- */
.bakker-skel {
	display: block;
	background: linear-gradient(90deg, #eef1f6 25%, #e2e7ef 37%, #eef1f6 63%);
	background-size: 400% 100%;
	border-radius: 6px;
	animation: bakker-skel-shimmer 1.3s ease-in-out infinite;
}

@keyframes bakker-skel-shimmer {
	0% {
		background-position: 100% 50%;
	}
	100% {
		background-position: 0 50%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bakker-skel {
		animation: none;
	}
}

.bakker-search__tile--skel {
	gap: 7px;
}

.bakker-skel--thumb {
	width: 100%;
	aspect-ratio: 1 / 1;
	border-radius: 8px;
}

.bakker-skel--line {
	height: 10px;
	width: 100%;
}

.bakker-skel--line.is-short {
	width: 60%;
}

.bakker-skel--price {
	height: 13px;
	width: 55%;
	margin-top: 4px;
}

.bakker-skel--btn {
	height: 30px;
	width: 100%;
	border-radius: 8px;
	margin-top: auto;
}

.bakker-search__skelcat {
	padding: 9px 10px;
}

.bakker-search__skelcat .bakker-skel {
	height: 12px;
	width: 80%;
}

/* ---------------------------------------------------------------------
 * Responsief
 * ------------------------------------------------------------------- */
/* Twee rijen tonen. Per breakpoint verandert het aantal kolommen, dus
   verbergen we de tegels die niet in twee rijen passen. */
.bakker-search__tile:nth-child(n + 21) {
	display: none;
}

@media (max-width: 1800px) {
	.bakker-search__grid {
		grid-template-columns: repeat(8, minmax(0, 1fr));
	}

	.bakker-search__tile:nth-child(n + 17) {
		display: none;
	}
}

@media (max-width: 1500px) {
	.bakker-search__grid {
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}

	.bakker-search__tile:nth-child(n + 13) {
		display: none;
	}
}

@media (max-width: 1200px) {
	.bakker-search__grid {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}

	.bakker-search__tile:nth-child(n + 11) {
		display: none;
	}

	.bakker-search__side {
		flex: 0 0 220px;
		width: 220px;
	}
}

@media (max-width: 900px) {
	.searchwrapper {
		padding-left: 0;
	}

	.bakker-search .bakker-search__input,
	.searchwrapper .bakker-search__input {
		height: 44px;
		font-size: 16px; /* voorkomt inzoomen op iOS */
		/* Het thema zet op smalle schermen border/radius weg met !important. */
		border: 1px solid var(--bs-border) !important;
		border-radius: 10px !important;
		text-align: left !important;
	}

	.bakker-search__results {
		max-height: 72vh;
	}

	/* Categorieen boven de tegels in plaats van ernaast. */
	.bakker-search__layout {
		flex-direction: column;
	}

	.bakker-search__side {
		flex: 1 1 auto;
		width: 100%;
		border-right: none;
		border-bottom: 1px solid var(--bs-border);
		padding: 14px 14px 16px;
	}

	.bakker-search__main {
		padding: 14px;
	}

	.bakker-search__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}

	/* Op mobiel houden we het compact: 6 tegels, de rest via
	   "alle resultaten bekijken". */
	.bakker-search__tile:nth-child(n + 7) {
		display: none;
	}
}

@media (max-width: 560px) {
	.bakker-search__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}

	.bakker-search__tile {
		padding: 10px;
	}

	.bakker-search__name {
		font-size: 12.5px;
		-webkit-line-clamp: 2;
	}

	.bakker-search__add span {
		font-size: 12px;
	}
}
