/* =========================================================
   style.css — WebGIS Air Tanah Indonesia
   Production-ready: duplikasi dihapus, variabel CSS terpusat,
   accessibility & print support.
   ========================================================= */

/* ── Design Tokens ───────────────────────────────────────────────── */
.webgis-map {
  /* Layout */
  --left-x: 20px;
  --right-x: 19px;
  --zoom-top: 10px;
  --main-top: 140px;
  --main-w: 60px;
  --main-h: 60px;
  --main-radius: 12px;
  --tool-size: 35px;
  --tool-radius: 12px;
  --tools-top: 100px;
  --tool-count: 8;
  --tools-gap: 0px;
  --info-gap: 12px;

  /* Colors */
  --bg-glass: rgba(255, 255, 255, 0.9);
  --bg-glass-dark: rgba(0, 0, 0, 0.65);
  --border-light: rgba(0, 0, 0, 0.08);
  --border-subtle: rgba(0, 0, 0, 0.15);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.18);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.22);
  --text-muted: rgba(0, 0, 0, 0.55);

  /* Animation */
  --transition-fast: 0.15s ease;
}

/* ── Reset & Base ─────────────────────────────────────────────────── */
.webgis-map *,
.webgis-map *::before,
.webgis-map *::after {
  box-sizing: border-box;
}

.webgis-map {
  position: relative;
  width: 100%;
  height: 100%;
}

/* ── Map Canvas ───────────────────────────────────────────────────── */
.webgis-map #map {
  position: relative;
  width: 100%;
  /* height: 100%; */
  height: calc(100vh - 90px); /* 90px tinggi header */
  background: #282424;
}

.webgis-map .maplibregl-canvas-container,
.webgis-map .maplibregl-map {
  background: #282424;
}

.webgis-map .maplibregl-control-container {
  z-index: 1600;
}

/* ── Loading Overlay ─────────────────────────────────────────────── */
.webgis-map .app-loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 30, 30, 0.82);
  backdrop-filter: blur(6px);
  transition: opacity var(--transition-fast);
}

.webgis-map .app-loading__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.webgis-map .app-loading__spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.webgis-map .app-loading__text {
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  margin: 0;
}

/* ── Map Title ────────────────────────────────────────────────────── */
.webgis-map .map-title {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  padding: 3px 16px;
  border-radius: 10px;
  /* background: var(--bg-glass); */
  /* backdrop-filter: blur(10px); */
  /* border: 1px solid var(--border-subtle); */
  /* box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18); */
  font-weight: 400;
  font-size: 36px;
      text-shadow: 0 0 5px #000000;
  color: rgba(255, 255, 255, 0.82);
  letter-spacing: 0.2px;
  pointer-events: none;
  text-align: center;
  max-width: calc(100vw - 40px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Zoom Control ─────────────────────────────────────────────────── */
.webgis-map .maplibregl-ctrl-top-left {
  top: var(--zoom-top) !important;
  /* left: var(--left-x) !important; */
  left: 10px;
  z-index: 1700 !important;
}

.webgis-map .maplibregl-ctrl-top-left .maplibregl-ctrl-group {
  border-radius: var(--tool-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.webgis-map .maplibregl-ctrl-top-left .maplibregl-ctrl-group button {
  width: var(--tool-size);
  height: var(--tool-size);
}

/* ── Left Controls Container ─────────────────────────────────────── */
.webgis-map .map-controls {
  position: absolute;
  inset: 0;
  z-index: 1300;
  pointer-events: none;
}

.webgis-map .map-controls .btn,
.webgis-map .map-controls .dropdown,
.webgis-map .map-controls .dropdown-menu {
  pointer-events: auto;
}

/* ── Main Buttons (Basemap / Layers / Thematic) ───────────────────── */
/* Shared positioning mixin via CSS calc */
.webgis-map .basemap-gallery-control {
  position: absolute;
  top: var(--main-top);
  left: var(--left-x);
}

.webgis-map .layers-control {
  position: absolute;
  top: calc(var(--main-top) + (var(--main-h) + 10px));
  left: var(--left-x);
}

.webgis-map .thematic-control {
  position: absolute;
  top: calc(var(--main-top) + (var(--main-h) + 10px) * 2);
  left: var(--left-x);
  z-index: 1301;
}

/* Shared button style */
.webgis-map .basemap-toggle-btn,
.webgis-map .layers-toggle-btn,
.webgis-map .thematic-toggle-btn {
  background: var(--bg-glass) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--main-radius);
  width: var(--main-w);
  height: var(--main-h);
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.webgis-map .basemap-toggle-btn:hover,
.webgis-map .layers-toggle-btn:hover,
.webgis-map .thematic-toggle-btn:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Hide Bootstrap dropdown arrow */
.webgis-map .basemap-toggle-btn::after,
.webgis-map .layers-toggle-btn::after,
.webgis-map .thematic-toggle-btn::after {
  display: none !important;
}

.webgis-map .basemap-btn-content,
.webgis-map .layers-btn-content,
.webgis-map .thematic-btn-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.webgis-map .basemap-icon,
.webgis-map .layers-icon,
.webgis-map .thematic-icon {
  width: 22px;
  height: 22px;
  margin-bottom: 6px;
  object-fit: contain;
}

.webgis-map .basemap-label,
.webgis-map .layers-label,
.webgis-map .thematic-label {
  font-size: 0.7rem;
  line-height: 1;
  color: #333;
}

/* ── Dropdown Menus ───────────────────────────────────────────────── */
.webgis-map .basemap-gallery-control .dropdown-menu,
.webgis-map .layers-control .dropdown-menu,
.webgis-map .thematic-control .dropdown-menu {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  min-width: 260px;
  width: 350px;
  padding: 18px;
  margin-left: 14px;
  margin-top: -6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  overflow: visible !important; /* allow popover to escape */
}

/* ── Basemap Gallery ──────────────────────────────────────────────── */
.webgis-map .basemap-card {
  max-height: calc(72vh - 80px);
  overflow-y: auto;
  padding-right: 6px;
}

.webgis-map .basemap-item {
  cursor: pointer;
  border: 1px solid #e9ecef;
  border-radius: 14px;
  padding: 10px;
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 10px;
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 10px;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.webgis-map .basemap-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.webgis-map .basemap-thumb {
  width: 74px;
  height: 56px;
  border-radius: 12px;
  background: #ddd center/cover;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.webgis-map .basemap-name {
  font-size: 1rem;
  margin: 0;
  font-weight: 700;
  color: #111;
}
.webgis-map .basemap-desc {
  font-size: 0.82rem;
  margin: 0;
  color: #6c757d;
}

.webgis-map .basemap-radio input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* ── Layer Items (switch rows) ────────────────────────────────────── */
.webgis-map .layers-menu {
  padding: 10px 12px;
}
.webgis-map .thematic-menu {
  padding: 10px 12px;
}

.webgis-map .layer-item.form-check.form-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border-radius: 14px;
  margin: 2px 0;
  transition: background var(--transition-fast);
}

.webgis-map .layer-item.form-check.form-switch:hover {
  background: rgba(0, 0, 0, 0.04);
}

.webgis-map .layer-item .form-check-label {
  flex: 1;
  font-size: 15px;
  line-height: 1.2;
  color: rgba(0, 0, 0, 0.78);
  cursor: pointer;
  user-select: none;
  margin: 0 !important;
}

.webgis-map .layer-item .form-check-input {
  flex: 0 0 auto;
  cursor: pointer;
  margin: 0 !important;
}

.webgis-map .form-switch .form-check-input {
  width: 48px;
  height: 24px;
  border-radius: 999px;
}

/* ── Thematic Row (label + info button) ───────────────────────────── */
.webgis-map .thematic-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.webgis-map .thematic-row .row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

/* ── Info Dot Button ──────────────────────────────────────────────── */
.webgis-map .info-dot {
  position: relative;
  z-index: 50;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.9);
  color: rgba(0, 0, 0, 0.75);
  font-weight: 800;
  font-size: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: auto !important;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast);
}

.webgis-map .info-dot:hover {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.28);
}

/* Ensure dropdown content is clickable */
.webgis-map .map-controls .dropdown-menu,
.webgis-map .map-controls .dropdown-menu * {
  pointer-events: auto !important;
}

/* ── Info Popover ─────────────────────────────────────────────────── */
.webgis-map .info-popover {
  position: absolute;
  z-index: 9999;
  width: 320px;
  max-width: 70vw;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  transition:
    opacity var(--transition-fast),
    transform var(--transition-fast);
}

.webgis-map .info-popover__title {
  font-weight: 800;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.85);
  margin: 0 0 6px;
}

.webgis-map .info-popover__desc {
  font-size: 12.5px;
  line-height: 1.35;
  color: rgba(0, 0, 0, 0.78);
  margin: 0;
}

/* ── Tools Toolbar ────────────────────────────────────────────────── */
.webgis-map .tools-control {
  position: absolute;
  right: var(--right-x);
  top: var(--tools-top);
  z-index: 1600;
  display: flex;
  flex-direction: column;
  gap: var(--tools-gap);
  border-radius: var(--tool-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
}

.webgis-map .tool-btn {
  width: var(--tool-size);
  height: var(--tool-size);
  border: 0;
  outline: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.93);
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background var(--transition-fast);
}

.webgis-map .tool-btn + .tool-btn {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.webgis-map .tool-btn:hover {
  background: #fff;
}
.webgis-map .tool-btn.active {
  background: #e8f0ff;
}
.webgis-map .tool-btn:focus-visible {
  outline: 2px solid #1976d2;
  outline-offset: -2px;
}

.webgis-map .tool-icn {
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
}

/* ── Search Lokasi (di dalam popover toolbar kanan) ───────────────── */
.webgis-map .search-popover {
  width: 280px;
}
.webgis-map .map-search {
  position: relative;
  width: 100%;
}
.webgis-map .map-search__icon {
  position: absolute;
  left: 12px;
  top: 20px; /* center pada input (tinggi 40px), bukan seluruh .map-search */
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.6;
  pointer-events: none;
}
.webgis-map .map-search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 34px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  outline: none;
  backdrop-filter: blur(4px);
}
.webgis-map .map-search input:focus {
  border-color: #1976d2;
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.18);
}
.webgis-map .map-search__list {
  list-style: none;
  margin: 6px 0 0;
  padding: 4px;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  max-height: 320px;
  overflow-y: auto;
}
.webgis-map .map-search__list[hidden] {
  display: none;
}
.webgis-map .map-search__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.webgis-map .map-search__item:hover,
.webgis-map .map-search__item.is-active {
  background: #e8f0ff;
}
.webgis-map .map-search__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.webgis-map .map-search__badge {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff;
}
.webgis-map .map-search__badge--cat {
  background: #1565c0;
}
.webgis-map .map-search__badge--prov {
  background: #00897b;
}
.webgis-map .map-search__badge--tempat {
  background: #5c6bc0;
}

/* ── Home Control (di bawah zoom +/-) ─────────────────────────────── */
.webgis-map .maplibregl-ctrl-home {
  display: grid;
  place-items: center;
  cursor: pointer;
}
.webgis-map .maplibregl-ctrl-home svg {
  width: 20px;
  height: 20px;
  color: #333;
  pointer-events: none;
}

/* ── Popover Input Koordinat ──────────────────────────────────────── */
.webgis-map .coord-popover {
  position: absolute;
  right: calc(var(--right-x) + var(--tool-size) + 10px);
  top: var(--tools-top);
  z-index: 1650;
  width: 220px;
  padding: 12px;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}
.webgis-map .coord-popover[hidden] {
  display: none;
}
.webgis-map .coord-popover__title {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
}
.webgis-map .coord-popover__field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--text-muted);
}
.webgis-map .coord-popover__field input {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}
.webgis-map .coord-popover__field input:focus {
  border-color: #1976d2;
}
.webgis-map .coord-popover__actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.webgis-map .coord-popover__actions .btn {
  flex: 1;
}

/* ── Popup Info Titik (Identify) ──────────────────────────────────── */
.webgis-map .identify-popup .maplibregl-popup-content {
  padding: 10px 12px;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  min-width: 220px;
  max-height: 60vh;
  overflow-y: auto;
}
.webgis-map .identify-popup .maplibregl-popup-close-button {
  font-size: 16px;
  padding: 0 5px;
}
.webgis-map .identify-coord {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.webgis-map .identify-group {
  margin-bottom: 10px;
}
.webgis-map .identify-group:last-child {
  margin-bottom: 0;
}
.webgis-map .identify-group__h {
  font-size: 11.5px;
  font-weight: 700;
  color: #1565c0;
  border-bottom: 1px solid #e3eaf3;
  padding-bottom: 3px;
  margin-bottom: 5px;
}
.webgis-map .identify-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  padding: 2px 0;
}
.webgis-map .identify-row__label {
  color: var(--text-muted);
  flex: 0 0 auto;
}
.webgis-map .identify-row__val {
  text-align: right;
  font-weight: 600;
  word-break: break-word;
}
.webgis-map .zona-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.webgis-map .identify-loading,
.webgis-map .identify-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 0;
}

/* ── Info Control ─────────────────────────────────────────────────── */
.webgis-map .info-control {
  position: absolute;
  margin-top: 25px;
  left: var(--left-x);
  top: calc(
    var(--tools-top) + (var(--tool-size) * var(--tool-count)) +
      (var(--tools-gap) * (var(--tool-count) - 1)) + var(--info-gap)
  );
  z-index: 1600;
  border-radius: var(--tool-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
}

/* ── Data Info Panel (kanan atas) ────────────────────────────────── */
.webgis-map .data-info-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(15, 22, 40, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 10px;
  padding: 10px 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.38);
  pointer-events: none;
  color: #fff;
  min-width: 340px;
}

.webgis-map .data-info-panel__left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.webgis-map .data-info-panel__label {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.webgis-map .data-info-panel__source {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.webgis-map .data-info-panel__sep {
  width: 1px;
  height: 34px;
  background: rgba(255, 255, 255, 0.25);
  margin: 0 18px;
  flex: 0 0 auto;
}

.webgis-map .data-info-panel__right {
  font-size: 15px;
  font-weight: 700;
  color: #f5a623;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

/* ── Legend (default neraca) ─────────────────────────────────────── */
.webgis-map .legend-container {
  position: absolute;
  bottom: 30px;
  left: 20px;
  z-index: 1000;
  background: var(--bg-glass-dark);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.webgis-map .legend-container h3 {
  margin: 0 0 5px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
}
.webgis-map .legend-container h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
}

.webgis-map .legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.webgis-map .legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.webgis-map .legend-color-square {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  display: inline-block;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.webgis-map .legend-label {
  font-size: 12px;
  color: #fff;
}

/* ── Thematic Legend (dynamic) ───────────────────────────────────── */
.webgis-map .thematic-legend {
  position: absolute;
  left: 20px;
  bottom: 30px;
  z-index: 1;
  /* width: min(900px, calc(100vw - 40px)); */
  background: var(--bg-glass-dark);
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.webgis-map .thematic-legend .title {
  font-weight: 800;
  margin-bottom: 10px;
  font-size: 14px;
}

.webgis-map .thematic-legend .items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 18px;
}

.webgis-map .thematic-legend .item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  line-height: 1.2;
}

.webgis-map .thematic-legend .swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  flex: 0 0 auto;
}

/* Perizinan legend: 2-column layout */
.webgis-map #thematicLegend.periz-legend {
  width: min(920px, calc(100vw - 40px));
  padding: 14px 16px;
}

.webgis-map #thematicLegend.periz-legend #thematicLegendTitle {
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 12px;
}

.webgis-map #thematicLegend.periz-legend #thematicLegendItems {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.webgis-map #thematicLegend.periz-legend .legend-section h4 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.webgis-map #thematicLegend.periz-legend .legend-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.webgis-map #thematicLegend.periz-legend .legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  line-height: 1.25;
  color: #fff;
}

.webgis-map #thematicLegend.periz-legend .legend-swatch-square,
.webgis-map #thematicLegend.periz-legend .legend-swatch-circle {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.webgis-map #thematicLegend.periz-legend .legend-swatch-square {
  border-radius: 4px;
}
.webgis-map #thematicLegend.periz-legend .legend-swatch-circle {
  border-radius: 50%;
}

/* ── Hover Tooltip ────────────────────────────────────────────────── */
.webgis-map .maplibre-tooltip {
  position: absolute;
  z-index: 2000;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 12px;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  display: none;
  transform: translate(12px, 12px);
  max-width: 220px;
}

/* ── Map Toast (notifikasi non-blocking) ─────────────────────────── */
.map-toast {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  max-width: 380px;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.22);
  animation: map-toast-in .18s ease;
}
.map-toast[hidden] { display: none; }
.map-toast--error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.map-toast--warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.map-toast--info    { background: #e0f2fe; color: #0369a1; border: 1px solid #7dd3fc; }
@keyframes map-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Print ────────────────────────────────────────────────────────── */
@page {
  size: landscape;
  margin: 10mm;
}

/* Force warna tercetak pada semua elemen legenda & swatch */
.webgis-map .legend-container,
.webgis-map .legend-color-square,
.webgis-map .thematic-legend,
.webgis-map .thematic-legend .swatch,
.webgis-map #thematicLegend.periz-legend .legend-swatch-square,
.webgis-map #thematicLegend.periz-legend .legend-swatch-circle {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

@media print {
  /* ukuran halaman */
  @page {
    size: A4 landscape;
    margin: 0;
  }

  /* reset halaman */
  html,
  body {
    width: 100%;
    height: 100%;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  /* sembunyikan semua di luar peta */
  body * {
    visibility: hidden !important;
  }

  /* tampilkan map saja */
  .webgis-map,
  .webgis-map * {
    visibility: visible !important;
  }

  /* container map memenuhi halaman — area yang dilihat user yang tercetak */
  .webgis-map {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
  }

  /* canvas map */
  .webgis-map #map {
    position: absolute !important;
    inset: 0;
  }

  /* Regangkan canvas WebGL mengisi halaman — bitmap tampilan saat ini
     (persis yang dilihat user) diskalakan ke ukuran kertas, bukan di-resize
     ulang yang akan mengubah cakupan area. */
  .webgis-map .maplibregl-canvas-container,
  .webgis-map .maplibregl-canvas {
    width: 100% !important;
    height: 100% !important;
  }

  /* ── Sembunyikan semua tombol/widget (tidak ikut tercetak) ───────── */
  .webgis-map .map-controls,
  .webgis-map .thematic-control,
  .webgis-map .info-control,
  .webgis-map .tools-control,
  .webgis-map .info-popover,
  .webgis-map .coord-popover,
  .webgis-map .search-popover,
  .webgis-map .region-panel,
  .webgis-map .maplibre-tooltip,
  .webgis-map #map-toast,
  .webgis-map .map-toast,
  .webgis-map .maplibregl-ctrl-group {
    display: none !important;
  }

  /* ── Pertahankan attribution MapLibre (kanan bawah) ──────────────── */
  .webgis-map .maplibregl-ctrl-bottom-right,
  .webgis-map .maplibregl-ctrl-attrib {
    display: block !important;
    visibility: visible !important;
  }

  /* ── Judul (atas-kiri, agar tidak tertutup panel sumber data) ────── */
  .webgis-map .map-title {
    position: absolute !important;
    top: 14px !important;
    left: 20px !important;
    transform: none !important;
    text-align: left !important;
    font-size: 22px !important;
    max-width: 55vw !important;
    z-index: 9999 !important;
  }

  /* ── Sumber data (atas-kanan) ────────────────────────────────────── */
  .webgis-map .data-info-panel {
    position: absolute !important;
    top: 12px !important;
    right: 14px !important;
    z-index: 9999 !important;
  }

  /* ── Legend neraca & tematik (bawah-kiri) ────────────────────────── */
  .webgis-map .legend-container,
  .webgis-map #thematicLegend,
  .webgis-map .thematic-legend {
    position: absolute !important;
    bottom: 20px !important;
    left: 20px !important;
    z-index: 9999 !important;
  }

  /* Pastikan latar gelap & warna ikut tercetak (jangan di-strip browser) */
  .webgis-map .data-info-panel,
  .webgis-map .legend-container,
  .webgis-map #thematicLegend,
  .webgis-map .thematic-legend,
  .webgis-map .maplibregl-ctrl-attrib {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* ── Measure / Label Tool ─────────────────────────────────────────── */

/* Canvas crosshair saat tool aktif (set via JS, ini hanya fallback) */
.webgis-map .maplibregl-canvas.tool-active {
  cursor: crosshair !important;
}

/* Tool button active state – lebih terang */
.webgis-map .tool-btn.active {
  background: #dbeafe !important;
  box-shadow: inset 0 0 0 2px #1976d2;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-height: 720px) {
  .webgis-map {
    --tools-top: 100px;
  }
}

@media (max-width: 900px) {
  .webgis-map #thematicLegend {
    left: 16px;
    right: 16px;
    width: auto;
    max-height: 34vh;
    overflow-y: auto;
  }
  .webgis-map .thematic-legend .items {
    grid-template-columns: 1fr;
  }
  .webgis-map #thematicLegend.periz-legend #thematicLegendItems {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

@media (max-width: 520px) {
  .webgis-map {
    --left-x: 8px;
    --main-w: 60px;
    --main-h: 60px;
  }

  .webgis-map .basemap-gallery-control .dropdown-menu,
  .webgis-map .layers-control .dropdown-menu,
  .webgis-map .thematic-control .dropdown-menu {
    width: 88vw;
    max-width: 88vw;
    min-width: auto;
  }

  .webgis-map .map-title {
    font-size: 15px;
    padding: 8px 12px;
  }

  .webgis-map .coord-popover {
    right: 50%;
    transform: translateX(50%);
    top: auto;
    bottom: 80px;
    width: min(280px, 88vw);
  }

  .webgis-map .layer-item .form-check-label {
    font-size: 14.5px;
  }

  .webgis-map .data-info-panel {
    min-width: unset;
    right: 8px;
    top: 8px;
    padding: 8px 12px;
    font-size: 12px;
  }
  .webgis-map .data-info-panel__right {
    font-size: 13px;
  }
  .webgis-map .data-info-panel__sep {
    margin: 0 12px;
  }
}

/* ── Accessibility ────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .webgis-map *,
  .webgis-map *::before,
  .webgis-map *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .webgis-map .app-loading__spinner {
    animation: none;
    border-top-color: #fff;
  }
}

@media (prefers-color-scheme: dark) {
  /* Map title sudah transparan cukup — tidak perlu override besar */
}

/* Focus visible untuk keyboard navigation */
:focus-visible {
  outline: 2px solid #1976d2;
  outline-offset: 2px;
}
