/**
 * BSPL-STYLESHEET-BUILD: 2.0.0-dev
 *
 * If the line above is missing from the file your browser actually loaded,
 * the deployed stylesheet is stale and no rule below is in effect.
 *
 * Bakhoobi Property Listing (BSPL) — public styles.
 *
 * THEME INDEPENDENCE
 *
 * This has to look right on a theme it has never met, so it assumes nothing.
 * No reset, no container width imposed on the theme, no font-family declared —
 * type is inherited so a listing looks like part of the site rather than like
 * a plugin bolted on. Only colour, spacing and the components core does not
 * provide are supplied here.
 *
 * Every value is a --bspl-property-* custom property, so a theme can retheme the whole
 * plugin by redeclaring a handful of variables rather than fighting selectors.
 *
 * Mobile first: min-width queries only.
 *
 * @package Bakhoobi\PropertyListing
 * @author  Bakhoobi Services Private Limited
 */

:root {
	/* Bakhoobi Services brand palette, shared with Lead Manager. */
	--bspl-property-gold: #f9b616;
	--bspl-property-orange: #ff750b;
	--bspl-property-brand: linear-gradient(135deg, var(--bspl-property-gold), var(--bspl-property-orange));

	--bspl-property-ink: #333;
	--bspl-property-muted: #6b6b6b;
	--bspl-property-line: #e3e3e5;
	--bspl-property-surface: #fff;
	--bspl-property-surface-alt: #f7f7f8;

	--bspl-property-success: #1c7c3c;
	--bspl-property-danger: #b32d2e;

	--bspl-property-radius: 6px;
	--bspl-property-gap: 20px;

	/*
	 * Everything a theme needs in order to fit this plugin to itself. The
	 * whole stylesheet reads --bspl-property-accent and --bspl-property-accent-bg rather than
	 * the raw brand colours, so redeclaring these two restyles every price,
	 * button, pill and focus ring at once. Settings -> Appearance writes
	 * them from the admin; a theme can override them in its own stylesheet.
	 */
	--bspl-property-accent: var(--bspl-property-orange);
	--bspl-property-accent-bg: var(--bspl-property-brand);

	/* Widest the plugin's own container grows. */
	--bspl-property-container-max: 1180px;

	/*
	 * The narrowest a card is allowed to get before the grid drops a
	 * column. This is what actually decides the column count — see
	 * .bspl-property-grid — and it is the single most useful thing to tune when the
	 * plugin sits inside a narrow theme column.
	 */
	--bspl-property-card-min: 260px;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.bspl-property-container {
	width: 100%;
	max-width: var(--bspl-property-container-max);
	margin: 0 auto;
	padding: 0 16px;
}

/*
 * THE GRID RESPONDS TO ITS CONTAINER, NOT TO THE VIEWPORT.
 *
 * Until v2 the column count came from viewport media queries: at 992px wide
 * .bspl-property-grid--3 took three columns. That is wrong whenever the plugin does not
 * own the full width. Drop the shortcode into a theme that gives its content a
 * 560px column and the media query still fires on a 1500px monitor, so three
 * cards are crushed into 174px each and every title wraps to four lines. The
 * plugin cannot see that column, and no media query ever will.
 *
 * So the count is derived instead. Each track is at least --bspl-property-card-min, and
 * at most an even share of --bspl-property-cols columns; auto-fill then fits as many as
 * genuinely go. Wide container: exactly --bspl-property-cols, never more. Narrow
 * container: fewer, automatically, with the cards staying readable. No
 * breakpoints, and correct inside a container this stylesheet has never met.
 *
 * minmax()'s floor is a max() rather than a bare length so the cap survives:
 * without it auto-fill would keep adding columns past --bspl-property-cols on a wide
 * screen.
 */
.bspl-property-grid {
	display: grid;
	gap: var(--bspl-property-gap);

	/* Overridden by the modifiers below; one column is the honest default. */
	--bspl-property-cols: 1;

	grid-template-columns: repeat(
		auto-fill,
		minmax(
			max(
				var(--bspl-property-card-min),
				(100% - (var(--bspl-property-cols) - 1) * var(--bspl-property-gap)) / var(--bspl-property-cols)
			),
			1fr
		)
	);
}

.bspl-property-grid--2 {
	--bspl-property-cols: 2;
}

.bspl-property-grid--3 {
	--bspl-property-cols: 3;
}

.bspl-property-grid--4 {
	--bspl-property-cols: 4;
}

.bspl-property-section-title {
	margin: 0 0 12px;
	font-size: 1.15em;
	line-height: 1.3;
}

/* ==========================================================================
   Card
   ========================================================================== */

.bspl-property-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: var(--bspl-property-surface);
	border: 1px solid var(--bspl-property-line);
	border-radius: var(--bspl-property-radius);
	overflow: hidden;
	transition: border-color .16s ease, box-shadow .16s ease;
}

.bspl-property-card:hover {
	border-color: var(--bspl-property-accent);
	box-shadow: 0 4px 18px rgba(0, 0, 0, .07);
}

.bspl-property-card__media {
	position: relative;
	display: block;
	aspect-ratio: 4 / 3;
	background: var(--bspl-property-surface-alt);
	line-height: 0;
}

.bspl-property-card__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.bspl-property-card__image--empty {
	display: block;
	width: 100%;
	height: 100%;
	background: var(--bspl-property-surface-alt);
}

.bspl-property-card__badges {
	position: absolute;
	top: 10px;
	left: 10px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.bspl-property-card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
	padding: 16px;
	overflow-wrap: break-word;
}

.bspl-property-card__type {
	margin: 0;
	color: var(--bspl-property-muted);
	font-size: .75em;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.bspl-property-card__title {
	margin: 0;
	font-size: 1.05em;
	line-height: 1.35;
}

.bspl-property-card__title a {
	color: inherit;
	text-decoration: none;
}

.bspl-property-card__title a:hover {
	color: var(--bspl-property-accent);
}

.bspl-property-card__location {
	margin: 0;
	color: var(--bspl-property-muted);
	font-size: .85em;
}

.bspl-property-card__price {
	margin: 4px 0 0;
	font-size: 1.15em;
	font-weight: 700;

	/*
	 * The price is the one number every visitor is looking for, so it gets the
	 * brand gradient rather than a flat colour. background-clip on text needs
	 * the -webkit- prefix to work at all in Safari and Chrome.
	 */
	background: var(--bspl-property-accent-bg);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

.bspl-property-card__facts {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	margin: 8px 0 0;
	padding: 8px 0 0;
	border-top: 1px solid var(--bspl-property-line);
	list-style: none;
}

.bspl-property-card__facts li {
	display: flex;
	flex-direction: column;
}

.bspl-property-card__fact-label {
	color: var(--bspl-property-muted);
	font-size: .7em;
	letter-spacing: .06em;
	text-transform: uppercase;
}

.bspl-property-card__fact-value {
	font-size: .9em;
	font-weight: 600;

	/* Digits line up between cards rather than wobbling. */
	font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Pills
   ========================================================================== */

.bspl-property-pill {
	display: inline-block;
	padding: 3px 9px;
	border-radius: 999px;
	font-size: .7em;
	font-weight: 700;
	letter-spacing: .04em;
	line-height: 1.5;
	text-transform: uppercase;
	white-space: nowrap;
}

.bspl-property-pill--featured {
	background: var(--bspl-property-accent-bg);
	color: #fff;
}

/* Each state carries distinct TEXT as well as colour, so the meaning survives
   for a colour-blind reader. */
.bspl-property-pill--available {
	background: #e6f4ea;
	color: var(--bspl-property-success);
}

.bspl-property-pill--under_offer,
.bspl-property-pill--upcoming {
	background: #fdf3e0;
	color: #8a5a00;
}

.bspl-property-pill--sold,
.bspl-property-pill--rented {
	background: #fdecec;
	color: var(--bspl-property-danger);
}

.bspl-property-pill--withdrawn {
	background: var(--bspl-property-surface-alt);
	color: var(--bspl-property-muted);
}

/* ==========================================================================
   Search form
   ========================================================================== */

.bspl-property-search {
	display: grid;
	gap: 12px;
	margin: 0 0 24px;
	padding: 16px;
	background: var(--bspl-property-surface-alt);
	border: 1px solid var(--bspl-property-line);
	border-radius: var(--bspl-property-radius);
	grid-template-columns: minmax(0, 1fr);
}

.bspl-property-search__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	margin: 0;
}

.bspl-property-search__field label {
	color: var(--bspl-property-muted);
	font-size: .75em;
	font-weight: 600;
	letter-spacing: .05em;
	text-transform: uppercase;
}

.bspl-property-search input,
.bspl-property-search select,
.bspl-property-form input,
.bspl-property-form select,
.bspl-property-form textarea {
	width: 100%;
	min-width: 0;

	/* 44px minimum touch target. */
	min-height: 44px;
	padding: 9px 12px;
	background: var(--bspl-property-surface);
	border: 1px solid var(--bspl-property-line);
	border-radius: var(--bspl-property-radius);
	color: inherit;
	font: inherit;
}

.bspl-property-search input:focus-visible,
.bspl-property-search select:focus-visible,
.bspl-property-form input:focus-visible,
.bspl-property-form select:focus-visible,
.bspl-property-form textarea:focus-visible {
	outline: 3px solid var(--bspl-property-accent);
	outline-offset: 1px;
}

.bspl-property-search__actions {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
}

.bspl-property-search__reset {
	color: var(--bspl-property-muted);
	font-size: .85em;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.bspl-property-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 11px 22px;
	background: var(--bspl-property-accent-bg);
	border: 0;
	border-radius: var(--bspl-property-radius);
	color: #fff;
	font: inherit;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
}

.bspl-property-btn:hover,
.bspl-property-btn:focus {
	color: #fff;
	filter: brightness(1.06);
}

.bspl-property-btn--whatsapp {
	background: #25d366;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.bspl-property-form {
	display: grid;
	gap: 12px;
	grid-template-columns: minmax(0, 1fr);
}

.bspl-property-form__row {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	margin: 0;
}

.bspl-property-form__row label {
	font-size: .9em;
	font-weight: 600;
}

.bspl-property-form__row textarea {
	min-height: 110px;

	/* Vertical only: horizontal resize lets a visitor drag the field wider
	   than the page and introduce a sideways scrollbar. */
	resize: vertical;
}

.bspl-property-form__consent label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-weight: 400;
}

.bspl-property-form__consent input {
	width: auto;
	min-height: 0;
	margin-top: 3px;
}

.bspl-property-form__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0;
}

.bspl-property-form__note {
	margin: 0;
	color: var(--bspl-property-muted);
	font-size: .8em;
}

.bspl-property-required {
	color: var(--bspl-property-danger);
}

/**
 * Turnstile.
 *
 * The widget is a fixed-size iframe Cloudflare sizes itself, so this only
 * gives it a row of its own and reserves its height. Reserving the height
 * matters: the iframe arrives after the form has painted, and without a
 * min-height the submit button jumps down the page as it loads, under a
 * cursor that is already on its way there.
 */
.bspl-property-turnstile {
	min-height: 65px;
}

/**
 * Honeypot.
 *
 * Deliberately NOT display:none — some bots specifically skip hidden fields,
 * which would defeat the trap entirely. Positioned off-screen instead, so it
 * stays in the DOM for a bot to find while no human ever meets it.
 */
.bspl-property-honeypot {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ==========================================================================
   Alerts and empty states
   ========================================================================== */

.bspl-property-alert {
	margin: 0 0 16px;
	padding: 12px 16px;
	border-left: 3px solid;
	border-radius: 0 var(--bspl-property-radius) var(--bspl-property-radius) 0;
	font-size: .95em;
}

.bspl-property-alert--success {
	background: #e6f4ea;
	border-color: var(--bspl-property-success);
	color: #14532d;
}

.bspl-property-alert--error {
	background: #fdecec;
	border-color: var(--bspl-property-danger);
	color: #7f1d1d;
}

.bspl-property-empty {
	margin: 0;
	padding: 32px 20px;
	background: var(--bspl-property-surface-alt);
	border: 1px dashed var(--bspl-property-line);
	border-radius: var(--bspl-property-radius);
	color: var(--bspl-property-muted);
	text-align: center;
}

/* ==========================================================================
   Single property
   ========================================================================== */

.bspl-property-single__head {
	margin: 0 0 20px;
}

.bspl-property-single__location {
	margin: 0 0 4px;
	color: var(--bspl-property-muted);
	font-size: .85em;
	letter-spacing: .06em;
	text-transform: uppercase;
}

.bspl-property-single__title {
	margin: 0 0 10px;
}

.bspl-property-single__headline {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}

.bspl-property-single__price {
	margin: 0;
	font-size: 1.6em;
	font-weight: 800;
	background: var(--bspl-property-accent-bg);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

.bspl-property-single__price-note {
	margin: 6px 0 0;
	color: var(--bspl-property-muted);
	font-size: .85em;
}

.bspl-property-single__hero {
	margin: 0 0 24px;
}

.bspl-property-single__hero-image {
	width: 100%;
	height: auto;
	border-radius: var(--bspl-property-radius);
}

.bspl-property-single__layout {
	display: grid;
	gap: 28px;
	grid-template-columns: minmax(0, 1fr);
}

.bspl-property-single__main > section {
	margin: 0 0 28px;
}

/* --- Specification table ------------------------------------------------ */

.bspl-property-specs__list {
	display: grid;
	gap: 0;
	margin: 0;
	border: 1px solid var(--bspl-property-line);
	border-radius: var(--bspl-property-radius);
	overflow: hidden;
	grid-template-columns: minmax(0, 1fr);
}

.bspl-property-specs__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	padding: 10px 14px;
	border-bottom: 1px solid var(--bspl-property-line);
}

.bspl-property-specs__row:last-child {
	border-bottom: 0;
}

.bspl-property-specs__row:nth-child(odd) {
	background: var(--bspl-property-surface-alt);
}

.bspl-property-specs__row dt {
	color: var(--bspl-property-muted);
	font-size: .85em;
}

.bspl-property-specs__row dd {
	margin: 0;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	text-align: right;
}

/* --- Gallery ------------------------------------------------------------- */

.bspl-property-gallery-public__list {
	display: grid;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bspl-property-gallery-public__item img {
	width: 100%;
	height: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: var(--bspl-property-radius);
}

/* --- Amenities ----------------------------------------------------------- */

.bspl-property-amenities__list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.bspl-property-amenities__list li {
	padding: 6px 12px;
	background: var(--bspl-property-surface-alt);
	border: 1px solid var(--bspl-property-line);
	border-radius: 999px;
	font-size: .85em;
}

/* ==========================================================================
   Archive
   ========================================================================== */

.bspl-property-archive__head {
	margin: 0 0 20px;
}

.bspl-property-archive__title {
	margin: 0 0 6px;
}

.bspl-property-archive__count {
	margin: 0;
	color: var(--bspl-property-muted);
	font-size: .85em;
}

.bspl-property-pagination {
	display: flex;
	justify-content: center;
	margin-top: 28px;
}

.bspl-property-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	margin: 0 3px;
	padding: 0 10px;
	border: 1px solid var(--bspl-property-line);
	border-radius: var(--bspl-property-radius);
	color: inherit;
	text-decoration: none;
}

.bspl-property-pagination .page-numbers.current {
	background: var(--bspl-property-accent-bg);
	border-color: transparent;
	color: #fff;
	font-weight: 700;
}

/* ==========================================================================
   Widgets
   ========================================================================== */

.bspl-property-widget__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.bspl-property-widget__item + .bspl-property-widget__item {
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid var(--bspl-property-line);
}

.bspl-property-widget__link {
	display: flex;
	align-items: center;
	gap: 10px;
	color: inherit;
	text-decoration: none;
}

.bspl-property-widget__thumb img {
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: var(--bspl-property-radius);
}

.bspl-property-widget__body {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.bspl-property-widget__title {
	font-size: .9em;
	line-height: 1.3;
}

.bspl-property-widget__price {
	color: var(--bspl-property-accent);
	font-size: .85em;
	font-weight: 700;
}

/* ==========================================================================
   Breakpoints
   ========================================================================== */

@media (min-width: 576px) {
	/*
	 * No .bspl-property-grid--* rules here any more. The grid sizes itself from its
	 * container now; re-adding a viewport breakpoint would override that and
	 * bring back the crushed-cards bug.
	 */
	.bspl-property-form {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bspl-property-form__row--wide,
	.bspl-property-form__actions,
	.bspl-property-form__note,
	.bspl-property-form__consent,
	.bspl-property-turnstile {
		grid-column: 1 / -1;
	}

	.bspl-property-gallery-public__list {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 782px) {
	.bspl-property-search {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.bspl-property-search__actions {
		grid-column: 1 / -1;
	}

	.bspl-property-specs__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bspl-property-specs__row:nth-child(odd) {
		background: transparent;
	}

	.bspl-property-specs__row:nth-child(4n + 1),
	.bspl-property-specs__row:nth-child(4n + 2) {
		background: var(--bspl-property-surface-alt);
	}
}

@media (min-width: 992px) {
	.bspl-property-single__layout {
		grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
	}

	.bspl-property-single__aside {
		position: sticky;
		top: 24px;
		align-self: start;
	}

	/* The sidebar form is narrow; one column reads better there. */
	.bspl-property-single__aside .bspl-property-form {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (prefers-reduced-motion: reduce) {
	.bspl-property-card {
		transition: none;
	}
}

/* ==========================================================================
   Lightbox
   --------------------------------------------------------------------------
   Created by assets/js/bspl-property-public.js. With JavaScript disabled the gallery
   thumbnails are ordinary links to the full-size image, which is a perfectly
   good fallback and the reason this is an enhancement rather than a feature.
   ========================================================================== */

.bspl-property-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(0, 0, 0, .88);
}

.bspl-property-lightbox__image {
	max-width: 100%;
	max-height: 100%;
	border-radius: var(--bspl-property-radius);
	object-fit: contain;
}

.bspl-property-lightbox__close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 44px;
	height: 44px;
	background: rgba(255, 255, 255, .12);
	border: 0;
	border-radius: 50%;
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}

.bspl-property-lightbox__close:focus-visible {
	outline: 3px solid var(--bspl-property-accent);
	outline-offset: 2px;
}

/* Stops the page behind scrolling while the dialog is open. */
body.bspl-property-lightbox-open {
	overflow: hidden;
}

/* Horizontal scroll is confined to the box; the page never scrolls sideways. */
.bspl-property-table-scroll {
	position: relative;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.bspl-property-table-scroll.has-overflow::after {
	content: "";
	position: sticky;
	top: 0;
	right: 0;
	float: right;
	width: 28px;
	height: 100%;
	margin-left: -28px;
	background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, .96));
	pointer-events: none;
}
