/* =========================================================================
   Sabeny — Header search bar (live AJAX).
   Reuses --sbn-* CSS variables from custom.css.
   ========================================================================= */

.sbn-search {
	position: relative;
	width: 100%;
	/* Allow the search to be the flex/grid grow element in its row so it
	 * fills the space between logo and buttons. Cap at a generous max so
	 * it doesn't look silly on ultrawide. */
	flex: 1 1 auto;
	max-width: 880px;
	display: flex;
	align-items: center;
	z-index: 100; /* sit above sibling Elementor widgets so the dropdown isn't covered */
}

/* The Elementor column that wraps the search shortcode should also grow.
 * Override the column's fixed % width on desktop so the search can stretch. */
@media (min-width: 1025px) {
	.elementor-element:has(> .elementor-widget-container > .sbn-search),
	.elementor-column:has(.sbn-search) {
		flex-grow: 1 !important;
		flex-shrink: 1 !important;
		width: auto !important;
	}
}

/* Belt-and-braces: Elementor widget wrappers can have overflow:hidden
   set via theme defaults. Allow our dropdown to escape on desktop. */
.elementor-widget-container:has(> .sbn-search),
.elementor-widget-shortcode:has(.sbn-search),
.elementor-element:has(.sbn-search) {
	overflow: visible !important;
}

/* ----- Form (input + button) ---------------------------------------- */
.sbn-search__form {
	position: relative;
	display: flex;
	align-items: stretch;
	width: 100%;
	background: #F3F4F6;
	border: 1px solid var(--sbn-line, #E5E7EB);
	border-radius: 999px;
	overflow: hidden;
	transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.sbn-search__form:focus-within {
	border-color: var(--sbn-teal, #0E6B6B);
	background: #fff;
	box-shadow: 0 0 0 3px rgba(14, 107, 107, 0.10);
}

.sbn-search .sbn-search__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 48px;
	padding: 0 16px 0 22px;
	border: 0 !important;
	background: transparent !important;
	font-size: 15px !important;
	font-family: inherit !important;
	color: var(--sbn-ink, #0F172A) !important;
	outline: none !important;
	box-shadow: none !important;
	border-radius: 0 !important;
	margin: 0 !important;
}
.sbn-search .sbn-search__input::placeholder {
	color: var(--sbn-mute, #6B7280);
	opacity: 1;
}
.sbn-search .sbn-search__input::-webkit-search-cancel-button {
	-webkit-appearance: none;
	height: 16px;
	width: 16px;
	background: var(--sbn-mute, #6B7280);
	-webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E") center/contain no-repeat;
	cursor: pointer;
	margin-right: 8px;
}

.sbn-search .sbn-search__btn {
	-webkit-appearance: none !important;
	appearance: none !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 56px !important;
	min-width: 56px !important;
	height: 48px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: var(--sbn-teal, #0E6B6B) !important;
	color: #fff !important;
	cursor: pointer !important;
	transition: background .15s ease !important;
	box-shadow: none !important;
	outline: 0 !important;
}
.sbn-search .sbn-search__btn:hover {
	background: var(--sbn-teal-dark, #0A5454) !important;
}
.sbn-search .sbn-search__btn svg {
	width: 20px;
	height: 20px;
	display: block;
}

/* ----- Results dropdown --------------------------------------------- */
.sbn-search__results {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	z-index: 1000;
	background: #fff;
	border: 1px solid var(--sbn-line, #E5E7EB);
	border-radius: 14px;
	box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
	max-height: 70vh;
	overflow-y: auto;
	overflow-x: hidden;
}
.sbn-search__results[hidden] { display: none !important; }

.sbn-search__result {
	display: grid;
	grid-template-columns: 64px 1fr auto;
	align-items: center;
	gap: 14px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--sbn-line, #E5E7EB);
	color: inherit;
	text-decoration: none;
	transition: background .12s ease;
}
.sbn-search__result:last-child { border-bottom: 0; }
.sbn-search__result:hover,
.sbn-search__result:focus {
	background: var(--sbn-soft, #F3F4F6);
	outline: none;
}

.sbn-search__result-img {
	width: 56px;
	height: 56px;
	border-radius: 8px;
	background: #fff;
	border: 1px solid var(--sbn-line, #E5E7EB);
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.sbn-search__result-img img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	display: block;
}

.sbn-search__result-body { min-width: 0; }
.sbn-search__result-title {
	font-size: 14px;
	font-weight: 600;
	color: var(--sbn-ink, #0F172A);
	margin: 0 0 3px;
	line-height: 1.35;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}
.sbn-search__result-cat {
	font-size: 12px;
	color: var(--sbn-mute, #6B7280);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sbn-search__result-price {
	font-size: 14px;
	font-weight: 700;
	color: var(--sbn-ink, #0F172A);
	white-space: nowrap;
	flex-shrink: 0;
}
.sbn-search__result-price del {
	color: var(--sbn-mute, #6B7280);
	font-weight: 500;
	font-size: 12px;
	margin-right: 4px;
}
.sbn-search__result-price ins { text-decoration: none; }

/* Status messages (loading / no results / view all link) */
.sbn-search__status {
	padding: 16px;
	text-align: center;
	color: var(--sbn-mute, #6B7280);
	font-size: 14px;
}
.sbn-search__viewall {
	display: block;
	padding: 12px 16px;
	text-align: center;
	background: var(--sbn-soft, #F3F4F6);
	color: var(--sbn-teal, #0E6B6B);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	border-top: 1px solid var(--sbn-line, #E5E7EB);
}
.sbn-search__viewall:hover { background: #E5E9EB; }

/* ----- Mobile collapse ---------------------------------------------- */
.sbn-search__mobile-toggle,
.sbn-search__close {
	display: none;
}
.sbn-search .sbn-search__mobile-toggle {
	-webkit-appearance: none !important;
	appearance: none !important;
	width: 44px;
	height: 44px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--sbn-ink, #0F172A);
	cursor: pointer;
	align-items: center;
	justify-content: center;
}
.sbn-search .sbn-search__mobile-toggle svg {
	width: 22px;
	height: 22px;
	display: block;color:#12888E;
}

@media (max-width: 768px) {
	/* Show toggle, hide form by default */
	.sbn-search .sbn-search__mobile-toggle {
		display: flex !important;
	}
	.sbn-search .sbn-search__form {
		display: none;
	}
	/*
	 * Reserve the right-hand 60px of the viewport for the close button so
	 * the search form's green search button doesn't collide with the X.
	 * Previously both elements were anchored to right: 12px and stacked on
	 * top of each other, plus the form's natural width extended off-screen.
	 *
	 * New layout:
	 *   [---------- form (input + magnifier btn) ----------][ × ]
	 *      left: 12px                       right: 72px    right: 12px
	 */
	.sbn-search.is-open .sbn-search__form {
		display: flex !important;
		position: fixed;
		top: 12px;
		left: 12px;
		right: 72px;             /* room for the X */
		width: auto !important;  /* override 100% from base styles */
		max-width: none;
		z-index: 99999;
		background: #fff;
		box-sizing: border-box;
	}
	.sbn-search.is-open .sbn-search__close {
		display: flex !important;
		position: fixed;
		top: 12px;
		right: 12px;
		z-index: 100000;
		width: 48px;
		height: 48px;
		align-items: center;
		justify-content: center;
		border: 0;
		border-radius: 50%;
		background: #fff;        /* sits over the dimmed backdrop */
		font-size: 28px;
		line-height: 1;
		color: var(--sbn-ink, #0F172A);
		cursor: pointer;
		box-shadow: 0 2px 8px rgba(15,23,42,.15);
	}
	/* Hide the input's native search-cancel-button on the mobile overlay —
	 * the dedicated X close handles dismissal there, and the duplicate
	 * mini-X next to the magnifier reads as a UI bug. */
	.sbn-search.is-open .sbn-search__input::-webkit-search-cancel-button {
		display: none;
	}
	.sbn-search.is-open::before {
		content: '';
		position: fixed;
		inset: 0;
		background: rgba(15, 23, 42, 0.55);
		z-index: 99998;
		animation: sbnSearchFade .2s ease;
	}
	.sbn-search.is-open .sbn-search__results {
		position: fixed;
		top: 76px;
		left: 12px;
		right: 12px;
		max-height: calc(100vh - 96px);
		z-index: 99999;
	}
}

@keyframes sbnSearchFade {
	from { opacity: 0; }
	to   { opacity: 1; }
}
