/**
 * Styles for the plugin's Elementor widgets.
 *
 * Only structure lives here: every colour, size and spacing is driven by the
 * widget's own controls, so the theme/editor always wins.
 */

.sm-attrs {
	--sm-attrs-align: start;
	--sm-attrs-divider-color: #e0e0e0;
	--sm-attrs-divider-weight: 1px;
}

.sm-attrs__title {
	margin-top: 0;
}

.sm-attrs__list {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	list-style: none;
}

.sm-attrs--inline .sm-attrs__list {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	justify-content: var(--sm-attrs-align);
}

.sm-attrs--grid .sm-attrs__list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sm-attrs__item {
	display: flex;
	align-items: center;
	justify-content: var(--sm-attrs-align);
	text-align: var(--sm-attrs-align);
	margin: 0;
	list-style: none;
}

.sm-attrs__icon {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.sm-attrs__icon svg {
	display: block;
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.sm-attrs__icon i {
	line-height: 1;
}

/* Icon after the text without flipping the box alignment. */
.sm-attrs--icon-after .sm-attrs__icon {
	order: 2;
}

.sm-attrs__separator {
	order: 3;
	flex: 0 0 auto;
}

.sm-attrs--dividers .sm-attrs__item {
	border-bottom: var(--sm-attrs-divider-weight) solid var(--sm-attrs-divider-color);
}

.sm-attrs--dividers.sm-attrs--list .sm-attrs__item:last-child,
.sm-attrs--dividers.sm-attrs--inline .sm-attrs__item {
	border-bottom: 0;
}

.sm-attrs__empty {
	margin: 0;
}

/* --- Estado del inmueble ------------------------------------------------- */

.sm-state {
	--sm-state-align: start;

	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: var(--sm-state-align);
}

.sm-state--stack {
	flex-direction: column;
	align-items: var(--sm-state-align);
}

.sm-state__item {
	display: inline-flex;
	align-items: center;
	max-width: 100%;
}

.sm-state__text {
	margin: 0;
}

.sm-state__icon {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.sm-state__icon svg {
	display: block;
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.sm-state__icon i {
	line-height: 1;
}

.sm-state--icon-after .sm-state__icon {
	order: 2;
}

.sm-state__separator {
	order: 3;
	flex: 0 0 auto;
	margin-inline-start: 0.35em;
}

/* --- Galería del inmueble ------------------------------------------------ */

.sm-gal {
	--sm-gal-columns: 4;
	--sm-gal-height: 420px;
	--sm-gal-gap: 20px;
	--sm-gal-ratio: 4 / 3;
	--sm-gal-zoom: 1.04;
	--sm-gal-zoom-duration: 0.5s;

	width: 100%;
}

.sm-gal__grid {
	position: relative; /* contiene las fotos que solo viven en el lightbox */
	display: grid;
	grid-template-columns: repeat(var(--sm-gal-columns), minmax(0, 1fr));
	gap: var(--sm-gal-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Mosaico: dos filas que reparten la altura, la primera foto ocupa 2 × 2.
   Si se piden más fotos de las que caben, las filas implícitas se reparten la
   misma altura en lugar de desbordarse. */
.sm-gal--mosaic .sm-gal__grid {
	grid-template-rows: repeat(2, minmax(0, 1fr));
	grid-auto-rows: minmax(0, 1fr);
	height: var(--sm-gal-height);
}

.sm-gal--mosaic .sm-gal__item--first {
	grid-column: span 2;
	grid-row: span 2;
}

/* Con pocas fotos el mosaico se reordena para no dejar huecos. */
.sm-gal--mosaic.sm-gal--count-1 .sm-gal__grid {
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: minmax(0, 1fr);
}

.sm-gal--mosaic.sm-gal--count-2 .sm-gal__grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
	grid-template-rows: minmax(0, 1fr);
}

.sm-gal--mosaic.sm-gal--count-3 .sm-gal__grid,
.sm-gal--mosaic.sm-gal--count-4 .sm-gal__grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sm-gal--mosaic.sm-gal--count-1 .sm-gal__item--first,
.sm-gal--mosaic.sm-gal--count-2 .sm-gal__item--first,
.sm-gal--mosaic.sm-gal--count-4 .sm-gal__item--first {
	grid-column: span 1;
	grid-row: span 1;
}

.sm-gal--mosaic.sm-gal--count-3 .sm-gal__item--first {
	grid-column: span 1;
}

/* Cuadrícula uniforme: cada foto con su proporción. */
.sm-gal--grid .sm-gal__item {
	aspect-ratio: var(--sm-gal-ratio);
}

.sm-gal__item {
	position: relative;
	display: block;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	overflow: hidden;
	list-style: none;
	background-color: #f5f6f7;
	text-decoration: none;
	color: inherit;
}

.sm-gal__item::before,
.sm-gal__item::marker {
	content: none;
}

/* Velo opcional al pasar el ratón (el color lo pone el widget). */
.sm-gal__item::after {
	content: "";
	position: absolute;
	inset: 0;
	opacity: 0;
	transition: opacity var(--sm-gal-zoom-duration) ease;
	pointer-events: none;
}

.sm-gal__item:hover::after {
	opacity: 1;
}

.sm-gal__image {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	object-fit: cover;
	object-position: center;
	transition: transform var(--sm-gal-zoom-duration) cubic-bezier(0.2, 0.7, 0.2, 1);
}

.sm-gal--grid .sm-gal__image,
.sm-gal--mosaic .sm-gal__image {
	height: 100%;
}

.sm-gal--zoom .sm-gal__item:hover .sm-gal__image {
	transform: scale(var(--sm-gal-zoom));
}

/* Fotos que solo existen para el lightbox. */
.sm-gal__item--hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	border: 0;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.sm-gal__more {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: rgba(27, 31, 34, 0.5);
	color: #fff;
	font-size: 15px;
	font-weight: 300;
	letter-spacing: 0.02em;
	transition: background-color 0.3s ease;
}

.sm-gal__caption {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	padding: 8px 12px;
	background-color: rgba(27, 31, 34, 0.6);
	color: #fff;
	font-size: 13px;
	line-height: 1.4;
}

.sm-gal__empty {
	margin: 0;
}

.sm-gal__item:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

@media (max-width: 767px) {

	/* La primera foto a todo el ancho y el resto en cuadrícula. */
	.sm-gal--mobile-stack .sm-gal__grid,
	.sm-gal--mobile-stack.sm-gal--count-1 .sm-gal__grid,
	.sm-gal--mobile-stack.sm-gal--count-2 .sm-gal__grid,
	.sm-gal--mobile-stack.sm-gal--count-3 .sm-gal__grid,
	.sm-gal--mobile-stack.sm-gal--count-4 .sm-gal__grid {
		grid-template-columns: repeat(var(--sm-gal-columns), minmax(0, 1fr));
		grid-template-rows: auto;
		height: auto;
	}

	.sm-gal--mobile-stack .sm-gal__item--first {
		grid-column: 1 / -1;
		grid-row: auto;
		aspect-ratio: 4 / 3;
	}

	.sm-gal--mobile-stack .sm-gal__item:not(.sm-gal__item--first) {
		grid-column: auto;
		grid-row: auto;
		aspect-ratio: 1 / 1;
	}

	.sm-gal--counter-short-mobile .sm-gal__more-text {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {

	.sm-gal__image,
	.sm-gal__more,
	.sm-gal__item::after {
		transition: none;
	}

	.sm-gal--zoom .sm-gal__item:hover .sm-gal__image {
		transform: none;
	}
}

/* --- Buscador de inmuebles ----------------------------------------------- */

.sm-search {
	--sm-search-gap: 12px;
	--sm-search-field-width: 180px;

	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: var(--sm-search-gap);
	width: 100%;
}

/* En una fila: los campos se reparten el ancho sobrante a partir de su ancho
   mínimo, y el botón ocupa solo lo que necesita (con grid, tres celdas se
   repartían el ancho completo y el botón salía enorme). */
.sm-search--stack {
	flex-direction: column;
	align-items: stretch;
}

.sm-search__field {
	display: flex;
	flex: 1 1 var(--sm-search-field-width);
	min-width: 0;
	flex-direction: column;
}

.sm-search__label {
	display: block;
}

/* Oculta la etiqueta sin quitarla del árbol de accesibilidad. */
.sm-search__label--hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	border: 0;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.sm-search__control {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	min-height: 0;
	margin: 0;
	font: inherit;
	line-height: 1.4;
	color: inherit;
	background-color: #fff;
	border: 1px solid #e4e7ea;
}

.sm-search__actions {
	display: flex;
	flex: 0 0 auto;
	gap: var(--sm-search-gap);
	align-items: center;
}

/* Divisor entre campos (y antes del botón). `align-self: stretch` le da la
   altura de la fila sin tocar la alineación del resto: los campos siguen
   pegados abajo aunque tengan etiqueta y el botón no. */
.sm-search__divider {
	flex: 0 0 auto;
	align-self: stretch;
	width: var(--sm-search-divider-width, 1px);
	background-color: var(--sm-search-divider-color, #e4e7ea);
}

.sm-search__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	margin: 0;
	font: inherit;
	line-height: 1.4;
	color: #fff;
	background-color: #1b1f22;
	border: 0;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sm-search__button--icon-after .sm-search__button-icon {
	order: 2;
}

.sm-search__button-icon {
	display: inline-flex;
	align-items: center;
	line-height: 1;
}

.sm-search__button-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.sm-search--button-full .sm-search__actions {
	flex: 1 1 100%;
}

.sm-search--button-full .sm-search__button {
	width: 100%;
}

.sm-search__reset {
	flex: 0 0 auto;
	white-space: nowrap;
}

@media (max-width: 767px) {

	.sm-search--no-dividers-mobile .sm-search__divider {
		display: none;
	}
}

/* --- Descripción del barrio ---------------------------------------------- */

.sm-barrio {
	--sm-barrio-align: left;

	text-align: var(--sm-barrio-align);
}

.sm-barrio__title {
	margin: 0;
}

/* The description comes from wpautop(), so it arrives wrapped in paragraphs:
   drop the outer margins and let the spacing control drive the rhythm. */
.sm-barrio__text > :first-child {
	margin-top: 0;
}

.sm-barrio__text > :last-child {
	margin-bottom: 0;
}

.sm-barrio__link {
	display: inline-block;
}

/* --- Aviso del editor ---------------------------------------------------- */

.sm-placeholder {
	margin: 0;
	padding: 12px 16px;
	border: 1px dashed #c3c4c7;
	border-radius: 4px;
	color: #646970;
	font-size: 13px;
	line-height: 1.5;
}
