/* =============================================================================
   C-96.20 — Enterprise Mapping Platform
   Shared CSS for all map instances across the site.
   CSS prefix: emap-
   Colors are applied via ThemeManager (amCharts API) — not hardcoded here.
============================================================================= */

/* ── Outer wrapper — positioned ancestor for the popup panel ──────────────── */

.emap-wrap {
  position: relative;
}

/* ── Canvas — amCharts renders directly into this element ─────────────────── */

.emap {
  position: relative;
  width: 100%;
  height: 520px;
  border-radius: var(--radius, 8px);
  overflow: hidden;           /* SVG edge clip + border-radius corner masking */
  background: #d5e7f7;        /* ocean placeholder while loading */
}

.emap--hero        { height: 380px; }
.emap--interactive { height: 560px; }

/* ── Loader ───────────────────────────────────────────────────────────────── */

.emap-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #d5e7f7;
  z-index: 10;
}

.emap-loader-ring {
  display: block;
  width: 36px;
  height: 36px;
  border: 3px solid rgba(13, 87, 162, .2);
  border-top-color: #0d57a2;
  border-radius: 50%;
  animation: emap-spin 0.85s linear infinite;
}

@keyframes emap-spin { to { transform: rotate(360deg); } }

.emap-loader-text,
.emap-error-text {
  font-size: .78rem;
  color: var(--text-muted, #6b7280);
  text-align: center;
  padding: 0 24px;
}

/* ── No-script fallback ───────────────────────────────────────────────────── */

.emap-noscript {
  padding: 48px 32px;
  text-align: center;
  color: var(--text-muted, #6b7280);
  font-size: .88rem;
  line-height: 1.7;
}

/* ── Interaction overlay — blocks pointer events on non-interactive maps ───── */

.emap-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

/* ── Filter bar ───────────────────────────────────────────────────────────── */

.emap-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.emap-filters-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted, #6b7280);
  margin-right: 4px;
}

.emap-filter-btn {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
  background: var(--surface, #f7f8fa);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius-pill, 999px);
  padding: 5px 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.emap-filter-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.emap-filter-btn:hover:not(:disabled),
.emap-filter-btn--active {
  background: var(--navy, #001844);
  color: #fff;
  border-color: var(--navy, #001844);
}

/* ── Popup panel — position:absolute within .emap-wrap ───────────────────── */

.emap-popup {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 20;
  background: #fff;
  border-radius: var(--radius, 8px);
  box-shadow: 0 8px 32px rgba(0, 24, 68, .14);
  padding: 18px 20px 16px;
  min-width: 220px;
  max-width: 280px;
}

.emap-popup-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.emap-popup-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.emap-popup-label {
  font-family: var(--font-heading, inherit);
  font-size: .95rem;
  font-weight: 700;
  color: var(--heading, #0a1628);
  margin: 0;
  outline: none;
}

.emap-popup-type {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--blue, #0d57a2);
}

.emap-popup-detail {
  font-size: .8rem;
  color: var(--text-muted, #6b7280);
  line-height: 1.55;
  margin: 6px 0 0;
}

.emap-popup-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--line, #e5e7eb);
}

.emap-popup-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted, #6b7280);
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  line-height: 1;
}

.emap-popup-close:hover { color: var(--heading, #0a1628); }

/* ── Legend ───────────────────────────────────────────────────────────────── */

.emap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.emap-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  color: var(--text-muted, #6b7280);
}

.emap-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .emap              { height: 340px; }
  .emap--hero        { height: 280px; }
  .emap--interactive { height: 420px; }
  .emap-popup        { max-width: calc(100% - 40px); }
}

@media (max-width: 640px) {
  .emap              { height: 260px; }
  .emap--hero        { height: 220px; }
  .emap--interactive { height: 320px; }
}

/* ── Reduced motion ───────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .emap-loader-ring { animation: none; border-top-color: #0d57a2; }
}
