/**
 * B2B RFQ Pro — Product Filter Bar widget (SPEC.md §3.5/§3.6,
 * phase-product-filter-bar-widget). Baseline, theme-agnostic structure
 * only — every colour, size, spacing, and typography value beyond the
 * bare functional minimum below is an Elementor control
 * (ProductFilterBarWidget) targeting the classes below via a
 * {{WRAPPER}}-scoped selector. Registered as this widget's own style
 * dependency (ProductFilterBarWidget::get_style_depends()), so it loads
 * only on a page that actually uses it.
 *
 * Every `<select>` is a real, native form control (templates/frontend/
 * product-filter-bar.php) — `appearance: none` strips the browser's own
 * default arrow so this file's own CSS-only chevron
 * (.b2b-rfq-product-filter-chevron) is the only one shown, in every
 * preset.
 */

.b2b-rfq-product-filter-bar {
	box-sizing: border-box;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 16px;
}

.b2b-rfq-product-filter {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.b2b-rfq-product-filter-label {
	display: block;
	font-size: 12px;
	color: #6b7280;
	white-space: nowrap;
}

/**
 * Wraps the <select> and its chevron together, separate from the label
 * above — the chevron (below) is positioned absolutely relative to *this*
 * element, not the outer .b2b-rfq-product-filter block, so it stays
 * vertically centred on the select regardless of the label's own height.
 *
 * Staging finding B (phase-product-filter-bar-label-height-controls):
 * `flex: 1 1 auto` — a flex-item property, meaningful only because this
 * element's own parent, `.b2b-rfq-product-filter`, is `display: flex;
 * flex-direction: column;` (above). Confirmed inert on any instance that
 * hasn't set `filter_row_height` (ProductFilterBarWidget): with no
 * explicit height on `.b2b-rfq-product-filter`, its own height stays
 * `auto` (content-driven), so there is no leftover space for this element
 * to grow into and `flex-grow` has no visible effect. Once an admin sets
 * Row Height, this element grows to fill the space left over after the
 * label, giving the `<select>` below (via its own `height: 100%`) a real,
 * definite height to fill — so the row genuinely looks taller instead of
 * gaining invisible dead space below an unchanged select.
 */
.b2b-rfq-product-filter-control {
	position: relative;
	display: block;
	flex: 1 1 auto;
}

.b2b-rfq-product-filter-select {
	box-sizing: border-box;
	display: block;
	width: 100%;
	max-width: 240px;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-color: #ffffff;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	padding: 8px 32px 8px 12px;
	font: inherit;
	font-size: 14px;
	color: #1a1a1a;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
	/**
	 * Staging finding B (phase-product-filter-bar-label-height-controls):
	 * resolves against `.b2b-rfq-product-filter-control`'s own height —
	 * `auto` (matching this select's own natural content height, no visible
	 * change) unless that parent has been given a definite height by its
	 * own `flex: 1 1 auto` (above) growing inside a `filter_row_height`
	 * -sized `.b2b-rfq-product-filter`, per CSS's own percentage-height
	 * resolution rules.
	 */
	height: 100%;
}

.b2b-rfq-product-filter-select:focus {
	outline: none;
	border-color: #1a1a1a;
}

.b2b-rfq-product-filter-select:disabled {
	cursor: not-allowed;
	opacity: 0.65;
}

/**
 * Staging fix (phase-kit5-style-leak-sweep-2, follow-up to phase-minicart
 * -kit5-style-leak-fix/PR #124): PR #124's own sweep flagged this
 * element as "unconfirmed" — Kit-5's exact `select` selector was reported
 * for other elements but never checked against this one specifically.
 * Now confirmed by the same specificity arithmetic PR #124 already
 * established for `textarea`/`select` (`.elementor-kit-5 select`, class +
 * type, no `:not()` needed, specificity (0,1,1)): the bare rule above,
 * one class, (0,1,0), loses outright (class column ties at 1, Kit-5 wins
 * the type column) — every property this rule sets that Kit-5's own
 * global select style also sets (background/border/padding at minimum)
 * would lose, including `appearance: none`'s effect if Kit-5 sets its
 * own. No live staging instance to inspect this phase — derived by
 * arithmetic only, not re-verified against a real Kit-5 install; still
 * lower-confidence than the other fixes in this phase for that reason.
 *
 * `.b2b-rfq-product-filter-bar` (this file's own outer wrapper,
 * product-filter-bar.php) is the confirmed real ancestor for every real
 * `<select>` in this template — two real classes, specificity (0,2,0),
 * already strictly beats Kit-5's (0,1,1) via the class column alone
 * (2 > 1). Deliberately the SAME specificity as this file's own Style
 * Preset overrides below (`.b2b-rfq-product-filter-bar--capsule
 * .b2b-rfq-product-filter-select` etc., also two real classes) and placed
 * before them in this file — a tie an active preset's own rule still
 * wins via plain source order (later in the file), so switching presets
 * stays exactly as before. Comfortably below `filter_select_bg_color`/
 * `filter_select_padding`/etc.'s own real `{{WRAPPER}}`-scoped (0,4,0)
 * (ProductFilterBarWidget) — that control's own value still wins
 * whenever set. No `!important`. Full property set re-declared,
 * byte-identical to the bare rule above (not just the contested
 * properties).
 */
.b2b-rfq-product-filter-bar .b2b-rfq-product-filter-select {
	box-sizing: border-box;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-color: #ffffff;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	padding: 8px 32px 8px 12px;
	font: inherit;
	font-size: 14px;
	color: #1a1a1a;
}

/**
 * CSS-only chevron (a rotated border corner, no icon font/SVG
 * dependency) — every preset shares this element; only its colour/
 * rotation-on-hover behaviour differs per preset below.
 */
.b2b-rfq-product-filter-chevron {
	position: absolute;
	top: 50%;
	right: 12px;
	width: 7px;
	height: 7px;
	border-right: 2px solid #6b7280;
	border-bottom: 2px solid #6b7280;
	transform: translateY(-70%) rotate(45deg);
	pointer-events: none;
	transition: transform 0.2s ease, border-color 0.2s ease;
}

/**
 * Loading state (mirrored from the paired archive's own .is-loading
 * class by product-filter-bar.js's own observeLoadingState()) — fades
 * the bar in place, no layout shift, same convention the archive engine
 * itself already uses for its own content region.
 */
.b2b-rfq-product-filter-bar.is-loading {
	opacity: 0.6;
}

/**
 * Editor-only notice (product-filter-bar.js's own showEditorNotice()) —
 * never shown to a real front-end visitor. Same dashed-amber convention
 * every other editor-only notice in this plugin already uses.
 */
.b2b-rfq-product-filter-bar-editor-notice {
	flex-basis: 100%;
	margin: 0;
	padding: 8px 12px;
	border: 1px dashed #f59e0b;
	border-radius: 4px;
	background-color: #fffbeb;
	color: #92400e;
	font-size: 0.875em;
}

/**
 * ============================================================
 * Style Presets (phase-product-filter-bar-widget,
 * ProductFilterBarWidget's own `style_preset` SELECT). 'default' (the
 * control's own default) uses only the plain, functional baseline above
 * — no extra CSS at all beyond this point. Every preset below shares one
 * accent custom property (--b2b-rfq-filter-accent, set by
 * preset_accent_color) rather than a colour control per preset, the same
 * "one accent, several ways" technique BrandGridWidget's own Style
 * Presets already establish.
 * ============================================================
 */

/**
 * Preset: Capsule Segment Control. Bordered rounded box, a small
 * uppercase meta-label always visible above the value (the shared
 * .b2b-rfq-product-filter-label already renders above the select in
 * every preset — this preset is the one that gives it its own
 * distinctive, always-legible treatment), and the shared chevron.
 */
.b2b-rfq-product-filter-bar--capsule .b2b-rfq-product-filter-label {
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-size: 11px;
	padding-left: 14px;
}

.b2b-rfq-product-filter-bar--capsule .b2b-rfq-product-filter-select {
	border: 2px solid #e5e7eb;
	border-radius: 999px;
	padding: 10px 34px 10px 16px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.b2b-rfq-product-filter-bar--capsule .b2b-rfq-product-filter-select:hover:not(:disabled),
.b2b-rfq-product-filter-bar--capsule .b2b-rfq-product-filter-select:focus {
	border-color: var( --b2b-rfq-filter-accent, #2271b1 );
}

.b2b-rfq-product-filter-bar--capsule .b2b-rfq-product-filter-chevron {
	border-color: var( --b2b-rfq-filter-accent, #2271b1 );
}

/**
 * Preset: Minimalist Underline. Text-only trigger — no visible box
 * border at all — with a thin underline that grows from the centre on
 * hover, and the shared chevron rotating 180deg on hover.
 */
.b2b-rfq-product-filter-bar--underline .b2b-rfq-product-filter-select {
	border: none;
	border-bottom: 1px solid #d0d0d0;
	border-radius: 0;
	background-color: transparent;
	padding: 6px 28px 6px 2px;
}

.b2b-rfq-product-filter-bar--underline .b2b-rfq-product-filter-control {
	position: relative;
}

.b2b-rfq-product-filter-bar--underline .b2b-rfq-product-filter-control::after {
	content: '';
	position: absolute;
	left: 50%;
	right: 50%;
	bottom: 0;
	height: 2px;
	background-color: var( --b2b-rfq-filter-accent, #2271b1 );
	transition: left 0.25s ease, right 0.25s ease;
}

.b2b-rfq-product-filter-bar--underline .b2b-rfq-product-filter-control:hover::after {
	left: 0;
	right: 0;
}

.b2b-rfq-product-filter-bar--underline .b2b-rfq-product-filter-control:hover .b2b-rfq-product-filter-chevron {
	transform: translateY(-70%) rotate(225deg);
	border-color: var( --b2b-rfq-filter-accent, #2271b1 );
}

/**
 * Preset: Glassmorphism Floating Box. Frosted-glass blur background,
 * subtle lift and shadow on hover.
 */
.b2b-rfq-product-filter-bar--glassmorphism .b2b-rfq-product-filter-select {
	background-color: rgba( 255, 255, 255, 0.55 );
	backdrop-filter: blur( 8px );
	-webkit-backdrop-filter: blur( 8px );
	border: 1px solid rgba( 255, 255, 255, 0.4 );
	border-radius: 10px;
	box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.06 );
	transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.b2b-rfq-product-filter-bar--glassmorphism .b2b-rfq-product-filter-select:hover:not(:disabled),
.b2b-rfq-product-filter-bar--glassmorphism .b2b-rfq-product-filter-select:focus {
	transform: translateY( -2px );
	background-color: rgba( 255, 255, 255, 0.75 );
	border-color: var( --b2b-rfq-filter-accent, #2271b1 );
	box-shadow: 0 8px 20px rgba( 0, 0, 0, 0.12 );
}

/**
 * prefers-reduced-motion — same "no transition/transform for a visitor
 * who has asked for reduced motion" rule every other animated surface in
 * this plugin already honours (brand-grid.css's own block is the most
 * recent precedent). Covers every preset's own hover transition/
 * transform above in one place.
 */
@media ( prefers-reduced-motion: reduce ) {
	.b2b-rfq-product-filter-select,
	.b2b-rfq-product-filter-chevron,
	.b2b-rfq-product-filter-control::after {
		transition: none !important;
	}

	.b2b-rfq-product-filter-bar--glassmorphism .b2b-rfq-product-filter-select:hover:not(:disabled),
	.b2b-rfq-product-filter-bar--glassmorphism .b2b-rfq-product-filter-select:focus {
		transform: none !important;
	}
}

/**
 * Responsive — verified empirically (headless Chromium, real markup)
 * against all six of this project's own reference breakpoints (Desktop,
 * Laptop 1366px, Tablet Landscape 1200px, Tablet Portrait 1000px,
 * Mobile Landscape 880px, Mobile Portrait 767px) for all four presets;
 * see this phase's own PR description for the full measurements.
 * flex-wrap on the base rule already lets filters drop to their own line
 * as space runs out — this block only narrows each filter's own maximum
 * width below Tablet Portrait, so four dropdowns wrapping to two rows of
 * two (rather than one very wide row) still each stay a comfortable,
 * legible width instead of stretching edge-to-edge.
 */
@media ( max-width: 999px ) {
	.b2b-rfq-product-filter {
		flex: 1 1 45%;
	}

	.b2b-rfq-product-filter-select {
		max-width: 100%;
	}
}

@media ( max-width: 767px ) {
	.b2b-rfq-product-filter-bar {
		gap: 12px;
	}

	.b2b-rfq-product-filter {
		flex: 1 1 100%;
	}
}
