*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  display: flex;
  height: 100vh;
  font-family: system-ui, sans-serif;
  font-size: 14px;
  color: #1a1a1a;
}

/* Sidebar */
#sidebar {
  width: 280px;
  min-width: 220px;
  padding: 20px 16px;
  background: #fff;
  border-right: 1px solid #e0e0e0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 1000;
}

h1 { font-size: 1.4rem; font-weight: 700; color: #1a6b3a; }
.subtitle { font-size: 0.8rem; color: #666; margin-top: 2px; }

.control-group { display: flex; flex-direction: column; gap: 6px; }
.control-group label { font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: #444; }
.control-group select {
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fafafa;
  cursor: pointer;
}

/* City autocomplete */
.autocomplete-wrapper { position: relative; }
.autocomplete-wrapper input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fafafa;
}
.autocomplete-wrapper input:focus {
  outline: none;
  border-color: #1a6b3a;
  background: #fff;
}
.suggestions-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ccc;
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 220px;
  overflow-y: auto;
  list-style: none;
  z-index: 2000;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.suggestions-list li {
  padding: 7px 10px;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid #f0f0f0;
}
.suggestions-list li:last-child { border-bottom: none; }
.suggestions-list li:hover,
.suggestions-list li.active { background: #f0f7f3; color: #1a6b3a; }

#result-panel { border-top: 1px solid #e0e0e0; padding-top: 16px; }
#result-panel h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: #444; margin-bottom: 10px; }
#result-content { font-size: 0.9rem; line-height: 1.6; }
/* Itinerary timeline */
.itin-header { margin-bottom: 14px; }
.itin-title { font-size: 0.95rem; font-weight: 700; }
.itin-meta { font-size: 0.8rem; color: #666; margin-top: 2px; }

.itin-stop { display: flex; gap: 10px; align-items: flex-start; }
.itin-node {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
  background: #1a6b3a;
  border: 2px solid #1a6b3a;
  position: relative;
}
.itin-change .itin-node { background: #fff; border-color: #f9a825; }
.itin-change .itin-node::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: #f9a825;
}
.itin-dest .itin-node { background: #1a1a1a; border-color: #1a1a1a; }

.itin-stop-body { flex: 1; min-width: 0; padding-bottom: 2px; }
.itin-city-name { font-size: 0.9rem; font-weight: 600; line-height: 1.3; }
.itin-terminal { font-size: 0.75rem; color: #888; margin-top: 1px; font-style: italic; }
.itin-wait { font-size: 0.78rem; color: #c17f00; font-weight: 500; margin-top: 2px; }
.itin-no-access { font-size: 0.75rem; color: #bbb; font-style: italic; margin-top: 3px; }

.itin-segment { display: flex; gap: 10px; }
.itin-spine { width: 12px; flex-shrink: 0; display: flex; justify-content: center; }
.itin-spine::before {
  content: '';
  width: 2px;
  background: #c5e0d0;
  display: block;
  min-height: 28px;
}
.itin-leg {
  font-size: 0.8rem;
  color: #555;
  padding: 3px 8px;
  background: #f5f5f5;
  border-radius: 4px;
  align-self: center;
  border-left: 3px solid #c5e0d0;
}
.itin-line-name {
  font-weight: 600;
  color: #1a6b3a;
}

.access-icons { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.access-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #eaf4ef;
  border: 1px solid #c5e0d0;
  font-size: 0.88rem;
  cursor: help;
  line-height: 1;
  user-select: none;
}
.access-icon:hover { background: #d3ece0; border-color: #1a6b3a; }

/* Layer toggles */
.layer-toggles { display: flex; flex-direction: column; gap: 5px; }
.layer-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-family: inherit;
  border: 1px solid #ccc;
  border-radius: 5px;
  background: #fafafa;
  color: #999;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.layer-toggle.active  { background: #f0f7f3; border-color: #1a6b3a; color: #1a1a1a; }
.layer-toggle:hover   { border-color: #1a6b3a; }
.toggle-line {
  display: inline-block;
  width: 22px;
  height: 3px;
  flex-shrink: 0;
  border-radius: 1px;
}
.toggle-line-velo { background: #0097a7; }

/* Reset button */
.reset-btn {
  width: 100%;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-family: inherit;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: #fafafa;
  color: #bbb;
  cursor: pointer;
  text-align: center;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.reset-btn:hover { background: #fff4f4; border-color: #ef5350; color: #ef5350; }

/* Duration segmented buttons */
.duration-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.dur-btn {
  flex: 1 1 auto;
  padding: 5px 4px;
  font-size: 0.78rem;
  font-family: inherit;
  border: 1px solid #ccc;
  border-radius: 5px;
  background: #fafafa;
  color: #444;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.dur-btn:hover   { background: #f0f7f3; border-color: #1a6b3a; color: #1a6b3a; }
.dur-btn.active  { background: #1a6b3a; border-color: #1a6b3a; color: #fff; font-weight: 600; }

/* Bike routes panel */
#bike-panel { border-top: 1px solid #e0e0e0; padding-top: 16px; }
#bike-panel h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: #444; margin-bottom: 6px; }

.bike-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 10px;
}
.legend-dot {
  display: inline-block;
  width: 14px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-ev  { background: #0097a7; }
.legend-nat { background: #e67e22; }

.bike-empty { font-size: 0.82rem; color: #999; font-style: italic; }

/* Route cards */
.route-card {
  padding: 8px 10px;
  border: 1px solid #e0e0e0;
  border-radius: 7px;
  margin-bottom: 7px;
  background: #fafafa;
}
.route-card-top {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 3px;
}
.route-ref {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.route-ref-ev  { background: #e0f5f7; color: #006978; border: 1px solid #b2dfe5; }
.route-ref-nat { background: #fef3e7; color: #a04000; border: 1px solid #f5c99c; }
.route-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.3;
}
.route-type-label { font-size: 0.73rem; color: #888; margin-bottom: 5px; }
.route-link {
  font-size: 0.78rem;
  color: #1a6b3a;
  text-decoration: none;
  font-weight: 500;
}
.route-link:hover { text-decoration: underline; }

/* 🚲 return-point marker — sits centred on the station circle (radius 7 → 14px diameter) */
.bike-return-marker {
  font-size: 9px;
  line-height: 14px;
  text-align: center;
  background: none;
  border: none;
  pointer-events: none;
}

/* Map */
#map { flex: 1; }

/* City circle markers */
.city-marker {
  cursor: pointer;
  transition: opacity 0.15s;
}

/* Reachability colour scale */
.reach-0 { background: #2a9d4e; }   /* direct — green */
.reach-1 { background: #4fc3f7; }   /* 1 change — light blue */
.reach-2 { background: #f9a825; }   /* 2 changes — amber */
.reach-3 { background: #ef5350; }   /* 3 changes — red */
.reach-origin { background: #1a1a1a; border-color: #fff; }
.reach-none   { background: #ccc; opacity: 0.3; }
