.properties-page {
  margin-top: 1rem;
}

/* ── FILTRI DESKTOP — sticky sotto l'header ── */
#filter-container {
  background: #004B37;
  color: #DCEFDA;
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  position: sticky;
  top: var(--header-h, 60px);
  z-index: 90;
  font-size: 13px;
  border-bottom: 2px solid #2D8B6F;
}

/* ── DRAWER MOBILE — scorre da sinistra, parte sotto l'header ── */
#filter-drawer {
  position: fixed;
  top: calc(var(--header-h, 60px) + 8px);
  left: 0;
  width: 80%;
  max-width: 300px;
  height: calc(100dvh - var(--header-h, 60px));
  overflow-y: auto;
  background: #004B37;
  color: #DCEFDA;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 13px;
  border-right: 2px solid #2D8B6F;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 999;
}

#filter-drawer.open {
  transform: translateX(0);
}

.close-drawer {
  display: none;
}

/* ── BOTTONE APRI/CHIUDI FILTRI (mobile, in basso a sinistra) ── */
.mobile-filter-btn {
  position: fixed;
  bottom: 1rem;
  left: .6rem;
  z-index: 1000;
  background: #004B37;
  color: #DCEFDA;
  border: 2px solid #DCEFDA;
  font-size: 20px;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, border-color 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.mobile-filter-btn:hover {
  border-color: #2D8B6F;
}

.mobile-filter-btn:active,
.mobile-filter-btn.active {
  background: #DCEFDA;
  color: #004B37;
  border-color: #DCEFDA;
  transform: scale(0.93);
}

/* ── GRUPPI FILTRO ── */
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-group--price { gap: 4px; }
.filter-group--tags  { gap: 6px; }
.filter-group--toggles { gap: 6px; flex-wrap: wrap; }

/* Select tipo */
.filter-select {
  background: #2D8B6F;
  color: #DCEFDA;
  border: 1px solid #DCEFDA44;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
  appearance: none;
  padding-right: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23DCEFDA'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.filter-select:hover,
.filter-select:focus {
  background-color: #004B37;
  border-color: #DCEFDA;
}

/* Input numerici */
.filter-input {
  background: #2D8B6F;
  color: #DCEFDA;
  border: 1px solid #DCEFDA44;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  width: 72px;
  outline: none;
  transition: border-color 0.2s;
}

.filter-input--sm { width: 48px; }

.filter-input:focus { border-color: #DCEFDA; }

.filter-input::placeholder { color: #DCEFDA66; }

/* Rimuovi spinner numerici */
.filter-input::-webkit-inner-spin-button,
.filter-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.filter-input[type=number] { -moz-appearance: textfield; }

/* Chips tag */
.filter-tag-chip {
  background: transparent;
  color: #DCEFDA;
  border: 1px solid #DCEFDA55;
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.filter-tag-chip:hover { border-color: #DCEFDA; background: #2D8B6F; }

.filter-tag-chip.active {
  background: #DCEFDA;
  color: #004B37;
  border-color: #DCEFDA;
}

/* Toggle (pool / giardino / preferite) */
.filter-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 3px 10px;
  border: 1px solid #DCEFDA55;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  user-select: none;
  color: #DCEFDA;
}

.filter-toggle:hover { border-color: #DCEFDA; background: #2D8B6F; }

.filter-toggle input[type="checkbox"] { display: none; }

.filter-toggle:has(input:checked) {
  background: #DCEFDA;
  color: #004B37;
  border-color: #DCEFDA;
}

/* Reset */
.filter-reset {
  background: transparent;
  color: #DCEFDA77;
  border: 1px solid #DCEFDA33;
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: auto;
}

.filter-reset:hover {
  color: #DCEFDA;
  border-color: #DCEFDA;
  background: #2D8B6F;
}

/* ── CONTAINER SCROLL SNAP ── */
#properties-container {
  height: calc(100dvh - var(--header-h, 60px));
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

#properties-container::-webkit-scrollbar { display: none; }

/* ── CARD ── */
.property-card {
  scroll-snap-align: start;
  height: 90%;
  display: flex;
  flex-direction: row;
  background: #fff;
  overflow: hidden;
  margin-bottom: 1rem;
}

/* ── LATO IMMAGINI ── */
.property-image-section {
  position: relative;
  flex: 0 0 60%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.property-images {
  flex: 1;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.property-images::-webkit-scrollbar { display: none; }

.image-wrapper {
  position: relative;
  min-width: 100%;
  flex-shrink: 0;
  height: 100%;
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── BARRA PREZZO ── */
.price-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: #004B37;
  color: #fff;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
  user-select: none;
}

.price-bar:hover { background: #004B37; }

.price-bar .toggle-icon {
  font-size: 11px;
  opacity: 0.8;
  transition: transform 0.3s;
}

.price-bar.open .toggle-icon { transform: rotate(180deg); }

/* ── PANNELLO DETTAGLI ── */
.details-panel {
  position: absolute;
  top: 36px;
  left: 0;
  right: 0;
  background: rgba(0, 75, 55, 0.92);
  color: #fff;
  padding: 0 12px;
  font-size: 14px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.3s ease, padding 0.3s;
}

.details-panel.open {
  max-height: 300px;
  opacity: 1;
  padding-top: 12px;
  padding-bottom: 12px;
}

.details-panel .detail-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── DESCRIZIONE (contenitore flex) ── */
.property-desc {
  flex: 1;
  padding-left: 24px;
  padding-right: 24px;
  display: flex;
  flex-direction: column;
  color: #004B37;
  height: 100%;               /* occupa tutta l'altezza disponibile */
  overflow: hidden;           /* impedisce lo spillamento */
}

/* Wrapper scrollabile per titolo e descrizione */
.desc-text-wrapper {
  flex: 1 1 auto;             /* occupa lo spazio disponibile */
  overflow-y: auto;           /* scroll verticale se necessario */
  padding-right: 8px;         /* piccolo spazio per non coprire il testo con la scrollbar */
  margin-bottom: 8px;         /* separazione dal footer */
}

.desc-text-wrapper h2 {
  font-size: clamp(18px, 2vw, 26px);
  margin-bottom: 0.75rem;
}

.desc-text-wrapper p {
  font-size: clamp(14px, 1.3vw, 16px);
  line-height: 1.8;
}

/* Footer fisso */
.property-footer {
  flex-shrink: 0;              /* non si restringe */
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
}

.footer-left {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.footer-right {
  flex-shrink: 0;
}

/* Tag dentro il footer */
.footer-left .tag-chip {
  background: #2D8B6F;
  color: #fff;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* Pulsante preferiti */
.property-footer .favorite-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  margin: 0;
  color: #004B37;
}

.property-footer .favorite-btn.saved {
  color: red;
}

.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #f5f5f5;
  color: #999;
  font-size: 14px;
}

/* ── PORTRAIT STRETTO (telefono verticale) ── */
@media (max-aspect-ratio: 2/3) {
  .property-card { flex-direction: column; }

  .property-image-section {
    flex: 0 0 60%;
    width: 100%;
  }

  .property-desc { flex: 1; }

  .property-footer {
    padding: 6px 10px;
  }
}