html, body { min-height: 100%; }
:root { --conil-mapa-nav-height: 62px; }
/* El menú es fixed-top en la plantilla base: reservar espacio y mantener visible el mapa. */
body { padding-top: var(--conil-mapa-nav-height); }
/* Sin padding superior para el contenedor principal de la plantilla. */
#principal { padding-top: 0; }
#mainNav { z-index: 1100; }
#maincontainer { min-width: 0; }
#maincontainer .mapa-sidebar h2 { margin: 0; padding: 0; background: transparent; }
#mapa { scroll-margin-top: calc(var(--conil-mapa-nav-height) + 8px); }
#maincontainer #mapa-app { margin-top: 0; }
.mapa-layout {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  min-height: 70vh;
}
.mapa-sidebar {
  min-width: 0;
  padding-right: .25rem;
}
.mapa-panel {
  min-width: 0;
  scroll-margin-top: 1rem;
  position: sticky;
  top: calc(var(--conil-mapa-nav-height) + .5rem);
}
.mapa-zonas-rapidas {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 0 0 .25rem;
}
.mapa-zonas-rapidas .btn { white-space: nowrap; padding: 0.2rem; }
/* El aviso pertenece a la barra de accesos rápidos y ocupa su propia fila.
   Así no queda oculto detrás del menú fijo ni entre el contador y la lista. */
#ayuda-localizacion-mapa {
  display: block;
  flex: 0 0 100%;
  width: 100%;
  margin: 0 0 .25rem;
  line-height: 1.35;
}
#mapa {
  width: 100%;
  height: min(77vh, 770px);
  min-height: 400px;
  border: 1px solid #dee2e6;
  border-radius: .5rem;
  z-index: 1;
}
/* Reservar espacio INTERIOR al pie del formulario; el padding no colapsa
   ni desaparece al desplazar el panel de filtros. */
#form-filtros:not(.is-hidden) {
  margin-bottom: 0;
  padding-bottom: 5rem;
  scroll-margin-bottom: 5rem;
}
.mapa-filtros.is-hidden { display: none !important; }
/* El formulario tiene scroll SOLO en los campos: ambos botones permanecen
   visibles en el pie flotante del panel, también al desplazar fechas y opciones. */
#panel-filtros {
  display: flex;
  flex-direction: column;
  max-height: min(72dvh, 730px);
  overflow: hidden;
  background-color: #fff;
}
#panel-filtros .mapa-filtros-campos {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}
#panel-filtros .mapa-filtros-acciones {
  position: relative;
  flex: 0 0 auto;
  z-index: 5;
  box-sizing: border-box;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom)) !important;
  border-top: 1px solid #dee2e6;
  border-radius: 0 0 .375rem .375rem;
  background: rgb(255 255 255 / 98%);
  box-shadow: 0 -4px 14px rgb(0 0 0 / 13%);
}
/* En pantallas estrechas el panel ocupa menos alto que el mapa sticky,
   evitando que el pie de acciones quede demasiado lejos del inicio. */
@media (max-width: 991.98px) {
  #panel-filtros { max-height: clamp(260px, 55dvh, 560px); }
  #form-filtros:not(.is-hidden) { padding-bottom: 6rem; }
}

/* La lista tiene su propio scroll: no desplaza la página ni oculta el mapa en escritorio. */
.mapa-lista-scroll {
  max-height: calc(100dvh - var(--conil-mapa-nav-height) - 150px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 0 .15rem .15rem 0;
  border-radius: .35rem;
}
.mapa-lista { display: grid; gap: .35rem; }
.alojamiento-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: .5rem;
  border: 1px solid #dee2e6;
  border-radius: .5rem;
  padding: .4rem;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.alojamiento-card:hover, .alojamiento-card:focus-visible {
  border-color: #0d6efd;
  box-shadow: 0 0 0 .15rem rgba(13,110,253,.12);
  outline: none;
}
.alojamiento-card.is-selected { border-color: #0d6efd; background: #f4f8ff; }
.card-foto { width: 96px; height: 100px; object-fit: cover; border-radius: .25rem; }
.card-contenido { min-width: 0; overflow-wrap: anywhere; }
.card-contenido h3 { margin: 0 0 .2rem; line-height: 1.2; }
.card-contenido p { margin-bottom: .2rem; line-height: 1.25; }
/* Popups Leaflet: eliminar los grandes márgenes interiores de fábrica. */
#mapa .leaflet-popup-content-wrapper { min-width: 250px; box-sizing: border-box; padding: 1px; border-radius: .45rem; }
#mapa .leaflet-popup-content { margin: 3px 6px; }
.popup-alojamiento { max-width: 300px; overflow-wrap: anywhere; line-height: 1.18; }
.popup-alojamiento p { margin-top: 0; margin-bottom: .1rem; }
.popup-foto { width: 210px; max-width: 100%; height: 115px; object-fit: cover; border-radius: .3rem; display: block; margin-bottom: .2rem; }
@media (max-width: 991.98px) {
  .mapa-layout { grid-template-columns: minmax(0, 1fr); }
  .mapa-sidebar { order: 2; }
  .mapa-panel {
    order: 1;
    top: var(--conil-mapa-nav-height);
    z-index: 20;
    background: #fff;
    padding-bottom: .35rem;
  }
  .mapa-zonas-rapidas { gap: .2rem; }
  .mapa-zonas-rapidas .btn {
    flex: 0 1 auto;
    padding: .15rem .3rem;
    font-size: .75rem;
    line-height: 1.15;
  }
  /* Altura menor para dejar visible una mayor parte del panel inferior. */
  #mapa { height: 35vh; min-height: 240px; max-height: 410px; }
  .mapa-lista-scroll {
    max-height: 38vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mapa-filtros { display: block; }
  .mapa-filtros.is-hidden { display: none !important; }
}
@media (max-width: 575.98px) {
  #maincontainer { padding-left: .65rem; padding-right: .65rem; }
  .alojamiento-card { grid-template-columns: 82px minmax(0, 1fr); gap: .4rem; padding: .35rem; }
  .card-foto { width: 82px; height: 88px; }
  #mapa { height: 32vh; min-height: 210px; max-height: 330px; }
  .mapa-zonas-rapidas .btn { padding: .12rem .25rem; font-size: .7rem; }
}

/* Evita el borde y halo blanco alrededor de los marcadores del mapa. */
.leaflet-marker-icon,
.leaflet-marker-shadow {
  border: 0 !important;
  box-shadow: none !important;
}

/* Marcador verde por defecto (sin precio medio y no visible en el panel), sin borde blanco. */
.alojamiento-marker-wrapper {
  background: transparent !important;
  border: 0 !important;
}
.alojamiento-marker {
  display: block;
  width: 18px;
  height: 18px;
  box-sizing: border-box;
  border: 0;
  border-radius: 50%;
  background: #16803d;
  box-shadow: 0 1px 4px rgb(0 0 0 / 35%);
}
.alojamiento-marker-visible {
  background: #ffdf00;
  box-shadow: 0 1px 4px rgb(0 0 0 / 45%);
}
/* Azul: casa con precio medio informado y válido. */
.alojamiento-marker-priced {
  background: #0d6efd;
  box-shadow: 0 1px 4px rgb(0 0 0 / 45%);
}

/* Las fotos enlazan directamente con la ficha del alojamiento. */
.card-foto-link,
.popup-foto-link {
  display: block;
  text-decoration: none;
}
.card-foto-link { line-height: 0; }
.popup-foto-link { margin-bottom: .15rem; }
.popup-foto-link .popup-foto { margin-bottom: 0; }

/* Ajustes para pie de página de la plantilla, sin invadir las fichas o el mapa. */
#maincontainer footer.container-lg { padding-bottom: 4rem; }
#maincontainer footer a { overflow-wrap: anywhere; }
.mapa-volver-arriba {
  position: fixed; bottom: 1rem; right: 1rem;
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: .5rem;
  background: rgb(128 128 128 / 40%); color: #0b3c91;
  text-decoration: none; z-index: 1050;
}
.mapa-volver-arriba:hover { background: rgb(128 128 128 / 65%); }
@media (max-width: 991.98px) {
  :root { --conil-mapa-nav-height: 60px; }
  #maincontainer .mapa-panel { box-shadow: 0 3px 6px rgb(0 0 0 / 8%); }
  .mapa-lista-scroll { max-height: 39dvh; }
}
@media (max-width: 575.98px) {
  .mapa-volver-arriba { right: .75rem; bottom: max(.75rem, env(safe-area-inset-bottom)); }
}

/* Iconos de características: distribución compacta en fichas y popups. */
.iconos-alojamiento {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  column-gap: 2px;
  row-gap: 2px;
  margin: 2px 0 4px;
}
.iconos-alojamiento .iconos {
  float: none !important;
  flex: 0 0 auto;
  min-width: 28px;
  max-width: 55px;
  margin: 0;
  padding: 0;
  text-align: center;
}
.iconos-alojamiento .centra {
  display: block;
  width: 25px;
  height: 25px;
  margin: 0 auto;
  object-fit: contain;
}
.iconos-alojamiento .iconos p {
  margin: 0;
  padding: 0;
  font-size: .62rem;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
#mapa .popup-alojamiento .iconos-alojamiento {
  max-width: 225px;
  margin: 0;
  row-gap: 1px;
}


/* Selector de fechas libres de ConilPlaya.com (dos meses, sin dependencias). */
#periodo { position: relative; }
#periodo .drp-input {
  background-color: #fffba0;
  color: #212529;
  cursor: pointer;
}
#periodo .drp-input:focus-visible { outline: 2px solid #0d6efd; outline-offset: 1px; }
.drp-host { position: relative; z-index: 1; }
.drp-popover {
  box-sizing: border-box;
  position: fixed;
  width: min(640px, calc(100vw - 24px));
  max-height: min(78dvh, 650px);
  overflow: auto;
  background: #fff;
  color: #212529;
  border: 1px solid #adb5bd;
  border-radius: .55rem;
  padding: .65rem;
  box-shadow: 0 8px 28px rgb(0 0 0 / 22%);
  z-index: 2000;
}
.drp-popover[hidden] { display: none !important; }
.drp-popover .drp-month-title { font-weight: 600; font-size: .95rem; }
.drp-popover .drp-month-picker { display: flex; flex-wrap: wrap; gap: 2px; }
.drp-popover .drp-month-picker .btn { padding: .15rem .35rem; font-size: .7rem; }
/* En el área de los dos meses, los gestos horizontales cambian de mes.
   El desplazamiento vertical de la página sigue permitido en móviles. */
.drp-popover [data-role="swipe-months"] {
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  cursor: ew-resize;
}
.drp-popover .drp-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}
.drp-popover .drp-dow { text-align: center; font-size: .75rem; font-weight: 600; color: #495057; }
.drp-popover .drp-day {
  border: 1px solid transparent;
  border-radius: .3rem;
  background: #f8f9fa;
  color: #212529;
  padding: .35rem .05rem;
  min-width: 0;
  font-size: .82rem;
  line-height: 1.25;
}
.drp-popover .drp-day:not(:disabled):hover,
.drp-popover .drp-day:focus-visible { background: #cfe2ff; border-color: #0d6efd; }
.drp-popover .drp-day.is-empty { background: transparent; visibility: hidden; }
.drp-popover .drp-day.is-disabled { color: #adb5bd; background: #fff; cursor: not-allowed; }
.drp-popover .drp-day.is-today { border-color: #0d6efd; }
.drp-popover .drp-day.is-inrange { background: #d9f0dc; }
.drp-popover .drp-day.is-start,
.drp-popover .drp-day.is-end { background: #0d6efd; color: #fff; font-weight: 700; }
.drp-popover .drp-legend { font-size: .8rem; }
@media (max-width: 575.98px) {
  .drp-popover { padding: .5rem; max-height: 75dvh; }
  .drp-popover .drp-day { padding: .2rem 0; }
}

/* Tarjeta del alojamiento: sustituye el popup de Leaflet por una ficha no modal
   que se desliza desde el borde inferior sin cambiar la vista del mapa. */
.ficha-deslizante-mapa {
  position: fixed;
  bottom: 0;
  right: 16px;
  z-index: 1300;
  width: min(420px, calc(100vw - 32px));
  max-height: min(68dvh, 540px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #212529;
  border: 1px solid #ced4da;
  border-radius: .75rem .75rem 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .25);
  transform: translateY(110%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform .28s ease, opacity .28s ease, visibility .28s;
}
.ficha-deslizante-mapa.is-visible {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.ficha-deslizante-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex: 0 0 auto;
  padding: .55rem .8rem;
  border-bottom: 1px solid #e9ecef;
  background: #fff;
}
.ficha-deslizante-contenido {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: .55rem .8rem max(.65rem, env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}
.ficha-deslizante-contenido .popup-alojamiento {
  max-width: none;
  line-height: 1.25;
}
.ficha-deslizante-contenido .popup-foto-link { display: block; margin-bottom: .3rem; }
.ficha-deslizante-contenido .popup-foto {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 175px;
  object-fit: contain;
  border-radius: .35rem;
  margin: 0;
}
.ficha-deslizante-contenido .iconos-alojamiento { max-width: none; }
.ficha-deslizante-contenido .popup-alojamiento p { margin-bottom: .2rem; }
/* El naranja tiene un icono mayor y siempre prevalece visualmente. */
.alojamiento-marker-wrapper-selected { z-index: 1; }
.alojamiento-marker.alojamiento-marker-selected {
  width: 28px;
  height: 28px;
  background: #ff8100;
  box-shadow: 0 1px 7px rgba(0, 0, 0, .7);
}
/* En dispositivos pequeños la ficha deslizante no debe tapar el listado
   lateral/inferior. En escritorio conserva su comportamiento original. */
@media (max-width: 991.98px) {
  .ficha-deslizante-mapa { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .ficha-deslizante-mapa { transition: none; }
}

/* descripcion2 conserva párrafos, listas, enlaces y negritas en la ficha. */
.ficha-deslizante-contenido .descripcion2-ficha {
  overflow-wrap: anywhere;
  line-height: 1.35;
  font-size: .9rem;
}
.ficha-deslizante-contenido .descripcion2-ficha p,
.ficha-deslizante-contenido .descripcion2-ficha ul,
.ficha-deslizante-contenido .descripcion2-ficha ol,
.ficha-deslizante-contenido .descripcion2-ficha blockquote {
  margin: 0 0 .35rem;
}
.ficha-deslizante-contenido .descripcion2-ficha ul,
.ficha-deslizante-contenido .descripcion2-ficha ol { padding-left: 1.25rem; }
.ficha-deslizante-contenido .descripcion2-ficha img {
  display: block;
  max-width: 100%;
  height: auto;
}
.ficha-deslizante-contenido .descripcion2-ficha table { max-width: 100%; }


.precios-alojamiento-tabla th { font-weight: 600; text-align: left; }
.precios-alojamiento-tabla td {
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  padding-right: 0;
}

/* Filtros prioritarios a la vista: fechas y número de personas. Los demás
   solo aparecen al pulsar Más filtros. Mantener campos extra en el formulario
   para que se envíen sin perder sus valores al contraerlos. */
#campos-filtros-adicionales[hidden] { display: none !important; }
#toggle-filtros-adicionales { white-space: nowrap; }

/* Una sola fila de precios debajo de las columnas Julio / Agosto / Medio.
   Si una tarjeta es estrecha, se permite el scroll horizontal de la tabla
   sin ensanchar ni deformar el panel lateral. */
.precios-alojamiento-contenedor {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  margin: .15rem 0 .1rem;
}
.precios-alojamiento-tabla {
  width: 100%;
  max-width: none;
  min-width: 205px;
  margin: 0;
  border-collapse: collapse;
  font-size: .71rem;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  table-layout: auto;
}
.precios-alojamiento-tabla th,
.precios-alojamiento-tabla td {
  padding: .12rem .25rem;
  border: 0;
  white-space: nowrap;
  vertical-align: middle;
  text-align: right;
}
.precios-alojamiento-tabla thead th {
  font-weight: 600;
  color: #4b5563;
}
.precios-alojamiento-tabla th:first-child {
  padding-left: 0;
  text-align: left;
}
.precios-alojamiento-tabla td:last-child,
.precios-alojamiento-tabla th:last-child { padding-right: 0; }
@media (max-width: 575.98px) {
  .precios-alojamiento-tabla { font-size: .68rem; }
  .precios-alojamiento-tabla th,
  .precios-alojamiento-tabla td { padding-inline: .16rem; }
}
