/**
 * Filters dialog of the split archive layouts (Customizer > Listings List
 * Options > Filters display: Modal). The "Listings sidebar" search form in a
 * centered dialog; a full-screen sheet on phones. Loaded only with that option.
 * Markup: listeo-core templates/archive/filters-modal.php and filters-modal-button.php.
 */

/* Filters button */
.listeo-filters-open {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 8px;
	height: 48px;
	margin: 0;
	padding: 0 16px;
	border: 1px solid #ddd;
	border-radius: 12px;
	background: #fff;
	color: #222;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.listeo-filters-open:hover,
.listeo-filters-open:focus-visible {
	border-color: #222;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.listeo-filters-open i {
	font-size: 14px;
}

/* Filters button on the right of the categories row. */
.listeo-filters-bar {
	display: flex;
	align-items: center;
	gap: 16px;
}

.listeo-filters-bar > .listeo-filters-open {
	order: 2;
	margin-left: auto;
}

.listeo-filters-bar > .slider-container {
	flex: 1 1 auto;
	min-width: 0;
}

/* Icon-only version that follows the scrolled list. */
.sticky-filter-button .listeo-filters-open {
	width: 46px;
	height: 46px;
	justify-content: center;
	padding: 0;
	border-radius: 0 12px 12px 0;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sticky-filter-button .listeo-filters-open__text {
	display: none;
}

/* Without the slide-in sidebar the list takes its room. */
.listeo-filters-modal-enabled.full-page-container .full-page-content-container {
	flex-grow: 1;
}

/* Dialog */
.listeo-filters-modal {
	position: fixed;
	inset: 0;
	/* Above sticky headers (the header builder uses 1100) and the admin bar. */
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	/* Hidden only after the fade-out... */
	transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.listeo-filters-modal.is-open {
	visibility: visible;
	opacity: 1;
	pointer-events: auto;
	/* ...but visible at once, so the close button can take focus. */
	transition: opacity 0.2s ease, visibility 0s;
}

/* Dropdowns of the form open in <body>; keep them above the dialog. */
body.listeo-filters-modal-open .select2-container--open,
body.listeo-filters-modal-open .daterangepicker,
body.listeo-filters-modal-open .flatpickr-calendar.open {
	z-index: 100001;
}

.listeo-filters-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
}

.listeo-filters-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 640px;
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 80px);
	overflow: hidden;
	border-radius: 24px;
	background: #fff;
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
	transform: translateY(24px);
	transition: transform 0.25s ease;
}

.listeo-filters-modal.is-open .listeo-filters-modal__dialog {
	transform: none;
}

.listeo-filters-modal__header {
	position: relative;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 64px;
	padding: 0 64px;
	border-bottom: 1px solid #ebebeb;
}

.listeo-filters-modal__title {
	margin: 0;
	padding: 0;
	color: #222;
	font-size: 16px;
	line-height: 20px;
	font-weight: 700;
}

.listeo-filters-modal__close {
	position: absolute;
	top: 50%;
	inset-inline-end: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #222;
	font-size: 16px;
	transform: translateY(-50%);
	cursor: pointer;
}

.listeo-filters-modal__close:hover,
.listeo-filters-modal__close:focus-visible {
	background: #f2f2f2;
}

.listeo-filters-modal__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 24px;
}

/* style.css pins the date picker to the left sidebar of split layouts. */
body.listeo-filters-modal-open .daterangepicker {
	left: 50% !important;
	right: auto !important;
	transform: translateX(-50%);
}

body.listeo-filters-modal-open .daterangepicker::before,
body.listeo-filters-modal-open .daterangepicker::after {
	display: none;
}

/* The dialog header names it already. */
.listeo-filters-modal__body .listing-widget > .widget-title:first-child {
	display: none;
}

/* The widget area keeps its sidebar styles; only the sticky behaviour goes. */
.listeo-filters-modal__body .sidebar,
.listeo-filters-modal__body .sidebar-container {
	position: static;
	width: auto;
	max-width: none;
	margin: 0;
	padding: 0;
	top: auto;
}

.listeo-filters-modal__body .widget:last-child {
	margin-bottom: 0;
}

.listeo-filters-modal__footer {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 24px;
	border-top: 1px solid #ebebeb;
	background: #fff;
}

.listeo-filters-modal__clear {
	margin: 0;
	padding: 10px 0;
	border: 0;
	background: none;
	color: #222;
	font-size: 16px;
	font-weight: 600;
	text-decoration: underline;
	cursor: pointer;
}

.listeo-filters-modal .listeo-filters-modal__apply {
	margin: 0;
	height: 48px;
	padding: 0 24px;
	border-radius: 12px;
	background-color: var(--listeo-primary-color, #222);
	color: #fff;
	font-size: 16px;
	font-weight: 600;
	line-height: 48px;
	white-space: nowrap;
}

body.listeo-filters-modal-open {
	overflow: hidden;
}

/* The form in the dialog: one label size, one field height, a line between
   groups. The rows of the sidebar form become a wrapping flex list so the rooms
   fields and the booking options share rows. */
.listeo-filters-modal__body #listeo_core-search-form {
	display: flex;
	flex-wrap: wrap;
	column-gap: 12px;
}

.listeo-filters-modal__body #listeo_core-search-form > * {
	flex: 0 0 100%;
	min-width: 0;
	margin-left: 0;
	margin-right: 0;
	padding-left: 0;
	padding-right: 0;
}

/* Fields sit flush with the group line. */
.listeo-filters-modal__body #listeo_core-search-form .bootstrap-select,
.listeo-filters-modal__body #listeo_core-search-form .select2-container {
	margin-bottom: 0;
}

.listeo-filters-modal__body [id^="listeo-search-form_heading_"]:not(:first-child) {
	margin-top: 24px;
	padding-top: 24px;
	border-top: 1px solid #ebebeb;
}

.listeo-filters-modal__body [id^="listeo-search-form_heading_"] h3 {
	margin: 0 0 12px !important;
	color: #222;
	font-size: 16px;
	line-height: 24px;
	font-weight: 600;
}

.listeo-filters-modal__body .row.with-forms input.date_range,
.listeo-filters-modal__body .row.with-forms .select2-selection,
.listeo-filters-modal__body .row.with-forms select {
	height: 48px;
	margin-bottom: 0;
}

.listeo-filters-modal__body #listeo-search-form__bedrooms,
.listeo-filters-modal__body #listeo-search-form__beds,
.listeo-filters-modal__body #listeo-search-form__bathrooms {
	flex: 1 1 0;
}

/* Price: the group heading names it, the slider sits on the page. */
.listeo-filters-modal__body #listeo-search-form__price {
	margin-bottom: 0;
}

.listeo-filters-modal__body #listeo-search-form__price {
	padding-top: 0;
	padding-bottom: 0;
	border: 0;
	background: none;
	box-shadow: none;
}

.listeo-filters-modal__body .range-slider-container {
	margin: 0;
	padding: 32px 12px 0;
	border: 0;
	opacity: 1;
}

.listeo-filters-modal__body .range-slider-headline,
.listeo-filters-modal__body .range-slider-subtitle,
.listeo-filters-modal__body .slider-disable {
	display: none;
}

/* Long checkbox groups in two columns. */
.listeo-filters-modal__body .checkboxes.one-in-row {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	column-gap: 24px;
	row-gap: 12px;
}

.listeo-filters-modal__body .checkboxes.one-in-row label {
	width: auto;
	margin: 0;
}

.listeo-filters-modal__body #listeo-search-form__instant_booking,
.listeo-filters-modal__body #listeo-search-form__self_checkin,
.listeo-filters-modal__body #listeo-search-form__free_cancellation,
.listeo-filters-modal__body #listeo-search-form__pets_allowed {
	flex: 1 1 calc(50% - 6px);
}

.listeo-filters-modal__body .checkboxes-single {
	margin-top: 0 !important;
}

.listeo-filters-modal__body .checkboxes-single label {
	margin: 0 0 12px;
}

/* Phones: full-screen sheet. */
@media (max-width: 767px) {
	.listeo-filters-modal__dialog {
		width: 100%;
		max-width: none;
		height: 100%;
		max-height: none;
		border-radius: 0;
		transform: translateY(32px);
	}

	.listeo-filters-modal__body {
		padding: 20px;
	}

	.listeo-filters-modal__footer {
		padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
	}
}
