/* CSS variables for theming */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-alt: #f0f4ff;
  --text-primary: #1a1a2e;
  --text-secondary: #555770;
  --accent: #1a73e8;
  --accent-muted: #e8f0fe;
  --border: #e0e4ef;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --progress-bg: #e0e4ef;
  --chip-arriving: #34a853;
  --chip-soon: #fbbc04;
  --chip-normal: #1a73e8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-alt: #1c2333;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent: #58a6ff;
    --accent-muted: #1f3358;
    --border: #30363d;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --progress-bg: #21262d;
    --chip-arriving: #3fb950;
    --chip-soon: #d29922;
    --chip-normal: #58a6ff;
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

/* Header */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px 12px;
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow);
}

h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

#status {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Progress bar */
#progress-container {
  height: 3px;
  background: var(--progress-bg);
  width: 100%;
  position: sticky;
  top: 53px;
  z-index: 9;
}

#progress-bar {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transition: width 10s linear;
}

/* Main content */
main {
  padding: 16px;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Stop cards */
.stop {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.stop-header {
  background: var(--accent-muted);
  padding: 10px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.stop-destination {
  font-weight: 400;
  opacity: 0.75;
  text-transform: none;
  letter-spacing: 0;
}

/* ETA rows */
.eta-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.eta-row:last-child {
  border-bottom: none;
}

.route-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 6px;
  padding: 4px 10px;
  min-width: 52px;
  text-align: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.eta-time {
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  font-weight: 500;
  flex: 1;
}

.eta-diff {
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 20px;
  padding: 3px 10px;
  white-space: nowrap;
}

.eta-diff.arriving {
  background: #e6f4ea;
  color: var(--chip-arriving);
}

.eta-diff.soon {
  background: #fef9e7;
  color: var(--chip-soon);
}

.eta-diff.normal {
  background: var(--accent-muted);
  color: var(--chip-normal);
}

@media (prefers-color-scheme: dark) {
  .eta-diff.arriving {
    background: #1e3a26;
  }
  .eta-diff.soon {
    background: #2d2208;
  }
}

.projected-arrival {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  margin-left: auto;
}

/* Travel time footer */
.travel-time {
  padding: 8px 16px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
}

.travel-time.collecting {
  font-style: italic;
  opacity: 0.7;
}

/* No ETAs state */
.no-etas {
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Page footer */
footer {
  text-align: center;
  padding: 20px;
  font-size: 0.8rem;
}

footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

@media (min-width: 600px) {
  main {
    padding: 20px;
  }

  h1 {
    font-size: 1.4rem;
  }

  .eta-row {
    padding: 14px 20px;
  }

  .stop-header {
    padding: 12px 20px;
  }
}
