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

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a1f;
  color: #e8e8ec;
}

.theme-dark {
  --cupertino-pane-background: #252528;
  --cupertino-pane-color: #e8e8ec;
  --cupertino-pane-border-radius: 16px;
  --cupertino-pane-shadow: 0 -6px 28px rgba(0, 0, 0, 0.5);
  --cupertino-pane-move-background: #6e6e78;
  --cupertino-pane-destroy-button-background: #3a3a40;
  --cupertino-pane-icon-close-color: #c4c4cc;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Marker DOM iznad canvasa (MapLibre ponekad ostavlja z-index 0). */
#map .maplibregl-marker {
  z-index: 6;
}

/* DOM markeri (maplibregl.Marker) — uvijek iznad WebGL slojeva, ne gube se ispod 3D zgrada. */
.map-vehicle-marker {
  pointer-events: none;
}

.map-vehicle-marker__badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px 2px 4px;
  border-radius: 999px;
  background: rgba(26, 26, 31, 0.96);
  border: 1px solid rgba(92, 184, 92, 0.55);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
}

.map-vehicle-marker--highlight .map-vehicle-marker__badge {
  border-color: rgba(255, 193, 7, 0.9);
  box-shadow:
    0 0 0 2px rgba(255, 193, 7, 0.35),
    0 1px 5px rgba(0, 0, 0, 0.5);
}

.map-vehicle-marker__icon {
  display: flex;
  align-items: center;
  color: #5cb85c;
  line-height: 0;
}

.map-vehicle-marker__num {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #f2f2f2;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-chrome {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
}

.app-chrome > * {
  pointer-events: auto;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  max-width: min(100% - 20px, 520px);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}

.toolbar {
  background: rgba(30, 30, 34, 0.94);
  color: #f2f2f2;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.toolbar-actions {
  margin-left: 0;
  width: 100%;
  justify-content: flex-end;
}

.toolbar-btn {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.85rem;
  background: #3a3a44;
  color: #f2f2f2;
}

.toolbar-btn--primary {
  background: #0069d9;
  color: #fff;
}

.pwa-install-prompt {
  position: fixed;
  z-index: 25;
  top: 66px;
  left: 10px;
  right: 10px;
  pointer-events: none;
}

.pwa-install-prompt__content {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(30, 30, 34, 0.96);
  color: #f2f2f2;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}

.pwa-install-prompt__text {
  font-size: 0.86rem;
}

.pwa-install-prompt__actions {
  display: inline-flex;
  gap: 8px;
}

.pwa-install-prompt__btn {
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
  cursor: pointer;
}

.pwa-install-prompt__btn--install {
  background: #0069d9;
  color: #fff;
}

.pwa-install-prompt__btn--dismiss {
  background: #3a3a44;
  color: #f2f2f2;
}

/* Cupertino Pane: iznad karte; prazan prostor ispod pane-a propušta događaje karti */
.cupertino-pane-wrapper.app-info-pane {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}

.cupertino-pane-wrapper.app-info-pane .pane {
  pointer-events: auto;
  max-height: 100dvh;
  overflow: hidden;
}

#sheet-info {
  color: #eee;
  background: #1e1e22;
  height: 100%;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#sheet-root {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

@keyframes sheet-nav-forward {
  from {
    opacity: 0.72;
    transform: translateX(22px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes sheet-nav-back {
  from {
    opacity: 0.72;
    transform: translateX(-22px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

#sheet-root.sheet-animate-forward {
  animation: sheet-nav-forward 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

#sheet-root.sheet-animate-back {
  animation: sheet-nav-back 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.sheet-title {
  margin: 0;
  padding: 4px 16px 10px;
  font-size: 1.05rem;
  font-weight: 600;
}

.sheet-body {
  padding: 0 16px 24px;
  font-size: 0.95rem;
  line-height: 1.45;
  /* max-height: min(70vh, 520px); */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sheet-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.sheet-section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.sheet-muted {
  margin: 0;
  color: #9a9aa8;
  font-size: 0.9rem;
}

.sheet-back {
  align-self: flex-start;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.9rem;
  background: #333338;
  color: #e8e8ec;
  cursor: pointer;
}

.sheet-back--ghost {
  background: transparent;
  padding-left: 0;
}

.sheet-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 4px;
}

.sheet-list li {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.sheet-list-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  background: #2c2c32;
  color: #e8e8ec;
  font-size: 0.9rem;
  cursor: pointer;
}

.sheet-list-btn:hover {
  background: #36363e;
}

.sheet-line-name {
  flex: 1;
}

.sheet-line-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.sheet-line-sub {
  font-size: 0.78rem;
  color: #9a9aa8;
}

.sheet-bus-icon {
  flex-shrink: 0;
  color: #5cb85c;
  display: flex;
  align-items: center;
}

.sheet-bus-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 5px;
  border-radius: 999px;
  background: rgba(26, 26, 31, 0.94);
  border: 1px solid rgba(92, 184, 92, 0.5);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.sheet-bus-badge__icon {
  display: flex;
  align-items: center;
}

.sheet-bus-badge__num {
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #f2f2f2;
  line-height: 1;
  max-width: 4.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-list--stops .sheet-list-btn--stop {
  flex: 1;
}

.sheet-list--stops .sheet-list-btn--stop.is-next-stop {
  border: 1px solid rgba(255, 193, 7, 0.65);
  box-shadow: 0 0 0 1px rgba(255, 193, 7, 0.22) inset;
}

.sheet-stop-order {
  font-variant-numeric: tabular-nums;
  color: #9a9aa8;
  min-width: 1.5rem;
}

.sheet-stop-name {
  flex: 1;
}

.sheet-stop-time {
  font-variant-numeric: tabular-nums;
  color: #b8b8c8;
}

.sheet-next-stop-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #111;
  background: rgba(255, 193, 7, 0.9);
}

.sheet-mini {
  flex-shrink: 0;
  width: 36px;
  border: none;
  border-radius: 8px;
  background: #333338;
  color: #e8e8ec;
  cursor: pointer;
  font-size: 1rem;
}

.sheet-mini:hover {
  background: #3d3d44;
}

.sheet-segmented {
  display: flex;
  gap: 6px;
}

.sheet-seg {
  flex: 1;
  border: none;
  border-radius: 8px;
  padding: 8px;
  font-size: 0.82rem;
  background: #2c2c32;
  color: #c4c4cc;
  cursor: pointer;
}

.sheet-seg.is-active {
  background: #0069d9;
  color: #fff;
}

.sheet-list--arrivals .sheet-arrival-line {
  font-weight: 600;
  min-width: 2.5rem;
}

.sheet-list--arrivals .sheet-arrival-meta {
  margin-left: auto;
  color: #b8b8c8;
  font-variant-numeric: tabular-nums;
}

.maplibregl-ctrl-top-right {
  top: 56px;
}
