/* ============================
   CARD — STRUTTURA BASE
============================ */
.immobile-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  margin-bottom: 35px;
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ============================
   IMMAGINE + ZOOM MORBIDO
============================ */
.immobile-img-wrap {
  position: relative;
  width: 100%;
  height: 260px;
  overflow: hidden;
}

.immobile-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}

.immobile-card:hover .immobile-img-wrap img {
  transform: scale(1.12);
}

/* ============================
   OVERLAY IN BASSO (STRISCIA NERA SFUMATA)
============================ */
.immobile-overlay-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;

  /* ✅ Striscia nera sfumata */
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.90) 0%,
    rgba(0,0,0,0.60) 40%,
    rgba(0,0,0,0.00) 100%
  );

  padding: 16px 18px 20px;
  color: #fff;
  z-index: 3;

  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* RIGA 1: Titolo + Prezzo */
.overlay-riga1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.overlay-riga1 h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(0,0,0,0.9);
}

.property-price {
  font-size: 1.2rem;
  font-weight: 800;
  text-shadow: 0 0 6px rgba(0,0,0,0.9);
}

/* RIGA 2: Tipologia + Comune + MQ */
.overlay-riga2 {
  display: flex;
  gap: 20px;
  font-size: 0.95rem;
  opacity: 0.95;
}

.overlay-riga2 span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.overlay-riga2 i {
  font-size: 1rem;
  opacity: 0.9;
}

/* ============================
   BADGE CONTRATTO — RIBBON
============================ */
.badge-angolo {
  position: absolute;
  top: 15px;
  left: -40px;
  padding: 8px 60px;
  font-size: 1rem;
  font-weight: 800;
  transform: rotate(-45deg);
  z-index: 5;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
  letter-spacing: 1px;
  color: #000;
  background: #5BC5CE;
}

/* Colori dinamici */
.badge-vendita {
  background: #E6E6E6;
}

.badge-affitto {
  background: #1976d2;
}

/* ============================
   BOTTONE DETTAGLI
============================ */
.immobile-card-content {
  padding: 18px;
  text-align: center;
}

.immobile-card-content .btn {
  display: inline-block;
  padding: 12px 28px;
  background: #61ffbe;
  color: #000 !important;
  border-radius: 6px;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.25s ease, transform 0.25s ease;
  box-shadow: 0 3px 10px rgba(0,0,0,0.20);
}

.immobile-card-content .btn:hover {
  background: #E6E6E6;
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

/* ============================
   RIMUOVI DATI SOTTO
============================ */
.property-fields {
  display: none !important;
}

/* ============================
   RESPONSIVE
============================ */
@media (max-width: 768px) {
  .immobile-img-wrap {
    height: 220px;
  }

  .immobile-overlay h3 {
    font-size: 1.25rem;
  }

  .property-price {
    font-size: 1.2rem;
  }

  .property-meta {
    font-size: 0.95rem;
  }
}
.immobile-card-content {
  padding: 0 !important;
  margin: 0 !important;
  height: 0 !important;
}
.paginazione-immobili {
  text-align: center;
  margin: 40px 0;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.paginazione-immobili .pagina-link {
  padding: 8px 14px;
  background: #222;
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  transition: 0.2s;
}

.paginazione-immobili .pagina-link:hover {
  background: #444;
}

.paginazione-immobili .pagina-link.attiva {
  background: #5bc5ce;
  border: 2px solid #fff;
}
/* Mappa con margini laterali per evitare blocco scroll */
#mappa-immobili {
  width: calc(100% - 80px); /* riduce la larghezza totale */
  margin: 0 auto 40px;      /* centra la mappa */
  border-radius: 10px;      /* opzionale, estetico */
  overflow: hidden;         /* evita spigoli */
}
/* ============================
   SCHEDE CONTRATTO
============================ */
.schede-contratto {
  display: flex;
  gap: 12px;
  margin: 25px 0 35px;
  justify-content: center;
  flex-wrap: wrap;
}

.scheda-btn {
  padding: 10px 22px;
  background: #333;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: 0.2s;
  border: 1px solid #444;
}

.scheda-btn:hover {
  background: #555;
}

.scheda-btn.attiva {
  background: #fdd835;
  color: #000;
  border-color: #000;
}

/* ✅ Mobile */
@media (max-width: 600px) {
  .scheda-btn {
    flex: 1 1 calc(50% - 10px);
    text-align: center;
    padding: 12px 0;
  }
}

/* Mappa con margini laterali e altezza garantita */
#mappa-immobili {
  width: calc(100% - 80px);
  margin: 0 auto 40px;
  border-radius: 10px;
  overflow: hidden;
}

/* Mobile: margini ridotti */
@media (max-width: 600px) {
  #mappa-immobili {
    width: 100%;
    margin: 0 0 30px;
  }
}
/* ============================
   LINGUETTE CONTRATTO - STILE COMPATTO
============================ */
.schede-contratto-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: -1px;
  padding: 0;
  justify-content: flex-start;
  border-bottom: 1px solid #ddd;
}

.scheda-tab {
  padding: 10px 18px;
  background: #fff;
  border: 1px solid #ccc;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  color: #333;
  font-weight: 500;
  text-decoration: none;
  transition: 0.2s;
  position: relative;
  top: 1px;
}

.scheda-tab:hover {
  border-color: #999;
  background: #f9f9f9;
}

.scheda-tab.attiva {
  background: #f7f7f7;
  border-color: #000;
  font-weight: 600;
  z-index: 2;
}

/* Mobile */
@media (max-width: 600px) {
  .schede-contratto-tabs {
    flex-wrap: wrap;
    gap: 8px;
  }

  .scheda-tab {
    flex: 1 1 calc(50% - 8px);
    text-align: center;
  }
}
.scheda-tab.attiva {
  background: #5BC5CE;
  border-color: #5BC5CE;
  color: #fff;
  font-weight: 600;
  z-index: 2;
}
.immobili-search-form {
  background: #5BC5CE;
  padding: 20px;
  border-radius: 0 6px 6px 6px;
  margin-top: 0;
}
/* ============================================
   BARRA FILTRI COMPATTA (AGGIUNTA SICURA)
   — Non modifica nulla del CSS esistente
   — Sovrascrive solo ciò che serve
============================================ */

.immobili-search-form {
  background: #5BC5CE;
  padding: 12px 15px;
  border-radius: 0 6px 6px 6px;
  margin-top: 0;
}

.immobili-search-form .form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.immobili-search-form .form-field {
  flex: 1 1 calc(16.66% - 10px);
  min-width: 140px;
}

.immobili-search-form select,
.immobili-search-form input[type="number"] {
  height: 38px;
  padding: 6px 10px;
  font-size: 14px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  color: #333;
  width: 100%;
}

.immobili-search-form select option:first-child {
  color: #666;
  font-weight: 500;
}

.immobili-search-form button {
  height: 38px;
  padding: 6px 15px;
  font-size: 14px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
}

.immobili-search-form button:hover {
  background: #eaeaea;
}

/* Responsive */
@media (max-width: 768px) {
  .immobili-search-form .form-field {
    flex: 1 1 48%;
  }
}

@media (max-width: 480px) {
  .immobili-search-form .form-field {
    flex: 1 1 100%;
  }
}
/* Nascondi campi Piano, Stato conservazione, Posizione */
.form-field.hide {
  display: none !important;
}
/* Nasconde il form su mobile */
@media (max-width: 768px) {
  .immobili-search-form {
    display: none;
  }

  .filtro-toggle-btn {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    background: #5BC5CE;
    color: #fff;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
  }
}

/* Classe per nascondere campi */
.form-field.hide {
  display: none !important;
}
/* Nasconde solo la linguetta "Affitto/Vendita" (ID = 3) */
.schede-contratto-tabs a[href*="motivazione=3"] {
  display: none !important;
}
/* Nasconde la terza linguetta (Affitto/Vendita) */
.schede-contratto-tabs a:nth-child(3) {
  display: none !important;
}
@media (max-width: 768px) {
  .immobili-search-form {
    display: none;
  }

  .immobili-search-form .submit-field {
    display: none !important;
  }

  .filtro-toggle-btn {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    background: #5BC5CE;
    color: #fff;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
  }
}
/* Nasconde il pulsante Filtra su desktop */
@media (min-width: 769px) {
  .filtro-toggle-btn {
    display: none !important;
  }
}
/* ✅ HOME DESKTOP — Nasconde i filtri di default */
@media (min-width: 769px) {
  body.home .immobili-search-form {
    display: none !important;
  }
}
/* ============================================================
   ✅ FIX MOBILE — Ripristina linguette e filtri funzionanti
============================================================ */
@media (max-width: 768px) {

  /* Mostra le linguette */
  .schede-contratto-tabs {
    display: flex !important;
  }

  /* Il form deve essere nascosto ma riapribile dal JS */
  .immobili-search-form {
    display: none; /* niente !important */
  }

  /* Mostra il pulsante Filtra corretto */
  .filtro-toggle-btn {
    display: block !important;
  }

  /* Nasconde eventuali pulsanti del tema */
  .immobili-search-form .submit-field {
    display: none !important;
  }
}

/* ============================================================
   ✅ HOME DESKTOP — Filtri chiusi + pulsante grande
============================================================ */
@media (min-width: 769px) {

  /* Nasconde i filtri SOLO in home */
  body.home .immobili-search-form {
    display: none !important;
  }

  /* Mostra il pulsante SOLO in home */
  body.home .filtro-toggle-btn {
    display: inline-block !important;
    margin: 30px auto;
    padding: 18px 40px;
    background: #5BC5CE;
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  }

  /* Nasconde il pulsante in tutte le altre pagine desktop */
  body:not(.home) .filtro-toggle-btn {
    display: none !important;
  }
}
/* ============================================================
   ✅ FIX MOBILE — Ripristina linguette e filtri funzionanti
============================================================ */
@media (max-width: 768px) {

  /* Mostra le linguette */
  .schede-contratto-tabs {
    display: flex !important;
  }

  /* Il form deve essere nascosto ma riapribile dal JS */
  .immobili-search-form {
    display: none !important;
  }

  /* Mostra il pulsante Filtra corretto */
  .filtro-toggle-btn {
    display: block !important;
  }
}

/* ============================================================
   ✅ HOME DESKTOP — Filtri chiusi + pulsante grande
============================================================ */
@media (min-width: 769px) {

  /* Nasconde i filtri SOLO in home */
  body.home .immobili-search-form {
    display: none !important;
  }

  /* Mostra il pulsante SOLO in home */
  body.home .filtro-toggle-btn {
    display: inline-block !important;
    margin: 30px auto;
    padding: 18px 40px;
    background: #5BC5CE;
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  }

  /* Nasconde il pulsante in tutte le altre pagine desktop */
  body:not(.home) .filtro-toggle-btn {
    display: none !important;
  }
}
/* ============================
   FIX MOBILE: linguette + filtro con toggle
   (ripristino comportamento corretto)
============================ */
@media (max-width: 768px) {

  /* Mostra le linguette */
  .schede-contratto-tabs {
    display: flex !important;
  }

  /* Il form parte chiuso, ma il JS può aprirlo */
  .immobili-search-form {
    display: none !important;
  }

  /* Mostra il pulsante Filtra */
  .filtro-toggle-btn {
    display: block !important;
    margin: 20px auto;
    padding: 10px 20px;
    background: #5BC5CE;
    color: #fff;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
  }

  /* Nasconde il bottone "Cerca" interno (submit-field) solo su mobile,
     così non ti ritrovi due pulsanti */
  .immobili-search-form .submit-field {
    display: none !important;
  }
}
/* ============================================================
   ✅ RIPRISTINO MOBILE — linguette + filtri chiusi + toggle
============================================================ */
@media (max-width: 768px) {

  /* Linguette visibili */
  .schede-contratto-tabs {
    display: flex !important;
  }

  /* Filtri chiusi di default, ma riapribili dal JS */
  .immobili-search-form {
    display: none !important;
  }

  /* Pulsante Filtra visibile */
  .filtro-toggle-btn {
    display: block !important;
    margin: 20px auto;
    padding: 10px 20px;
    background: #5BC5CE;
    color: #fff;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
  }

  /* Nasconde il pulsante "Cerca" interno */
  .immobili-search-form .submit-field {
    display: none !important;
  }
}
/* Nasconde completamente il form filtri e linguette SOLO in home */
body.home .immobili-search-form,
body.home .schede-contratto,
body.home .schede-contratto-tabs,
body.home .filtro-toggle-btn {
  display: none !important;
}
/* ✅ NASCONDE QUALSIASI MODULO DI RICERCA SOLO IN HOME */
body.home [class*="search"],
body.home [id*="search"],
body.home [class*="filter"],
body.home [id*="filter"],
body.home .immobili-search-form,
body.home .schede-contratto,
body.home .schede-contratto-tabs,
body.home .search-panel,
body.home .search-panel-custom,
body.home .property-search,
body.home .search-wrapper,
body.home .search-container {
  display: none !important;
}

/* ✅ NASCONDE QUALSIASI COSA CHE SIA UN FORM DI RICERCA SOLO IN HOME */
body.home form,
body.home [class*="search"],
body.home [id*="search"],
body.home [class*="filter"],
body.home [id*="filter"],
body.home [class*="panel"],
body.home [class*="immobili"],
body.home [class*="property"],
body.home [class*="tabs"],
body.home [class*="schede"],
body.home [class*="contratto"] {
  display: none !important;
}
