:root {
  --bus-burdeos: #973A4B;
}

/* Navbar superior */
.bus-navbar {
  height: 60px !important;
  transition: height 180ms ease, box-shadow 180ms ease;
  overflow: hidden;
}

.bus-navbar .bus-navbar__title {
  font-size: 1.25rem;
  transition: font-size 180ms ease;
}

.bus-navbar.is-compact {
  height: 46px !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.bus-navbar.is-compact .bus-navbar__title {
  font-size: 1.05rem;
}

/* =============================
   LAYOUT PRINCIPAL
   ============================= */
.bus-main {
  display: flex;
  height: calc(100vh - 195px);
  /* Altura total menos cabecera */
  overflow: hidden;
  position: relative;
}

.bus-filters {
  position: relative;
  width: 50px;
  background: #dddddd;
  color: #fff;
  transition: width 0.25s ease;
  z-index: 2000;
}

/* tirador cuando está plegado */
.filters-handle {
  position: absolute;
  inset: 0;
  width: 50px;
  background: rgba(0, 0, 0, 0.08);
  border: none;
  cursor: pointer;
  display: flex;
  /* 👈 para centrar */
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.filters-handle::before {
  content: "FILTRAR SALAS";
  display: block;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: black;
  transform: rotate(-90deg);
  /* 👈 lo ponemos en horizontal */
  white-space: nowrap;
}

/* cuando está abierto, seguimos ocultando el handle como ya hacías */
.bus-filters.filters-open .filters-handle {
  display: none;
}


.filters-inner {
  display: none;
  flex-direction: column;
  gap: 16px;
  padding: 0 16px 20px 16px;
  overflow-y: auto;
  /* Permite scroll en filtros si son muy altos */
  height: 100%;
}

.bus-filter-group label {
  color: black !important;
}

.bus-filter-group select {
  color: black !important;
}

.filters-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.filters-close {
  appearance: none;
  border: none;
  background: transparent;
  color: black;
  width: auto;
  height: auto;
  font-size: 40px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

#bus-search {
  background: white !important;
}

#bus-search::placeholder {
  color: black !important;
}

.bus-filters.filters-open {
  width: 330px;
}

.bus-filters.filters-open .filters-inner {
  display: flex;
}

.bus-filters.filters-open .filters-handle {
  display: none;
}

/* =============================
   CONTENEDOR PRINCIPAL
   ============================= */
.bus-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  overflow: hidden;
  min-height: 0;
  /* IMPEDIR que crezca más allá del flex container */
}

/* Tabs móvil */
.bus-tabs {
  display: none;
  background: #fff;
  border-bottom: 1px solid #ddd;
  min-height: 44px;
}

.bus-tabs button {
  flex: 1 1 50%;
  border: none;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
  padding: 12px 0;
}

.bus-tabs button.active {
  border-bottom: 3px solid var(--bus-burdeos);
  color: var(--bus-burdeos);
}

/* Vista principal */
.bus-view {
  display: flex;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  /* IMPORTANTE para child scrolling */
}

/* Panel lateral (LISTADO) */
.bus-panel {
  flex: 1;
  /* Ocupa todo el espacio restante por defecto */
  background: #fff;
  overflow-y: auto;
  border-right: 1px solid #ddd;
  transition: all 0.25s ease;
  position: relative;
}

.bus-panel-inner {
  padding: 24px 24px 80px 24px;
}

/* Panel detalle encima */
.bus-panel-detail {
  display: none;
  position: absolute;
  inset: 0;
  background: #fff;
  overflow-y: auto;
  animation: fadeSlideIn 0.25s ease forwards;
}

.bus-panel-detail__close {
  position: relative;
  z-index: 10;
  background: transparent;
  color: #973A4B;
  border: none;
  border-radius: 0;
  padding: 20px 20px 0 20px;
  width: auto;
  text-align: left;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

.bus-panel-detail__content {
  padding: 20px 24px 80px 24px;
}

/* =============================
   MAPA (SIDEBAR DERECHA)
   ============================= */
.bus-map-sidebar {
  position: relative;
  width: 50px;
  /* Colapsado por defecto */
  background: #dddddd;
  transition: width 0.25s ease;
  z-index: 1000;
  border-left: 1px solid #ddd;
  display: flex;
}

/* Tirador del mapa (lado derecho) */
.map-handle {
  position: absolute;
  inset: 0;
  width: 50px;
  background: rgba(0, 0, 0, 0.08);
  /* Similar al filtro */
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  z-index: 1010;
}

.map-handle::before {
  content: "VER MAPA";
  display: block;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: black;
  transform: rotate(-90deg);
  /* Texto vertical */
  white-space: nowrap;
}

/* Cuando el mapa está abierto */
.bus-map-sidebar.map-open {
  width: 40%;
  /* Ancho del mapa abierto */
}

.bus-map-sidebar.map-open .map-handle {
  display: none;
}




/* El contenedor del mapa Leaflet */
.bus-map {
  flex: 1;
  position: relative;
  display: none;
  /* Oculto cuando está colapsado para no cargar */
  overflow: hidden;
}

.bus-map-sidebar.map-open .bus-map {
  display: block;
}

.map-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10000;
  background: white;
  color: #333;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  width: 34px;
  height: 34px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
}

/* Mostrar botón cerrar solo cuando el mapa está abierto en desktop */
.bus-map-sidebar.map-open .map-close-btn {
  display: flex;
}

.map-close-btn:hover {
  background: #f4f4f4;
}

#bus-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.leaflet-control-container .leaflet-top,
.leaflet-control-container .leaflet-bottom {
  z-index: 9999 !important;
}

/* =============================
   ANIMACIONES
   ============================= */
@keyframes fadeSlideIn {
  0% {
    opacity: 0;
    transform: translateX(50px);
  }

  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInFilters {
  0% {
    opacity: 0;
    transform: translateX(-250px);
  }

  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutFilters {
  0% {
    opacity: 1;
    transform: translateX(0);
  }

  100% {
    opacity: 0;
    transform: translateX(-250px);
  }
}

@media (max-width: 1400px) {
  .bus-panel {
    /* flex: 0 0 500px;  <-- REMOVED fixed width to allow filling space */
    flex: 1;
    min-width: 400px;
  }
}

/* =============================
   RESPONSIVE <1200px
   ============================= */
@media (max-width: 1200px) {
  .bus-filters {
    position: absolute;
    left: 0;
    height: calc(100vh - 60px);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.25);
  }

  .bus-filters.filters-open {
    width: 330px;
  }

  .bus-panel {
    margin-left: 50px;
  }
}

/* =============================
   RESPONSIVE <1024px
   ============================= */
@media (max-width: 1024px) {
  .bus-panel {
    /* flex: 0 0 330px; <-- REMOVED fixed width */
    flex: 1;
    min-width: 300px;
  }
}

/* =============================
   RESPONSIVE <700px
   ============================= */
@media (max-width: 700px) {
  .bus-tabs {
    display: flex;
  }

  .bus-view {
    position: relative;
    flex: 1 1 auto;
  }

  .bus-panel,
  .bus-map {
    flex: 0 0 100%;
    width: 100%;
    max-width: calc(100vw - 50px);
    margin-left: 50px;
    height: 100%;
  }

  .bus-panel {
    display: none;
  }

  .bus-main.show-list .bus-panel {
    display: block;
  }

  .bus-main.show-list .bus-map {
    display: none;
  }

  .bus-main.show-map .bus-map {
    display: block;
  }

  .bus-main.show-map .bus-panel {
    display: none;
  }

  /* el popup que dibuja Leaflet */
  .leaflet-popup-content-wrapper {
    width: calc(100% - 20px);
    /* el 100% del contenedor del mapa, no del viewport */
    max-width: none;
    /* Mejor: respetar el alto real del móvil (con fallback) */
    max-height: calc(100vh - 220px);
    max-height: calc(100dvh - 220px);
    overflow-y: auto;
  }

  .leaflet-popup {
    margin: 0;
  }

  .leaflet-popup-tip {
    display: none;
  }

  /* Asegurar scroll interno en el contenido (más específico que reglas globales) */
  .bus-map .leaflet-popup-content-wrapper,
  .bus-map .leaflet-popup-content {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* =============================
   BLOQUE DE FILTROS
   ============================= */
.filters-inner h3 {
  font-size: 1rem;
  margin: 8px 0 0;
}

.bus-filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bus-filter-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.bus-filter-group input,
.bus-filter-group select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.15);
  color: #fff;
  font-size: 0.85rem;
}

.bus-filter-group select option {
  background: #fff;
  color: #222;
}

/* Checkbox "Se puede reservar" - tamaño normal, texto junto a él */
.bus-filter-checkbox-container {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem;
  background-color: #f3f4f6;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.bus-filter-checkbox-container:hover {
  background-color: #e5e7eb;
}

/* Tamaño normal (evitar que reglas genéricas de input lo estiren) */
.bus-filter-checkbox-container .bus-filter-checkbox-custom {
  appearance: none;
  -webkit-appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  min-height: 1.25rem;
  border: 2px solid #913344;
  border-radius: 0.25rem;
  background-color: white;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  margin: 0;
  flex-shrink: 0;
}

.bus-filter-checkbox-container .bus-filter-checkbox-custom:checked {
  background-color: #913344;
}

.bus-filter-checkbox-container .bus-filter-checkbox-custom:checked::after {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  background-color: white;
}

.bus-filter-checkbox-container .bus-filter-checkbox-custom:focus {
  outline: 2px solid rgba(145, 51, 68, 0.4);
  outline-offset: 2px;
}

.bus-filter-checkbox-container span {
  margin-left: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #374151;
  user-select: none;
}

.bus-filter-clear {
  margin-top: 12px;
  background: #973A4B;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  border-radius: 4px;
  padding: 6px 8px;
  cursor: pointer;
}

.bus-filter-clear:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ==== estilo específico del buscador ==== */
#bus-search {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 0.85rem;
}

#bus-search::placeholder {
  color: rgba(255, 255, 255, 0.8);
  font-style: italic;
}

#bus-search:focus {
  outline: none;
  border-color: #fff;
  background: rgba(255, 255, 255, 0.25);
}

/* =============================
   SALAS AGRUPADAS POR BIBLIOTECA
   ============================= */

/* =============================
   SALAS AGRUPADAS POR BIBLIOTECA
   ============================= */

/* Contenedor del listado: GRID */
.bus-panel-inner {
  padding: 24px;
  display: grid;
  /* El ancho mínimo de tarjeta determina cuántas caben */
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 20px;
  align-items: start;
}

/* =============================
   Card Redesign - Typography & Layout
   ============================= */
.bus-sala-card {
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 12px;
  /* More rounded */
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
  min-width: 0;
}

.bus-sala-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  border-color: transparent;
}

.bus-sala-thumb {
  width: 100%;
  height: 180px;
  flex: 0 0 auto;
  background: #f8f8f8;
  position: relative;
}

.bus-sala-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.bus-sala-body {
  padding: 20px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* Título (Default Font) */
.bus-sala-title {
  /* font-family: inherit; */
  color: #973A4B;
  /* Burdeos */
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.3;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Location Subtitle */
.bus-sala-location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: #666;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.bus-sala-location svg {
  color: #973A4B;
}

/* Badges Container */
.bus-sala-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bus-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.bus-badge svg {
  opacity: 0.8;
}

/* Badge Colors */
.badge-blue {
  background-color: #f0f0f0;
  color: #444;
}

.badge-green {
  background-color: #f0f0f0;
  color: #444;
}

.badge-purple {
  background-color: #f0f0f0;
  color: #444;
}

/* DescripciÃƒÂ³n */
.bus-sala-desc {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.5;
  margin: 4px 0 8px;
  /* Separacion extra antes del footer */
}

/* Footer Link */
.bus-sala-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #f5f5f5;
}

.bus-link-action {
  font-size: 0.85rem;
  font-weight: 700;
  color: #973A4B;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.bus-link-action .arrow {
  transition: transform 0.2s ease;
}

.bus-sala-card:hover .arrow {
  transform: translateX(4px);
}

/* Highlight temporal al sincronizar mapa -> listado (móvil) */
.bus-lib-card.is-active {
  outline: 3px solid rgba(151, 58, 75, 0.45);
  outline-offset: 2px;
}

/* =============================
   POPUP (Leaflet) - estilo tipo card
   ============================= */
.bus-popup-card {
  font-family: inherit;
  padding: 4px 2px;
  word-break: break-word;
  display: flex;
  flex-direction: column;
  max-height: 520px; /* fallback */
  max-height: min(65vh, 520px);
  overflow: hidden;
}

.bus-popup__header {
  flex-shrink: 0;
}

.bus-popup__title {
  color: var(--bus-burdeos);
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.25;
  margin: 0 0 4px 0;
}

.bus-popup__address {
  display: inline-block;
  font-size: 0.85rem;
  color: #666;
  text-decoration: underline;
  line-height: 1.35;
}

.bus-popup__address:link,
.bus-popup__address:visited,
.bus-popup__address:hover,
.bus-popup__address:active {
  color: var(--bus-burdeos);
}

/* Lista de salas: scroll independiente para no desbordar el popup */
.bus-popup__list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 42vh;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

.bus-popup__empty {
  flex-shrink: 0;
}

/* Cards de salas dentro del popup (tipo card, sin foto) */
.bus-popup__room-card {
  border: 1px solid #f0f0f0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.bus-popup__room-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}

.bus-popup__room-title {
  font-weight: 800;
  color: #222;
  font-size: 0.95rem;
  line-height: 1.25;
}

.bus-popup__badges {
  margin-top: 8px;
}

.bus-popup__room-actions {
  margin-top: auto;
  padding-top: 10px;
}

/* Botón granate tipo "ver disponibilidad" */
.bus-popup__action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bus-burdeos) !important;
  color: #fff !important;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 8px 10px;
  border-radius: 10px;
  line-height: 1;
}

.bus-popup__action-btn:hover,
.bus-popup__action-btn:active,
.bus-popup__action-btn:visited {
  color: #fff !important;
}

.bus-popup__action-btn .arrow {
  transition: transform 0.2s ease;
}

.bus-popup__action-btn:hover .arrow {
  transform: translateX(3px);
}

.bus-popup-card .bus-popup__empty {
  margin-top: 10px;
  color: #666;
  font-size: 0.9rem;
}

/* =============================
   POPUP CENTRADO (overlay en el mapa)
   Sin fondo oscuro: solo la tarjeta, mapa visible detrás.
   ============================= */
.bus-map {
  position: relative;
}

.bus-popup-overlay {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 16px 16px 0;
  box-sizing: border-box;
  pointer-events: none;
}

@media (min-width: 701px) {
  .bus-popup-overlay {
    padding-top: 64px;
  }
}

.bus-popup-overlay.is-open {
  display: flex;
}

.bus-popup-overlay__backdrop {
  display: none;
}

.bus-popup-overlay__center {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  pointer-events: auto;
}

.bus-popup-overlay__card {
  position: relative;
  width: 100%;
  max-width: 380px;
  max-height: 50vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.bus-popup-overlay__close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  color: #333;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.bus-popup-overlay__close:hover {
  background: rgba(0, 0, 0, 0.15);
  color: #000;
}

.bus-popup-overlay__content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 20px;
  padding-top: 44px; /* espacio para el botón cerrar */
}

/* Dentro del overlay, el popup card no necesita max-height extra */
.bus-popup-overlay__content .bus-popup-card {
  max-height: none;
  padding: 0;
}

.bus-popup-overlay__content .bus-popup__list {
  max-height: none;
  flex: 1 1 auto;
  min-height: 0;
}

/* Bottom sheet móvil para biblioteca seleccionada en mapa */
.bus-mobile-sheet {
  display: none;
}

@media (max-width: 700px) {
  .bus-mobile-sheet {
    position: absolute;
    inset: 0;
    z-index: 1001;
    display: none;
    pointer-events: none;
    box-sizing: border-box;
  }

  .bus-mobile-sheet.is-open {
    display: block;
  }

  .bus-mobile-sheet__card {
    pointer-events: auto;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 12px 14px 14px;
    width: min(340px, calc(100% - 16px));
    max-height: min(44vh, 260px);
    overflow: auto;
    position: absolute;
  }

  .bus-mobile-sheet__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    color: #222;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
  }

  .bus-mobile-sheet__content {
    padding-top: 6px;
  }

  .bus-mobile-sheet__title {
    color: #1b1b1b;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    padding-right: 34px;
  }

  .bus-mobile-sheet__meta {
    margin-top: 4px;
    color: #973A4B;
    font-size: 0.83rem;
    font-weight: 700;
  }

  .bus-mobile-sheet__address {
    margin-top: 6px;
    color: #4a4a4a;
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .bus-mobile-sheet__cta {
    margin-top: 12px;
    width: 100%;
    border: none;
    border-radius: 10px;
    background: #973A4B;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 10px 12px;
    cursor: pointer;
  }

  /* En móvil ocultamos el tooltip nativo del marker para evitar duplicados con la card. */
  .bus-map .bus-marker-tooltip.leaflet-tooltip {
    display: none !important;
  }
}

/* Tooltip al hacer hover sobre un marcador */
.bus-map .bus-marker-tooltip.leaflet-tooltip {
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  background: var(--bus-burdeos);
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  margin-bottom: 12px;
}

.bus-map .bus-marker-tooltip.leaflet-tooltip::before {
  border-top-color: var(--bus-burdeos);
}

/* =============================
   DETALLE DE BIBLIOTECA
   ============================= */
.bus-detail__header h2 {
  margin: 0 0 4px;
  color: var(--bus-burdeos);
}

.bus-detail__header p {
  margin: 0 0 10px;
  color: #666;
}

.bus-detail__image {
  margin-bottom: 10px;
}

.bus-detail__section {
  margin-top: 10px;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bus-detail__section h4 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.bus-detail__section p {
  margin: 2px 0;
  font-size: 0.85rem;
}

.bus-detail__section a {
  color: var(--bus-burdeos);
  text-decoration: underline;
}

.bus-detail__image img {
  width: 100%;
  margin-bottom: 10px;
}

/* que todo dentro del panel de filtros respete el ancho */
.bus-filters.filters-open .filters-inner {
  width: 100%;
  box-sizing: border-box;
}

.bus-filters .bus-filter-group input,
.bus-filters .bus-filter-group select,
.bus-filters .bus-filter-group label {
  width: 100%;
  box-sizing: border-box;
}

/* El checkbox no debe estirarse a 100% */
.bus-filters .bus-filter-group .bus-filter-checkbox-container input.bus-filter-checkbox-custom {
  width: 1.25rem;
  min-width: 1.25rem;
}

/* por si algún navegador encoge el select */
.bus-filters .bus-filter-group select {
  max-width: 100%;
  display: block;
}

.bus-navbar__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;

}

.bus-navbar__inner a {
  padding: 20px;
}

.bus-navbar__logo {
  display: flex;
  justify-content: start;
  align-items: center;
  gap: 30px;
  padding: 20px;
  width: 100%;
  background: #973A4B;
  color: white;
  padding: 20px;
}

.bus-navbar__logo h1 {
  margin: 0;
  margin-top: 15px;
  color: white;
}

/* En tablet/desktop aseguramos un popup "cómodo" y acotado */
@media (min-width: 701px) {
  .leaflet-popup-content-wrapper {
    min-width: 300px;
    max-width: 380px;
    max-height: 75vh !important;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
  }

  .leaflet-popup-content {
    max-height: 75vh !important;
    overflow: hidden !important;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
}

/* =============================
   RESPONSIVE <700px
   ============================= */

@media (max-width: 700px) {

  #bus-map,
  .leaflet-container {
    height: 100% !important;
    width: 100% !important;
  }

  .bus-tabs {
    display: flex;
  }

  .bus-view {
    position: relative;
    flex: 1 1 auto;
  }

  /* Asegurar que los filtros estén bien anclados al contenedor */
  .bus-filters {
    position: absolute;
    left: unset;
  }

  .bus-content {
    position: relative;
  }

  .bus-main {
    height: calc(100vh - 145px);
    overflow: hidden;
    display: flex;
    position: relative;
    -webkit-overflow-scrolling: touch;
  }

  .bus-panel {
    display: none;
    /* Controlado por JS, pero por defecto layout */
    width: 100%;
    margin-left: 50px;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    /* Margen de seguridad inferior */
    flex: 0 0 100%;
    max-width: calc(100vw - 50px);
  }

  .bus-map {
    display: none;
    width: 100%;
    margin-left: 50px;
    height: 100%;
    max-width: calc(100vw - 50px);
    flex: 0 0 100%;
  }

  /* Ajustar ancho de filtros en móvil */
  .bus-filters.filters-open {
    width: calc(100vw - 50px);
    max-width: 330px;
  }

  /* RESET SIDEBAR MAP PARA MOVIL */
  .bus-map-sidebar {
    width: 100% !important;
    height: 100% !important;
    position: relative;
    display: flex;
    background: transparent;
    border: none;
    flex: 0 0 100%;
  }

  .map-handle {
    display: none !important;
  }

  .map-close-btn {
    display: none !important;
  }

  /* Aseguramos que el mapa se muestre si la pestaña mapa está activa */
  .bus-main.show-map .bus-map {
    display: block !important;
  }

  /* Aseguramos que el listado se muestre si la pestaña listado está activa */
  .bus-main.show-list .bus-panel {
    display: block !important;
  }

  .bus-main.show-list .bus-map {
    display: none !important;
  }

  .bus-main.show-map .bus-panel {
    display: none !important;
  }

  .bus-panel-inner {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 16px;
  }
}

/* =============================
   RESPONSIVE <430px - NAVBAR
   ============================= */
@media (max-width: 430px) {
  .bus-navbar img[alt="Espacios BUS"] {
    height: 30px !important;
    width: auto !important;
  }

  .bus-navbar h2 {
    font-size: 1rem !important;
  }
}
