/* Ebola Track Pro — Carte analyse plein écran (premium) */
:root {
  --map-bg: #060b14;
  --map-panel: rgba(8, 14, 26, 0.94);
  --map-border: rgba(0, 212, 255, 0.22);
  --map-text: #e8f0f8;
  --map-muted: #7a9bb8;
  --map-cyan: #00d4ff;
  --map-red: #ef5350;
  --map-green: #00e676;
  --map-orange: #ff7043;
  --map-font: 'Inter', system-ui, sans-serif;
  --map-head: 'Rajdhani', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body.etp-map-page {
  height: 100%;
  overflow: hidden;
  font-family: var(--map-font);
  background: var(--map-bg);
  color: var(--map-text);
}

#map {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.etp-map-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(180deg, rgba(6, 11, 20, 0.97) 0%, rgba(6, 11, 20, 0.55) 100%);
  border-bottom: 1px solid var(--map-border);
  backdrop-filter: blur(14px);
  pointer-events: none;
}

.etp-map-topbar > * { pointer-events: auto; }

.etp-map-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.etp-map-brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px;
}

.etp-map-brand h1 {
  font-family: var(--map-head);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
}

.etp-map-brand p {
  font-size: 11px;
  color: var(--map-muted);
  margin-top: 2px;
}

.etp-map-project-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--map-border);
  background: rgba(0, 212, 255, 0.08);
  color: var(--map-cyan);
}

.etp-map-project-pill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pill-color, var(--map-cyan));
}

.etp-map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.etp-map-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--map-border);
  background: rgba(14, 24, 41, 0.9);
  color: var(--map-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.etp-map-btn:hover {
  background: rgba(0, 212, 255, 0.12);
  border-color: var(--map-cyan);
}

.etp-map-btn--primary {
  background: linear-gradient(135deg, #0077c8, #00a8e8);
  border-color: transparent;
  color: #fff;
}

.etp-map-btn--primary:hover {
  filter: brightness(1.08);
}

.etp-map-panel {
  position: fixed;
  top: 88px;
  left: 14px;
  z-index: 20;
  width: min(380px, calc(100vw - 28px));
  max-height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
  background: var(--map-panel);
  border: 1px solid var(--map-border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.etp-map-panel-head {
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(30, 60, 100, 0.45);
}

.etp-map-panel-head h2 {
  font-family: var(--map-head);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.etp-map-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(30, 60, 100, 0.35);
}

.etp-map-kpi {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(30, 60, 100, 0.4);
}

.etp-map-kpi strong {
  display: block;
  font-family: var(--map-head);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: var(--kpi-color, var(--map-cyan));
}

.etp-map-kpi span {
  font-size: 10px;
  color: var(--map-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
  display: block;
}

.etp-map-filters {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid rgba(30, 60, 100, 0.35);
}

.etp-map-filters label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--map-muted);
}

.etp-map-filters select,
.etp-map-filters input {
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid rgba(30, 60, 100, 0.6);
  background: rgba(0, 0, 0, 0.35);
  color: var(--map-text);
  font-size: 13px;
}

.etp-map-layer-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.etp-map-chip {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid rgba(30, 60, 100, 0.6);
  background: rgba(0, 0, 0, 0.2);
  color: var(--map-muted);
  cursor: pointer;
  user-select: none;
}

.etp-map-chip.active {
  border-color: var(--map-cyan);
  color: var(--map-cyan);
  background: rgba(0, 212, 255, 0.1);
}

.etp-map-list-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.etp-map-list-head {
  padding: 10px 14px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--map-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.etp-map-case-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 12px;
}

.etp-map-case-card {
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 12px;
  border: 1px solid rgba(30, 60, 100, 0.45);
  background: rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
}

.etp-map-case-card:hover,
.etp-map-case-card.selected {
  border-color: var(--map-cyan);
  transform: translateX(2px);
}

.etp-map-case-card .case-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.etp-map-case-card .case-name {
  font-weight: 600;
  font-size: 13px;
  color: #fff;
}

.etp-map-case-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.etp-map-case-badge.critical,
.etp-map-case-badge.high { background: rgba(198, 40, 40, 0.35); color: #ffcdd2; }
.etp-map-case-badge.moderate,
.etp-map-case-badge.medium { background: rgba(239, 108, 0, 0.3); color: #ffe0b2; }
.etp-map-case-badge.low { background: rgba(46, 125, 50, 0.35); color: #c8e6c9; }
.etp-map-case-badge.confirmed { background: rgba(0, 212, 255, 0.15); color: var(--map-cyan); }

.etp-map-case-meta {
  font-size: 11px;
  color: var(--map-muted);
  line-height: 1.55;
}

.etp-map-case-meta i {
  width: 14px;
  color: var(--map-cyan);
  opacity: 0.85;
}

.etp-map-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--map-muted);
  font-size: 12px;
}

.etp-map-legend {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 20;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--map-panel);
  border: 1px solid var(--map-border);
  font-size: 11px;
  min-width: 200px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.etp-map-legend h3 {
  font-family: var(--map-head);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  color: var(--map-cyan);
}

.etp-map-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 5px 0;
  color: var(--map-muted);
}

.etp-map-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.etp-map-legend-swatch.round { border-radius: 50%; }

.etp-map-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 40;
  width: min(420px, 100vw);
  height: 100%;
  background: rgba(8, 14, 26, 0.98);
  border-left: 1px solid var(--map-border);
  box-shadow: -12px 0 48px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.etp-map-drawer.open { transform: translateX(0); }

.etp-map-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 18px 14px;
  border-bottom: 1px solid rgba(30, 60, 100, 0.45);
  background: linear-gradient(135deg, rgba(198, 40, 40, 0.12), transparent);
}

.etp-map-drawer-head h2 {
  font-family: var(--map-head);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.etp-map-drawer-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--map-text);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.etp-map-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 24px;
}

.etp-map-detail-grid {
  display: grid;
  gap: 10px;
}

.etp-map-detail-row {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(30, 60, 100, 0.4);
}

.etp-map-detail-row label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--map-muted);
  margin-bottom: 4px;
}

.etp-map-detail-row p {
  font-size: 13px;
  color: #fff;
  line-height: 1.45;
  word-break: break-word;
}

.etp-map-detail-row.wide { grid-column: 1 / -1; }

.etp-map-status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.etp-map-status-pill {
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.25);
  color: var(--map-cyan);
}

.etp-map-loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 11, 20, 0.85);
  flex-direction: column;
  gap: 14px;
}

.etp-map-loading.hidden { display: none; }

.etp-map-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(0, 212, 255, 0.2);
  border-top-color: var(--map-cyan);
  border-radius: 50%;
  animation: etpMapSpin 0.75s linear infinite;
}

@keyframes etpMapSpin { to { transform: rotate(360deg); } }

.mapboxgl-popup-content {
  background: rgba(8, 14, 26, 0.96) !important;
  border: 1px solid var(--map-border) !important;
  border-radius: 12px !important;
  padding: 14px 16px !important;
  color: var(--map-text) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5) !important;
  max-width: 280px;
}

.mapboxgl-popup-close-button {
  color: var(--map-muted) !important;
  font-size: 18px !important;
  padding: 4px 8px !important;
}

.etp-map-popup h4 {
  font-family: var(--map-head);
  font-size: 15px;
  color: #fff;
  margin-bottom: 8px;
}

.etp-map-popup p {
  font-size: 11px;
  color: var(--map-muted);
  margin: 4px 0;
  line-height: 1.5;
}

.etp-map-popup .popup-btn {
  margin-top: 10px;
  width: 100%;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: var(--map-cyan);
  color: #061018;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
}

@media (max-width: 900px) {
  .etp-map-panel {
    top: auto;
    bottom: 14px;
    left: 14px;
    right: 14px;
    width: auto;
    max-height: 42vh;
  }
  .etp-map-topbar { flex-wrap: wrap; }
  .etp-map-legend {
    left: 14px;
    right: 14px;
    bottom: calc(42vh + 24px);
  }
}
