/* =========================================================
   FIRE HOTSPOT WEBGIS
   STYLE.CSS
   ========================================================= */

* {
  box-sizing: border-box;
}


/* =========================================================
   HTML & BODY
   ========================================================= */

html,
body {
  margin: 0;
  padding: 0;

  width: 100%;
  height: 100%;

  font-family: Arial, Helvetica, sans-serif;

  background: #f4f6f8;
  color: #1f2937;

  overflow: hidden;
}


/* =========================================================
   TOPBAR
   ========================================================= */

.topbar {
  height: 76px;

  padding: 12px 20px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  background: #111827;
  color: white;

  position: relative;
  z-index: 100;
}


.topbar h1 {
  margin: 0;

  font-size: 21px;
  line-height: 1.2;
}


.topbar p {
  margin: 4px 0 0;

  color: #cbd5e1;

  font-size: 12px;
}


#lastUpdate {
  font-size: 12px;

  color: #d1d5db;

  text-align: right;

  max-width: 320px;
}


/* =========================================================
   APP LAYOUT
   ========================================================= */

.app {
  width: 100%;
  height: calc(100vh - 76px);

  display: grid;

  grid-template-columns: 290px minmax(0, 1fr);

  overflow: hidden;
}


/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar {
  height: 100%;

  overflow-y: auto;

  padding: 14px;

  background: #ffffff;

  border-right: 1px solid #dbe1e8;

  position: relative;

  z-index: 20;
}


/* =========================================================
   PANEL
   ========================================================= */

.panel,
.stats {
  margin-bottom: 14px;

  padding: 14px;

  border: 1px solid #e5e7eb;

  border-radius: 10px;

  background: #ffffff;
}


.panel h2 {
  margin: 0 0 12px;

  font-size: 15px;
}


/* =========================================================
   FORM
   ========================================================= */

label {
  display: block;

  margin: 10px 0 5px;

  font-size: 12px;

  font-weight: 700;
}


select,
button {
  width: 100%;

  padding: 9px;

  border: 1px solid #cbd5e1;

  border-radius: 7px;

  background: #ffffff;

  color: #1f2937;

  font-family: inherit;

  font-size: 14px;
}


select {
  cursor: pointer;
}


button {
  margin-top: 12px;

  cursor: pointer;

  font-weight: 700;

  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}


button:hover {
  background: #f8fafc;

  border-color: #94a3b8;
}


button:active {
  background: #e2e8f0;
}


/* =========================================================
   STATISTICS
   ========================================================= */

.stats {
  display: grid;

  grid-template-columns: 1fr 1fr;

  gap: 8px;

  border: 0;

  padding: 0;

  background: transparent;
}


.stats div {
  padding: 11px;

  border-radius: 9px;

  background: #f1f5f9;
}


.stats span {
  display: block;

  font-size: 11px;

  color: #64748b;

  margin-bottom: 2px;
}


.stats strong {
  font-size: 21px;

  color: #111827;
}


/* =========================================================
   LEGEND
   ========================================================= */

.legend p {
  margin: 8px 0;

  font-size: 12px;
}


.dot {
  display: inline-block;

  width: 10px;
  height: 10px;

  margin-right: 7px;

  border-radius: 50%;

  vertical-align: middle;
}


.dot.high {
  background: #dc2626;
}


.dot.nominal {
  background: #f97316;
}


.dot.low {
  background: #eab308;
}


/* =========================================================
   SOURCE INFORMATION
   ========================================================= */

.source {
  margin: 0;

  line-height: 1.5;

  font-size: 11px;

  color: #64748b;
}


/* =========================================================
   MAP CONTAINER
   ========================================================= */

.map-wrap {
  position: relative;

  min-width: 0;
  min-height: 0;

  width: 100%;
  height: 100%;

  overflow: hidden;
}


#map {
  width: 100%;
  height: 100%;
}


/* =========================================================
   OPENLAYERS CONTROLS
   ========================================================= */

.ol-control {
  z-index: 10;
}


.ol-zoom {
  top: 10px;
  left: 10px;
}


.ol-zoom button {
  width: 28px;
  height: 28px;

  padding: 0;

  margin: 1px;

  font-size: 18px;

  line-height: 28px;

  border: 0;

  border-radius: 2px;

  background: rgba(255, 255, 255, 0.9);

  color: #1f2937;
}


.ol-zoom button:hover {
  background: #ffffff;
}


/* =========================================================
   HOTSPOT POPUP
   Digunakan oleh app.js baru
   ========================================================= */

#popup {
  position: absolute;

  min-width: 260px;
  max-width: 340px;

  padding: 14px;

  background: #ffffff;

  color: #1f2937;

  border: 1px solid #dbe1e8;

  border-radius: 10px;

  box-shadow:
    0 8px 25px rgba(0, 0, 0, 0.20);

  z-index: 9999;

  font-family:
    Arial,
    Helvetica,
    sans-serif;

  pointer-events: auto;
}


/* =========================================================
   POPUP CLOSE BUTTON
   ========================================================= */

#popupClose {
  position: absolute;

  top: 5px;
  right: 7px;

  width: 28px;
  height: 28px;

  margin: 0;

  padding: 0;

  border: 0;

  border-radius: 50%;

  background: transparent;

  color: #475569;

  font-size: 22px;

  font-weight: 400;

  line-height: 28px;

  text-align: center;

  cursor: pointer;
}


#popupClose:hover {
  background: #f1f5f9;

  color: #111827;
}


/* =========================================================
   POPUP TITLE
   ========================================================= */

.popup-title {
  margin: 0 28px 10px 0;

  font-size: 17px;

  font-weight: 700;

  line-height: 1.3;
}


/* =========================================================
   POPUP TABLE
   ========================================================= */

.popup-table {
  width: 100%;

  border-collapse: collapse;

  font-size: 12px;
}


.popup-table tr {
  border-bottom: 1px solid #f1f5f9;
}


.popup-table tr:last-child {
  border-bottom: 0;
}


.popup-table td {
  padding: 5px 3px;

  vertical-align: top;
}


.popup-table td:first-child {
  width: 43%;

  font-weight: 700;

  color: #64748b;
}


.popup-table td:last-child {
  color: #111827;

  word-break: break-word;
}


/* =========================================================
   CONFIDENCE COLORS
   ========================================================= */

.confidence-high {
  color: #dc2626;
}


.confidence-nominal {
  color: #f97316;
}


.confidence-low {
  color: #ca8a04;
}


/* =========================================================
   ADMINISTRATIVE LAYER
   ========================================================= */

/*
   Layer provinsi dan kabupaten sebenarnya
   sudah diberi style dari app.js.

   Bagian ini hanya memastikan layer tetap
   berada di belakang hotspot.
*/

.ol-layer {
  pointer-events: auto;
}


/* =========================================================
   RESPONSIVE - TABLET
   ========================================================= */

@media (max-width: 900px) {

  .app {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .sidebar {
    padding: 10px;
  }

  .panel,
  .stats {
    margin-bottom: 10px;
  }

  #popup {
    min-width: 230px;

    max-width: 300px;
  }

}


/* =========================================================
   RESPONSIVE - MOBILE
   ========================================================= */

@media (max-width: 700px) {

  html,
  body {
    overflow: auto;
  }


  .topbar {
    height: auto;

    min-height: 76px;

    padding: 10px 14px;

    align-items: flex-start;

    gap: 10px;
  }


  .topbar h1 {
    font-size: 18px;
  }


  .topbar p {
    font-size: 11px;
  }


  #lastUpdate {
    font-size: 10px;

    max-width: 150px;
  }


  .app {
    height: calc(100vh - 76px);

    grid-template-columns: 1fr;

    grid-template-rows:
      auto
      minmax(400px, 1fr);

    overflow: hidden;
  }


  .sidebar {
    height: auto;

    max-height: 280px;

    overflow-y: auto;

    border-right: 0;

    border-bottom:
      1px solid #dbe1e8;
  }


  .map-wrap {
    min-height: 400px;
  }


  #popup {
    min-width: 220px;

    max-width: calc(100vw - 40px);

    font-size: 12px;
  }

}


/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 450px) {

  .topbar {
    flex-direction: column;
  }


  #lastUpdate {
    width: 100%;

    max-width: none;

    text-align: left;
  }


  .app {
    grid-template-rows:
      260px
      minmax(400px, 1fr);
  }


  .sidebar {
    max-height: 260px;
  }


  .stats strong {
    font-size: 18px;
  }


  #popup {
    min-width: 210px;

    max-width:
      calc(100vw - 30px);

    padding: 12px;
  }


  .popup-table {
    font-size: 11px;
  }

}
/* =========================================================
   GPS / LOKASI PENGGUNA
   ========================================================= */

.gps-panel {
  margin-top: 14px;
}


.gps-panel h2 {
  margin-bottom: 10px;
}


/* Tombol GPS */

#gpsButton,
#gpsFollowButton {
  width: 100%;

  padding: 9px 10px;

  margin-top: 6px;

  border-radius: 7px;

  border: 1px solid #cbd5e1;

  background: #ffffff;

  color: #1f2937;

  font-size: 13px;

  font-weight: 700;

  cursor: pointer;
}


#gpsButton:hover,
#gpsFollowButton:hover {
  background: #f8fafc;

  border-color: #94a3b8;
}


/* Tombol follow aktif */

#gpsFollowButton.active {
  background: #111827;

  color: #ffffff;

  border-color: #111827;
}


/* Status GPS */

.gps-status {
  margin-top: 10px;

  padding: 8px;

  border-radius: 7px;

  background: #f1f5f9;

  color: #475569;

  font-size: 11px;

  line-height: 1.4;
}


/* Informasi koordinat */

.gps-info {
  margin-top: 10px;

  padding: 9px;

  border-radius: 8px;

  background: #f8fafc;

  border: 1px solid #e2e8f0;
}


.gps-info div {
  display: flex;

  justify-content: space-between;

  gap: 10px;

  padding: 4px 0;

  border-bottom: 1px solid #e5e7eb;
}


.gps-info div:last-child {
  border-bottom: none;
}


.gps-info span {
  color: #64748b;

  font-size: 11px;
}


.gps-info strong {
  color: #111827;

  font-size: 11px;

  text-align: right;

  word-break: break-all;
}


/* Status berhasil */

.gps-status.success {
  background: #ecfdf5;

  color: #166534;

  border: 1px solid #bbf7d0;
}


/* Status error */

.gps-status.error {
  background: #fef2f2;

  color: #991b1b;

  border: 1px solid #fecaca;
}


/* Status upload KML/KMZ (pola sama dengan .gps-status) */

.kml-status {
  margin-top: 10px;

  padding: 8px;

  border-radius: 7px;

  background: #f1f5f9;

  color: #475569;

  font-size: 11px;

  line-height: 1.4;
}


.kml-status.success {
  background: #ecfdf5;

  color: #166534;

  border: 1px solid #bbf7d0;
}


.kml-status.error {
  background: #fef2f2;

  color: #991b1b;

  border: 1px solid #fecaca;
}


/* Baris checkbox toggle layer (mis. batas administrasi) */

.check-row {
  display: flex;

  align-items: center;

  gap: 8px;

  margin: 8px 0 0;

  font-size: 13px;

  font-weight: 400;

  cursor: pointer;
}


.check-row:first-of-type {
  margin-top: 0;
}


.check-row input[type="checkbox"] {
  width: auto;

  margin: 0;

  cursor: pointer;
}


/* =========================================================
   GPS MARKER
   ========================================================= */

.gps-marker {
  width: 18px;

  height: 18px;

  border-radius: 50%;

  background: #2563eb;

  border: 3px solid #ffffff;

  box-shadow:
    0 0 0 2px #2563eb,
    0 2px 8px rgba(0, 0, 0, 0.35);
}


/* Lingkaran akurasi GPS */

.gps-accuracy-circle {
  fill: rgba(37, 99, 235, 0.12);

  stroke: rgba(37, 99, 235, 0.45);

  stroke-width: 1;
}


/* =========================================================
   TOOLTIP PENGUKURAN
   ========================================================= */

.measure-tooltip {
  position: relative;

  background: rgba(17, 24, 39, 0.85);

  color: #ffffff;

  padding: 4px 8px;

  border-radius: 5px;

  font-size: 12px;
  font-weight: 700;

  white-space: nowrap;

  pointer-events: none;
}


.measure-tooltip::before {
  content: "";

  position: absolute;

  bottom: -6px;
  left: 50%;

  transform: translateX(-50%);

  border: 6px solid transparent;
  border-top-color: rgba(17, 24, 39, 0.85);
}


.measure-tooltip-static {
  background: #2563eb;
}


.measure-tooltip-static::before {
  border-top-color: #2563eb;
}


.measure-button.active {
  background: #111827;

  color: #ffffff;

  border-color: #111827;
}


/* Teks keterangan kecil di panel Download */

.download-info {
  font-size: 11px;
  color: #64748b;
  margin: 0 0 10px;
  line-height: 1.4;
}


/* =========================================================
   BASEMAP SWITCHER (floating di pojok kanan atas peta)
   ========================================================= */

.basemap-switcher {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 400;

  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  padding: 8px 12px;

  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 150px;
}

.basemap-switcher-title {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.basemap-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #1e293b;
  cursor: pointer;
  font-weight: 400;
  margin: 0;
}

.basemap-option input[type="radio"] {
  width: auto;
  margin: 0;
  cursor: pointer;
  accent-color: #f97316;
}


/* =========================================================
   FILTER HOTSPOT PER WILAYAH
   ========================================================= */

.wilayah-result {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  color: #1e293b;
}

.wilayah-result .wr-title {
  font-weight: 700;
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.wilayah-result .wr-total {
  font-size: 22px;
  font-weight: 800;
  color: #f97316;
  line-height: 1.2;
  margin-bottom: 4px;
}

.wilayah-result .wr-label {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 8px;
}

.wilayah-result .wr-breakdown {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.wilayah-result .wr-chip {
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}

.wr-chip.high    { background: #fee2e2; color: #991b1b; }
.wr-chip.nominal { background: #ffedd5; color: #9a3412; }
.wr-chip.low     { background: #fef9c3; color: #713f12; }
