/**
 * 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.
 */
.b2b-rfq-product-filter-control {
	position: relative;
	display: block;
}

.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;
}

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

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

/**
 * 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%;
	}
}
