/**
 * B2B RFQ Pro — Header Search widget (SPEC.md §3.6). Baseline,
 * theme-agnostic structure and behaviour only — every colour, size,
 * spacing, and state value is an Elementor control (HeaderSearchWidget)
 * targeting the classes below via a {{WRAPPER}}-scoped selector.
 * Registered as this widget's own style dependency
 * (HeaderSearchWidget::get_style_depends()), so it loads only on a page
 * that actually uses this widget.
 *
 * One shared structure for all six modes (see HeaderSearchWidget's own
 * docblock) — mode-specific presentation is layered on top via
 * `[data-mode="..."]` attribute selectors and the panel's own `[hidden]`
 * attribute (server-rendered by HeaderSearchWidget::render(), toggled by
 * `header-search.js` on a real click/hover), never a second markup
 * structure. No `.is-expanded`/similar state class exists here — the
 * open/closed state is fully expressed by `[hidden]` and the trigger's
 * own `aria-expanded`, so there is nothing else for a rule here to key
 * off of.
 */

.b2b-rfq-header-search {
	position: relative;
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
}

.b2b-rfq-header-search-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	background: transparent;
	padding: 4px;
	cursor: pointer;
	color: inherit;
}

.b2b-rfq-header-search-trigger svg {
	display: block;
	width: 24px;
	height: 24px;
}

/* Visible field: the panel is always shown, laid out inline. */
.b2b-rfq-header-search[data-mode="visible"] .b2b-rfq-header-search-panel {
	position: relative;
}

/* Icon-triggered/dropdown/full-width: the panel is an absolutely
 * positioned overlay anchored under the trigger until expanded. */
.b2b-rfq-header-search[data-mode="icon_click"] .b2b-rfq-header-search-panel,
.b2b-rfq-header-search[data-mode="icon_hover"] .b2b-rfq-header-search-panel,
.b2b-rfq-header-search[data-mode="dropdown"] .b2b-rfq-header-search-panel {
	position: absolute;
	top: 100%;
	right: 0;
	z-index: 100;
	width: max-content;
	min-width: 320px;
}

/* Full width: the expanded panel spans the widget's own full width
 * (typically stretched to the header's width by the theme/layout). */
.b2b-rfq-header-search[data-mode="full_width"] .b2b-rfq-header-search-panel {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 100;
}

/* Full screen: the panel becomes a fixed, full-viewport overlay.
 * `:not([hidden])` is load-bearing, not decorative: without it this
 * selector's specificity (0,3,0 — two classes + one attribute selector)
 * beats `.b2b-rfq-header-search-panel[hidden] { display: none; }`
 * (0,2,0) outright, regardless of source order, so the panel would
 * render `display: flex` even while `hidden` — a full-viewport overlay
 * stuck permanently visible, on a real front-end page too, not just the
 * editor. Scoping this rule to only match when `hidden` is absent makes
 * the two selectors mutually exclusive instead of racing on
 * specificity. */
.b2b-rfq-header-search[data-mode="full_screen"] .b2b-rfq-header-search-panel:not([hidden]) {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	padding: 48px 24px;
	overflow-y: auto;
}

body.b2b-rfq-header-search-lock-scroll {
	overflow: hidden;
}

.b2b-rfq-header-search-panel {
	box-sizing: border-box;
	background-color: #ffffff;
	border: 1px solid #d4d4d8;
	border-radius: 4px;
	padding: 12px;
}

.b2b-rfq-header-search-panel[hidden] {
	display: none;
}

.b2b-rfq-header-search-close {
	align-self: flex-end;
	display: inline-flex;
	border: 0;
	background: transparent;
	cursor: pointer;
	color: inherit;
	padding: 8px;
}

.b2b-rfq-header-search-close svg {
	display: block;
	width: 28px;
	height: 28px;
}

.b2b-rfq-header-search-form {
	display: flex;
	align-items: stretch;
	gap: 8px;
	width: 100%;
}

.b2b-rfq-header-search-label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.b2b-rfq-header-search-input-wrap {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
}

.b2b-rfq-header-search-input {
	width: 100%;
	box-sizing: border-box;
	border: 1px solid #d4d4d8;
	border-radius: 4px;
	padding: 8px 36px 8px 12px;
	font: inherit;
	color: inherit;
	background-color: #ffffff;
}

.b2b-rfq-header-search-clear {
	position: absolute;
	top: 50%;
	right: 8px;
	transform: translateY( -50% );
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #71717a;
	cursor: pointer;
}

.b2b-rfq-header-search-clear[hidden] {
	display: none;
}

.b2b-rfq-header-search-clear svg {
	width: 100%;
	height: 100%;
}

.b2b-rfq-header-search-submit {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid transparent;
	border-radius: 4px;
	padding: 8px 16px;
	background-color: #18181b;
	color: #ffffff;
	cursor: pointer;
}

.b2b-rfq-header-search-submit svg {
	width: 18px;
	height: 18px;
}

.b2b-rfq-header-search-results {
	margin-top: 8px;
	display: flex;
	flex-direction: column;
	max-height: 360px;
	overflow-y: auto;
}

.b2b-rfq-header-search-results[hidden] {
	display: none;
}

.b2b-rfq-header-search-suggestion {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px;
	border-radius: 4px;
	cursor: pointer;
}

.b2b-rfq-header-search-suggestion:hover,
.b2b-rfq-header-search-suggestion.is-active {
	background-color: #f4f4f5;
}

.b2b-rfq-header-search-suggestion-image {
	flex: 0 0 auto;
	display: block;
}

.b2b-rfq-header-search-suggestion-img {
	display: block;
	width: 48px;
	height: 48px;
	object-fit: cover;
}

.b2b-rfq-header-search-suggestion-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.b2b-rfq-header-search-suggestion-title {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.b2b-rfq-header-search-suggestion-sku {
	font-size: 0.85em;
	color: #71717a;
}

.b2b-rfq-header-search-view-all {
	display: block;
	margin-top: 8px;
	text-align: center;
}

.b2b-rfq-header-search-view-all[hidden] {
	display: none;
}

.b2b-rfq-header-search-message {
	margin: 8px 0 0;
	color: #52525b;
	font-size: 0.875em;
}

.b2b-rfq-header-search-message:empty {
	display: none;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.b2b-rfq-header-search.is-loading .b2b-rfq-header-search-panel {
	opacity: 0.85;
}
