/**
 * KAMAK homepage search-mode toggle (Stories 4.5 + 4.6).
 * Accessible segmented control: a native radio group styled as two pills, with a
 * visible focus ring (keyboard) and a clear selected state. The toggle drives the
 * site's rtcl search banner; in "Roommate rental" mode the rental property-type
 * category pills are hidden (they are rental-only).
 */
/* White text so the toggle stays readable on the (dark) hero. */
.kamak-search-toggle,
.kamak-search-toggle__legend,
.kamak-search-toggle__label {
	color: #ffffff;
}

/* Center the whole widget (legend, mode toggle, property-type chips) to match the
   "Place to rent" advanced-search widget's centered layout in the same column. */
.kamak-search-toggle {
	text-align: center;
}

.kamak-search-toggle__modes {
	border: 0;
	margin: 0 0 1rem;
	padding: 0;
}

.kamak-search-toggle__legend {
	display: block;
	font-weight: 600;
	margin-bottom: 0.5rem;
	padding: 0;
}

.kamak-search-toggle__options {
	display: inline-flex;
	border: 1px solid currentColor;
	border-radius: 9999px;
	overflow: hidden;
}

.kamak-search-toggle__option {
	position: relative;
	display: inline-flex;
	align-items: center;
	margin: 0;
}

/* Visually hidden but still focusable + operable by keyboard. */
.kamak-search-toggle__radio {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.kamak-search-toggle__label {
	display: inline-block;
	padding: 0.6rem 1.5rem;
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
	line-height: 1.2;
}

.kamak-search-toggle__radio:checked + .kamak-search-toggle__label {
	background: #1d2327;
	color: #fff;
}

/* Visible keyboard focus (the radio is hidden, so style its label). */
.kamak-search-toggle__radio:focus-visible + .kamak-search-toggle__label,
.kamak-search-toggle__radio:focus + .kamak-search-toggle__label {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

/* Story 4.11: roommate dwelling-type chips (Apartments / Home). They sit under the
   toggle in the SAME position as the rent category pills, but only in roommate mode.
   They drive the roommate-only `filters[property_type]` select (see search-toggle.js),
   so the advanced-search dropdown for it is hidden in roommate mode (chips replace it). */
.kamak-property-type-chips {
	display: none;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 1rem;
}
html[data-kamak-mode="roommate"] .kamak-property-type-chips {
	display: inline-flex;
}
.kamak-pt-chip {
	display: inline-flex;
	align-items: center;
	padding: 0.45rem 1.1rem;
	border: 0;
	border-radius: 9999px;
	background: transparent;
	color: #ffffff;
	font: inherit;
	line-height: 1.2;
	cursor: pointer;
	white-space: nowrap;
}
/* Elementor's kit applies a global default `button:hover` fill (its primary green)
   to any native <button> inside its widgets — override it so the pill itself never
   fills with color; only the icon circle (below) is allowed to change color. */
.kamak-pt-chip,
.kamak-pt-chip:hover,
.kamak-pt-chip:focus {
	background: transparent !important;
	color: #ffffff !important;
}
.kamak-pt-chip.is-active {
	background: #1d2327 !important;
	color: #ffffff !important;
}
.kamak-pt-chip:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}
/* Icon badge, matched 1:1 to the rent category pills' round icon treatment
   (theme's .advance-search-form .search-radio li i — see homlisti styles.css,
   ~line 4771) so both widgets carry the same visual weight. */
.kamak-pt-chip__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background-color: rgba(255, 255, 255, 0.2);
	color: #fff;
	font-size: 14px;
	line-height: 30px;
	margin-right: 10px;
	transition: 0.4s;
}
.kamak-pt-chip:hover .kamak-pt-chip__icon,
.kamak-pt-chip.is-active .kamak-pt-chip__icon {
	background-color: var(--rt-primary-dark, #00a376) !important;
}
/* Chips are the roommate control for property_type → hide its advanced-box dropdown. */
html[data-kamak-mode="roommate"] .advance-search-form .search-item:has([name^="filters[property_type]"]) {
	display: none !important;
}

/* Property-type category pills (Apartments / Commercial / …) belong to rental
   search only. Hide them when the visitor switches the toggle to Roommate rental.
   `display:none` also drops their radio inputs from the tab order (a11y). The
   document-level signal is set by search-toggle.js. */
html[data-kamak-mode="roommate"] .listing-category-list {
	display: none !important;
}

/* Story 4.11: the KAMAK rent/roommate toggle replaces rtcl's "Select Type"
   ad-type filter — hide the native ad-type select/radio in the search banner so
   there is one control, not two. (The toggle injects filter_ad_type itself.) */
.advance-search-form .search-item.ad-type,
.advance-search-form .ad-type-wrapper {
	display: none !important;
}

/* Story 4.11: the Roommate category is a top-level rtcl category, so it renders
   among the property-type pills — hide it (roommate isn't a rental property type;
   the toggle handles roommate). The pill <li> carries the term slug as a class. */
.listing-category-list li.roommate {
	display: none !important;
}

/* Mode-conditional FILTER FIELDS (Story 4.7). The advanced-search box loads a mix
   of always-on rental fields + the pinned category's fields, so we hide the ones
   that don't belong to the active mode. Wrappers are generic `.search-item`, so we
   match by the field's stable `name="filters[<field>]"` via :has(). `display:none`
   also drops the controls from the tab order (a11y). */
/* Roommate mode → hide the rental-only filters.
   NOTE (Story 4.11, Task 4): `lease_term` is intentionally NOT hidden here. The
   migration made it a shared/unconditional field so it must render in BOTH modes
   (AC 8/9). It was previously listed here as rental-only, which kept it in the DOM
   but `display:none`'d its wrapper in roommate mode — the bug Amir saw. */
/* NOTE (Story 4.11): `amenities` is intentionally NOT hidden in roommate mode —
   Amir wants the amenities filter available for Roommate Rental too. */
html[data-kamak-mode="roommate"] .advance-search-form .search-item:has([name^="filters[beds]"]),
html[data-kamak-mode="roommate"] .advance-search-form .search-item:has([name^="filters[baths]"]),
html[data-kamak-mode="roommate"] .advance-search-form .search-item:has([name^="filters[area]"]),
html[data-kamak-mode="roommate"] .advance-search-form .search-item:has([name^="filters[parking]"]) {
	display: none !important;
}
/* Rent mode → hide the roommate-only filters (belt-and-suspenders; they normally
   aren't loaded under a rental category). */
html[data-kamak-mode="rent"] .advance-search-form .search-item:has([name^="filters[current_roommates]"]),
html[data-kamak-mode="rent"] .advance-search-form .search-item:has([name^="filters[bathroom_type]"]),
html[data-kamak-mode="rent"] .advance-search-form .search-item:has([name^="filters[lifestyle]"]) {
	display: none !important;
}

/* Story 4.11 (Task 5, AC 11): the select2-enhanced filter selects initialise with
   an inline `width:auto` (select2 can't measure a container that is hidden or freshly
   AJAX-loaded), which collapses them so labels clip to "Life…", "Bat…", "Smoki…".
   Give every advanced-search select2 a uniform, readable MINIMUM width so labels stay
   legible in both modes. min-width sidesteps select2's inline `width` without !important. */
.advance-search-form .select2-container {
	min-width: 150px;
}

/* Story 4.11 (Task 4): the Move-in date filter is a native <input type="date"> (the
   theme's FB search renderer has no date case, so we render it via the child theme).
   The theme force-hides `.hom-search-banner-label`, and a date input can't show the
   field name as a select2 placeholder like the other filters — so give move-in its
   own visible label above the picker. */
.advance-search-form .kamak-move-in-filter .kamak-move-in-label {
	display: block;
	margin-bottom: 4px;
	font-size: 13px;
	line-height: 1.2;
	color: #5a5a5a;
}
.advance-search-form .kamak-move-in-filter .form-control[type="date"] {
	width: 100%;
}
