/* UI foundation: design tokens, top bar accent, surfaces, type scale.
   Loaded first of the ui-* layers (after ui-shell.css). */

/* UI system: design tokens, spacing/type scale, controls, chips, list rows, bars
   and panel surfaces (ui-shell.css owns only the top bar / app shell layout).
   Loaded before mobile-nav.css, which carries the mobile-only overrides. */

:root {
  --surface-radius: 12px;
  --control-radius: 8px;
  --elev-1: 0 1px 2px rgba(15, 16, 18, 0.05), 0 2px 8px rgba(15, 16, 18, 0.06);
}

body[data-theme="dark"] {
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 10px rgba(0, 0, 0, 0.4);
}

/* ---------- Top bar (accent, per theme) ---------- */
.topbar {
  background: var(--topbar-bg);
  color: var(--topbar-fg);
  border-bottom: 1px solid var(--topbar-border);
  box-shadow: none;
  padding: 0 var(--sp-4);
}

.topbar .topbar-brand,
.topbar .topbar-name,
.topbar .topbar-user-label {
  color: var(--topbar-fg);
}

.topbar .topbar-tagline {
  color: var(--topbar-fg);
  opacity: 0.78;
}

.topbar .header-icon,
.topbar svg {
  stroke: currentColor;
}

.topbar .btn,
.topbar .header-icon-btn {
  background: var(--topbar-btn-bg);
  border-color: transparent;
  color: var(--topbar-fg);
  box-shadow: none;
}

.topbar .btn:hover {
  background: var(--topbar-btn-hover);
  border-color: transparent;
  box-shadow: none;
}

.topbar .topbar-cities:disabled {
  background: transparent;
  opacity: 0.72;
}

/* ---------- Surfaces ---------- */
.panel {
  border-radius: var(--surface-radius);
  box-shadow: var(--elev-1);
}

.progress-track,
.progress-fill {
  border-radius: 999px;
}

.map-mode-btn {
  border-radius: 10px;
}

.tabbar-btn {
  border-radius: 10px;
}

.line-view-card {
  border-radius: var(--surface-radius);
}

.line-view-panel:not([hidden]) {
  animation: line-view-in 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.line-view-panel.line-view-closing {
  animation: line-view-out 0.2s ease forwards;
}

@keyframes line-view-out {
  from {
    opacity: 1;
    transform: none;
  }
  to {
    opacity: 0;
    transform: translateX(12px);
  }
}

@keyframes line-view-in {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.line-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "dot name stops"
    ". meta controls";
  align-items: center;
  column-gap: 8px;
  row-gap: 1px;
  padding: 6px 0;
  transition: background 0.16s ease;
}

.line-item.is-manual-on,
.line-item.is-manual-off {
  padding-left: 10px;
}

.line-item > .line-color-dot {
  grid-area: dot;
  width: 9px;
  height: 9px;
  align-self: center;
}

.line-item > .line-name {
  grid-area: name;
  min-width: 0;
  white-space: normal;
  overflow: visible;
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.line-item > .line-meta {
  grid-area: meta;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-caption);
  color: var(--muted);
}

.line-item > .line-side-top {
  grid-area: stops;
  justify-self: end;
  min-height: 0;
  font-size: var(--fs-caption);
  color: var(--muted);
}

.line-item > .line-visibility-controls {
  grid-area: controls;
  justify-self: end;
}

.line-visibility-btn {
  min-width: 30px;
  padding: 3px 7px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 10px;
  line-height: 1.5;
}

.line-item:hover {
  background: var(--button-hover);
}

.line-item .line-color-dot {
  transition: transform 0.16s ease;
}

.line-item:hover .line-color-dot {
  transform: scale(1.12);
}

.line-view-panel,
.line-view-card,
body[data-theme="dark"] .line-view-card,
body[data-theme="light"] .line-view-card {
  background: var(--panel);
}

/* The line view no longer uses the status card: identity moved into the header
   and progress into the progress row, so the leftover card stays hidden. */
.line-view-card .user-status-card {
  display: none !important;
}

.panel:hover {
  transform: none;
  border-color: var(--panel-border);
  box-shadow: var(--elev-1);
}

.dropdown-panel,
.map-notice-card {
  border-radius: var(--surface-radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--elev-1);
}

.panel,
.dropdown-panel,
.sidebar,
.topbar,
.tabbar,
.user-status-card,
.consent-banner,
.line-view-panel,
.line-view-card,
.map-mode-btn,
.map-notice-card {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ---------- Type hierarchy ---------- */
.panel-summary {
  font-size: var(--fs-section);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
}

.panel-summary::before {
  font-size: 10px;
  opacity: 0.45;
}

.panel-dropdown-body {
  padding: 0 var(--sp-4) var(--sp-4);
}

.filter-section-title {
  font-family: inherit;
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: none;
  color: var(--muted);
  margin: 0;
}

.mono-label,
.microcopy {
  font-family: inherit;
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}

.route-list-summary {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--ink);
}
