/* ============================================================
 * News Map page — full-bleed Leaflet + sticky sidebar.
 * ========================================================== */
body.map-body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg, #faf6ec);
  font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
}

.map-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 70px);  /* leave room for site header */
}

/* ---- TOP BAR ---------------------------------------------- */
.map-topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  padding: 10px 20px;
  background: var(--surface, #fff);
  border-bottom: 1px solid var(--border, #e3e6ec);
  z-index: 5;
}
.map-topbar-left { display: flex; align-items: center; gap: 14px; }
.map-title { font-size: 18px; font-weight: 900; margin: 0; }
.map-stats {
  font-size: 12px; color: var(--muted, #6b7280);
  background: var(--bg-2, #fdfaf2);
  padding: 4px 10px; border-radius: 999px;
}
.map-filters { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.map-filters label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700;
}
.map-filters select {
  font-family: inherit; font-size: 13px;
  padding: 6px 10px; border: 1px solid var(--border, #e3e6ec);
  border-radius: 8px; background: var(--surface, #fff); color: var(--text, #1a1a2e);
}
.map-breaking-toggle input { accent-color: #dc2626; width: 16px; height: 16px; }

/* ---- MAP + SIDEBAR SHELL ---------------------------------- */
.map-shell {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 400px;
  min-height: 0;
}
.map-canvas { width: 100%; height: 100%; background: #dde3ea; }

/* ---- SIDEBAR ---------------------------------------------- */
.map-side {
  background: var(--surface, #fff);
  border-right: 1px solid var(--border, #e3e6ec);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.map-side-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #e3e6ec);
  font-weight: 800;
}
.map-side-close {
  background: transparent; border: 0;
  font-size: 22px; cursor: pointer; color: var(--muted, #6b7280);
  line-height: 1; padding: 2px 8px; border-radius: 6px;
}
.map-side-close:hover { background: var(--bg-2, #fdfaf2); color: var(--text, #1a1a2e); }
.map-side-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
.map-side-hint { font-size: 13.5px; color: var(--muted, #6b7280); line-height: 1.75; text-align: center; padding: 30px 14px; }

/* ---- STORY CARDS inside sidebar --------------------------- */
.map-story-card {
  display: flex; gap: 10px;
  padding: 10px; margin-bottom: 10px;
  background: var(--bg-2, #fdfaf2);
  border: 1px solid var(--border, #e3e6ec);
  border-right: 3px solid var(--accent-2, #0d9488);
  border-radius: 10px;
  text-decoration: none; color: var(--text, #1a1a2e);
  transition: transform .15s, box-shadow .15s;
}
.map-story-card:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(0,0,0,0.2); }
.map-story-card.is-breaking { border-right-color: #dc2626; }
.map-story-thumb {
  flex: 0 0 72px; width: 72px; height: 72px;
  border-radius: 8px; overflow: hidden; background: var(--bg-3, #f1ede2);
}
.map-story-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.map-story-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.map-story-meta {
  display: flex; gap: 8px; font-size: 11px;
  color: var(--muted, #6b7280); font-weight: 600;
  align-items: center; flex-wrap: wrap;
}
.map-story-meta .cat { color: var(--accent-2, #0d9488); font-weight: 700; }
.map-story-meta .breaking-tag { background: #dc2626; color: #fff; padding: 1px 6px; border-radius: 4px; }
.map-story-title {
  font-size: 14px; font-weight: 700; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---- Leaflet overrides ------------------------------------ */
.leaflet-container { font-family: inherit; }
.leaflet-popup-content-wrapper { border-radius: 10px; }
.map-marker-breaking {
  background: #dc2626; width: 14px; height: 14px; border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.3), 0 2px 6px rgba(0,0,0,0.3);
  animation: mapPulse 1.8s ease-in-out infinite;
}
@keyframes mapPulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(220,38,38,0.3), 0 2px 6px rgba(0,0,0,0.3); }
  50%     { box-shadow: 0 0 0 8px rgba(220,38,38,0.15), 0 2px 6px rgba(0,0,0,0.3); }
}

/* ---- RESPONSIVE ------------------------------------------- */
@media (max-width: 900px) {
  .map-shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .map-side {
    border-right: 0; border-top: 1px solid var(--border, #e3e6ec);
    max-height: 45vh;
  }
  .map-side.closed { max-height: 0; }
}
@media (max-width: 520px) {
  .map-topbar { padding: 8px 12px; gap: 8px; }
  .map-title { font-size: 15px; }
  .map-stats { display: none; }
  .map-filters { flex: 1; justify-content: flex-end; }
  .map-filters label { font-size: 12px; }
}

/* ---- DARK THEME ------------------------------------------- */
[data-theme="dark"] .map-canvas { background: #1a1e33; }
[data-theme="dark"] .leaflet-tile { filter: brightness(0.8) invert(1) contrast(0.85) hue-rotate(180deg); }
