/* ═══════════════════════════════════════════════════════════════
   n-mini-map.css — Sensor network mini-map card (Phase 1 / 2).
   Sits beside the Hero card in `.n-overview-split`.
   Contains: instrument tabs, Leaflet canvas, detail panel.
═══════════════════════════════════════════════════════════════ */

/* ── SPLIT CONTAINER ──────────────────────────────────────── */
.n-overview-split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: stretch;
}
@media (max-width: 1199px) {
  .n-overview-split { grid-template-columns: 1fr; }
}

.n-overview-split > .n-hero-card,
.n-overview-split > .n-mini-map-card {
  min-width: 0;
  min-height: 0;
}

/* ── MINI MAP CARD ────────────────────────────────────────── */
.n-mini-map-card {
  display: flex;
  flex-direction: column;
  background: var(--n-surface-raised);
  border: 1px solid var(--n-border-subtle);
  border-radius: var(--n-radius-xl);
  overflow: hidden;
  position: relative;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 40px rgba(0, 0, 0, 0.2);
}
.theme-light .n-mini-map-card {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 2px 10px rgba(15, 23, 42, 0.05);
}

.n-mini-map-head {
  padding: 1rem 1.25rem 0.5rem;
}
.n-mini-map-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
  margin: 0;
}
.n-mini-map-sub {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
}

/* ── INSTRUMENT TABS ──────────────────────────────────────── */
.n-mini-map-tabs {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 1rem 0.75rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.n-mini-map-tabs::-webkit-scrollbar { display: none; }

.n-mmtab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem;
  background: transparent;
  border: 1px solid var(--n-border-subtle);
  border-radius: var(--n-radius-sm, 6px);
  color: var(--text-muted, #94a3b8);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.n-mmtab:hover {
  color: var(--text-primary, #e2e8f0);
  border-color: rgba(148, 163, 184, 0.4);
}
.n-mmtab.n-mmtab--active {
  color: var(--text-primary, #e2e8f0);
  border-color: rgba(79, 195, 247, 0.6);
  background: rgba(79, 195, 247, 0.08);
}
.theme-light .n-mmtab {
  color: #475569;
  background: rgba(15, 23, 42, 0.02);
}
.theme-light .n-mmtab.n-mmtab--active {
  color: #0f172a;
  background: rgba(79, 195, 247, 0.12);
  border-color: rgba(14, 116, 144, 0.35);
}

.n-mmtab-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.n-mmtab-dot--pm { background: #ea580c; }
.n-mmtab-dot--wind { background: #0e7490; }
.n-mmtab-dot--pandora { background: #7c3aed; }

body:not(.theme-light):not(.theme-coastal):not(.theme-aqi) .n-mmtab-dot--pm { background: #fb923c; }
body:not(.theme-light):not(.theme-coastal):not(.theme-aqi) .n-mmtab-dot--wind { background: #38bdf8; }
body:not(.theme-light):not(.theme-coastal):not(.theme-aqi) .n-mmtab-dot--pandora { background: #a78bfa; }
.n-mmtab-label { letter-spacing: 0.01em; }

.n-mmtab-count {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0 0.35rem;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  color: var(--text-muted, #94a3b8);
  text-align: center;
}
.n-mmtab.n-mmtab--active .n-mmtab-count {
  background: rgba(79, 195, 247, 0.22);
  color: var(--text-primary, #e2e8f0);
}

.n-mmtab-freshness {
  font-size: 0.65rem;
  line-height: 1;
  margin-left: 0.1rem;
}
.n-mmtab-freshness[data-freshness="live"]    { color: #22c55e; }
.n-mmtab-freshness[data-freshness="stale"]   { color: #eab308; }
.n-mmtab-freshness[data-freshness="offline"] { color: #ef4444; }
.n-mmtab-freshness[data-freshness="unknown"] { color: rgba(148, 163, 184, 0.5); }

/* ── MAP CANVAS (hosts Leaflet) ───────────────────────────
   Leaflet requires an explicit height on the container, not just
   min-height. Using a fixed 260px keeps the card compact next to
   the Hero. Overridden in the narrow-screen breakpoint below. */
.n-mini-map-canvas {
  position: relative;
  height: 260px;
  background:
    linear-gradient(135deg, rgba(148, 163, 184, 0.08), rgba(148, 163, 184, 0.02));
  border-top: 1px solid var(--n-border-subtle);
  border-bottom: 1px solid var(--n-border-subtle);
}
.n-mini-map-canvas .leaflet-container {
  width: 100%;
  height: 100%;
  background: transparent;
  font-family: inherit;
}
.n-mini-map-canvas .leaflet-control-zoom {
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.n-mini-map-canvas .leaflet-control-zoom a {
  background: var(--n-surface-raised, rgba(30, 41, 59, 0.95));
  color: var(--text-primary, #e2e8f0);
  border-color: var(--n-border-subtle);
}
.theme-light .n-mini-map-canvas .leaflet-control-zoom a {
  background: rgba(255, 255, 255, 0.95);
  color: #0f172a;
}
.n-mini-tooltip {
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  border: none;
  padding: 0.3rem 0.55rem;
  font-size: 0.7rem;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.theme-light .n-mini-tooltip {
  background: rgba(15, 23, 42, 0.88);
  color: #f1f5f9;
}
.n-mini-tooltip::before { display: none; }
.theme-light .n-mini-map-canvas {
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.03), rgba(15, 23, 42, 0.01));
}

.n-mini-map-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #94a3b8);
  font-size: 0.8125rem;
  font-style: italic;
}

/* When Leaflet is initialized, the canvas host the map directly.
   Class `.n-mini-map-canvas--ready` removes the placeholder visually. */
.n-mini-map-canvas--ready .n-mini-map-placeholder { display: none; }

/* ── DETAIL PANEL ─────────────────────────────────────────── */
.n-mini-map-detail {
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.n-mmd-header {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.n-mmd-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
}
.n-mmd-loc {
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
}

.n-mmd-desc {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text-muted, #94a3b8);
}

/* Parameter chips (re-uses the same vibe as .n-about-param but scoped) */
.n-mmd-params {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.n-mmd-param {
  padding: 0.2rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted, #94a3b8);
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--n-border-subtle);
  border-radius: var(--n-radius-sm, 6px);
  letter-spacing: 0.01em;
}

/* Per-sensor peer rows (e.g. PurpleAir tab shows both 196911 & 196951) */
.n-mmd-peers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.n-mmd-peer {
  padding: 0.6rem 0.75rem;
  background: rgba(148, 163, 184, 0.05);
  border: 1px solid var(--n-border-subtle);
  border-radius: var(--n-radius-sm, 6px);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.n-mmd-peer-id {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.n-mmd-peer-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
}
.n-mmd-peer-age {
  font-size: 0.7rem;
  color: var(--text-muted, #94a3b8);
}
.n-mmd-peer-age[data-freshness="live"]    { color: #22c55e; }
.n-mmd-peer-age[data-freshness="stale"]   { color: #eab308; }
.n-mmd-peer-age[data-freshness="offline"] { color: #ef4444; }

/* ── RESPONSIVE — Narrow screens ─────────────────────────── */
@media (max-width: 767px) {
  .n-mini-map-canvas { height: 200px; }
  .n-mini-map-head   { padding: 0.875rem 1rem 0.35rem; }
  .n-mini-map-tabs   { padding: 0.4rem 0.75rem 0.5rem; }
  .n-mini-map-detail { padding: 0.875rem 1rem 1rem; }
}
