/* ================================================================
   BreMesh Live Map – Styles
   hbme.sh design shell with BIA-style dark map embedded
   ================================================================ */

/* ── Livemap-specific layout ─────────────────────────── */
.livemap-main {
  padding: 0;
  max-width: none;
  border: 1px solid var(--line, #e6e6e6);
  border-top: none;
  margin: 0;
}
.site-footer {
  margin-top: 0;
}

/* ── Map wrapper (full-width, dark) ──────────────────── */
.map-wrap {
  background: #0d1117;
  border-bottom: 1px solid var(--line, #e6e6e6);
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  background: #13151e;
  border-bottom: 1px solid #2a3040;
  gap: 12px;
}

.map-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-toolbar-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #d0d4dc;
  letter-spacing: 0.5px;
}

.ws-status {
  font-size: 0.7rem;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  color: #505a6a;
}

.map-toolbar-right {
  display: flex;
  align-items: center;
}

.map-route-label {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  font-size: 0.7rem;
  color: #505a6a;
}

/* Live dot */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #505a6a;
  transition: background 0.3s;
  flex-shrink: 0;
}
.live-dot.connected {
  background: #27ae60;
  box-shadow: 0 0 6px #27ae60;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 4px #27ae60; }
  50% { box-shadow: 0 0 10px #27ae60; }
}

/* Route map – header ~71px, toolbar ~37px, footer ~30px */
.map-container {
  position: relative;
}
.route-map {
  height: calc(100vh - 160px);
  min-height: 400px;
  background: #0d1117;
}
.route-map .leaflet-control-attribution {
  background: rgba(10,12,18,0.8) !important;
  color: #505a6a !important;
  font-size: 9px;
}
.route-map .leaflet-control-attribution a { color: #7a8494 !important; }
.route-map .leaflet-control-zoom a {
  background: #191d28;
  color: #d0d4dc;
  border-color: #2a3040;
}
.route-map .leaflet-control-zoom a:hover {
  background: #222838;
}

/* Map info overlay badge */
.map-pkt-badge {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  font-size: 0.65rem;
  color: #7a8494;
  background: #10121a;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid #2a3040;
}

/* ── Repeater Markers on Map ─────────────────────────── */
.rpt-marker-wrap { background: none !important; border: none !important; }
.rpt-marker {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #3498db;
  border: 2px solid rgba(52,152,219,0.4);
  box-shadow: 0 0 6px #3498db;
  position: relative;
  transition: width 0.15s, height 0.15s, opacity 0.15s, border-width 0.15s, box-shadow 0.15s;
}
.rpt-marker.rpt-active {
  animation: rpt-pulse 1.8s ease-out infinite;
}
.rpt-marker.rpt-dimmed {
  width: 5px; height: 5px;
  border-width: 1px;
  opacity: 0.25;
  box-shadow: none;
}
.rpt-marker::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid #3498db;
  opacity: 0;
}
.rpt-marker.rpt-active::after {
  animation: rpt-ring 1.8s ease-out infinite;
}
.rpt-marker.rpt-dimmed::after { display: none; }
@keyframes rpt-pulse {
  0%   { transform: scale(1); box-shadow: 0 0 6px #3498db; }
  50%  { transform: scale(1.3); box-shadow: 0 0 18px #3498db, 0 0 40px rgba(52,152,219,0.3); }
  100% { transform: scale(1); box-shadow: 0 0 6px #3498db; }
}
@keyframes rpt-ring {
  0%   { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* ── Route Endpoints ─────────────────────────────────── */
.route-endpoint-wrap { z-index: 900 !important; background: none !important; border: none !important; }
.route-endpoint {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  line-height: 1;
  background: #191d28;
  border: 2px solid #3498db;
  box-shadow: 0 0 8px #3498db;
}
.route-endpoint.route-src { border-color: #2ecc71; box-shadow: 0 0 8px #2ecc71; }
.route-endpoint.route-dst { border-color: #e74c3c; box-shadow: 0 0 8px #e74c3c; }
.route-endpoint.route-rx {
  font-size: 0.75rem;
  border: 2px solid #3498db;
  border-radius: 50%;
  background: #13151e;
  width: 20px; height: 20px;
}

/* Triangulation overlay – white lines between start repeaters + centroid */
.tri-centroid-wrap { background: none !important; border: none !important; z-index: 910 !important; }
.tri-centroid {
  width: 10px; height: 10px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255,255,255,0.9), 0 0 20px rgba(255,255,255,0.4);
  animation: tri-pulse 2s ease-in-out infinite;
}
@keyframes tri-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 10px rgba(255,255,255,0.9); }
  50% { transform: scale(1.3); box-shadow: 0 0 16px rgba(255,255,255,1), 0 0 30px rgba(255,255,255,0.5); }
}

/* Star for ADVERT source */
.route-star-wrap { background: none !important; border: none !important; z-index: 900 !important; }
.route-star-center {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  font-size: 1.3rem;
  filter: drop-shadow(0 0 8px rgba(255, 200, 0, 0.8));
  animation: star-pulse 2s ease-in-out infinite;
}
@keyframes star-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 8px rgba(255, 200, 0, 0.8)); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 14px rgba(255, 200, 0, 1)); }
}

/* Path labels */
.route-path-label-wrap { background: none !important; border: none !important; z-index: 700 !important; }
.route-path-label {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
}

/* Speech bubble */
.detail-speech-wrap { z-index: 950 !important; background: none !important; border: none !important; pointer-events: none !important; }
.detail-speech-bubble {
  background: rgba(25, 29, 40, 0.55);
  border: 1px solid #27ae60;
  border-radius: 8px;
  padding: 5px 8px;
  max-width: 180px;
  font-size: 0.7rem;
  color: #d0d4dc;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  position: relative;
  pointer-events: none;
  backdrop-filter: blur(2px);
}
.detail-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: -8px;
  border: 4px solid transparent;
  border-right-color: #27ae60;
}
.detail-speech-sender { color: #1abc9c; font-weight: 600; font-size: 0.68rem; margin-bottom: 2px; }
.detail-speech-text { font-style: italic; }
.detail-speech-channel { color: #8e44ad; font-size: 0.62rem; margin-top: 2px; }

/* ── Activity Overlay (inside map) ────────────────────── */
.activity-overlay {
  position: absolute;
  bottom: 24px;
  left: 12px;
  z-index: 1000;
  width: 280px;
  background: rgba(13, 17, 23, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  pointer-events: auto;
}
.activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.activity-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(208,212,220,0.7);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.activity-count {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  font-size: 0.62rem;
  color: rgba(208,212,220,0.4);
}
.ws-clients {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  font-size: 0.6rem;
  color: rgba(208,212,220,0.5);
}
.ws-clients-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #27ae60;
  box-shadow: 0 0 4px #27ae60;
}
.activity-list {
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.activity-list::-webkit-scrollbar { width: 4px; }
.activity-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Activity items */
.activity-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: rgba(255,255,255,0.05); }
.activity-item.activity-active { background: rgba(52,152,219,0.15); }
.activity-item-new { animation: activity-flash 0.6s ease-out; }
@keyframes activity-flash {
  0% { background: rgba(52,152,219,0.2); }
  100% { background: transparent; }
}
.activity-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}
.activity-body {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.activity-label {
  font-size: 0.72rem;
  color: #d0d4dc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.activity-meta {
  font-size: 0.6rem;
  color: rgba(208,212,220,0.4);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  white-space: nowrap;
}
.activity-type {
  font-size: 0.55rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
/* Dark type badges */
.activity-type.type-advert { background: rgba(39,174,96,0.2); color: #2ecc71; }
.activity-type.type-txt { background: rgba(52,152,219,0.2); color: #3498db; }
.activity-type.type-grp { background: rgba(155,89,182,0.2); color: #9b59b6; }
.activity-type.type-ack { background: rgba(149,165,166,0.15); color: #95a5a6; }
.activity-type.type-req { background: rgba(230,126,34,0.2); color: #e67e22; }
.activity-type.type-response { background: rgba(241,196,15,0.2); color: #f1c40f; }
.activity-type.type-trace { background: rgba(231,76,60,0.15); color: #e74c3c; }
.activity-type.type-path { background: rgba(241,196,15,0.15); color: #f1c40f; }
.activity-type.type-default { background: rgba(255,255,255,0.06); color: #888; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 860px) {
  .map-toolbar { flex-direction: column; align-items: flex-start; gap: 4px; }
}
@media (max-width: 600px) {
  .activity-overlay { width: 220px; bottom: 12px; left: 8px; }
  .map-toolbar-right { display: none; }
}
