/* ===========
   LIVE MAP LAYOUT
   =========== */

/* 1) Ensure the site header sits above everything (including Leaflet panes) */
.site-header,
header.site-header,
header {
  position: sticky;   /* or fixed if that’s what you use */
  top: 0;
  z-index: 9999;
}

/* 2) Prevent Leaflet from “winning” the stacking order */
.live-map-map-wrapper,
#live-map {
  position: relative;
  z-index: 0;
}

/* 3) Belt-and-suspenders: keep Leaflet’s internal panes below your header */
#live-map .leaflet-pane,
#live-map .leaflet-control {
  z-index: 1;
}

main {
  margin-top: 1rem;
}

/* Overall layout: sidebar + map */
.live-map-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Sidebar (calls list) */
.live-map-sidebar {
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  padding: 1rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.live-map-sidebar h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main, #111827);
  margin-bottom: 0.1rem;
}

.live-map-sidebar .lead {
  font-size: 0.9rem;
  color: var(--text-muted, #6b7280);
  margin-bottom: 0.4rem;
}

/* Count + last updated line */
.live-map-count {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-main, #111827);
}

.live-map-updated {
  font-size: 0.78rem;
  color: var(--text-muted, #6b7280);
  margin-bottom: 0.3rem;
}

.live-map-call-sections {
  margin-top: 0.75rem;
}

.live-map-call-section + .live-map-call-section {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.3);
}

.live-map-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  color: #0354f5;
}

.live-map-call-empty {
  font-size: 0.8rem;
  color: #9ca3af;
  padding: 0.4rem 0;
}

/* Calls list container */
.live-map-call-list {
  list-style: none;
  margin: 0;
  padding: 0;
  margin-top: 0.2rem;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Individual call item */
.live-map-call-item {
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.08s ease;
}

.live-map-call-item:hover {
  background: #f9fafb;
  border-color: rgba(129, 140, 248, 0.45);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

/* Active/selected call */
.live-map-call-item.active {
  border-color: rgb(197, 2, 2);
  background: radial-gradient(
      circle at top left,
      rgba(129, 140, 248, 0.18),
      transparent 55%
    ),
    #f9fafb;
  box-shadow:
    0 0 0 1px rgba(197, 2, 2, 0.25),
    0 8px 20px rgba(15, 23, 42, 0.08);
}

/* Recently inactive calls in list */
.live-map-call-item.inactive {
  opacity: 0.7;
}

/* Time / type / location text */
.call-time {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main, #111827);
}

.call-type {
  font-size: 0.90rem;
  font-weight: 800;
  color: #000000;
}

.call-location {
  font-size: 0.8rem;
  color: var(--text-muted, #6b7280);
}

.call-location-alias {
  font-size: 1.0rem;
  font-weight: 700;
  color: var(--text-main, #0558ff);
}

/* Status line */
.call-status {
  font-size: 0.78rem;
  color: var(--text-muted, #6b7280);
  margin-top: 0.05rem;
}

/* Map wrapper */
.live-map-map-wrapper {
  border-radius: 20px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

/* Leaflet map div */
#live-map {
  width: 100%;
  height: 360px;
}

/* Leaflet popup tweaks */
.leaflet-popup-content-wrapper {
  border-radius: 14px;
}

.leaflet-popup-content {
  margin: 8px 10px;
}

/* Gray-out recently inactive markers on the map */
.wdw-marker-inactive {
  filter: grayscale(100%) brightness(0.85) !important;
  opacity: 0.9 !important;
}

/* Make sure active markers look normal */
.wdw-marker-active {
  filter: none !important;
  opacity: 1 !important;
}

/* =================
   CLUSTER VISIBILITY
   (used by JS: className "wdw-cluster ..." + inner ".wdw-cluster-bubble")
   ================= */

.wdw-cluster {
  background: transparent;
}

/* Bubble (size controlled by JS inline width/height + iconSize) */
.wdw-cluster .wdw-cluster-bubble {
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  background: rgba(17, 24, 39, 0.95);
  color: #ffffff;

  border: 3px solid rgba(255, 255, 255, 0.92);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.35),
    0 0 0 2px rgba(0, 0, 0, 0.18) inset;

  text-rendering: geometricPrecision;
}

.wdw-cluster .wdw-cluster-total {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.45);
}

.wdw-cluster .wdw-cluster-active {
  font-size: 0.80rem;
  font-weight: 800;
  margin-top: 3px;
  opacity: 0.98;
  line-height: 1;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.45);
}

/* If cluster contains active calls, tint it red */
.wdw-cluster.has-active .wdw-cluster-bubble {
  background: rgba(197, 2, 2, 0.95);
  border-color: rgba(255, 255, 255, 0.96);
}

/* Hover feedback */
.wdw-cluster:hover .wdw-cluster-bubble {
  transform: translateY(-1px);
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.38),
    0 0 0 2px rgba(0, 0, 0, 0.18) inset;
}

.wdw-cluster .wdw-cluster-bubble {
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

/* Desktop layout (taller heights) */
@media (min-width: 900px) {
  .live-map-layout {
    flex-direction: row;
    align-items: stretch;
  }

  /* Sidebar width */
  .live-map-sidebar {
    flex: 2;
    max-width: 420px;
    height: 760px;
    overflow-y: auto;
  }

  /* Map container */
  .live-map-map-wrapper {
    flex: 3;
    height: 760px;
  }

  /* Leaflet map height */
  #live-map {
    height: 760px;
  }

  /* Calls list area inside sidebar */
  .live-map-call-list {
    max-height: none;
  }
}

/* ===============================
   HIGH-VISIBILITY MAP CLUSTERS
   =============================== */

.wdw-cluster {
  background: transparent !important;
}

/* Bubble container */
.wdw-cluster .wdw-cluster-bubble {
  min-width: 64px;
  min-height: 64px;
  padding: 6px;

  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  background: rgba(17, 24, 39, 0.96);
  color: #ffffff;

  border: 4px solid rgba(255, 255, 255, 0.95);

  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.45),
    0 0 0 2px rgba(0, 0, 0, 0.25) inset;

  text-align: center;
  line-height: 1;
}

/* BIG number (total calls) */
.wdw-cluster .wdw-cluster-total {
  font-size: 1.55rem;      /* ⬅ much larger */
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1;

  text-shadow:
    0 2px 4px rgba(0, 0, 0, 0.6);
}

/* "X active" badge */
.wdw-cluster .wdw-cluster-active {
  margin-top: 5px;
  padding: 2px 6px;

  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;

  background: rgba(255, 255, 255, 0.92);
  color: #111827;

  border-radius: 999px;
  text-transform: uppercase;

  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}

/* Active clusters go RED */
.wdw-cluster.has-active .wdw-cluster-bubble {
  background: rgba(197, 2, 2, 0.97);
  border-color: rgba(255, 255, 255, 0.98);
}

/* Hover feedback */
.wdw-cluster:hover .wdw-cluster-bubble {
  transform: scale(1.06) translateY(-1px);
  box-shadow:
    0 22px 44px rgba(0, 0, 0, 0.5),
    0 0 0 2px rgba(0, 0, 0, 0.25) inset;
}

/* Smooth transitions */
.wdw-cluster .wdw-cluster-bubble {
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}

/* ===============================
   WDW CLUSTERS (force override)
   =============================== */

/* MarkerCluster plugin adds "marker-cluster" to the icon.
   Target both classes so our rules always win. */
.leaflet-marker-icon.wdw-cluster,
.leaflet-marker-icon.wdw-cluster.marker-cluster {
  background: transparent !important;
}

.leaflet-marker-icon.wdw-cluster .wdw-cluster-bubble {
  min-width: 64px !important;
  min-height: 64px !important;

  border-radius: 999px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;

  background: rgba(17, 24, 39, 0.96) !important;
  color: #fff !important;

  border: 4px solid rgba(255, 255, 255, 0.96) !important;
  box-shadow: 0 18px 38px rgba(0,0,0,0.45) !important;

  text-align: center !important;
  line-height: 1 !important;
  padding: 6px !important;
}

.leaflet-marker-icon.wdw-cluster .wdw-cluster-total {
  font-size: 1.55rem !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  text-shadow: 0 2px 4px rgba(0,0,0,0.6) !important;
}

.leaflet-marker-icon.wdw-cluster .wdw-cluster-active {
  margin-top: 5px !important;
  padding: 2px 6px !important;

  font-size: 0.72rem !important;
  font-weight: 800 !important;

  background: rgba(255,255,255,0.92) !important;
  color: #111827 !important;

  border-radius: 999px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35) !important;
}

.leaflet-marker-icon.wdw-cluster.has-active .wdw-cluster-bubble,
.leaflet-marker-icon.wdw-cluster.marker-cluster.has-active .wdw-cluster-bubble {
  background: rgba(197, 2, 2, 0.97) !important;
}
