html,
body {
  height: 100%;
  margin: 0;
  background: #0b1220;
}

#map {
  height: 100%;
  width: 100%;
}

/* SÖK: uppe till höger + mindre */
.searchbar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 9999;
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

.searchbar input {
  width: min(260px, 55vw);
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  outline: none;
  background: rgba(2, 6, 23, 0.35);
  color: #fff;
  font: 600 13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.searchbar button {
  width: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(2, 6, 23, 0.35);
  color: #fff;
  font: 900 18px system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  cursor: pointer;
}

/* PIL */
.train-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  transform-origin: 50% 50%;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
}

.train-icon svg {
  width: 30px;
  height: 30px;
  display: block;
}

/* Glow när pinnad */
.train-selected .train-icon {
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.62))
    drop-shadow(0 10px 18px rgba(0, 0, 0, 0.28));
}

/* =========================
   CHIP / LABEL (divIcon)
   ========================= */

.train-chip {
  border: none;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.leaflet-tooltip.train-chip,
.leaflet-marker-icon.train-chip {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.leaflet-tooltip.train-chip:before,
.leaflet-marker-icon.train-chip:before {
  display: none;
}

.leaflet-tooltip.train-chip {
  margin-top: -6px;
}

/* labeln ska inte fånga mus */
.leaflet-marker-icon.train-chip,
.train-chip {
  pointer-events: none;
}

.train-chip .chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 14px;
  color: var(--chip-text, #fff);
  font:
    600 13px/1.2 system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    sans-serif;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.28);
}

.train-chip.pinned .chip,
.leaflet-tooltip.train-chip.pinned .chip,
.leaflet-marker-icon.train-chip.pinned .chip {
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.48),
    0 0 0 3px rgba(255, 255, 255, 0.32),
    0 0 18px rgba(255, 255, 255, 0.22);
}

.train-chip .logo {
  width: 22px;
  height: 22px;
  border-radius: 0;
  background: transparent;
  border: none;
  object-fit: contain;
}

/* Grön “i tid”-prick */
.train-chip .statusDot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex: 0 0 auto;
  margin-left: 2px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  /* Ingen "kastskugga" på chipet; bara glow */
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.18),
    0 0 22px rgba(255, 255, 255, 0.30);
}

/* +N badge (försening) */
.train-chip .delayBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-left: 2px;
  padding: 3px 7px;
  border-radius: 999px;

  /* Mer lik texten i chipet (mindre "tung") */
  font:
    600 10px/1 system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    sans-serif;
  letter-spacing: 0.2px;
  color: #ffffff;

  border: 1px solid rgba(255, 255, 255, 0.22);

  /* Ingen offset-skugga som "faller" på chipet — bara stark glow */
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.18),
    0 0 26px rgba(255, 255, 255, 0.30);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.29);
}

/* Positionera labeln rakt ovanför markercentrum */
.trainLabelPos {
  position: relative;
  transform: translate(-50%, calc(-100% - var(--label-gap, 18px)));
  transform-origin: 0 0;
  display: inline-block;
  pointer-events: none;
}

/* =========================
   USER LOCATION (Google Maps style)
   ========================= */
.userLocWrap {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

.userLocDot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #1a73e8;
  border: 3px solid #ffffff;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(26, 115, 232, 0.35);
  position: relative;
}

.userLocPulse {
  position: absolute;
  inset: -10px;
  border-radius: 999px;
  background: rgba(26, 115, 232, 0.18);
  animation: userPulse 1.8s ease-out infinite;
}

@keyframes userPulse {
  0% { transform: scale(0.55); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Locate button (Google Maps-ish) */
.locateBtn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  cursor: pointer;
  font: 900 18px/1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.28);
}

.locateBtn.is-following {
  box-shadow:
    0 12px 22px rgba(0, 0, 0, 0.28),
    0 0 0 2px rgba(255, 255, 255, 0.25),
    0 0 16px rgba(255, 255, 255, 0.18);
}
