/* =============================================================
   Fair Business — global search overlay.
   Mobile: full-screen modal.
   Desktop ≥768px: floating panel docked beneath the header's search
   bar; appears centered, ~640px wide.

   Same DOM, different presentation. Search.js controls the open/close
   state and result rendering — this file only styles.
   ============================================================= */

.fb-search-overlay {
	position: fixed;
	inset: 0;
	z-index: 110;
	display: flex;
	align-items: stretch;
	justify-content: center;
	opacity: 0;
	/* Critical: with display:flex the overlay was capturing pointer events
	   across the whole viewport even at opacity 0, making the page beneath
	   unclickable. `[hidden]` also has to be honored explicitly — class
	   selectors out-specificity the UA `[hidden] { display: none }`. Both
	   guards together: hidden = removed; not-yet-open = visually fading
	   in but inert until is-open. */
	pointer-events: none;
	transition: opacity .18s ease;
}
.fb-search-overlay[hidden] { display: none !important; }
.fb-search-overlay.is-open {
	opacity: 1;
	pointer-events: auto;
}

.fb-search-scrim {
	position: absolute; inset: 0;
	background: rgba(15,23,42,.55);
	backdrop-filter: blur(2px);
}

.fb-search-panel {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--white, #fff);
	width: 100%;
	max-width: 100%;
	height: 100dvh;
	overflow: hidden;
}

@media (min-width: 768px) {
	.fb-search-overlay { align-items: flex-start; padding-top: 80px; }
	.fb-search-panel {
		max-width: 640px;
		height: auto;
		max-height: calc(100dvh - 120px);
		border-radius: 16px;
		box-shadow: 0 24px 60px rgba(15,23,42,.22);
	}
}

/* === Input row === */
.fb-search-input-row {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	border-bottom: 1px solid var(--slate-100, #f1f5f9);
	background: var(--white, #fff);
}
@media (min-width: 768px) {
	.fb-search-input-row { padding: 16px 18px; }
}

.fb-search-glyph {
	width: 20px; height: 20px;
	flex-shrink: 0;
	color: var(--slate-500, #64748b);
}

.fb-search-input {
	flex: 1;
	min-width: 0;
	height: 36px;
	border: 0;
	background: transparent;
	font: inherit;
	font-size: var(--fs-lg);
	color: var(--slate-900, #0f172a);
	outline: none;
}
.fb-search-input::placeholder { color: var(--slate-400, #94a3b8); }
/* Suppress browser-native search ×. We render our own .fb-search-clear and
   .fb-search-cancel buttons — without this CSS, Chrome/Safari painted a third
   tiny × inside the input itself, so the user saw three close glyphs in a row. */
.fb-search-input::-webkit-search-cancel-button,
.fb-search-input::-webkit-search-decoration {
	-webkit-appearance: none;
	appearance: none;
	display: none;
}

.fb-search-cancel {
	width: 32px; height: 32px;
	flex-shrink: 0;
	background: transparent;
	border: 0;
	cursor: pointer;
	color: var(--slate-500, #64748b);
	border-radius: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.fb-search-cancel:hover { background: var(--slate-100, #f1f5f9); color: var(--slate-900, #0f172a); }
.fb-search-cancel svg { width: 18px; height: 18px; }
@media (min-width: 768px) {
	/* Desktop: hide the Cancel button; clicking the scrim or pressing Esc closes. */
	.fb-search-cancel { display: none; }
}

/* === Results === */
.fb-search-results {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 6px 0 14px;
}

.fb-sr-group {
	padding: 8px 0;
	border-bottom: 1px solid var(--slate-100, #f1f5f9);
}
.fb-sr-group:last-child { border-bottom: none; }

.fb-sr-group-label {
	display: flex; align-items: center; justify-content: space-between;
	margin: 0;
	padding: 6px 18px 8px;
	font-size: var(--fs-xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--slate-500, #64748b);
}

.fb-sr-clear {
	background: transparent;
	border: 0;
	cursor: pointer;
	font-size: var(--fs-xs);
	font-weight: 500;
	color: var(--slate-500, #64748b);
	text-transform: none;
	letter-spacing: 0;
}
.fb-sr-clear:hover { color: var(--slate-900, #0f172a); text-decoration: underline; }

.fb-sr-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.fb-sr-item {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 10px 18px;
	background: transparent;
	border: 0;
	cursor: pointer;
	text-align: left;
	color: var(--slate-900, #0f172a);
	text-decoration: none;
	transition: background .12s ease;
}
.fb-sr-item:hover,
.fb-sr-item.is-focus { background: var(--slate-50, #f8fafc); }

.fb-sr-thumb {
	width: 40px; height: 40px;
	flex-shrink: 0;
	border-radius: 8px;
	overflow: hidden;
	background: var(--slate-100, #f1f5f9);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--slate-500, #64748b);
	font-weight: 700;
	font-size: var(--fs-base);
}
.fb-sr-thumb.is-product { border-radius: 6px; }
.fb-sr-thumb.has-img { background: var(--white, #fff); border: 1px solid var(--slate-100, #f1f5f9); }
.fb-sr-thumb.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fb-sr-thumb.is-cat svg { width: 18px; height: 18px; color: var(--slate-500, #64748b); }
.fb-sr-thumb.is-recent svg { width: 16px; height: 16px; color: var(--slate-400, #94a3b8); }
.fb-sr-thumb.is-cat { background: var(--green-50, #f0fdf4); color: var(--green-dark, #166534); }
.fb-sr-thumb.is-letter { background: var(--green-50, #f0fdf4); color: var(--green-dark, #166534); }

.fb-sr-meta {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	flex: 1;
}
.fb-sr-meta strong {
	font-weight: 600;
	font-size: var(--fs-base);
	color: var(--slate-900, #0f172a);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.fb-sr-meta small {
	font-size: var(--fs-xs);
	color: var(--slate-500, #64748b);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fb-sr-see-all {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin: 10px 18px 4px;
	padding: 10px 14px;
	background: var(--slate-50, #f8fafc);
	border-radius: 8px;
	font-size: var(--fs-base);
	font-weight: 600;
	color: var(--slate-800, #1e293b);
	text-decoration: none;
	transition: background .12s ease;
}
.fb-sr-see-all:hover { background: var(--slate-100, #f1f5f9); color: var(--slate-900, #0f172a); }
.fb-sr-see-all svg { width: 14px; height: 14px; }

.fb-search-empty {
	padding: 32px 18px;
	text-align: center;
	font-size: var(--fs-base);
	color: var(--slate-500, #64748b);
}
.fb-search-empty strong { color: var(--slate-900, #0f172a); font-weight: 600; }
