footer {
    display: none !important;
}

.rutas-mapa-container {
    display: flex;
    /* height: calc(100vh - 140px); */
    height: calc(100vh - 198px);
    width: 100%;
    background: #fff;
    border-top: 1px solid #ddd;
    font-family: 'Aller';
}

/* 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';
}

.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;
}

.rutas-sidebar label {
    display: block;
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: #555;
    user-select: none;
}

.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;
}

.rutas-sidebar input:focus,
.rutas-sidebar select:focus {
    /* border-color: #B6BE1A; */
    /* box-shadow: 0 0 8px rgba(0, 0, 0, 0.4); */
    outline: none;
}

.filtros-avanzados {
    margin-top: 20px;
    border-top: 1px solid #ddd;
    padding-top: 12px;
}

.filtros-avanzados summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 12px;
    list-style: none;
    position: relative;
    padding-left: 22px;
    color: #B6BE1A;
    user-select: none;
    transition: color 0.3s ease;
    animation: fadeInLeft 0.5s ease forwards;
}

.filtros-avanzados summary::marker {
    content: '';
}

.filtros-avanzados summary::before {
    content: "▶";
    position: absolute;
    left: 0;
    top: -0.2rem;
    font-size: 1.1rem;
    transition: transform 0.3s ease;
    color: #B6BE1A;
}

.filtros-avanzados[open] summary::before {
    transform: rotate(90deg);
}

.filtros-avanzados label {
    margin-left: 14px;
    font-weight: 500;
    font-size: 0.9rem;
}

.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);
}

.filtro-tipos {
    padding-top: 10px;
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    justify-content: space-between;
}

.filtro-tipos img {
    width: 40px;
    cursor: pointer;
}

/* Listado */
#lista-rutas {
    list-style: none;
    padding: 0;
    margin: 0;
}

#lista-rutas li {
    padding: 10px 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    /* cursor: pointer; */
    transition: box-shadow 0.3s ease, transform 0.25s ease;
    margin-bottom: 12px;
    background: #fff;
    animation: fadeInUp 0.4s ease forwards;
}

/* #lista-rutas li:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(-4px);
} */

/* Card de ruta */
.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 {
    /* background: #f9f9f9; */
    transform: translateX(6px);
    /* transition: background 0.25s ease, transform 0.25s ease; */
}

/* Imagen con lazy load y blur */
.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: 65px;
    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);
}

/* Loader shimmer solo para el mapa */
#map-container {
    position: relative;
    flex: 1;
    height: 100%;
    z-index: 1;
}

#map {
    width: 100%;
    height: 100%;
}

#map-loader {
    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 loader para listado */
.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 personalizado para sidebar */
.rutas-sidebar::-webkit-scrollbar {
    width: 8px;
}

.rutas-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 8px;
}

.rutas-sidebar::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.rutas-sidebar::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* Animaciones clave */
@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);
    }
}

/* Responsive */

body:not(:has(#wpadminbar)) .rutas-mapa-container {
    height: calc(100vh - 140px);
}

/* CON admin bar: desktop/tablet (>=783px) → 32px extra */
@media (min-width: 783px) {
    body:has(#wpadminbar) .rutas-mapa-container {
        height: calc(100vh - (140px + 32px));
        /* 172px */
    }
}

/* CON admin bar: móvil (<=782px) → 46px extra */
@media (max-width: 782px) {
    body:has(#wpadminbar) .rutas-mapa-container {
        height: calc(100vh - (140px + 46px));
        /* 186px */
    }
}

/* ====== 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));
  }
}

@media (max-width: 768px) {

    .filtros-basicos-row label:first-of-type,
    .filtros-basicos-row label:last-of-type {
        flex: 1 0 100%;
    }

    .rutas-mapa-container {
        flex-direction: column;
        height: auto;
    }

    .rutas-sidebar {
        flex: none;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #ddd;
        padding: 15px 20px;
    }

    .filtros-avanzados summary {
        padding-left: 18px;
    }

    #lista-rutas li {
        margin-bottom: 10px;
        padding: 8px 10px;
    }

    #map {
        height: 70vh;
    }
}

.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;
}

.rutas-sidebar .button.load {
    display: none;
}

.rutas-sidebar .button:hover {
    background: #B6BE1A;
    transform: scale(1.05);
}

.filtros-buttons {
    display: flex;
    flex-flow: row nowrap;
    justify-content: flex-end;
    gap: 20px;
}

.rt-nav,
.rt-handle-zone{
  display: none !important;
}

/* =========================
   RUTAS - MOBILE APP MODE
   ========================= */
@media (max-width: 900px){
  :root{
    --safe-b: max(env(safe-area-inset-bottom), 0px);
    --safe-extra: 14px;
    --safe-b-pad: calc(var(--safe-b) + var(--safe-extra));

    --rt-collapsed: 96px;   /* nav + handle (ajusta si quieres) */
    --rt-list: 65dvh;
    --rt-full: 90dvh;
  }

    .rt-nav,
  .rt-handle-zone{
    display: flex !important;
  }
  .rt-handle-zone{
    display: block !important; /* handle zone mejor block */
  }

  .rutas-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;
  }

  #map-container{
    position: absolute;
    inset: 0;
    z-index: 1;
  }
  #map{ height: 100% !important; width: 100%; }

  .rutas-sidebar{
    position: absolute;
    left: 0; right: 0; bottom: 0;
    width: 100%;
    z-index: 8;

    border-right: none;
    border-top: 1px solid #ddd;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 30px rgba(0,0,0,.16);
    background: #fff;

    height: var(--rt-list);
    max-height: var(--map-avail-h, 100dvh);

    display: flex;
    flex-direction: column;
    overflow: hidden;

    padding: 10px 14px 0;
    will-change: height;
  }

  /* Handle */
  .rt-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;
    user-select: none;
    -webkit-user-select: none;
  }
  .rt-handle{
    width: 46px;
    height: 5px;
    border-radius: 999px;
    background: rgba(0,0,0,0.22);
    margin: 6px auto 10px;
  }

  /* Scroll area */
  .rt-scroll{
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
    padding-bottom: 10px;
    touch-action: pan-y;
  }

  /* Bottom nav */
  .rt-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) !important;
  }
  .rt-nav button{
    border: 0;
    background: transparent;
    font: inherit;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
  }
  .rt-nav button.is-active{
    background: rgba(182,190,26,0.18);
    font-weight: 600;
  }

  /* States (igual que municipios, pero rutas) */
  body.rt-collapsed .rutas-sidebar{ height: var(--rt-collapsed); }
  body.rt-list      .rutas-sidebar{ height: var(--rt-list); }
  body.rt-full      .rutas-sidebar{ height: var(--rt-full); }

  /* IMPORTANTÍSIMO: en collapsed reduce padding del nav para que no “baje” */
  body.rt-collapsed .rt-nav{
    padding-bottom: calc(var(--safe-b) + 6px) !important;
  }

  /* en collapsed oculto el scroll */
  body.rt-collapsed .rt-scroll{ display:none; }

/* Por defecto: listado visible */
#rt-filters{ display:none; }
#rt-list{ display:block; }

/* LISTADO */
body.rt-list #rt-filters{ display:none; }
body.rt-list #rt-list{ display:block; }

/* FILTROS */
body.rt-full #rt-filters{ display:block; }
body.rt-full #rt-list{ display:none; }

/* MAPA: oculto ambos */
body.rt-collapsed #rt-filters,
body.rt-collapsed #rt-list{ display:none; }


}
