/**
 * The stay search bar, wherever it is drawn.
 *
 * Two forms share it: the property page's own stay search
 * (WP_LG_RH_Beds24_Search_Section, Main.dc.html's #stay form) and the site
 * search form in the theme header (WP_LG_RH_Beds24_Search_Form, the
 * [bedzy_search] shortcode). It also themes the flatpickr calendar both open.
 *
 * Enqueued on every front-end page, because the header form is on nearly every
 * page and is rendered by Elementor after <head> has been printed. Where the
 * bar sits on the property page, and how it folds on a phone there, stays in
 * bedzy-property.css.
 *
 * Sizes are in px, not rem: the theme sets a 10px root font size.
 */

:where(.bedzy-search, .bedzy-site-search) {
	--bedzy-accent: #009FE3;
	--bedzy-link: #0079AE;
	--bedzy-link-hover: #005D86;
	--bedzy-ink: #1A1A1A;
	--bedzy-body: #444A4D;
	--bedzy-muted: #5E6669;
	--bedzy-hairline: #EDF1F3;
	--bedzy-border: #E1E8EB;
	--bedzy-warning: #A3521B;
	--bedzy-radius: 8px;

	/* Not a token in the brief: the artboard's own inner hairline for the
		search bar's field dividers (#E7ECEE), distinct from --bedzy-hairline. */
	--bedzy-rule: #E7ECEE;

	font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
	color: var(--bedzy-body);
	font-size: 16px;
}

.bedzy-search *,
.bedzy-search *::before,
.bedzy-search *::after {
	box-sizing: border-box;
}

/* A visible keyboard focus ring, in the link colour so it reads as ours rather
	than as the browser default the theme may have suppressed. */
.bedzy-search :focus-visible {
	outline: 2px solid var(--bedzy-link);
	outline-offset: 2px;
	border-radius: 4px;
}

/* -------------------------------------------------------------------------
 * Stay search - Main.dc.html, the #stay form
 * ---------------------------------------------------------------------- */

.bedzy-search {
	display: block;
	margin: 0;
	padding: 14px 16px;
	background: #FFFFFF;
	border: 1px solid var(--bedzy-border);
	border-radius: var(--bedzy-radius);
	box-shadow: 0 2px 16px rgba(16, 42, 67, 0.06);
}

.bedzy-search__row {
	display: flex;
	align-items: center;
	gap: 4px;
}

/* The artboard's field padding is 6px 18px around a ~24px control row. The
	control is raised to 44px below for the touch-target rule, so the vertical
	padding drops to 2px to keep the bar close to the artboard's height. */
.bedzy-search__field {
	flex: 1 1 0;
	min-width: 0;
	padding: 2px 18px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.bedzy-search__label {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--bedzy-muted);
}

.bedzy-search__control {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
}

.bedzy-search__icon {
	flex: 0 0 auto;
	color: var(--bedzy-accent);
}

.bedzy-search__control input,
.bedzy-search__control select {
	width: 100%;
	min-width: 0;
	min-height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	font-family: inherit;
	font-size: 17px;
	font-weight: 600;
	line-height: 1.2;
	color: var(--bedzy-ink);
}

/* The native date picker and select arrow are left alone on purpose: they are
	the affordance, and overriding `appearance` removes the calendar button in
	Chromium without replacing it. */

.bedzy-search__divider {
	flex: 0 0 auto;
	width: 1px;
	height: 46px;
	background: var(--bedzy-rule);
}

/* Filled with the link token rather than the accent: white on #009FE3 is
	2.97:1, and 17px/700 is not large text under WCAG. White on #0079AE is
	4.83:1. */
.bedzy-search__submit {
	flex: 0 0 auto;
	height: 60px;
	padding: 0 40px;
	border: 0;
	border-radius: var(--bedzy-radius);
	background: var(--bedzy-link);
	color: #FFFFFF;
	font-family: inherit;
	font-size: 17px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
}

.bedzy-search__submit:hover,
.bedzy-search__submit:focus-visible {
	background: var(--bedzy-link-hover);
}

/* The warning panel as States.dc.html:48 draws it. */
.bedzy-search__notice {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin: 16px 0 0 0;
	padding: 16px 18px;
	border: 1px solid #F3D9C4;
	border-radius: var(--bedzy-radius);
	background: #FDF3EC;
	font-size: 16px;
	font-weight: 600;
	/* The artboard's panel text, a shade deeper than --bedzy-warning, which it
		uses for the icon only. */
	color: #7A3E13;
}

.bedzy-search__notice-icon {
	flex: 0 0 auto;
	color: var(--bedzy-warning);
}

/* -------------------------------------------------------------------------
 * Site search - [bedzy_search], placed in the Elementor header templates
 *
 * Not on the canvas: the property page's bar with a destination in front.
 * The shortcode can land in any Elementor column, so it folds on the width it
 * is given (a container query on .bedzy-site-search), not on the viewport.
 * Fields are placed by modifier rather than by position, because the
 * destination makes five.
 * ---------------------------------------------------------------------- */

.bedzy-site-search {
	container-name: bedzy-site-search;
	container-type: inline-size;
	/* A size container has no content width of its own, and Elementor's
		columns shrink a widget to its content. So the form asks for its own
		width and gives way to whatever the column allows. */
	width: 1120px;
	max-width: 100%;
	margin: 0 auto;
	text-align: left;
}

/* Five fields where the property page has four: a little less air around
	each, so a chosen date and "0 children" still fit. */
.bedzy-search--site .bedzy-search__field {
	padding-left: 14px;
	padding-right: 14px;
}

.bedzy-search--site .bedzy-search__submit {
	padding: 0 32px;
}

/* A chosen date ("Wed 21 Oct 2026") is the longest value in the bar. */
.bedzy-search--site .bedzy-search__field--check-in,
.bedzy-search--site .bedzy-search__field--check-out {
	flex-grow: 1.2;
}

/* The theme draws its own border, height and padding on every select. */
.bedzy-search--site .bedzy-search__control select {
	height: auto;
	box-shadow: none;
	outline-offset: 2px;
}

/* The results page's folded phone search (WP_LG_RH_Beds24_Search_Form::summary()).
	Hidden unless bedzy-results.js folded the form and the form has under 600px. */
.bedzy-site-search__summary {
	display: none;
}

/* Two rows: where to and when, then who and Search. */
@container bedzy-site-search (max-width: 959px) {

	.bedzy-search--site {
		padding: 4px 12px 12px 12px;
	}

	.bedzy-search--site .bedzy-search__row {
		display: grid;
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 0;
	}

	.bedzy-search--site .bedzy-search__divider {
		display: none;
	}

	.bedzy-search--site .bedzy-search__field {
		gap: 2px;
		padding: 10px 12px 8px;
		border-bottom: 1px solid var(--bedzy-hairline);
	}

	.bedzy-search--site .bedzy-search__field--destination {
		grid-column: span 2;
	}

	.bedzy-search--site .bedzy-search__field--destination,
	.bedzy-search--site .bedzy-search__field--check-in,
	.bedzy-search--site .bedzy-search__field--adults {
		border-right: 1px solid var(--bedzy-hairline);
	}

	.bedzy-search--site .bedzy-search__field--adults,
	.bedzy-search--site .bedzy-search__field--children {
		border-bottom: 0;
	}

	.bedzy-search--site .bedzy-search__submit {
		grid-column: span 2;
		align-self: center;
		margin: 8px 0 0 12px;
		height: 52px;
		padding: 0;
	}
}

/* A phone: the destination on its own row, dates and party in pairs. */
@container bedzy-site-search (max-width: 599px) {

	.bedzy-search--site .bedzy-search__row {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bedzy-search--site .bedzy-search__field {
		padding: 10px 10px 8px;
	}

	.bedzy-search--site .bedzy-search__field--destination {
		border-right: 0;
	}

	.bedzy-search--site .bedzy-search__label {
		font-size: 11px;
	}

	.bedzy-search--site .bedzy-search__control {
		gap: 7px;
	}

	.bedzy-search--site .bedzy-search__icon {
		width: 16px;
		height: 16px;
	}

	.bedzy-search--site .bedzy-search__control input,
	.bedzy-search--site .bedzy-search__control select {
		font-size: 15px;
		text-overflow: ellipsis;
		white-space: nowrap;
		overflow: hidden;
	}

	.bedzy-search--site .bedzy-search__submit {
		margin: 8px 0 0 0;
		width: 100%;
	}
}

/* -------------------------------------------------------------------------
 * Date pickers - flatpickr, themed to the design's tokens
 *
 * flatpickr ships its own blue and its own radii. These rules restate it in
 * the page's palette rather than leaving a calendar that belongs to a
 * different site. Scoped to .bedzy-calendar, which bedzy-datepicker.js does
 * not set - flatpickr appends its calendar to <body>, outside every container
 * on the page, so the selectors below are deliberately global to the library's
 * own class names and carry no .bedzy- ancestor.
 * ---------------------------------------------------------------------- */

.flatpickr-calendar {
	--bedzy-accent: #009FE3;
	--bedzy-link: #0079AE;
	--bedzy-ink: #1A1A1A;
	--bedzy-muted: #5E6669;
	--bedzy-hairline: #EDF1F3;
	font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
	border-radius: 8px;
	box-shadow: 0 8px 28px rgba(16, 42, 67, 0.16);
	border: 1px solid #E1E8EB;
}

.flatpickr-months {
	padding-top: 6px;
}

.flatpickr-current-month,
.flatpickr-weekday {
	color: var(--bedzy-ink);
	font-weight: 600;
}

.flatpickr-weekday {
	color: var(--bedzy-muted);
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
	color: var(--bedzy-link);
	fill: var(--bedzy-link);
	/* flatpickr's arrows are 34px tall by default; a calendar a guest taps on a
		phone needs the same 44px floor as everything else on this page. */
	min-width: 44px;
	min-height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.flatpickr-day {
	border-radius: 6px;
	color: var(--bedzy-ink);
}

.flatpickr-day:hover,
.flatpickr-day:focus {
	background: #E7F6FD;
	border-color: #E7F6FD;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
	/* The link tone rather than the accent: white on #009FE3 is 2.97:1 and
		fails AA, the same reason every primary button on this page moved. */
	background: var(--bedzy-link);
	border-color: var(--bedzy-link);
	color: #FFFFFF;
}

.flatpickr-day.today {
	border-color: var(--bedzy-accent);
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
	color: #A8B0B4;
}

/* The replacement field the library creates needs no rules of its own. It is
	an input inside the search control, so the field styling further up this
	file already claims it. An earlier version of this block restated those
	same properties and, being the more specific selector, quietly overrode
	them: the chosen date came out a size smaller and a weight lighter than the
	artboard asks for. */

/* The library's own readonly cursor reads as "not editable" rather than
	"opens a calendar", which is what tapping it does. */
.bedzy-search__control input.flatpickr-input,
.bedzy-search__control input[readonly] {
	cursor: pointer;
}

/* -------------------------------------------------------------------------
 * The folded search on the results page, under 600px of form width
 * (SearchMobile.dc.html): one line, Edit to unfold.
 * ---------------------------------------------------------------------- */

@container bedzy-site-search (max-width: 599px) {

	.bedzy-site-search.is-folded .bedzy-search--site {
		display: none;
	}

	.bedzy-site-search.is-folded .bedzy-site-search__summary {
		display: flex;
		align-items: center;
		gap: 12px;
		width: 100%;
		min-height: 64px;
		margin: 0;
		padding: 10px 14px;
		border: 1px solid var(--bedzy-border);
		border-radius: var(--bedzy-radius);
		box-shadow: 0 2px 16px rgba(16, 42, 67, 0.06);
		background: #FFFFFF;
		font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
		text-align: left;
		cursor: pointer;
	}

	.bedzy-site-search__summary .bedzy-search__icon {
		color: var(--bedzy-accent);
	}

	.bedzy-site-search__summary-text {
		flex: 1 1 auto;
		min-width: 0;
		display: flex;
		flex-direction: column;
	}

	.bedzy-site-search__summary-where {
		font-size: 16px;
		font-weight: 700;
		color: var(--bedzy-ink);
	}

	.bedzy-site-search__summary-stay {
		font-size: 14px;
		color: var(--bedzy-muted);
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.bedzy-site-search__summary-edit {
		flex: 0 0 auto;
		font-size: 15px;
		font-weight: 700;
		color: var(--bedzy-link);
	}
}
