/*
 * Campo Vecchio - search form (home) and search results page.
 * Loaded by includes/search-form.php and includes/search-alternatives.php.
 */

:root {
	--cv-accent: #8998b3;      /* the site's button colour */
	--cv-line: #d9d1c7;
	--cv-card: #fff;
	--cv-ink: #222;
	--cv-soft: #5f5a55;
	--cv-band: #ebe5de;        /* range between arrival and departure */
	--cv-ok: #3f7a52;          /* "free on your dates" badge */
}

/* ---------- Home search form: bubble over the departure days ---------- */

.cv-sf-bubble {
	position: absolute;
	z-index: 100000; /* above the date picker popup */
	max-width: 260px;
	padding: 7px 10px;
	border: 1px solid #d9d9d9;
	border-radius: 6px;
	background: #fff;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
	color: var(--cv-ink);
	font-size: 14px;
	line-height: 1.35;
	pointer-events: none; /* never blocks a click on the day underneath */
}

.cv-sf-bubble[hidden] {
	display: none;
}

.cv-sf-bubble strong {
	display: block;
}

.cv-sf-bubble::after {
	content: "";
	position: absolute;
	bottom: -6px;
	left: var(--cv-arrow-x, 50%);
	width: 10px;
	height: 10px;
	margin-left: -5px;
	border-right: 1px solid #d9d9d9;
	border-bottom: 1px solid #d9d9d9;
	background: #fff;
	transform: rotate(45deg);
}

/*
 * Band from arrival to departure in the date picker (as on Airbnb).
 * The day circles fill their table cells, so the band is the cells' own
 * background; arrival and departure cells get half a band, towards the inside.
 */
.datepick-popup td.cv-range-in,
.datepick-popup td.cv-range-in .mphb-date-cell {
	/* !important: MotoPress's picker styles use longer selectors; these only
	   ever apply to cells our script has marked. */
	border-color: var(--cv-band) !important;
	background: var(--cv-band) !important;
}

.datepick-popup td.cv-range-in .mphb-date-cell {
	border-radius: 0 !important;
	color: var(--cv-ink) !important;
}

.datepick-popup td.cv-range-start {
	background: linear-gradient(90deg, #fff 50%, var(--cv-band) 50%) !important;
}

.datepick-popup td.cv-range-end {
	background: linear-gradient(90deg, var(--cv-band) 50%, #fff 50%) !important;
}

.datepick-popup td.cv-range-start .mphb-date-cell,
.datepick-popup td.cv-range-end .mphb-date-cell {
	border-radius: 50% !important;
	background: #222 !important;
	color: #fff !important;
}

/* Departure under the pointer, not chosen yet: outlined, like Airbnb */
.datepick-popup td.cv-range-hover-end .mphb-date-cell {
	background: #fff !important;
	color: var(--cv-ink) !important;
	box-shadow: inset 0 0 0 2px #222;
}

/* Line under the form once both dates are chosen (also the only hint on phones) */
.cv-sf-summary {
	margin: 10px 0 0;
	font-size: 15px;
	line-height: 1.4;
	color: var(--cv-soft);
}

.cv-sf-summary:empty {
	display: none;
}

/* ---------- Results page: every result uses the card below ---------- */

/* MotoPress's multi-room cart ("Choisissez parmi les logements disponibles."):
   each card now has its own button straight to checkout. */
.mphb_sc_search_results-wrapper #mphb-reservation-cart {
	display: none;
}

/* Free accommodations: MotoPress's loop puts the cards in its own wrapper. */
.mphb_sc_search_results-wrapper .cv-alt-card {
	margin: 0 0 20px;
}

.cv-alt-list .cv-alt-card {
	margin: 0; /* the list's grid gap spaces those */
}

.cv-alt-desc {
	margin: 0 0 10px;
	color: var(--cv-soft);
	font-size: 14px;
	line-height: 1.5;
}

.cv-alt-card--exact .cv-alt-badge {
	border-color: var(--cv-ok);
	color: var(--cv-ok);
}

/* ---------- Results page: price of the stay on MotoPress's cards ---------- */

.mphb_sc_search_results-wrapper .mphb-regular-price .mphb-price-period {
	border-bottom: 0;
	cursor: auto;
}

/* ---------- Results page: nearby dates ---------- */

.cv-alt {
	clear: both;
	margin: 48px 0 24px;
}

.cv-alt-title {
	margin: 0 0 8px;
	font-size: 1.6rem;
	line-height: 1.25;
}

.cv-alt-intro {
	margin: 0 0 20px;
	color: var(--cv-soft);
}

.cv-alt-list {
	display: grid;
	gap: 20px;
}

/* Picture flush with the card's left, top and bottom edges, as tall as the text. */
.cv-alt-card {
	display: grid;
	grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
	overflow: hidden;
	border: 1px solid var(--cv-line);
	border-radius: 8px;
	background: var(--cv-card);
}

.cv-alt-image {
	position: relative;
	display: block;
	min-height: 240px;
}

/* Two classes: Elementor's ".elementor img { height: auto }" loads later. */
.cv-alt-card .cv-alt-image img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	border-radius: 0;
}

.cv-alt-body {
	padding: 22px 26px;
}

/* Palmeria hides every h3 inside .mphb_sc_search_results-wrapper; ours must show. */
.mphb_sc_search_results-wrapper .cv-alt-name,
.cv-alt-name {
	display: block;
	margin: 0 0 8px;
	font-size: 1.3rem;
	line-height: 1.3;
}

.cv-alt-name a {
	text-decoration: none;
}

.cv-alt-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 10px;
}

.cv-alt-badge {
	padding: 2px 10px;
	border: 1px solid var(--cv-accent);
	border-radius: 999px;
	color: #4b5a74;
	font-size: 13px;
	line-height: 1.6;
	white-space: nowrap;
}

.cv-alt-dates {
	margin: 0 0 4px;
	font-weight: 600;
}

.cv-alt-dates::first-letter {
	text-transform: uppercase;
}

.cv-alt-price {
	margin: 0 0 14px;
}

.cv-alt-fees {
	color: var(--cv-soft);
	font-size: 0.9em;
}

.cv-alt-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 18px;
}

.cv-alt-actions form {
	margin: 0;
}

.cv-alt-book.button {
	margin: 0;
}

.cv-alt-details {
	font-size: 14px;
}

@media (max-width: 600px) {
	.cv-alt-card {
		grid-template-columns: 1fr;
	}

	/* Picture across the top of the card, edge to edge */
	.cv-alt-image {
		min-height: 0;
		aspect-ratio: 16 / 10;
	}

	.cv-alt-body {
		padding: 16px;
	}

	.cv-alt-actions form,
	.cv-alt-book.button {
		width: 100%;
	}
}
