body { margin: 0; }

#app {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
#map { flex: 1; min-height: 0; }

/* Slim header styling tuned for the explore layout — the shared
   .page-header is defined in commute.css; here we trim padding. */
#app > .page-header {
  padding: 6px 12px;
}
#app > .page-header h1 {
  font-size: 14px;
}

/* Overlay panel */
.panel {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 320px;
  max-height: calc(100vh - 20px);
  overflow-y: auto;
  background: white;
  border-radius: 8px;
  padding: 14px;
  font: 13px/1.5 sans-serif;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  z-index: 1000;
}
.panel.hidden {
  display: none;
}
@media (max-width: 768px) {
  .panel {
    top: 0;
    right: 0;
    left: auto;
    width: 75vw;
    max-width: 320px;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    padding: 12px;
    box-sizing: border-box;
    font-size: 12px;
    transition: transform 0.25s ease;
    transform: translateX(0);
  }
  .panel.hidden {
    display: block;
    transform: translateX(100%);
  }
  .panel h2 { font-size: 14px; }
  .timeline .departures { font-size: 11px; }
  .bus-count { font-size: 11px; }
  .leaflet-control-layers { font-size: 11px; }
}
.panel-close {
  float: right;
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
  color: #999;
  padding: 0 4px;
  line-height: 1;
}
.panel-close:hover { color: #333; }
.panel h2 {
  margin: 0 0 2px;
  font-size: 16px;
}
.panel .stop-meta {
  font-size: 11px;
  color: #666;
  margin-bottom: 8px;
}

/* Legend */
.legend {
  background: white;
  padding: 10px 14px;
  border-radius: 6px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.3);
  line-height: 22px;
  font: 13px/1.5 sans-serif;
}
.legend h4 { margin: 0 0 6px; font-size: 14px; }
.legend i {
  width: 14px; height: 14px;
  display: inline-block;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: middle;
}


/* Bus markers */
.bus-wrapper {
  position: relative;
  width: 36px;
  height: 36px;
}
.bus-icon {
  position: absolute;
  top: 4px;
  left: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  color: white;
  background: #60a5fa;
  border: 2px solid transparent;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
}
.bus-icon.hovered {
  border-color: #ffd700;
}
.bus-icon.selected {
  background: #2563eb;
  border-color: #ffd700;
}
.bus-wrapper.dimmed {
  opacity: 0.25;
}
.bus-bearing {
  position: absolute;
  top: 0;
  left: 0;
  width: 36px;
  height: 36px;
  pointer-events: none;
}

/* === Timeline (stop + bus-route) ===
   Shared grid + dot + chip styles live in timeline.css.
   Here we set column templates for the map panel views. */
.timeline { font: 12px/1.4 sans-serif; margin-top: 6px; }
.timeline .loading { color: #999; font-style: italic; }

/* Stop timeline: dot | route | destination | sched | status */
.timeline .departures {
  grid-template-columns: auto auto 1fr auto auto;
}

/* Bus-route stop list: dot | sched | actual | chip | stop-name */
.timeline .route-stops {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: auto auto auto auto 1fr;
  gap: 0 6px;
  align-items: baseline;
}
.timeline .route-stops .departure > * {
  padding-top: 3px;
  padding-bottom: 3px;
}

.timeline .departure:hover > * {
  background: #f5f5f5;
}

/* Show more buttons */
.show-more {
  display: block;
  width: 100%;
  padding: 4px 0;
  border: none;
  background: none;
  color: #888;
  font-size: 11px;
  cursor: pointer;
  text-align: center;
}
.show-more:hover {
  color: #333;
  background: #f5f5f5;
}
.show-more-future { border-bottom: 1px solid #eee; margin-bottom: 2px; }
.show-more-past { border-top: 1px solid #eee; margin-top: 2px; }

/* Bus count + refresh timer */
.bus-count {
  background: white;
  padding: 4px 10px;
  border-radius: 6px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.3);
  font: 13px/1.5 sans-serif;
  min-width: 90px;
}
.bus-count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.refresh-toggle, .refresh-now {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  color: #666;
  line-height: 1;
}
.refresh-toggle:hover, .refresh-now:hover { color: #333; }
.refresh-bar {
  height: 2px;
  background: #eee;
  border-radius: 1px;
  margin-top: 3px;
  overflow: hidden;
}
.refresh-bar-fill {
  height: 100%;
  background: #60a5fa;
  width: 100%;
  transform-origin: left;
  animation: refresh-countdown 20s linear;
}
@keyframes refresh-countdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}
.commute-save-btn {
  display: block;
  width: 100%;
  margin: 8px 0;
  padding: 6px 12px;
  border: 1px solid #4a6fa5;
  border-radius: 6px;
  background: none;
  color: #4a6fa5;
  font: 13px/1.5 system-ui, sans-serif;
  font-weight: 600;
  cursor: pointer;
}
.commute-save-btn:hover { background: #f0f4fa; }
.commute-save-btn.saved {
  border-color: #059669;
  color: #059669;
}
.commute-save-btn.saved:hover { background: #ecfdf5; }
