.map-shell {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--map-bg, #0a1018);
  position: relative;
}

[data-theme="light"] {
  --map-bg: #dde4ee;
  --map-loader-bg: rgba(221, 228, 238, .94);
}

.map-loading .map-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  position: absolute;
  inset: 0;
  z-index: 500;
  background: var(--map-loader-bg, rgba(10, 16, 24, .92));
  color: var(--muted);
  font-size: .9rem;
}
.map-loader { display: none; }
.map-loading .map-loader .icon-lg {
  animation: mapSpin 1.2s linear infinite;
  color: var(--accent-2);
}
@keyframes mapSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.map-marker-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .75rem;
  margin: .65rem 0;
  font-size: .78rem;
  color: var(--muted);
}
.map-marker-key {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .25rem .55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
}
.map-marker-mini {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  transform: scale(.55);
  transform-origin: center;
  margin: -4px 0;
}
.map-marker-mini .ews-marker-pin {
  width: 34px;
  height: 34px;
}
.map-marker-mini .ews-marker-pin svg {
  width: 14px;
  height: 14px;
}

#map, .map-embed, #ews-map-full {
  width: 100%;
  height: 480px;
  border-radius: 0;
  border: 0;
}

.map-embed { height: 300px; margin: 0; }
.map-embed-detail { height: 340px; }

.leaflet-container {
  background: var(--map-bg, #0a1018);
  font-family: var(--font);
}

.map-toolbar {
  display: flex;
  gap: .65rem;
  flex-wrap: wrap;
  margin: .85rem 0;
  align-items: center;
  justify-content: space-between;
}

.map-toolbar-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .75rem;
  color: var(--muted);
  font-size: .82rem;
  align-items: center;
}

.map-source-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border);
  font-size: .72rem;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem .85rem;
  margin: .65rem 0 1rem;
  font-size: .8rem;
  color: var(--muted);
}

.map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
}

.map-legend-swatch {
  width: .75rem;
  height: .75rem;
  border-radius: .2rem;
  border: 1px solid rgba(255, 255, 255, .2);
}

.map-note {
  font-size: .82rem;
  color: var(--muted);
  margin-top: .85rem;
  display: flex;
  align-items: flex-start;
  gap: .45rem;
}

.leaflet-control-layers {
  background: var(--map-panel-bg, rgba(12, 18, 28, .94)) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: .65rem !important;
  box-shadow: var(--shadow) !important;
  padding: .35rem !important;
}

[data-theme="light"] { --map-panel-bg: rgba(255, 255, 255, .96); }

.leaflet-control-layers-list label {
  color: var(--text) !important;
  font-size: .82rem !important;
  margin: .15rem 0 !important;
}

.leaflet-control-layers-expanded { padding: .5rem .65rem !important; }

.leaflet-popup-content-wrapper {
  background: var(--map-popup-bg, rgba(14, 20, 30, .96));
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: .65rem;
  box-shadow: var(--shadow);
}

[data-theme="light"] { --map-popup-bg: rgba(255, 255, 255, .98); }

.leaflet-popup-tip { background: var(--map-popup-bg, rgba(14, 20, 30, .96)); }

.popup-head {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .35rem;
}

.popup-type {
  font-size: .72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Custom map markers */
.ews-marker { background: transparent; border: 0; }

.ews-marker-pin {
  width: 34px;
  height: 34px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
}

.ews-marker-pin svg {
  width: 16px;
  height: 16px;
  transform: rotate(45deg);
  stroke: #fff;
  fill: none;
}

.ews-marker-gempa .ews-marker-pin { background: linear-gradient(145deg, #ff8c2a, #e67e22); }
.ews-marker-tsunami .ews-marker-pin { background: linear-gradient(145deg, #3b9eff, #2471a3); }
.ews-marker-banjir .ews-marker-pin { background: linear-gradient(145deg, #3498db, #1f618d); }
.ews-marker-gunung .ews-marker-pin { background: linear-gradient(145deg, #e74c3c, #922b21); border-radius: 35% 35% 35% 0; }
.ews-marker-kebakaran .ews-marker-pin { background: linear-gradient(145deg, #ff4b4b, #c0392b); }
.ews-marker-default .ews-marker-pin { background: linear-gradient(145deg, var(--accent), #9d0f1c); }

.ews-volcano-ref {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e74c3c;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(231, 76, 60, .35);
}

.push-banner {
  margin: 1rem 0;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(232, 25, 44, .12), rgba(59, 158, 255, .08));
  border: 1px solid rgba(232, 25, 44, .25);
  display: flex;
  gap: .85rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.push-banner-text {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex: 1;
  min-width: 200px;
}

.push-banner .icon { color: var(--accent-2); flex-shrink: 0; }

.related-alert {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: rgba(255, 75, 75, .08);
  border: 1px solid rgba(255, 75, 75, .22);
}

.related-alert strong {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .5rem;
}

@media (max-width: 640px) {
  #ews-map-full, #map { height: 380px; }
  .map-embed { height: 260px; }
}
