/**
 * Showcase IDX – Zillow-Style Search Bar (styling)
 * -----------------------------------------------------------------------------
 * Matches the site's existing SIDX widget: brand green #408175, Roboto,
 * 8px radius, ~58px control height. NOT Zillow's blue. Only styles the
 * elements this plugin injects, plus a light layout nudge on the SIDX bar.
 * -----------------------------------------------------------------------------
 */

:root {
	--sidxzb-brand: #408175;
	--sidxzb-brand-dark: #356b61;
	--sidxzb-border: #d6dbe0;
	--sidxzb-text: #2b2b2b;
	--sidxzb-radius: 8px;
	--sidxzb-height: 50px; /* ONE height shared by every control in the bar */
	--sidxzb-font: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* The SIDX basic bar becomes a wrapping flex row so `order` works. */
.sidxzb-bar.sidx-basic,
.sidxzb-bar {
	display: flex !important;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-start !important; /* SIDX spreads items full-width otherwise */
	gap: 8px;
}
/* Keep SIDX's own fields compact — SIDX assigns flex-grow (10/2/1) to its
   wrappers, which stretches them wide while the visible control stays small;
   that empty wrapper space was the "huge gaps". !important beats SIDX's rules. */
.sidxzb-bar > * {
	flex: 0 0 auto !important;
	width: auto !important;
	min-width: 0 !important;
}
.sidxzb-bar .sidx-locations-field-wrapper {
	/* Location is the hero field — bigger, absorbs the most leftover width. */
	flex: 1 1 420px !important;
	min-width: 300px !important;
	max-width: 640px !important;
}

/* Elements intentionally removed from this build (see enhance() in the JS).
   Save Search is a native SIDX element, so it's hidden rather than deleted.
   Extra `html` prefix raises specificity so this always beats the uniform-
   height rule below (which sets display:inline-flex on the Save Search pill). */
html .sidxzb-bar .sidx-save-search-pill,
html .sidxzb-pill--type {
	display: none !important;
}
/* Beds & Baths share one wrapper — keep its two fields snug together. */
.sidxzb-bar .sidx-beds-and-baths {
	display: inline-flex !important;
	gap: 8px;
}

/* ---- Uniform heights: every control in the bar shares one height ----
   IMPORTANT: the height must be enforced on the WRAPPER CHAIN, not just on
   .sidx-field. When a dropdown opens, SIDX swaps the field out for its
   min/max inputs and the wrapper collapses (50px -> 28px); with the bar
   vertically centered that made the button visibly drop ~11px. */
.sidxzb-bar > .sidx-range,
.sidxzb-bar > .sidx-range > *:not(.sidx-floating-menu),
.sidxzb-bar .sidx-range .sidx-dropdown,
.sidxzb-bar .sidx-range .sidx-floating-menu-anchor,
.sidxzb-bar .sidx-range .sidx-floating-menu-anchor > *:not(.sidx-floating-menu),
.sidxzb-bar .sidx-beds-and-baths .sidx-dropdown,
.sidxzb-bar .sidx-beds-and-baths .sidx-floating-menu-anchor,
.sidxzb-bar .sidx-streamlined-search .sidx-dropdown,
.sidxzb-bar .sidx-streamlined-search .sidx-floating-menu-anchor {
	height: var(--sidxzb-height) !important;
	min-height: var(--sidxzb-height) !important;
	align-self: center !important;
	box-sizing: border-box !important;
}
/* The floating panel must never inherit the field height (it would squash to
   50px and hide its options). :not() above keeps it out of the rule. */
.sidxzb-bar .sidx-floating-menu {
	height: auto !important;
	min-height: 0 !important;
	align-self: auto !important;
}

.sidxzb-bar .sidx-field,
.sidxzb-bar .sidx-dropdown-pill,
.sidxzb-bar .sidx-streamlined-toggle,
.sidxzb-bar .sidx-save-search-pill,
.sidxzb-bar button.sidx-primary {
	height: var(--sidxzb-height) !important;
	min-height: var(--sidxzb-height) !important;
	display: inline-flex !important;
	align-items: center !important;
	box-sizing: border-box !important;
}
.sidxzb-bar .sidx-locations-field-wrapper input,
.sidxzb-bar .sidx-suggestions-input input,
.sidxzb-bar .sidx-locations-field-wrapper .sidx-suggestions-input {
	height: var(--sidxzb-height) !important;
	min-height: var(--sidxzb-height) !important;
	box-sizing: border-box !important;
}

/* While the driver silently opens the modal to read/set values, hide it so
   the user never sees it flash. The REAL modal is a ReactModal portal —
   .ReactModal__Overlay is the fixed, full-screen, z-index 9999999 element,
   so THAT is what must be hidden (not the zero-height wrapper). Because the
   `sidxzb-driving` class sits on <html> BEFORE the modal mounts, this rule
   applies the instant ReactModal renders — no flash. Uses opacity/visibility
   (not off-screen) so SIDX's internal getBoundingClientRect math still works. */
.sidxzb-driving .ReactModal__Overlay,
.sidxzb-driving .ReactModal__Content,
.sidxzb-driving .sidx-streamlined-modal-container,
.sidxzb-driving .sidx-floating-menu {
	opacity: 0 !important;
	visibility: hidden !important;
	pointer-events: none !important;
}

/* ---- Injected pills (Status, Property Type) ---- */
.sidxzb-pill {
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	gap: 6px;
	height: var(--sidxzb-height);
	padding: 0 14px;
	font-family: var(--sidxzb-font);
	font-size: 14px;
	font-weight: 500;
	color: var(--sidxzb-text);
	background: #fff;
	border: 1px solid var(--sidxzb-border);
	border-radius: var(--sidxzb-radius);
	cursor: pointer;
	white-space: nowrap;
	line-height: 1;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.sidxzb-pill:hover {
	border-color: var(--sidxzb-brand);
}
.sidxzb-pill[aria-expanded="true"] {
	border-color: var(--sidxzb-brand);
	box-shadow: 0 0 0 2px rgba(64, 129, 117, .18);
}
/* Zillow-style active state: when a filter is set, the pill highlights.
   SOLID light-green fill — a transparent tint disappears over the dark
   hero image and left the pill looking like bare text. */
.sidxzb-pill.sidxzb-active {
	border-color: var(--sidxzb-brand) !important;
	background: #e7f2ef !important;
	color: var(--sidxzb-brand-dark) !important;
	font-weight: 600;
}
.sidxzb-pill.sidxzb-active .sidxzb-caret {
	color: var(--sidxzb-brand);
}
.sidxzb-pill__label {
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 160px;
}
.sidxzb-caret {
	font-size: 11px;
	color: #7a7a7a;
}

/* ---- Dropdown menus for the pills ---- */
.sidxzb-menu {
	position: fixed;
	/* Above SIDX's own ReactModal overlay (9999999) and any theme layer.
	   The menu is also portaled to <body> at open time (see positionMenu). */
	z-index: 2147483000;
	display: none;
	box-sizing: border-box;
	max-height: 320px;
	overflow-y: auto;
	overflow-x: hidden;
	margin: 0;
	padding: 6px;
	background: #fff;
	border: 1px solid var(--sidxzb-border);
	border-radius: var(--sidxzb-radius);
	box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
	font-family: var(--sidxzb-font);
}
.sidxzb-menu.sidxzb-open {
	display: block;
}
/* !important guards: the theme styles generic <button> elements (stretched,
   centered, grey) — these keep menu items looking like menu items. */
.sidxzb-menu__item {
	display: block !important;
	width: 100% !important;
	min-width: 0 !important;
	max-width: none !important;
	text-align: left !important;
	margin: 0 !important;
	padding: 9px 12px !important;
	font-size: 14px !important;
	font-weight: 400 !important;
	line-height: 1.35 !important;
	color: var(--sidxzb-text) !important;
	background: transparent !important;
	border: 0 !important;
	border-radius: 6px !important;
	box-shadow: none !important;
	cursor: pointer;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	box-sizing: border-box;
}
.sidxzb-menu__item:hover {
	background: rgba(64, 129, 117, .10) !important;
	color: var(--sidxzb-brand-dark) !important;
}
/* Zillow-style checkmark on the currently-selected option. */
.sidxzb-menu__item.sidxzb-current {
	color: var(--sidxzb-brand-dark) !important;
	font-weight: 600 !important;
	padding-right: 30px !important;
	position: relative;
}
.sidxzb-menu__item.sidxzb-current::after {
	content: "✓";
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--sidxzb-brand);
	font-weight: 700;
}

/* ---- Reset button (compact, sits beside Search) ---- */
.sidxzb-reset {
	height: var(--sidxzb-height) !important;
	min-height: var(--sidxzb-height) !important;
	width: auto !important;
	min-width: 0 !important;
	max-width: none !important;
	flex: 0 0 auto !important;   /* never stretch across the row */
	display: inline-flex !important;
	align-items: center !important;
	margin: 0 !important;
	padding: 0 16px !important;
	font-family: var(--sidxzb-font);
	font-size: 14px !important;
	font-weight: 500 !important;
	color: var(--sidxzb-brand) !important;
	background: #fff !important;
	border: 1px solid var(--sidxzb-brand) !important;
	border-radius: var(--sidxzb-radius) !important;
	box-sizing: border-box !important;
	cursor: pointer;
	white-space: nowrap;
	transition: background .15s ease, color .15s ease;
}
.sidxzb-reset:hover {
	background: var(--sidxzb-brand);
	color: #fff;
}

/* ---- Unified field styling: one visual language for the whole bar ----
   SIDX ships Price/Beds/Baths as dark boxes and Save Search in blue; the
   theme leaves Filters as a green outline. Restyle them all to the same
   white pill look so the bar reads as one design, Zillow-style. */
.sidxzb-bar .sidx-field,
.sidxzb-bar .sidx-streamlined-toggle,
.sidxzb-bar .sidx-save-search-pill {
	background: #fff !important;
	color: var(--sidxzb-text) !important;
	border: 1px solid var(--sidxzb-border) !important;
	border-radius: var(--sidxzb-radius) !important;
	box-shadow: none !important;
	padding-left: 14px !important;
	padding-right: 14px !important;
}
.sidxzb-bar .sidx-field,
.sidxzb-bar .sidx-field span,
.sidxzb-bar .sidx-field i,
.sidxzb-bar .sidx-streamlined-toggle,
.sidxzb-bar .sidx-streamlined-toggle span,
.sidxzb-bar .sidx-streamlined-toggle i,
.sidxzb-bar .sidx-save-search-pill,
.sidxzb-bar .sidx-save-search-pill span,
.sidxzb-bar .sidx-save-search-pill i {
	color: var(--sidxzb-text) !important;
	font-family: var(--sidxzb-font) !important;
	font-size: 14px !important;
	font-weight: 500 !important;
}
.sidxzb-bar .sidx-field:hover,
.sidxzb-bar .sidx-streamlined-toggle:hover,
.sidxzb-bar .sidx-save-search-pill:hover {
	border-color: var(--sidxzb-brand) !important;
}

/* Search button: primary green, compact — never stretched across the row. */
.sidxzb-bar button.sidx-primary,
.sidx-searchform button.sidx-primary {
	width: auto !important;
	min-width: 110px !important;
	max-width: 180px !important;
	flex: 0 0 auto !important;
	background: var(--sidxzb-brand) !important;
	color: #fff !important;
	border: 0 !important;
	border-radius: var(--sidxzb-radius) !important;
	font-family: var(--sidxzb-font) !important;
	font-size: 15px !important;
	font-weight: 600 !important;
	padding: 0 24px !important;
	justify-content: center !important;
}
.sidxzb-bar button.sidx-primary:hover {
	background: var(--sidxzb-brand-dark) !important;
}

/* Location box: center the search icon and placeholder on one line. */
.sidxzb-bar .sidx-locations-field-wrapper .sidx-suggestions-input {
	position: relative !important;
	display: flex !important;
	align-items: center !important;
	height: var(--sidxzb-height) !important;
	box-sizing: border-box !important;
}
.sidxzb-bar .sidx-locations-field-wrapper .sidx-icon.sidx-search,
.sidxzb-bar .sidx-locations-field-wrapper i.sidx-fa-search {
	position: absolute !important;
	left: 12px !important;
	top: 50% !important;
	transform: translateY(-50%) !important;
	margin: 0 !important;
	line-height: 1 !important;
}
.sidxzb-bar .sidx-locations-field-wrapper input {
	padding: 0 12px 0 36px !important;
	line-height: normal !important;
	border-radius: var(--sidxzb-radius) !important;
}

/* SIDX's own panels (Price/Beds/Baths/Filters) live INSIDE the search bar,
   which is a stacking context at z-index:10. Later page sections (e.g. the
   listing results grid) paint above it, so those panels were half-covered.
   While a native dropdown is open we lift the bar's whole stacking context;
   the class is removed as soon as it closes, so the bar never permanently
   overlays the site header. */
.sidxzb-bar.sidxzb-menuopen {
	position: relative !important;
	z-index: 2147482000 !important;
}
/* NOTE: the CSS above is not sufficient on its own — Elementor's wrapper
   creates a stacking context the bar cannot escape. liftStackingContexts()
   in the JS raises the whole ancestor chain while a panel is open. */
.sidxzb-bar .sidx-floating-menu {
	z-index: 2147483000 !important;
}

/* SIDX positions each field's dropdown panel at its ORIGINAL ~28px field
   height; with our 50px fields the panel opened overlapping the button.
   Pin panels to open just below the field instead. */
.sidxzb-bar .sidx-dropdown .sidx-floating-menu {
	top: calc(var(--sidxzb-height) + 4px) !important;
	border-radius: var(--sidxzb-radius) !important;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .14) !important;
}

/* ---- Single-row layout ----
   Everything on one line:
   Location | Status | Property Type | Price | Beds | Baths | Filters | Search | Reset | Save Search
   Location absorbs spare width; the rest stay compact. On viewports too narrow
   to fit, the flex row wraps gracefully. (The old .sidxzb-rowbreak element and
   the full-width Search override were removed for the single-row layout.) */
.sidxzb-bar button.sidx-primary,
.sidx-searchform button.sidx-primary {
	flex: 0 0 auto !important;
	min-width: 110px !important;
	max-width: 180px !important;
}

/* ---- Desktop: distribute the row evenly, Location dominant ----
   Remaining controls: Location (hero) | Status | Price | Beds | Baths | Filters | Search */
@media (min-width: 641px) {
	.sidxzb-bar .sidx-range              { flex: 1 1 0 !important; }
	.sidxzb-bar .sidx-beds-and-baths     { flex: 2 1 0 !important; } /* two fields inside */
	.sidxzb-bar .sidx-streamlined-search { flex: 1 1 0 !important; }
	.sidxzb-bar button.sidx-primary      { flex: 1 1 0 !important; min-width: 120px !important; max-width: 200px !important; }
	.sidxzb-pill--status { flex: 1 1 0 !important; justify-content: space-between !important; }
	/* Inner controls fill their (now wider) wrappers instead of leaving gaps. */
	/* Inner controls fill their (now wider) wrappers instead of leaving gaps. */
	.sidxzb-bar .sidx-range .sidx-field,
	.sidxzb-bar .sidx-streamlined-toggle {
		width: 100% !important;
		justify-content: center !important;
		gap: 6px;
	}
	.sidxzb-bar .sidx-beds-and-baths .sidx-dropdown { flex: 1 1 0 !important; }
	.sidxzb-bar .sidx-beds-and-baths .sidx-field {
		width: 100% !important;
		justify-content: center !important;
	}
}

/* ---- Tablet ---- */
@media (max-width: 1024px) {
	.sidxzb-pill__label { max-width: 120px; }
}

/* ---- Mobile: clean full-width stack in the right order ---- */
@media (max-width: 640px) {
	.sidxzb-bar.sidx-basic,
	.sidxzb-bar {
		flex-direction: column !important;
		align-items: stretch !important;
	}
	/* SIDX's small-screen variant is a different form instance where inline
	   `order` may not be applied — enforce the sequence here (CSS !important
	   beats inline styles). */
	.sidxzb-bar .sidx-locations-field-wrapper { order: 10 !important; }
	.sidxzb-bar .sidxzb-pill--status          { order: 20 !important; }
	.sidxzb-bar .sidxzb-pill--type            { order: 30 !important; }
	.sidxzb-bar .sidx-range                   { order: 40 !important; }
	.sidxzb-bar .sidx-beds-and-baths          { order: 50 !important; }
	.sidxzb-bar .sidx-streamlined-search      { order: 60 !important; }
	.sidxzb-bar .sidx-primary,
	.sidxzb-bar button.sidx-primary           { order: 70 !important; }
	.sidxzb-bar .sidxzb-reset                 { order: 75 !important; }
	.sidxzb-bar .sidx-save-search-pill        { order: 80 !important; }

	/* The small-screen Location wrapper reserves ~260px for suggestions —
	   that was the huge empty gap. Its dropdown is fine opening over content. */
	.sidxzb-bar .sidx-locations-field-wrapper {
		height: var(--sidxzb-height) !important;
		min-height: var(--sidxzb-height) !important;
		max-height: var(--sidxzb-height) !important;
		max-width: none !important;
		flex: 0 0 auto !important;
		overflow: visible !important;
	}

	.sidxzb-bar > *,
	.sidxzb-pill,
	.sidxzb-reset {
		width: 100% !important;
	}
	.sidxzb-pill,
	.sidxzb-reset {
		justify-content: space-between !important;
	}
	.sidxzb-bar .sidx-field,
	.sidxzb-bar .sidx-streamlined-toggle {
		width: 100% !important;
		justify-content: center !important;
	}
	/* Beds & Baths side by side, half width each. */
	.sidxzb-bar .sidx-beds-and-baths .sidx-dropdown { flex: 1 1 0 !important; }
}
