/* ==========================================================================
   1. Barra de Búsqueda Principal (Sticky) y Dropdowns
   ========================================================================== */

.search-bar-sticky-container {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: #fff;
  padding: 15px 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  width: 100%;
}

.search-bar {
  width: 90%;
  margin: 0 auto;
  background-color: white;
  padding: 15px 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

.search-bar .form-group {
  color: #555;
  flex-grow: 1;
  padding: 0 15px;
  text-align: left;
  width: 25%;
}

#dropdownCommunities {
  width: 177px;
}

.search-bar>a {
  color: #333;
  text-decoration: none;
  white-space: nowrap;
  padding: 0 15px;
  font-weight: 700;
}

.search-bar label {
  font-size: 0.8em;
  margin: 0;
  color: #333;
}

.search-bar select,
.search-bar input[type="text"] {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 1em;
  font-weight: bold;
  color: #333;
  padding: 8px 0;
  margin: 0;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.search-bar input:focus,
.search-bar select:focus {
  outline: none;
}

.price-inputs {
  display: flex;
  align-items: center;
}

.price-inputs span {
  margin: 0 5px;
  color: #ccc;
}

.search-bar .separator {
  width: 1px;
  height: 45px;
  background-color: #e0e0e0;
}

.search-bar-button {
  background-color: #28a745;
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: bold;
  margin-left: 15px;
}

.search-bar .more {
  font-weight: 100;
  padding-right: 6px;
}

.search-bar .search {
  padding-right: 10px;
}


/* --- Dropdowns --- */
.dropdown {
  position: relative;
  display: inline-block;
  width: 100%;
}

.dropdown .arrow {
  font-size: 20px;
  transition: transform 0.2s;
  color: black;
  font-weight: 400;
  display: inline-block;
}

.dropdown.active .arrow {
  transform: rotate(180deg);
}

.dropdown-btn {
  background: transparent;
  border: none;
  padding: 8px 0;
  color: #888;
  font-weight: bold;
  cursor: pointer;
  width: 100%;
  text-align: left;
  position: relative;
  font-size: 1em;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #ffffff;
  color: #333333;
  border-radius: 8px;
  margin-top: 15px;
  min-width: 240px;
  z-index: 10;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
  border: 1px solid #e0e0e0;
  padding: 10px;
}

.dropdown.active .dropdown-content {
  display: block;
}

.dropdown-content::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 30px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid #ffffff;
}

.dropdown-content label {
  padding: 0;
}

.dropdown-content .radio-label,
.dropdown-content .checkbox-label {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 1rem;
  color: #333;
}

.dropdown-content .radio-label:hover,
.dropdown-content .checkbox-label:hover {
  background-color: #f5f5f5;
}

.dropdown-content input[type="radio"],
.dropdown-content input[type="checkbox"] {
  display: none;
}

.dropdown-content input[type="radio"]+span {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 12px;
  border-radius: 50%;
  border: 2px solid #cccccc;
  position: relative;
  transition: all 0.2s ease;
}

.dropdown-content input[type="radio"]:checked+span {
  border-color: #28a745;
}

.dropdown-content input[type="radio"]:checked+span::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #28a745;
}

.dropdown-content input[type="checkbox"]+span {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 10px;
  border-radius: 4px;
  border: 2px solid #cccccc;
  position: relative;
  vertical-align: middle;
  transition: all 0.2s ease;
}

.dropdown-content input[type="checkbox"]:checked+span {
  border-color: #28a745;
  background-color: #28a745;
}

.dropdown-content input[type="checkbox"]:checked+span::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.dropdown-content.wide {
  min-width: 550px;
  padding: 20px;
}

.dropdown-columns {
  display: flex;
  justify-content: space-between;
  gap: 30px;
}

.column {
  flex: 1;
}

.dropdown-footer {
  display: flex;
  justify-content: space-between;
  padding-top: 20px;
  margin-top: 10px;
  border-top: 1px solid #eee;
}

.dropdown-footer button {
  border: none;
  padding: 12px 25px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.reset-btn {
  background-color: #f0f0f0;
  color: #333;
}

.apply-btn {
  background-color: #28a745;
  color: white;
}


/* --- Dropdown Específico: Type --- */
#dropdownType .dropdown-content.wide {
  min-width: 380px;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.type-option {
  display: block;
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.type-option:hover {
  border-color: #aaa;
}

.type-option-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 15px 10px;
  text-align: center;
  font-size: 1em;
  color: #555;
}

.type-option input[type="checkbox"]:checked+.type-option-content {
  background-color: #28a745;
  color: white;
  border-color: #28a745;
}

.type-option-content span {
  font-size: 0.8em;
  font-weight: bold;
  margin-top: 8px;
}

.type-option-content i {
  font-size: 2em;
  height: 32px;
  width: 32px;
  background-color: #888;
  display: block;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.type-option input[type="checkbox"]:checked+.type-option-content i {
  background-color: white;
}

.extra-option {
  margin-bottom: 20px;
  padding: 20px 0 0;
  border-top: 1px solid #eee;
}


/* --- Dropdown Específico: Beds & Baths --- */
#dropdownBedsBaths .dropdown-content {
  min-width: 350px;
  padding: 20px;
}

.beds-baths-section {
  margin-bottom: 20px;
}

.section-label {
  display: block;
  font-size: 0.8em;
  font-weight: bold;
  color: #888;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.options-row {
  display: flex;
}

.options-row button {
  flex: 1;
  padding: 10px;
  border: 1px solid #ccc;
  background-color: #fff;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.2s ease;
  margin-left: -1px;
}

.options-row button:first-child {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
  margin-left: 0;
}

.options-row button:last-child {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

.options-row button.active {
  background-color: #28a745;
  color: white;
  border-color: #28a745;
  z-index: 2;
  position: relative;
}


/* --- Iconos (SVG en Base64) --- */
.icon-condos {
  -webkit-mask-image: url("...");
  mask-image: url("...");
}

.icon-houses {
  -webkit-mask-image: url("...");
  mask-image: url("...");
}

.icon-land {
  -webkit-mask-image: url("...");
  mask-image: url("...");
}

.icon-commercial {
  -webkit-mask-image: url("...");
  mask-image: url("...");
}

.icon-business {
  -webkit-mask-image: url("...");
  mask-image: url("...");
}

.icon-multi-family {
  -webkit-mask-image: url("...");
  mask-image: url("...");
}

/* ==========================================================================
   2. Panel Lateral "More Filters"
   ========================================================================== */

.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100vw;
  height: 100vh;
  background-color: #ffffff;
  color: #1c1e21;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 1001;
  display: flex;
  flex-direction: column;
}

.side-panel:target {
  transform: translateX(0);
}

.panel-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.close-button {
  color: #333;
  text-decoration: none;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
}

.panel-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 10px 20px;
}

.panel-footer {
  padding: 20px;
  border-top: 1px solid #eee;
  background-color: #fff;
}

.panel-footer-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-footer-buttons button {
  border: none;
  padding: 12px 25px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.panel-footer-buttons .panel-reset-btn {
  background: none;
  color: #333;
}

.panel-footer-buttons .panel-apply-btn {
  background-color: #28a745;
  color: white;
}

/* --- Acordeón y filtros dentro del Panel --- */
.filter-accordion {
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 10px;
}

.filter-accordion:last-of-type {
  border-bottom: none;
}

.filter-accordion[open] summary {
  margin-bottom: 15px;
}

.filter-accordion summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  color: #333;
}

.filter-accordion summary::-webkit-details-marker {
  display: none;
}

.filter-accordion summary::after {
  content: '›';
  font-size: 2rem;
  color: #888;
  font-weight: 400;
  transform: rotate(90deg);
  transition: transform 0.2s ease;
}

.filter-accordion[open]>summary::after {
  transform: rotate(-90deg);
}

.accordion-content {
  padding-bottom: 15px;
}

.view-subtitle {
  font-size: 0.9rem;
  color: #555;
  margin-top: 15px;
  margin-bottom: 10px;
}

.filter-count {
  background-color: #28a745;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  margin-left: 8px;
  display: none;
}

.filter-search-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-bottom: 15px;
  box-sizing: border-box;
}

.filter-search-input:focus {
  outline: none;
  border-color: #28a745;
}

.filter-checkbox {
  display: none;
}

.filter-option-wrapper {
  display: inline-block;
  margin: 0;
}

.filter-label-styled {
  display: inline-flex;
  padding: 8px 14px;
  border: 1px solid #ccc;
  border-radius: 20px;
  background-color: #f9f9f9;
  color: #555;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  user-select: none;
  font-size: 0.9rem;
}

.filter-label-styled:hover {
  border-color: #999;
}

.filter-checkbox:checked+.filter-label-styled {
  background-color: #28a745;
  color: #fff;
  border-color: #218838;
}


/* ==========================================================================
   3. Área de Resultados de Búsqueda
   ========================================================================== */

/* --- Cabecera de Resultados (Título e Iconos) --- */
.sec_2_1_heading_2 {
  width: 90%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px auto 0 auto;
}

.sec_2_1_heading_2 h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.sec_2_1_heading_2 p {
  font-weight: 400;
  font-size: 14px;
  color: black;
  margin: 5px 0 0 0;
}

.sec_2_1_heading_2 .icons {
  display: flex;
  justify-content: space-between;
  /*width: 150px;*/
}

.sec_2_1_heading_2 .icons a img,
/* Cambiado a 'a img' para los enlaces */
.sec_2_1_heading_2 .icons img {
  width: 33px;
  height: 33px;
  cursor: pointer;
  border-radius: 4px;
  padding: 4px;
  transition: background-color 0.2s;
}

.sec_2_1_heading_2 .icons a.active img,
/* Estilo para el ícono activo */
.sec_2_1_heading_2 .icons a:hover img {
  background-color: #f0f0f0;
}

/* --- Contenedor de Tarjetas de Propiedad --- */
#results-container {
  width: 90%;
  max-width: 1400px;
  margin: 20px auto;
  padding-bottom: 20px;
}

.more-dropdown {
  position: absolute;
  top: 40px;
  right: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  display: none;
  flex-direction: column;
  min-width: 30px;
  overflow: hidden;
  z-index: 10;
}

.more-dropdown a {
  padding: 8px 7px;
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  color: #333;
  text-decoration: none;
  transition: 0.3s;
}

.more-dropdown a:hover {
  background: #f5f5f5;
}

.more-container.active .more-dropdown {
  display: flex;
}

/* --- Estilos para la VISTA GRID (por defecto) --- */
#results-container.grid-view {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  justify-items: center;
}

.grid-view .property-card {
  width: 100%;
  max-width: 400px;
  height: 451px;
  border-radius: 20px;
  box-shadow: 0px 1px 10px 3px rgb(195, 195, 195);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- Tarjeta Individual --- */
.property-card .sec_2_2_img1 {
  position: relative;
  height: 250px;
  width: 100%;
}

.property-card .sec_2_2_img1>img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}

.property-card .like {
  position: absolute;
  right: 20px;
  top: 20px;
  height: 35px;
  width: 35px;
  background-color: #F5F5F5;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 22px;
  color: #555;
  cursor: pointer;
  transition: color 0.3s ease;
}

.property-card .like:hover {
  color: red;
}

.property-card .sec_2_2_des {
  height: 201px;
  /* Ajuste para que calce con la altura total */
  width: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  background: #fff;
}

.property-card .sec_2_2_des1 {
  display: flex;
  justify-content: flex-start;
  flex-direction: column;
}

.property-card .sec_2_2_des1 h1 {
  font-weight: 600;
  font-size: 20px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 0;
}

.property-card .sec_2_2_des2 {
  display: flex;
  justify-content: flex-start;
  gap: 20px;
}

.property-card .sec_2_2_des2 span {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.property-card .sec_2_2_des2 span img {
  height: 16px;
  width: 16px;
}

.property-card .sec_2_2_des3 {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: #ccc solid 1px;
}

.property-card .sec_2_2_des3 .p1 {
  font-size: 16px;
  font-weight: 500;
  color: #000;
  margin: 0;
}

.property-card .sec_2_2_des3 .p2 {
  font-size: 14px;
  color: #717171;
  font-weight: 400;
  margin: 0;
}

.hide-card {
  display: none !important;
}


/* --- Botón "Load More" --- */
.sec_2_3 {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 15px;
  padding: 40px 0;
  margin-bottom: 20px;
}

.results-info {
  font-size: 16px;
  color: #666;
  text-align: center;
}

.results-info strong {
  color: #333;
  font-weight: 600;
}

.results-info span {
  color: #46AD67;
  font-weight: 700;
}

.sec_2_3 button {
  width: 261.53px;
  height: 54.5px;
  border-radius: 8px;
  background-color: #46AD67;
  font-weight: 600;
  font-size: 15px;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
}

.sec_2_3 button:hover {
  background-color: rgb(72, 188, 119);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(70, 173, 103, 0.3);
}

.sec_2_3 button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.sec_2_3 button i {
  font-size: 20px;
}


/* ==========================================================================
   4. ✅ ESTILOS PARA CAMBIO DE VISTA (GRID/LIST) --> ¡AQUÍ VA LO NUEVO!
   ========================================================================== */
/* --- Contenedor Principal de Resultados --- */
#results-wrapper {
  width: 100%;
  position: relative;
}

/* --- El Mapa --- */
/* Por defecto, el mapa está oculto fuera de la pantalla */
#map-container {
  position: -webkit-sticky;
  /* <-- CAMBIADO */
  position: sticky;
  /* <-- CAMBIADO */
  top: 150px;
  /* Ajusta esto a la altura de tu header + barra de búsqueda */
  right: 0;
  width: 50%;
  height: calc(100vh - 150px);
  /* Ocupa el resto de la altura */
  background-color: #e0e0e0;
  /* transition: transform 0.4s ease-in-out; <-- ELIMINADO */
  /* transform: translateX(100%); <-- ELIMINADO */
  display: none;
  /* <-- AÑADIDO: Oculto por defecto */
  z-index: 50;
  /* Por debajo de la barra de búsqueda */
}

/* --- Columna de Resultados (Grid/List) --- */
#results-column {
  width: 100%;
  transition: width 0.4s ease-in-out;
}

/* --- ESTADO ACTIVO PARA LA VISTA DE MAPA --- */
#results-wrapper.map-view-active {
  display: flex;
  /* <-- AÑADIDO: Convierte el wrapper en flexbox */
}

#results-wrapper.map-view-active #map-container {
  /* transform: translateX(0); <-- ELIMINADO */
  display: block;
  /* <-- AÑADIDO: Muestra el mapa */
}

#results-wrapper.map-view-active #results-column {
  width: 50%;
  /* La columna de resultados ocupa el espacio restante */

  /* --- AÑADIDO PARA SCROLL INDEPENDIENTE --- */
  height: calc(100vh - 150px);
  /* Altura = 100% del viewport menos el header */
  overflow-y: auto;
  /* Añade scroll SÓLO a esta columna */
  position: -webkit-sticky;
  position: sticky;
  /* Se "pega" a la parte superior */
  top: 150px;
  /* Distancia al top (igual que el mapa) */
  /* ----------------------------------------- */
}

/* Ajustes para que el grid se vea bien en el espacio reducido */
#results-wrapper.map-view-active #results-container.grid-view {
  grid-template-columns: repeat(2, 1fr);
  /* 2 columnas en lugar de 3 */
}

/* --- Estilos para la VISTA LIST --- */
#results-container.list-view {
  display: flex;
  /* Cambiamos de grid a flex */
  flex-direction: column;
  /* Apilamos los elementos verticalmente */
  gap: 20px;
  /* Espacio entre tarjetas */
}

.list-view .property-card {
  display: flex;
  flex-direction: row;
  /* Elementos internos en fila */
  width: 100%;
  max-width: none;
  /* Ocupa todo el ancho disponible */
  height: 220px;
  /* Altura fija para la vista de lista */
  box-shadow: 0px 1px 8px 1px rgba(0, 0, 0, 0.1);
  /* Sombra más sutil */
}

.list-view .property-card .sec_2_2_img1 {
  width: 300px;
  /* Ancho fijo para la imagen */
  height: 100%;
  /* La imagen ocupa toda la altura de la tarjeta */
  flex-shrink: 0;
  /* Evita que la imagen se encoja */
}

.list-view .property-card .sec_2_2_des {
  flex-grow: 1;
  /* La descripción ocupa el resto del espacio */
  height: 100%;
  justify-content: center;
  /* Centra el contenido verticalmente */
}

/*mostramos el searchbutton*/
#mbl-search-button {
  display: none;
}

/* ==========================================================================
   5. Animaciones
   ========================================================================== */

@keyframes fadeInSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-enter-animation {
  animation: fadeInSlideUp 0.7s ease-out forwards;
}

/* --- Estilo para resaltar la tarjeta al hacer clic en el mapa --- */
.highlight-card {
  box-shadow: 0 0 10px 5px rgba(40, 167, 69, 0.6) !important;
  /* Sombra verde */
  transform: scale(1.02);
  /* Efecto de zoom sutil */
  transition: all 0.3s ease-in-out;
}

/* ==========================================================================
   6. Estilos Responsivos (Móvil)
   ========================================================================== */

@media (max-width: 1024px) {

  /* ==========================================================================
   ✅ ESTILOS PARA VISTA DE MAPA EN MÓVIL
   ========================================================================== */
  /* ocultamos la search bar*/
  .search-bar-sticky-container {
    display: none;
  }

  #results-container {
    width: 100% !important;
  }

  .grid-view-txt {
    display: none;
  }

  .list-view-txt {
    display: block;
  }

  #results-count {
    display: none;
    /* Apilamos el mapa y los resultados verticalmente */
  }

  .sec_2_1_heading_2 .icons {
    width: 100%;
  }

  .view-btn {
    width: 100px !important;
  }

  #ml-menu-toggle {
    z-index: 10;
  }

  .leaflet-control-layers {
    display: none;
  }

  .icons {
    width: 100%;
    height: 40px;
  }

  /* Aseguramos que el contenedor del mapa sea el punto de referencia */
  #map-container {
    position: relative;
    /* ¡Muy importante! */
  }

  /* Cuando la vista de mapa está activa en móvil... */
  #results-wrapper.map-view-active #map-container {
    width: 100vw;
    /* Ocupa el 100% del ancho de la ventana */
    height: 100vh;
    /* Ocupa el 100% del alto de la ventana */
    position: fixed;
    /* Lo sacamos del flujo normal del documento */
    top: 0;
    left: 0;
    transform: none;
    /* Anulamos la transformación de la vista de escritorio */
    z-index: 10;
    /* Se posiciona como una capa de fondo */
  }

  /* El contenedor de la columna de resultados se vuelve transparente */
  #results-wrapper.map-view-active #results-column {
    background: transparent;
    width: 100%;
    position: relative;
    /*z-index: 20;*/
    /* Se coloca por encima del mapa para que sus hijos sean visibles */
  }

  /* Ocultamos el contenedor de las tarjetas y el botón "Load More" */
  #results-wrapper.map-view-active #results-container,
  #results-wrapper.map-view-active .sec_2_3 {
    display: none;
  }


  /* Reemplaza el bloque anterior con este para posicionar la cabecera en la parte superior */
  #results-wrapper.map-view-active .sec_2_1_heading_2 {
    /* --- Posicionamiento Fijo --- */
    position: fixed;
    /* Fija el elemento a la ventana del navegador */
    top: 15px;
    /* Distancia desde la parte superior */
    left: 50%;
    /* Lo mueve al centro horizontalmente */
    transform: translateX(-50%);
    /* Ajuste fino para centrarlo perfectamente */
    width: 95%;
    /* Ancho del 95% del contenedor */
    max-width: 450px;
    /* Un ancho máximo para que no se estire demasiado en tablets */
    z-index: 30;
    /* Asegura que esté por encima del mapa y otros elementos */

    /* --- Estilos Visuales --- */
    background-color: #ffffff;
    /* Fondo blanco sólido para mejor legibilidad */
    padding: 12px 15px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    /* Sombra más pronunciada para destacarlo */
    margin: 0;
    /* Eliminamos el margen anterior */
  }

  /*ocultamos el listview*/
  #list-view-btn {
    display: none;
  }

  /*mostramos el searchbutton*/
  #mbl-search-button {
    display: block;
  }

  /* En móvil, tanto grid como list se verán como una sola columna */
  #results-container.grid-view,
  #results-container.list-view {
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 5px;
  }

  .page-content {
    padding: 0px !important;
  }

  .grid-view .property-card,
  .list-view .property-card {
    width: 100%;
    height: auto;
    /* Altura automática en móvil */
    flex-direction: column;
    /* Vuelve a columna en móvil */
  }

  .list-view .property-card .sec_2_2_img1 {
    width: 100%;
    /* La imagen ocupa todo el ancho */
    height: 200px;
    /* Altura fija para la imagen */
  }

}

@media (max-width: 992px) {
  .search-bar {
    display: none;
  }
}

@media (min-width: 768px) {
  .side-panel {
    width: 50vw;
    max-width: 450px;
  }
}

/* Estilo base para el botón personalizado */
.leaflet-control-custom a {
  background-image: none;
  background-color: white;
  width: 34px;
  height: 34px;
  line-height: 34px;
  text-align: center;
  font-size: 1.2em;
  color: #333;
}

/* Estilo para cuando el botón está activo (modo dibujo ON) */
.leaflet-control-custom.active a {
  background-color: #f4f4f4;
  color: #46AD67;
  /* Un color para indicar que está activo */
}

/* Opcional pero recomendado: Oculta el botón por defecto de FreeDraw */
/* ya que ahora tenemos nuestro propio control */
.leaflet-freedraw-menu {
  display: none !important;
}

.property-card:hover {
  border: #46AD67 solid 4px;
  cursor: pointer;
}

.custom-div-icon {
  position: relative;
  text-align: center;
}

.custom-div-icon i {
  position: absolute;
  text-align: center;
  width: 22px;
  font-size: 16px;
  left: 4px;
  top: 5px;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}

.marker-pin {
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 0;
  position: absolute;
  transform: rotate(-45deg);
  left: 50%;
  top: 50%;
  margin: -15px 0 0 -15px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/*
  Hacemos que el nuevo grupo de botones se alinee horizontalmente
  en la vista de escritorio, igual que antes.
*/
.search-bar .form-button-group {
  display: flex;
  align-items: center;
  gap: 15px;
  padding-left: 10px;
  /* Espacio entre el enlace "More Filters" y el botón "Search" */
}

.form-button-group a {
  width: 120px;
  color: #333;
  text-decoration: none;
}

/*
  Nos aseguramos de que el botón de búsqueda no tenga un margen izquierdo
  que pueda entrar en conflicto con la nueva propiedad 'gap'.
*/
.search-bar .form-button-group .search-bar-button {
  margin-left: 0;
}

/* Estilos para el panel de búsqueda móvil */
.search-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  /* Ocupa toda la altura de la pantalla */
  background-color: #ffffff;
  z-index: 1050;
  /* Z-index alto para que esté sobre todo, incluido el mapa */
  transform: translateY(100%);
  /* Comienza 100% abajo (oculto) */
  transition: transform 0.4s ease-in-out;
  /* Transición suave */
  display: flex;
  flex-direction: column;
}

/* Clase que se añade con JS para mostrar el panel */
.search-panel.is-open {
  transform: translateY(0);
  /* Lo mueve a su posición original (visible) */
}

.search-panel .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
  /* Evita que el header se encoja */
}

.search-panel .panel-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.search-panel .close-panel-btn {
  background: none;
  border: none;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
  color: #555;
  padding: 0;
}

.search-panel .panel-content {
  flex-grow: 1;
  /* Hace que el contenido ocupe el espacio restante */
  overflow-y: auto;
  /* Permite scroll si el formulario es muy largo */
  padding: 20px;
}

/* --- Estilos para adaptar el formulario al panel móvil --- */

/* Cuando el formulario está dentro del panel */
.search-panel #deskSearch {
  display: flex;
  flex-direction: column;
  /* Apilamos los elementos verticalmente */
  gap: 25px;
  /* Espacio entre cada grupo de filtros */
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  /* Quitamos estilos de la barra de escritorio */
  width: 100%;
  height: 100%;
  /* Ocupa todo el espacio del panel-content */
}

/* Ocultamos los separadores verticales que no tienen sentido en móvil */
.search-panel #deskSearch .separator {
  display: none;
}

/* Hacemos que cada grupo de filtros ocupe todo el ancho */
.search-panel #deskSearch .form-group {
  width: 100%;
  padding: 0;
}

/* Ajustamos el grupo de botones del final */
.search-panel #deskSearch .form-button-group {
  display: flex;
  flex-direction: column;
  /* Botones uno encima del otro */
  gap: 15px;
  width: 100%;
  margin-top: auto;
  /* Empuja los botones al final del formulario */
  padding-top: 20px;
  /* Espacio antes de los botones */
  border-top: 1px solid #eee;
  /* Línea separadora */
}

/* Estilos para los botones dentro del panel */
.search-panel #deskSearch .form-button-group a,
.search-panel #deskSearch .form-button-group button {
  width: 100%;
  text-align: center;
  padding: 15px;
  margin-left: 0;
  font-size: 1rem;
}

/* Estilo específico para el botón "More Filters" */
.search-panel #deskSearch .form-button-group a {
  background-color: #f0f0f0;
  border-radius: 8px;
  font-weight: 600;
}

/* ==========================================================================
   Estilos para el Nuevo Formulario de Búsqueda Móvil
   ========================================================================== */

/* Ajuste al panel principal para que el footer no se superponga */
.search-panel .panel-content {
  padding-bottom: 100px;
  /* Espacio para el footer fijo */
}

.mobile-form .form-group {
  margin-bottom: 25px;
}

.mobile-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
}

/* Barra de Búsqueda */
.search-input-wrapper {
  position: relative;
}

.search-input-wrapper .ri-search-line {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
}

.search-input-wrapper input {
  width: 100%;
  padding: 12px 15px 12px 45px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
}

/* Rango de Precios */
.price-range-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.price-range-inputs input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  text-align: center;
}

.price-range-inputs span {
  color: #888;
}

/* Steppers (+/-) */
.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 5px;
}

.stepper-value {
  display: none;
  /* Ocultamos el input numérico */
}

.stepper-label {
  font-size: 1rem;
  font-weight: 500;
  flex-grow: 1;
  text-align: center;
}

.stepper button {
  border: none;
  background-color: #f0f0f0;
  color: #333;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

/* Tipo de Propiedad */
.property-type-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.property-type-buttons button {
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.property-type-buttons button.active {
  background-color: #46AD67;
  /* Color primario */
  color: #fff;
  border-color: #46AD67;
}

/* Footer Fijo */
.panel-footer-sticky {
  position: sticky;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #fff;
  padding: 15px 20px;
  border-top: 1px solid #eee;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  gap: 15px;
  z-index: 10;
}

.panel-footer-sticky button {
  width: 100%;
  padding: 15px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.button-primary {
  background-color: #46AD67;
  color: #fff;
  border: 1px solid #46AD67;
}

.button-secondary {
  background-color: #fff;
  color: #333;
  border: 1px solid #ccc;
}

/* ==========================================================================
   Estilos para Selector de Región y Autocompletar
   ========================================================================== */

/* Estilo para el nuevo <select> de Región */
#mobile-region-select {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  background-color: #fff;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27292.4%27%20height%3D%27292.4%27%3E%3Cpath%20fill%3D%27%23888888%27%20d%3D%27M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%27%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 15px top 50%;
  background-size: .65em auto;
}

/* Estilo para el input deshabilitado */
#mobile-keyword-search:disabled {
  background-color: #f0f0f0;
  cursor: not-allowed;
}

/* Contenedor de las sugerencias de autocompletar */
.autocomplete-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 8px 8px;
  z-index: 10;
  max-height: 250px;
  overflow-y: auto;
  display: none;
  /* Oculto por defecto */
}

.autocomplete-suggestions.active {
  display: block;
  /* Se muestra con JS */
}

.suggestion-item {
  padding: 12px 15px;
  cursor: pointer;
}

.suggestion-item:hover {
  background-color: #f5f5f5;
}

.suggestion-item strong {
  font-weight: 600;
}

/* ==========================================================================
   Estilos para Botones de Área Multi-Select
   ========================================================================== */

.area-buttons {
  display: flex;
  flex-wrap: wrap;
  /* Permite que los botones pasen a la siguiente línea */
  gap: 10px;
}

.area-buttons button {
  padding: 10px 15px;
  border: 1px solid #ccc;
  border-radius: 20px;
  /* Estilo "píldora" */
  background-color: #f9f9f9;
  color: #555;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.area-buttons button.active {
  background-color: #46AD67;
  color: #fff;
  border-color: #46AD67;
}

.show-more-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  width: 100%;
  margin-top: 15px;
  cursor: pointer;
  font-weight: 600;
  color: #333;
}

/* ==========================================================================
   Estilos para la Tarjeta Popup del Mapa
   ========================================================================== */

.map-card-popup {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 1001;
  /* Por encima de los controles del mapa */
  padding: 15px;
  display: flex;
  justify-content: center;

  /* Oculto por defecto (120% para asegurar que no se vea) */
  transform: translateY(120%);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.map-card-popup.is-visible {
  transform: translateY(0);
  /* Lo desliza a la vista */
}

/* El contenedor interno necesita una posición relativa para el botón de cierre */
.map-card-popup .card-wrapper {
  position: relative;
  width: 100%;
  max-width: 420px;
}

/* Estilos para la tarjeta cuando está dentro del popup */
.map-card-popup .property-card {
  /* Usamos los estilos que ya tienes, pero aseguramos el tamaño */
  width: 100%;
  height: auto;
  /* Altura automática */
  margin-bottom: 0;
  box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.15);
}

/* Botón para cerrar la tarjeta */
.map-card-popup .close-card-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  background-color: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 28px;
  text-align: center;
  cursor: pointer;
  z-index: 10;
}

.property-card.highlight-card {
  box-shadow: 0 0 0 3px #46AD67;
  /* Un borde verde brillante */
  transform: scale(1.02);
  /* Un ligero zoom para destacarla */
  transition: all 0.3s ease-in-out;
}

/* ==========================================================================
   FIX para el Dibujo del Polígono en Móvil
   ========================================================================== */
#map-container {
  touch-action: none;
}

/* Forzar visibilidad de panes y capas de overlay */
.leaflet-overlay-pane,
.leaflet-shadow-pane,
.leaflet-marker-pane,
.leaflet-overlay-pane svg,
.leaflet-overlay-pane canvas {
  z-index: 650 !important;
  pointer-events: auto !important;
}

/* Asegurar que los polígonos y polylines SVG estén encima */
.leaflet-overlay-pane svg path,
.leaflet-overlay-pane svg polygon,
.leaflet-overlay-pane svg polyline {
  stroke-width: 3 !important;
  stroke-opacity: 1 !important;
  fill-opacity: 0.15 !important;
}

/* Si FreeDraw usa una clase específica (por si acaso) */
.leaflet-freedraw-overlay,
.leaflet-freedraw-overlay * {
  z-index: 660 !important;
  pointer-events: auto !important;
}

/* ==========================================================================
   Overlay de Carga para el Mapa
   ========================================================================== */

.map-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.75);
  /* Fondo blanco semitransparente */
  z-index: 1000;
  /* Asegura que esté por encima de los tiles del mapa */

  /* Centra el contenido (el spinner y el texto) */
  display: flex;
  justify-content: center;
  align-items: center;

  /* Oculto por defecto con una transición suave */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Clase para mostrar el overlay */
.map-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  color: #333;
  font-weight: 500;
}

/* Reutilizamos la animación de spin que ya tienes */
.loading-indicator .spin {
  font-size: 48px;
  color: #46AD67;
  /* Color primario */
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.price-tag {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.8);
  padding: 5px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 16px;
  color: #000;
}

.slider-wrapper {
  position: relative;
  /* Esto sigue siendo crucial */
  width: 100%;
  height: 200px;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
}

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

/* Estilo base para ambas flechas */
.placeholder-arrow {
  position: absolute;
  top: 50%;
  /* Las centra verticalmente */
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  font-weight: bold;
  z-index: 10;
  transition: background-color 0.2s;
  pointer-events: none;
  /* Importante para que el clic lo reciba el wrapper */
}

.slick-next:before,
.slick-prev:before {
  position: absolute;
  top: 50%;
  /* Las centra verticalmente */
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.5);
  color: white !important;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex !important;
  justify-content: center;
  align-items: center;
  font-size: 24px !important;
  font-weight: bold;
  z-index: 10;
  transition: background-color 0.2s;
}

.slick-arrow {
  background-color: rgba(0, 0, 0, 0) !important;
}

.slick-next,
.slick-prev,
.slick-next:focus,
.slick-prev:focus {
  background-color: rgba(0, 0, 0, 0);
}

.slick-arrow:hover {
  background-color: rgba(0, 0, 0, 0);
}

/* Posición específica para cada flecha */
.placeholder-arrow.left {
  left: 10px;
}

.placeholder-arrow.right {
  right: 10px;
}

/* Efecto hover: las flechas se hacen más visibles */
.slider-wrapper:hover .placeholder-arrow {
  background-color: rgba(0, 0, 0, 0.7);
}

.img-slider {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.property-slider .slick-slide {
  height: 250px;
  /* Le damos la altura del wrapper al slide */
}

.property-location,
.p1 {
  margin-bottom: 0;
}

.slick-dots {
  display: none !important;
}

.leaflet-control-zoom {
  bottom: 45px;
}

.leaflet-control-custom {
  bottom: 40px;
}

.view-btn {
  color: #28a745;
  border: 1px solid #28a745;
  /* padding: 12px 30px; */
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: bold;
  margin-left: 15px;
  width: 150px;
  text-align: center;
  padding: 5px;
}

.into-btn {
  margin-right: 10px;
}

.list-view-txt {
  display: none;
}

.grid-view-txt {
  display: block;
}

.view-btn.active {
  background-color: #28a745;
  color: white;
  border: none;
  /* padding: 12px 30px; */
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: bold;
  /* margin-left: 15px; */
  text-align: center;
  padding: 5px;
}
/* Mensaje informativo del mapa */
.map-info-message {
    background: #f0f8ff;
    border: 1px solid #4a90e2;
    border-radius: 8px;
    padding: 15px 20px;
    margin: 20px 0;
    text-align: center;
    animation: slideIn 0.3s ease-out;
}

.map-info-message p {
    margin: 0;
    color: #2c3e50;
    font-size: 14px;
}

.load-more-map-btn {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-left: 5px;
}

.load-more-map-btn:hover {
    background: #357abd;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.error-message {
    background: #ffe6e6;
    border: 1px solid #ff4444;
    color: #cc0000;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin: 20px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
