/* Commute view — mobile-first, no Leaflet, pure list UI */

/* === Base === */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.5 system-ui, -apple-system, sans-serif;
  color: #1a1a2e;
  background: #f3f4f6;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* === Header === */
/* .page-header is shared across the four landing views (explore, commute,
   commute-home, reckon, about) and rendered by components/page-header.js.
   .commute-header is the simpler back-link + action header used by
   drill-down views like commute/detail.js. Both look the same. */
.page-header,
.commute-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 12px;
}
.page-header h1,
.commute-header h1 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}
.back-link {
  color: #4a6fa5;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.exit-link {
  color: #6b7280;
  text-decoration: none;
  font-size: 12px;
}

/* === Cross-page nav (Explore · Commute · Reckon) === */
.page-nav {
  display: flex;
  gap: 6px;
  font-size: 12px;
}
.page-nav a {
  color: #6b7280;
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 4px;
}
.page-nav a:hover { background: #f3f4f6; color: #1a1a2e; }
.page-nav a.active {
  color: #1a1a2e;
  font-weight: 600;
  background: #e8eef5;
}

/* === Stop name + routes (shared by home cards + detail) === */
.stop-name {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 2px;
}
.stop-routes {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 8px;
}
.stop-routes.no-service {
  color: #b91c1c;
  font-style: italic;
}

/* === Reliability pill + strip (shared by home cards + detail) === */
.rel-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.rel-good    { background: #d1fae5; color: #047857; }
.rel-warn    { background: #fef3c7; color: #b45309; }
.rel-bad     { background: #fee2e2; color: #b91c1c; }
.rel-unknown { background: #f3f4f6; color: #9ca3af; }

.rel-strip {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  margin: 4px 0 8px;
  background: #f3f4f6;
  color: #374151;
}
.rel-strip strong { font-weight: 700; }
.rel-strip small { color: #6b7280; }
.rel-strip.rel-good { background: #ecfdf5; }
.rel-strip.rel-warn { background: #fffbeb; }
.rel-strip.rel-bad  { background: #fef2f2; }
.rel-strip.rel-unknown { font-style: italic; color: #9ca3af; }

/* === Loading / error / empty states === */
.loading, .error, .empty, .empty-state, .section-empty {
  text-align: center;
  padding: 32px 16px;
  color: #6b7280;
  font-size: 13px;
}
.error { color: #b91c1c; }

/* === Home: stop cards === */
.stop-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.stop-card:active {
  box-shadow: 0 1px 6px rgba(0,0,0,0.15);
}
.stop-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.stop-card-header .stop-name {
  flex: 1;
  min-width: 0;
}
.remove-btn {
  flex-shrink: 0;
  border: none;
  background: none;
  font-size: 20px;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
  padding: 0 2px;
}
.remove-btn:hover { color: #b91c1c; }

.no-departures {
  font-size: 12px;
  color: #9ca3af;
  margin: 6px 0 0;
  font-style: italic;
}

/* === Add stop button === */
.add-stop-btn {
  display: block;
  text-align: center;
  padding: 12px;
  margin-top: 8px;
  background: #4a6fa5;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.add-stop-btn:active { background: #3b5998; }

/* === Departures list: commute column template === */
/* Shared row primitives + dots + chips live in timeline.css.
   Here we only set the grid template: dot | route | destination | time | status */
.departures {
  margin-top: 6px;
  grid-template-columns: auto auto 1fr auto auto;
}
.departure {
  font-size: 13px;
}

/* === Detail: timeline === */
.timeline-scroll {
  flex: 1;
  overflow-y: auto;
  margin: 0 -16px;
  padding: 0 16px;
}

/* Past entries: dimmed (applied to each cell since display:contents
   removes the li from the box model) */
.departures-past .departure > * {
  opacity: 0.55;
}
.departures-past .departure:hover > * {
  opacity: 0.85;
}

/* Now divider */
.now-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  color: #4a6fa5;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.now-divider::before,
.now-divider::after {
  content: '';
  flex: 1;
  height: 2px;
  background: #4a6fa5;
  border-radius: 1px;
}

/* Coming entries: full weight */
.departures-coming .departure {
  padding: 6px 0;
}

/* === Detail: save toggle === */
.save-toggle {
  border: 1px solid #4a6fa5;
  background: none;
  color: #4a6fa5;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.save-toggle.saved {
  border-color: #d1d5db;
  color: #6b7280;
}

/* === Search === */
#search-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
#search-input:focus {
  border-color: #4a6fa5;
  box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.12);
}
.hint {
  font-size: 12px;
  color: #9ca3af;
  padding: 4px 0;
  min-height: 20px;
}
.result-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.result {
  padding: 12px;
  background: #fff;
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  transition: box-shadow 0.15s;
}
.result:active {
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.result.saved {
  border-left: 3px solid #059669;
}
.result-name {
  font-weight: 600;
  font-size: 14px;
}
.result-routes {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}
.result-saved {
  font-size: 11px;
  color: #059669;
  font-weight: 500;
  margin-top: 2px;
}