/* Nestermind Frontend
   Colori: usano i colori globali di Elementor, con valori di riserva.
   Per personalizzare basta ridefinire le variabili, es. .nsif-search { --nsif-accent: #b8860b; } */

.nsif-info,
.nsif-gallery,
.nsif-details,
.nsif-features,
.nsif-search,
.nsif-map {
	--nsif-accent: var(--e-global-color-primary, #009a96);
	--nsif-text: #2b2f30;
	--nsif-muted: #6b7280;
	--nsif-border: rgba(0, 0, 0, 0.1);
	--nsif-radius: 6px;
	--nsif-gap: 8px;
}

/* ---------- Galleria ---------- */
.nsif-gallery {
	display: grid;
	gap: var(--nsif-gap);
	grid-template-columns: repeat(var(--nsif-cols, 3), 1fr);
}
.nsif-gallery__item {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--nsif-radius);
	aspect-ratio: 4 / 3;
	background: #f2f2f2;
}
.nsif-gallery__item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}
.nsif-gallery__item:hover img {
	transform: scale(1.03);
}
.nsif-gallery__item--hidden {
	display: none;
}
.nsif-gallery__more {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	font-size: 1.25rem;
	font-weight: 600;
}

/* Mosaico: prima foto grande a sinistra, le altre a destra.
   Il blocco ha proporzioni fisse e le foto riempiono le celle. */
.nsif-gallery--mosaico {
	grid-template-columns: 2fr 1fr 1fr;
	grid-template-rows: repeat(2, minmax(0, 1fr));
	aspect-ratio: 2 / 1;
}
.nsif-gallery--mosaico .nsif-gallery__item {
	aspect-ratio: auto;
	min-height: 0;
}
.nsif-gallery--mosaico .nsif-gallery__item:first-child {
	grid-row: span 2;
}
.nsif-gallery--mosaico[data-count="1"] {
	grid-template-columns: 1fr;
	grid-template-rows: 1fr;
	aspect-ratio: 16 / 9;
}
.nsif-gallery--mosaico[data-count="1"] .nsif-gallery__item:first-child {
	grid-row: auto;
}
.nsif-gallery--mosaico[data-count="2"] {
	grid-template-columns: 2fr 1fr;
	grid-template-rows: 1fr;
	aspect-ratio: 2.4 / 1;
}
.nsif-gallery--mosaico[data-count="2"] .nsif-gallery__item:first-child {
	grid-row: auto;
}
.nsif-gallery--mosaico[data-count="3"] {
	grid-template-columns: 2fr 1fr;
	aspect-ratio: 16 / 9;
}
.nsif-gallery--mosaico[data-count="4"] {
	grid-template-columns: 2fr 1fr;
	grid-template-rows: repeat(3, minmax(0, 1fr));
	aspect-ratio: 16 / 9;
}
.nsif-gallery--mosaico[data-count="4"] .nsif-gallery__item:first-child {
	grid-row: span 3;
}

@media (max-width: 767px) {
	.nsif-gallery,
	.nsif-gallery--mosaico,
	.nsif-gallery--mosaico[data-count] {
		grid-template-columns: repeat(2, 1fr);
		grid-template-rows: none;
		aspect-ratio: auto;
	}
	.nsif-gallery--mosaico .nsif-gallery__item {
		aspect-ratio: 4 / 3;
	}
	.nsif-gallery--mosaico .nsif-gallery__item:first-child,
	.nsif-gallery--mosaico[data-count] .nsif-gallery__item:first-child {
		grid-column: 1 / -1;
		grid-row: auto;
	}
}

/* ---------- Prezzo e valori ---------- */
.nsif-price {
	font-weight: 600;
}
.nsif-value__label {
	color: var(--nsif-muted);
}

/* ---------- Tabella dati ---------- */
.nsif-details__title,
.nsif-features__title {
	margin: 0 0 0.75em;
}
.nsif-details__list {
	margin: 0;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	column-gap: 2rem;
}
.nsif-details__row {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.6em 0;
	border-bottom: 1px solid var(--nsif-border);
}
.nsif-details__row dt {
	color: var(--nsif-muted);
	font-weight: 400;
}
.nsif-details__row dd {
	margin: 0;
	font-weight: 600;
	text-align: right;
	color: var(--nsif-text);
}
@media (max-width: 767px) {
	.nsif-details__list {
		grid-template-columns: 1fr;
	}
}

/* ---------- Caratteristiche ---------- */
.nsif-features__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(var(--nsif-cols, 2), minmax(0, 1fr));
	gap: 0.5em 2rem;
}
.nsif-features__list li {
	position: relative;
	padding-left: 1.6em;
}
.nsif-features__list li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.3em;
	width: 1em;
	height: 1em;
	border-radius: 50%;
	background: var(--nsif-accent);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a8 8 0 1 0 0 16A8 8 0 0 0 8 0Zm3.7 5.9-4.2 4.6a.8.8 0 0 1-1.2 0L4.3 8.3a.8.8 0 1 1 1.2-1.1l1.4 1.6 3.6-4a.8.8 0 1 1 1.2 1.1Z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a8 8 0 1 0 0 16A8 8 0 0 0 8 0Zm3.7 5.9-4.2 4.6a.8.8 0 0 1-1.2 0L4.3 8.3a.8.8 0 1 1 1.2-1.1l1.4 1.6 3.6-4a.8.8 0 1 1 1.2 1.1Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
@media (max-width: 767px) {
	.nsif-features__list {
		grid-template-columns: 1fr;
	}
}

/* ---------- Form di ricerca ---------- */
.nsif-search {
	display: grid;
	gap: 12px;
	align-items: end;
}
.nsif-search--orizzontale {
	grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
}
.nsif-search--verticale {
	grid-template-columns: 1fr;
}
.nsif-search__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin: 0;
}
.nsif-search__label {
	font-size: 0.8em;
	color: var(--nsif-muted);
}
.nsif-search select,
.nsif-search input {
	width: 100%;
	min-height: 44px;
	padding: 0 12px;
	border: 1px solid var(--nsif-border);
	border-radius: var(--nsif-radius);
	background: #fff;
	color: var(--nsif-text);
	font: inherit;
}
.nsif-search__actions {
	display: flex;
	align-items: center;
	gap: 12px;
}
.nsif-search .nsif-search__submit,
.nsif-search .nsif-search__submit:hover,
.nsif-search .nsif-search__submit:focus {
	background-color: var(--nsif-accent);
	border: 0;
	color: #fff;
}
.nsif-search .nsif-search__submit:hover,
.nsif-search .nsif-search__submit:focus {
	filter: brightness(0.92);
}
.nsif-search__submit {
	min-height: 44px;
	padding: 0 24px;
	border: 0;
	border-radius: var(--nsif-radius);
	background: var(--nsif-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	flex: 1;
}
.nsif-search__reset {
	font-size: 0.85em;
	white-space: nowrap;
}

/* ---------- Mappe ---------- */
.nsif-map {
	width: 100%;
	border-radius: var(--nsif-radius);
	overflow: hidden;
	z-index: 0;
}
.nsif-map .leaflet-popup-content {
	margin: 0;
}
.nsif-map .leaflet-popup-content-wrapper {
	padding: 0;
	overflow: hidden;
	border-radius: var(--nsif-radius);
}
.nsif-popup {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding-bottom: 10px;
	color: var(--nsif-text) !important;
	text-decoration: none !important;
}
.nsif-popup img {
	width: 100%;
	height: 130px;
	object-fit: cover;
	margin-bottom: 6px;
}
.nsif-popup strong,
.nsif-popup span {
	padding: 0 12px;
}
.nsif-popup__price {
	color: var(--nsif-accent);
	font-weight: 600;
}
.nsif-popup__info {
	font-size: 0.85em;
	color: var(--nsif-muted);
}

/* ---------- Dati principali con icone ---------- */
.nsif-info {
	display: flex;
	flex-wrap: wrap;
	gap: 18px 36px;
}
.nsif-info__item {
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.nsif-info__label {
	font-size: 0.8em;
	color: var(--nsif-muted);
}
.nsif-info__value {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
	color: var(--nsif-text);
}
.nsif-info__value svg {
	width: 22px;
	height: 22px;
	flex: none;
	stroke: var(--nsif-accent);
	fill: none;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Titoli interni a [nsi_dati] e [nsi_caratteristiche] */
.nsif-details__title,
.nsif-features__title {
	color: var(--nsif-accent);
}

/* Selettore Satellite / Mappa */
.nsif-map .leaflet-control-layers {
	border: 0;
	border-radius: var(--nsif-radius);
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
	font-size: 12px;
}
.nsif-map .leaflet-control-layers-expanded {
	padding: 4px 8px;
}
.nsif-map .leaflet-control-layers-base label {
	display: inline-block;
	margin: 0 6px 0 0;
}

/* ---------- Conteggio + ordinamento ---------- */
.nsif-sort {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	--nsif-border: rgba(0, 0, 0, 0.12);
}
.nsif-sort__label {
	font-size: 0.85em;
	color: #6b7280;
	white-space: nowrap;
}
.nsif-sort select {
	min-height: 40px;
	padding: 0 34px 0 12px;
	border: 1px solid var(--nsif-border);
	border-radius: 6px;
	background-color: #fff;
	color: #2b2f30;
	font: inherit;
	font-size: 14px;
}

/* =====================================================================
   Form di ricerca [nsi_ricerca] – stile RealHomes
   ===================================================================== */
.nsif-sf {
	--sf-accent: var(--e-global-color-primary, #009a96);
	--sf-soft: #c4e4e2;
	--sf-text: #333;
	--sf-muted: #808080;
	position: relative;
	background: #fff;
	border-radius: 30px;
	box-shadow: 0 6px 30px rgba(0, 0, 0, 0.08);
	padding: 8px 8px 8px 12px;
	font-family: "Lato", sans-serif;
	font-size: 14px;
	color: var(--sf-text);
}
.nsif-sf {
	transition: border-radius 0.35s ease;
}
.nsif-sf.is-advanced {
	border-radius: 24px;
}
.nsif-sf__adv svg {
	transition: transform 0.35s ease;
}
.nsif-sf.is-advanced .nsif-sf__adv svg {
	transform: rotate(90deg);
}
.nsif-sf__main {
	display: flex;
	align-items: center;
	gap: 0;
}
.nsif-sf__field {
	position: relative;
	flex: 1 1 0;
	min-width: 0;
}
.nsif-sf__main > .nsif-sf__field + .nsif-sf__field::before {
	content: "";
	position: absolute;
	left: 0;
	top: 12px;
	bottom: 12px;
	border-left: 1px solid #e6e6e6;
}

/* Campo (select nativa e pulsante della scelta multipla) */
.nsif-sf select,
.nsif-sf .nsif-ms__toggle {
	-webkit-appearance: none;
	appearance: none;
	display: flex;
	align-items: center;
	width: 100%;
	height: 44px;
	padding: 0 46px 0 15px;
	margin: 0;
	border: 0;
	border-radius: 22px;
	background: transparent;
	color: var(--sf-text);
	font: inherit;
	font-size: 14px;
	text-align: left;
	cursor: pointer;
	box-shadow: none;
	outline-offset: -2px;
}
.nsif-sf .nsif-ms__toggle:hover,
.nsif-sf .nsif-ms__toggle:focus,
.nsif-sf select:hover {
	background: transparent;
	color: var(--sf-text);
}
.nsif-ms__label {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}
.nsif-ms.has-value .nsif-ms__label,
.nsif-sf select:has(option:checked:not([value=""])) {
	color: var(--sf-accent);
}
.nsif-sf__caret {
	position: absolute;
	right: 12px;
	top: 50%;
	width: 24px;
	height: 24px;
	margin-top: -12px;
	border-radius: 50%;
	background: var(--sf-soft);
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	transition: transform 0.2s ease;
}
.nsif-sf__caret svg {
	width: 9px;
	height: 6px;
	fill: none;
	stroke: #333;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.nsif-ms.is-open .nsif-sf__caret {
	transform: rotate(180deg);
}

/* Pannello della scelta multipla */
.nsif-ms__panel {
	position: absolute;
	z-index: 50;
	top: calc(100% + 6px);
	left: 0;
	min-width: 230px;
	width: 100%;
	padding: 12px;
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 9px 20px -9px rgba(0, 0, 0, 0.75);
}
.nsif-ms__panel[hidden] {
	display: none;
}
.nsif-sf .nsif-ms__search {
	width: 100%;
	height: 34px;
	padding: 0 14px;
	margin: 0 0 8px;
	border: 1px solid var(--sf-accent);
	border-radius: 20px;
	background: #fff;
	font: inherit;
	font-size: 14px;
}
.nsif-ms__actions {
	display: flex;
	margin: 0 0 6px;
	border: 1px solid var(--sf-accent);
	border-radius: 20px;
	overflow: hidden;
}
.nsif-sf .nsif-ms__actions button {
	flex: 1;
	height: 30px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.nsif-sf .nsif-ms__actions button + button {
	border-left: 1px solid var(--sf-accent);
}
.nsif-sf .nsif-ms__actions button:hover {
	background: var(--sf-soft);
}
.nsif-ms__actions svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: var(--sf-accent);
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.nsif-ms__list {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 240px;
	overflow-y: auto;
}
.nsif-ms__list li[hidden] {
	display: none;
}
.nsif-ms__list label {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 8px;
	margin: 0;
	border-radius: 6px;
	cursor: pointer;
	font-size: 15px;
	color: var(--sf-text);
}
.nsif-ms__list label:hover {
	background: #f4f9f9;
}
.nsif-ms__list input[type="checkbox"] {
	-webkit-appearance: none;
	appearance: none;
	flex: none;
	width: 16px;
	height: 16px;
	margin: 0;
	border: 1px solid #c9c9c9;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
}
.nsif-ms__list input[type="checkbox"]:checked {
	border-color: var(--sf-accent);
	background: var(--sf-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.nsif-ms__list input[type="checkbox"]:checked + span {
	color: var(--sf-accent);
}
.nsif-ms__empty {
	padding: 6px 8px;
	color: var(--sf-muted);
}

/* Pulsanti */
.nsif-sf__buttons {
	display: flex;
	gap: 8px;
	flex: none;
	padding-left: 8px;
}
.nsif-sf .nsif-sf__adv,
.nsif-sf .nsif-sf__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 42px;
	padding: 0 28px;
	margin: 0;
	border: 0;
	border-radius: 40px;
	font: inherit;
	font-size: 15px;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
	transition: filter 0.2s ease, background-color 0.2s ease;
}
.nsif-sf .nsif-sf__adv,
.nsif-sf .nsif-sf__adv:focus {
	background: var(--sf-soft);
	color: var(--sf-accent);
}
.nsif-sf .nsif-sf__adv:hover,
.nsif-sf.is-advanced .nsif-sf__adv {
	background: var(--sf-accent);
	color: #fff;
}
.nsif-sf__adv svg {
	width: 16px;
	height: 16px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
}
.nsif-sf .nsif-sf__submit,
.nsif-sf .nsif-sf__submit:hover,
.nsif-sf .nsif-sf__submit:focus {
	background: var(--sf-accent);
	color: #fff;
}
.nsif-sf .nsif-sf__submit:hover {
	filter: brightness(0.92);
}

/* Ricerca avanzata */
.nsif-sf__advanced {
	padding: 14px 6px 6px 15px;
	margin-top: 6px;
	border-top: 1px solid #eee;
}
.nsif-sf__advanced[hidden] {
	display: none;
}
.nsif-sf__row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 0;
	margin: 6px -6px 0 -15px;
}
.nsif-sf__row .nsif-sf__field {
	flex: 1 1 200px;
}
.nsif-sf__row .nsif-sf__field + .nsif-sf__field::before {
	content: "";
	position: absolute;
	left: 0;
	top: 12px;
	bottom: 12px;
	border-left: 1px solid #e6e6e6;
}
.nsif-sf__reset {
	display: inline-block;
	margin: 8px 0 0;
	font-size: 13px;
	color: var(--sf-muted);
	text-decoration: underline;
}

/* Cursore prezzo */
.nsif-sf__price {
	display: flex;
	align-items: center;
	gap: 18px;
	min-height: 40px;
	padding-right: 10px;
}
.nsif-sf__price-label {
	flex: none;
	font-size: 14px;
}
.nsif-sf__price-text {
	flex: none;
	font-size: 14px;
}
.nsif-sf__price-text b {
	font-weight: 400;
	color: var(--sf-accent);
}
.nsif-range {
	position: relative;
	flex: 1;
	height: 18px;
	min-width: 140px;
}
.nsif-range__track {
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: 10px;
	margin-top: -5px;
	border-radius: 10px;
	background: #ececec;
}
.nsif-range__fill {
	position: absolute;
	top: 0;
	bottom: 0;
	border-radius: 10px;
	background: var(--sf-soft);
}
.nsif-range input[type="range"] {
	-webkit-appearance: none;
	appearance: none;
	position: absolute;
	inset: 0;
	width: 100%;
	height: 18px;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	pointer-events: none;
}
.nsif-range input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 18px;
	height: 18px;
	border: 0;
	border-radius: 50%;
	background: var(--sf-accent);
	cursor: pointer;
	pointer-events: auto;
}
.nsif-range input[type="range"]::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border: 0;
	border-radius: 50%;
	background: var(--sf-accent);
	cursor: pointer;
	pointer-events: auto;
}
.nsif-range input[type="range"]::-moz-range-track {
	background: none;
}

/* Tablet e telefono: campi in colonna */
@media (max-width: 1024px) {
	.nsif-sf,
	.nsif-sf.is-advanced {
		border-radius: 20px;
		padding: 10px;
	}
	.nsif-sf__main {
		flex-wrap: wrap;
	}
	.nsif-sf__main > .nsif-sf__field {
		flex: 1 1 33%;
	}
	.nsif-sf__buttons {
		flex: 1 1 100%;
		padding: 8px 0 0;
	}
	.nsif-sf__buttons button {
		flex: 1;
	}
	.nsif-sf__price {
		flex-wrap: wrap;
		gap: 8px 14px;
	}
	.nsif-range {
		flex: 1 1 100%;
		order: 3;
	}
}
@media (max-width: 767px) {
	.nsif-sf__main > .nsif-sf__field,
	.nsif-sf__row .nsif-sf__field {
		flex: 1 1 100%;
	}
	.nsif-sf__main > .nsif-sf__field + .nsif-sf__field::before,
	.nsif-sf__row .nsif-sf__field + .nsif-sf__field::before {
		left: 15px;
		right: 15px;
		top: 0;
		bottom: auto;
		border-left: 0;
		border-top: 1px solid #eee;
	}
	.nsif-sf__buttons {
		flex-direction: column;
	}
	.nsif-sf .nsif-sf__buttons button {
		flex: none;
		width: 100%;
		padding: 0 16px;
	}
	.nsif-sf__row {
		margin-left: -15px;
	}
	.nsif-sf__advanced {
		padding-left: 15px;
	}
}

/* [nsi_info stile="riga"]: icone compatte in fila */
.nsif-info--riga {
	gap: 8px 22px;
	font-size: 13px;
	color: #666;
}
.nsif-info--riga .nsif-info__item {
	flex-direction: row;
	align-items: center;
	gap: 7px;
	white-space: nowrap;
}
.nsif-info--riga svg {
	width: 18px;
	height: 18px;
	flex: none;
	stroke: var(--nsif-accent);
	fill: none;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Segnaposto a goccia */
.nsif-map .nsif-pin {
	background: none;
	border: 0;
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}
.nsif-popup--text {
	padding: 10px 14px !important;
}
