:root {
  --teal: #4fb3a9;
  --teal-dark: #2f7a72;
  --ink: #1f2a2e;
  --muted: #6b7a80;
  --bg: #f5f7f6;
  --card: #ffffff;
  --border: #e0e6e4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: var(--teal-dark);
  color: white;
}

#topbar h1 {
  font-size: 18px;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.subtitle {
  font-size: 13px;
  font-weight: 400;
  opacity: 0.85;
}

#filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

#filters > label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

#filters input[type="date"] {
  padding: 5px 7px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
}

#filters button {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.5);
  background: transparent;
  color: white;
  cursor: pointer;
  font-size: 13px;
}

#filters button:hover {
  background: rgba(255,255,255,0.15);
}

.vt-dropdown {
  position: relative;
}

.vt-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: transparent;
  color: white;
  cursor: pointer;
  font-size: 13px;
}

.vt-toggle:hover,
.vt-toggle.open {
  background: rgba(255, 255, 255, 0.15);
}

.vt-toggle svg {
  flex: none;
  width: 18px;
  height: 18px;
}

/* The toggle's icon paths carry their own hardcoded fill/stroke (copied
   verbatim from Roadsurfer's sprite), so recolor them explicitly instead of
   relying on currentColor. */
.vt-toggle svg path[fill="#2A2A29"] {
  fill: white;
}

.vt-toggle svg path[stroke="#2A2A29"] {
  stroke: white;
}

.vt-toggle .vt-chevron {
  width: 10px;
  height: 6px;
  transition: transform 0.15s;
}

.vt-toggle.open .vt-chevron {
  transform: rotate(180deg);
}

.vt-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 1000;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  padding: 6px;
  min-width: 180px;
}

.vt-menu.hidden {
  display: none;
}

.vt-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.vt-option:hover {
  background: #f0f7f6;
}

.vt-option svg {
  flex: none;
  width: 20px;
  height: 20px;
}

.vt-option input[type="checkbox"] {
  cursor: pointer;
}

#resultCount {
  font-size: 12px;
  opacity: 0.9;
  min-width: 110px;
}

#main {
  flex: 1;
  display: flex;
  min-height: 0;
}

#map {
  flex: 1;
  min-width: 0;
}

#sidebar {
  width: 420px;
  min-width: 420px;
  overflow-y: auto;
  background: var(--card);
  border-right: 1px solid var(--border);
}

#listings {
  display: flex;
  flex-direction: column;
}

.listing {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
}

.listing:hover {
  background: #f0f7f6;
}

.listing .van-icon,
.listing .van-thumb {
  flex: none;
  width: 66px;
  aspect-ratio: 11 / 6;
  border-radius: 8px;
}

.listing .van-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eaf3f2;
}

.listing .van-icon svg {
  width: 80%;
  height: 80%;
}

.listing .van-thumb {
  object-fit: cover;
  background: #eaf3f2;
}

.listing .listing-body {
  min-width: 0;
  flex: 1;
}

.listing .route {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.listing .route .arrow {
  color: var(--teal-dark);
}

.station-selected-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: #f0f7f6;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.station-selected-header .counts {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.station-selected-header .header-actions {
  flex: none;
  display: flex;
  gap: 6px;
}

.station-selected-header button {
  flex: none;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
}

.station-selected-header button:hover {
  background: #e6efed;
}

.listing .dates {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.listing .dates div {
  padding: 1px 0;
}

.empty-state {
  padding: 24px 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

#status {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

#status.visible {
  opacity: 0.92;
}

.rs-popup h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.rs-popup .dest {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.rs-popup .dest .name {
  font-weight: 600;
}

.rs-popup .dest .window {
  color: var(--muted);
}

@media (max-width: 720px) {
  #sidebar {
    width: 100%;
    min-width: 0;
    max-height: 40%;
  }
  #main {
    flex-direction: column;
  }
}
