﻿.bus-app * {
  box-sizing: border-box;
}

.bus-panel,
.bus-side-panel {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.bus-panel {
  margin-bottom: 18px;
  padding: 18px;
}

.bus-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.bus-filters label {
  display: flex;
  flex: 1 1 220px;
  flex-direction: column;
  gap: 6px;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.bus-filters select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  color: #0f172a;
  background: #ffffff;
  font: inherit;
}

.bus-button,
.bus-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
}

.bus-button {
  border: 0;
  color: #ffffff;
  background: #0284c7;
  cursor: pointer;
}

.bus-button:hover {
  background: #0369a1;
}

.bus-clear {
  color: #0369a1;
  background: #e0f2fe;
}

.bus-count {
  margin: 12px 0 0;
  color: #64748b;
}

.bus-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  margin-bottom: 18px;
}

#map {
  min-height: 640px;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  background: #dbeafe;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.bus-side-panel {
  min-height: 640px;
  max-height: 640px;
  overflow: hidden;
  padding: 16px;
}

.bus-side-panel h2,
.bus-stop-details h2 {
  margin: 0 0 8px;
  color: #0f172a;
  font-size: 20px;
  font-weight: 800;
}

.bus-stop-details {
  scroll-margin-top: 96px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
  outline: none;
}

.bus-muted,
.bus-note,
.bus-empty,
.bus-loading {
  color: #64748b;
  font-size: 13px;
}

.bus-departures-list {
  display: grid;
  gap: 8px;
  max-height: 285px;
  overflow: auto;
}

.bus-departure {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.bus-line-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 8px;
  color: #ffffff;
  background: #075985;
  font-size: 12px;
  font-weight: 800;
}

.bus-departure-main {
  min-width: 0;
}

.bus-departure-main strong,
.bus-departure-main span {
  display: block;
  overflow-wrap: anywhere;
}

.bus-departure-main strong {
  color: #0f172a;
  font-size: 13px;
}

.bus-departure-main span {
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

.bus-waiting-time {
  color: #075985;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.bus-stop-list,
.bus-reports {
  display: grid;
  gap: 9px;
  max-height: 540px;
  overflow: auto;
  padding-right: 4px;
}

.bus-stop-item,
.bus-reports article {
  width: 100%;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  color: #0f172a;
  background: #f8fafc;
}

.bus-stop-item {
  text-align: left;
  cursor: pointer;
}

.bus-stop-item:hover,
.bus-stop-item.active {
  border-color: #0284c7;
  background: #eff6ff;
}

.bus-stop-item strong,
.bus-stop-item span {
  display: block;
}

.bus-stop-item span,
.bus-reports p {
  margin-top: 5px;
  color: #64748b;
  font-size: 13px;
}

.bus-stop-action {
  color: #0284c7 !important;
  font-weight: 800;
}

.bus-reports a {
  color: #0284c7;
  font-weight: 700;
}

@media (max-width: 1024px) {
  .bus-map-layout {
    grid-template-columns: 1fr;
  }

  #map,
  .bus-side-panel {
    min-height: 460px;
    max-height: none;
  }

  .bus-stop-list,
  .bus-reports {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 640px) {
  .bus-app.container {
    padding-right: 0;
    padding-left: 0;
  }

  .bus-panel,
  .bus-side-panel,
  #map {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .bus-panel {
    padding: 14px;
  }

  .bus-filters {
    align-items: stretch;
    flex-direction: column;
  }

  .bus-filters label {
    flex-basis: auto;
  }

  .bus-button,
  .bus-clear {
    width: 100%;
  }

  #map {
    min-height: 52vh;
  }

  .bus-side-panel {
    min-height: 0;
    padding: 14px;
  }

  .bus-departures-list {
    max-height: none;
    overflow: visible;
  }

  .bus-departure {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .bus-waiting-time {
    grid-column: 2;
    font-size: 13px;
  }

  .bus-stop-item {
    min-height: 78px;
  }
}

@media (max-width: 380px) {
  .bus-departure {
    grid-template-columns: 1fr;
  }

  .bus-line-badge {
    width: max-content;
  }

  .bus-waiting-time {
    grid-column: 1;
  }
}

/* Leaflet donne un z-index élevé à la carte : on la garde sous le menu mobile. */
body > header {
  z-index: 5000 !important;
}

.mobile-menu.open {
  position: relative;
  z-index: 5001;
}

#map,
.leaflet-container,
.leaflet-pane,
.leaflet-top,
.leaflet-bottom {
  z-index: 1 !important;
}

.leaflet-popup-pane {
  z-index: 2 !important;
}

/* Correction du panneau des arrêts : évite que les cartes soient coupées. */
.bus-side-panel {
  overflow: visible;
  max-height: none;
}

.bus-stop-list,
.bus-reports {
  max-height: none;
  overflow: visible;
}

@media (min-width: 1025px) {
  .bus-side-panel {
    max-height: 640px;
    overflow: auto;
  }
}

/* Correction forte : les horaires et la liste d'arrêts doivent agrandir la page, pas être coupés. */
.bus-side-panel,
.bus-stop-list,
.bus-reports,
.bus-departures-list {
  max-height: none !important;
  overflow: visible !important;
}

.bus-side-panel {
  height: auto !important;
  min-height: 0 !important;
}

.bus-map-layout {
  align-items: start;
}
