/* Place Leaflet zoom controls on the right side of every map */
body:has(#map:not(.hidden)) #liveMap .leaflet-top.leaflet-left {
  top: 74px;
  right: 14px;
  left: auto;
}
body:has(#history:not(.hidden)) #historyMap .leaflet-top.leaflet-left {
  top: 145px;
  right: 12px;
  left: auto;
}
body:has(#geofences:not(.hidden)) #geoMap .leaflet-top.leaflet-left {
  top: 10px;
  right: 10px;
  left: auto;
}
body:has(#map:not(.hidden)) #liveMap .leaflet-control-zoom,
body:has(#history:not(.hidden)) #historyMap .leaflet-control-zoom,
body:has(#geofences:not(.hidden)) #geoMap .leaflet-control-zoom { margin: 0; }

/* Branded, touch-friendly Leaflet zoom control */
body:has(#map:not(.hidden)) #liveMap .leaflet-control-zoom,
body:has(#history:not(.hidden)) #historyMap .leaflet-control-zoom,
body:has(#geofences:not(.hidden)) #geoMap .leaflet-control-zoom {
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 35%) !important;
  border-radius: 13px !important;
  background: #14243a;
  box-shadow: 0 5px 15px rgb(7 17 31 / 24%);
}
body:has(#map:not(.hidden)) #liveMap .leaflet-control-zoom a,
body:has(#history:not(.hidden)) #historyMap .leaflet-control-zoom a,
body:has(#geofences:not(.hidden)) #geoMap .leaflet-control-zoom a {
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 0;
  background: #14243a;
  color: #f8fafc;
  font-size: 21px;
  font-weight: 600;
  line-height: 39px;
  text-align: center;
  transition: background-color .15s ease, color .15s ease;
}
body:has(#map:not(.hidden)) #liveMap .leaflet-control-zoom a + a,
body:has(#history:not(.hidden)) #historyMap .leaflet-control-zoom a + a,
body:has(#geofences:not(.hidden)) #geoMap .leaflet-control-zoom a + a { border-top: 1px solid rgb(255 255 255 / 18%); }
body:has(#map:not(.hidden)) #liveMap .leaflet-control-zoom a:hover,
body:has(#history:not(.hidden)) #historyMap .leaflet-control-zoom a:hover,
body:has(#geofences:not(.hidden)) #geoMap .leaflet-control-zoom a:hover { background: #24466d; color: #fff; }
body:has(#map:not(.hidden)) #liveMap .leaflet-control-zoom a:focus-visible,
body:has(#history:not(.hidden)) #historyMap .leaflet-control-zoom a:focus-visible,
body:has(#geofences:not(.hidden)) #geoMap .leaflet-control-zoom a:focus-visible { position: relative; z-index: 1; outline: 2px solid #9bc2ff; outline-offset: -3px; }

/* Keep required map credit compact; the Leaflet library prefix is disabled. */
body:has(#map:not(.hidden)) #liveMap .leaflet-control-attribution,
body:has(#history:not(.hidden)) #historyMap .leaflet-control-attribution,
body:has(#geofences:not(.hidden)) #geoMap .leaflet-control-attribution {
  padding: 3px 7px;
  border: 1px solid rgb(37 58 84 / 16%);
  border-radius: 7px;
  background: rgb(255 255 255 / 90%);
  color: #263a52;
  font-size: 10px;
  line-height: 1.35;
  box-shadow: 0 2px 8px rgb(16 35 63 / 10%);
}
body:has(#map:not(.hidden)) #liveMap .leaflet-control-attribution a,
body:has(#history:not(.hidden)) #historyMap .leaflet-control-attribution a,
body:has(#geofences:not(.hidden)) #geoMap .leaflet-control-attribution a { color: #193e73; font-weight: 650; }
body:has(#map:not(.hidden)) #liveMap .leaflet-control-attribution,
body:has(#history:not(.hidden)) #historyMap .leaflet-control-attribution,
body:has(#geofences:not(.hidden)) #geoMap .leaflet-control-attribution { width: max-content; max-width: none; white-space: nowrap; }

@media (max-width: 700px) {
  body:has(#map:not(.hidden)) #liveMap .leaflet-top.leaflet-left {
    top: calc(108px + env(safe-area-inset-top));
    right: 10px;
  }
  body:has(#history:not(.hidden)) #historyMap .leaflet-top.leaflet-left {
    top: calc(10px + env(safe-area-inset-top));
    right: 10px;
  }
  body:has(#geofences:not(.hidden)) #geoMap .leaflet-top.leaflet-left {
    top: 10px;
    right: 10px;
  }
  /* Keep full map credits visible below the top controls on every map. */
  body:has(#map:not(.hidden)) #liveMap .leaflet-bottom.leaflet-right,
  body:has(#history:not(.hidden)) #historyMap .leaflet-bottom.leaflet-right,
  body:has(#geofences:not(.hidden)) #geoMap .leaflet-bottom.leaflet-right {
    top: calc(62px + env(safe-area-inset-top));
    right: auto;
    bottom: auto;
    left: 10px;
  }
  body:has(#map:not(.hidden)) #liveMap .leaflet-control-zoom a,
  body:has(#history:not(.hidden)) #historyMap .leaflet-control-zoom a,
  body:has(#geofences:not(.hidden)) #geoMap .leaflet-control-zoom a { width: 46px; height: 46px; line-height: 45px; font-size: 23px; }
}
