/* =====================================================================
   map.css — peta global (Leaflet), toolbar, legenda, popup
   ===================================================================== */

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 10px 14px;
  margin-bottom: 10px;
}

.mode-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.mode-btn {
  background: transparent;
  color: var(--text);
  border: none;
  padding: 7px 14px;
  font-size: 0.85rem;
  cursor: pointer;
}
.mode-btn.is-active { background: var(--accent); color: #1a1a1a; font-weight: 700; }

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
}
.toolbar-group.layers { margin-left: auto; }

.rt-clock {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  align-self: center;
}

.search-form { display: flex; gap: 6px; }
.search-form input { width: 200px; padding: 6px 10px; font-size: 0.85rem; }

.map-toolbar .inline-field input[type="range"] { width: 150px; }

.map-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

#globalMap {
  width: 100%;
  height: 600px;
  background: #0b1a2e;
}

/* Tile OSM diberi filter agar bertema gelap tanpa layanan tile berbayar */
.osm-dark {
  filter: invert(1) hue-rotate(190deg) brightness(0.8) contrast(0.95) saturate(0.6);
}

/* Tombol buka/tutup legenda — hanya tampil pada layar kecil */
.legend-toggle {
  display: none;
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 810;
  align-items: center;
  gap: 4px;
  background: rgba(8, 16, 36, 0.9);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.legend-toggle::before { content: "🗂"; }

.map-legend {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 800;
  padding: 10px 12px;
  font-size: 0.75rem;
  max-width: 250px;
  background: rgba(8, 16, 36, 0.85);
}
.map-legend h4 { font-size: 0.78rem; margin-bottom: 4px; color: var(--text-muted); }
.legend-row { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.legend-swatch { width: 14px; height: 10px; border-radius: 2px; flex: none; }
.legend-grad {
  height: 10px;
  border-radius: 3px;
  background: linear-gradient(90deg, #4a148c, #1565c0, #26c6da, #66bb6a, #ffee58, #ff7043, #b71c1c);
  margin: 4px 0 2px;
}
.legend-scale { display: flex; justify-content: space-between; font-size: 0.68rem; color: var(--text-muted); }

/* Popup Leaflet */
.leaflet-popup-content-wrapper {
  background: #142445;
  color: var(--text);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}
.leaflet-popup-tip { background: #142445; }
.leaflet-popup-content { margin: 12px 14px; font-size: 0.82rem; line-height: 1.45; min-width: 200px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-muted); }

.wx-popup h4 { font-size: 0.95rem; margin-bottom: 2px; }
.wx-popup .wx-sub { color: var(--text-muted); font-size: 0.72rem; margin-bottom: 6px; }
.wx-popup .wx-big {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.4rem;
  font-weight: 700;
  margin: 4px 0;
}
.wx-popup .wx-big small { font-size: 0.78rem; font-weight: 400; color: var(--text-muted); }
.wx-popup table { border-collapse: collapse; width: 100%; margin-top: 4px; }
.wx-popup td { padding: 2px 4px 2px 0; }
.wx-popup td:first-child { color: var(--text-muted); white-space: nowrap; }
.wx-popup .wx-season {
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  font-weight: 600;
}
.wx-popup .wx-link { margin-top: 6px; font-size: 0.75rem; }

.leaflet-control-attribution { font-size: 0.65rem; }

.itcz-label {
  background: rgba(46, 134, 193, 0.85);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  box-shadow: none;
}
.itcz-label::before { display: none; }

.city-label {
  background: transparent;
  border: none;
  box-shadow: none;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  text-shadow: 0 0 3px #000, 0 0 3px #000;
  padding: 0;
  white-space: nowrap;
}

/* Saat legenda terbuka di layar kecil, tombol naik ke atas legenda */
@media (max-width: 620px) {
  .legend-toggle { bottom: auto; top: 8px; left: auto; right: 8px; }
}
