footer {
  display: none !important;
}

.servicios-mapa-container,
.rutas-mapa-container {
  display: flex;
  height: calc(100vh - 198px);
  width: 100%;
  background: #fff;
  border-top: 1px solid #ddd;
  font-family: "Aller";
}

/* Sidebar */
.servicios-sidebar,
.rutas-sidebar {
  flex: 0 0 30%;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid #ddd;
  padding: 20px 25px;
  overflow-y: auto;
  z-index: 3;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
  font-family: "Aller";
}

.servicios-sidebar h2,
.servicios-sidebar h3,
.rutas-sidebar h2,
.rutas-sidebar h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 15px;
  color: #97b129;
  letter-spacing: 0.03em;
  animation: fadeInUp 0.6s ease forwards;
}

.servicios-sidebar label,
.rutas-sidebar label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.95rem;
  color: #555;
  user-select: none;
}

.servicios-sidebar input,
.servicios-sidebar select,
.rutas-sidebar input,
.rutas-sidebar select {
  width: 100%;
  padding: 8px 12px;
  font-size: 1rem;
  border: 1.8px solid #bbb;
  border-radius: 6px;
  background: #fff;
  box-shadow: inset 0 2px 5px rgb(0 0 0 / 0.05);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.servicios-sidebar input:focus,
.servicios-sidebar select:focus,
.rutas-sidebar input:focus,
.rutas-sidebar select:focus {
  outline: none;
}

.filtros-basicos {
  flex-flow: column nowrap;
  gap: 20px;
}

.filtros-basicos-row {
  display: flex;
  flex-flow: row wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.filtros-basicos-row label input,
.filtros-basicos-row label select {
  margin-top: 10px;
}

.filtros-basicos-row label:first-of-type {
  flex: 1 0 calc(60% - 5px);
}

.filtros-basicos-row label:last-of-type {
  flex: 1 0 calc(40% - 5px);
}

/* Listados */
#lista-rutas,
#lista-servicios {
  list-style: none;
  padding: 0;
  margin: 0;
}

#lista-rutas li,
#lista-servicios li {
  padding: 10px 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  transition: box-shadow 0.3s ease, transform 0.25s ease;
  margin-bottom: 12px;
  background: #fff;
  animation: fadeInUp 0.4s ease forwards;
}

/* Card */
.ruta-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid #eee;
  background: #fff;
  transition: background 0.2s;
  animation: fadeInUp 0.4s ease forwards;
}

.ruta-card:hover {
  transform: translateX(6px);
}

.img-wrapper {
  position: relative;
  display: block;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 4px;
  background: #f0f0f0;
}

.img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  filter: blur(10px);
  transition: opacity 0.4s ease-in-out, filter 0.4s ease-in-out;
}

.img-wrapper img.loaded {
  opacity: 1;
  filter: blur(0);
}

.ruta-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.ruta-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: #333;
}

.ruta-card-excerpt {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 8px;
}

.ruta-card-button {
  display: block;
  width: fit-content;
  margin-left: auto;
  text-align: center;
  padding: 6px 8px;
  font-size: 0.85rem !important;
  background: #b6be1a;
  color: #fff !important;
  border-radius: 6px;
  text-decoration: none !important;
  transition: background 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.ruta-card-button:hover {
  background: #b6be1a;
  transform: scale(1.05);
}

/* Mapa */
#map-container {
  position: relative;
  flex: 1;
  height: 100%;
  z-index: 1;
}

#map {
  width: 100%;
  height: 100%;
}

#servicios-map-loader {
  display: none; /* Oculto por defecto */
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #eee 25%, #ddd 50%, #eee 75%);
  background-size: 200% 100%;
  animation: shimmerAnim 1.5s infinite;
  z-index: 2;
}

@keyframes shimmerAnim {
  100% {
    background-position-x: -200%;
  }
}

/* Skeleton */
.skeleton-card {
  display: flex;
  gap: 10px;
  padding: 10px !important;
}

.skeleton-image,
.skeleton-line {
  background: linear-gradient(90deg, #eee 25%, #ddd 50%, #eee 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.2s infinite;
}

.skeleton-image {
  width: 100px;
  height: 100px;
  border-radius: 4px;
  flex-shrink: 0;
}

.skeleton-lines {
  flex: 1;
}

.skeleton-line {
  height: 12px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-line.short {
  width: 40%;
}
.skeleton-line.medium {
  width: 70%;
}

@keyframes skeleton-loading {
  to {
    background-position: -200% 0;
  }
}

/* Scrollbar sidebar */
.servicios-sidebar::-webkit-scrollbar,
.rutas-sidebar::-webkit-scrollbar {
  width: 8px;
}

.servicios-sidebar::-webkit-scrollbar-track,
.rutas-sidebar::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 8px;
}

.servicios-sidebar::-webkit-scrollbar-thumb,
.rutas-sidebar::-webkit-scrollbar-thumb {
  background: #bbb;
  border-radius: 8px;
  transition: background-color 0.3s ease;
}

.servicios-sidebar::-webkit-scrollbar-thumb:hover,
.rutas-sidebar::-webkit-scrollbar-thumb:hover {
  background: #888;
}

/* Animaciones */
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  0% {
    opacity: 0;
    transform: translateX(-12px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ====== DEFAULT (sin .ban-recom) ====== */
body:not(:has(#wpadminbar)) .servicios-mapa-container {
  height: calc(100vh - 140px);
}

@media (min-width: 783px) {
  body:has(#wpadminbar) .servicios-mapa-container {
    height: calc(100vh - (140px + 32px));
  }
}

@media (max-width: 782px) {
  body:has(#wpadminbar) .servicios-mapa-container {
    height: calc(100vh - (140px + 46px));
  }
}

/* ====== OVERRIDE si existe .ban-recom en la página ====== */
body:has(.ban-recom):not(:has(#wpadminbar)) .servicios-mapa-container {
  height: calc(100vh - 198px);
}

@media (min-width: 783px) {
  body:has(.ban-recom):has(#wpadminbar) .servicios-mapa-container {
    height: calc(100vh - (198px + 32px));
  }
}

@media (max-width: 782px) {
  body:has(.ban-recom):has(#wpadminbar) .servicios-mapa-container {
    height: calc(100vh - (198px + 46px));
  }
}

/* Botones */
.servicios-sidebar .button,
.rutas-sidebar .button {
  width: fit-content;
  text-align: center;
  cursor: pointer;
  align-self: center;
  padding: 6px 8px;
  font-size: 0.85rem !important;
  background: #b6be1a;
  color: #fff !important;
  border-radius: 6px;
  text-decoration: none !important;
  transition: background 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  border-color: transparent;
}

.servicios-sidebar .button:hover,
.rutas-sidebar .button:hover {
  background: #b6be1a;
  transform: scale(1.05);
}

.filtros-buttons {
  display: flex;
  flex-flow: row nowrap;
  justify-content: flex-end;
  gap: 20px;
}

/* =========================
   MOBILE APP MODE (<=900px)
   ========================= */
@media (max-width: 900px) {
  :root {
    --safe-b: max(env(safe-area-inset-bottom), 0px);
    --safe-extra: 10px;
    --safe-b-pad: calc(var(--safe-b) + var(--safe-extra));
    --sb-collapsed: 140px;
    --sb-list: 65dvh;
    --sb-filters: 90dvh;
  }

  body:has(#wpadminbar) .servicios-mapa-container,
  body:not(:has(#wpadminbar)) .servicios-mapa-container,
  body:has(.ban-recom) .servicios-mapa-container {
    height: var(--map-avail-h, 100dvh) !important;
    min-height: var(--map-avail-h, 100dvh) !important;
  }

  html,
  body {
    height: 100%;
    overflow: visible; /* scroll solo en .sb-scroll */
  }

  body.sb-collapsed .servicios-sidebar .sb-scroll {
    display: none !important;
  }

  body.sb-collapsed .servicios-sidebar #sb-filters,
  body.sb-collapsed .servicios-sidebar #sb-list {
    display: none !important;
  }

  .servicios-mapa-container {
    position: relative;
    height: var(--map-avail-h, 100dvh) !important;
    min-height: var(--map-avail-h, 100dvh) !important;
    overflow: hidden;
    display: block;
    margin: 0 !important;
    padding: 0 !important;
    flex-direction: initial !important;
  }

  #map-container {
    position: absolute;
    inset: 0;
    padding-bottom: 0 !important;
  }

  #map {
    width: 100%;
    height: 100% !important;
  }

  .servicios-sidebar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    border-right: none;
    border-top: 1px solid #ddd;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.16);
    background: #fff;
    z-index: 8;

    height: var(--sb-list);
    max-height: var(--map-avail-h, 100dvh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 10px 14px 0;

    touch-action: auto;
    will-change: height;
  }

  .sb-handle-zone {
    flex: 0 0 auto;
    padding: 14px 0 8px;
    margin: -10px -14px 0;
    background: #fff;
    border-radius: 18px 18px 0 0;
    touch-action: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
  }
  .sb-handle-zone:active {
    cursor: grabbing;
  }

  .sb-handle {
    width: 46px;
    height: 5px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.22);
    margin: 6px auto 10px;
  }

  .sb-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
    padding-bottom: 10px;
    flex: 1 1 auto;
    touch-action: pan-y;
  }

  .sb-nav {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid #e9e9e9;
    background: #fff;
    padding: 10px 10px var(--safe-b);
    padding-bottom: var(--safe-b-pad);
  }

  .sb-nav button {
    border: 0;
    background: transparent;
    font: inherit;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
  }

  .sb-nav button.is-active {
    background: rgba(182, 190, 26, 0.18);
    font-weight: 600;
  }

  body.sb-collapsed .servicios-sidebar {
    height: var(--sb-collapsed);
  }
  body.sb-list .servicios-sidebar {
    height: var(--sb-list);
  }
  body.sb-filters .servicios-sidebar {
    height: var(--sb-filters);
  }

  body.sb-filters #sb-list {
    display: none;
  }
  body.sb-list #sb-filters {
    display: none;
  }
  body.sb-collapsed #sb-filters,
  body.sb-collapsed #sb-list {
    display: none;
  }

  body.sb-filters .filtros-buttons {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding-top: 10px;
    padding-bottom: var(--safe-b-pad);
    border-top: 1px solid #eee;
    z-index: 2;
  }

  .filtros-basicos-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px;
  }

  .filtros-basicos-row label:first-of-type,
  .filtros-basicos-row label:last-of-type {
    flex: initial !important;
    width: 100%;
  }

  .filtros-basicos-row label input,
  .filtros-basicos-row label select {
    width: 100%;
  }
}
