/* RESET & GLOBAL */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  overflow: hidden; /* Mencegah scroll di halaman webgis */
  color: white;
}

/* PETA BACKGROUND */
#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1; /* Peta di layer bawah */
}

/* UI LAYER (Di atas peta) */
.ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10; /* UI di atas peta */
  pointer-events: none; /* Agar area kosong bisa ditembus klik ke peta */
  display: flex;
  flex-direction: column;
}

/* EFEK GLASSMORPHISM GELAP */
.glass-box {
  background: rgba(15, 23, 42, 0.6); /* Warna biru gelap transparan */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  pointer-events: auto; /* Kembalikan fungsi klik untuk kotak ini */
}

/* NAVBAR */
.glass-navbar {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  margin: 1.5rem auto;
  width: 90%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2rem;
  pointer-events: auto;
}

.nav-logos {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.nav-logos img {
  height: 30px;
}
.nav-title {
  font-weight: 600;
  font-size: 1.1rem;
}
.nav-links a {
  color: #22c55e;
  text-decoration: none;
  font-weight: 600;
}

/* LAYOUT KONTEN UTAMA (KIRI & KANAN) */
.main-content {
  flex: 1;
  display: flex;
  justify-content: space-between;
  padding: 0 3rem;
  margin-top: 1rem;
  gap: 2rem;
}

/* SIDEBAR KIRI */
.left-sidebar {
  width: 450px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Scrollbar kustom tema Glassmorphism */
.left-sidebar::-webkit-scrollbar {
  width: 6px;
}
.left-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}
.left-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(34, 197, 94, 0.5); /* Hijau transparan */
}

/* Bagian Judul */
.title-section {
  text-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
}
.subtitle {
  color: #4ade80;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.title {
  font-size: 1.5rem; /* Font diperkecil agar judul panjang menyesuaikan */
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 1rem;
}
.desc {
  font-size: 0.9rem;
  color: #e2e8f0;
  line-height: 1.6; /* Diperbesar agar teks deskripsi tidak sempit */
  text-align: justify; /* Tambahan agar teks rata kiri-kanan (opsional, hapus jika tidak suka) */
}

.left-box {
  padding: 1.5rem;
  min-height: 150px;
  width: 300px; /* Kunci lebar kotak agar tidak ikut memanjang mengikuti teks */
}

/* SIDEBAR KANAN */
.right-sidebar {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Scroll HANYA untuk isi Kotak Info (Kotak Ke-3) */
#info-content {
  max-height: 35vh;
  overflow-y: auto;
  padding-right: 5px;
}

/* Desain Scrollbar khusus Kotak Info */
#info-content::-webkit-scrollbar {
  width: 6px;
}
#info-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}
#info-content::-webkit-scrollbar-thumb:hover {
  background: rgba(34, 197, 94, 0.5);
}

.right-box {
  padding: 1.25rem;
}
.box-title {
  font-size: 0.85rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==========================================
   KONTROL BAWAH (CAROUSEL SUPER MINIMALIS)
========================================== */
.bottom-control {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  z-index: 20;
  pointer-events: auto;
}

.carousel-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Tombol Panah */
.nav-btn-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 1.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.nav-btn-circle:hover {
  background: rgba(30, 41, 59, 0.9);
  color: #22c55e; /* Hover warna hijau */
  transform: scale(1.1);
}

/* Konsol Kapsul Tengah */
.center-console {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 240px; /* Dipersempit sedikit lagi agar rapat */
  height: 55px;
  padding: 0 2rem;
  border-radius: 9999px;
  position: relative;
}

/* Angka Kiri Kanan */
.side-node {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%; /* Pastikan rata tengah vertikal */
}

.num-small {
  font-size: 1.2rem;
  color: #94a3b8;
  font-weight: 500;
  line-height: 1; /* Mencegah angka terdorong ke atas/bawah */
}

/* ==========================================
   TONJOLAN TENGAH MINIMALIS (HIJAU)
========================================== */
.center-node-wrapper {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: center;
  align-items: center;
  filter: drop-shadow(
    0 4px 12px rgba(34, 197, 94, 0.4)
  ); /* Efek glow hijau halus */
}

.center-node {
  /* Lingkaran Hijau */
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background-color: #22c55ef1; /* Hijau sesuai permintaan */
  border: 2px solid rgba(255, 255, 255, 0.2);

  /* Pemusatan Absolut */
  display: flex;
  justify-content: center;
  align-items: center;
}

.num-large {
  font-size: 2rem; /* Sedikit dibesarkan karena sekarang sendirian */
  font-weight: 700;
  color: rgb(255, 242, 242);
  line-height: 1; /* Mencegah font memiliki jarak kosong tambahan di bawah/atas */
  margin-top: 2px; /* Tweak mikroskopis: font Inter seringkali memiliki ruang atas bawaan */
}

/* ANIMASI MUNCUL UNTUK KOTAK KRITERIA */
.fade-in {
  animation: fadeIn 0.4s ease-in forwards;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================
   KUSTOMISASI CHECKBOX & SLIDER (GLASSMORPHISM)
========================================== */

/* Toggle Checkbox Modern */
.layer-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background 0.3s ease;
}

.layer-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.layer-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: #e2e8f0;
}

/* Menyembunyikan checkbox asli */
.layer-toggle input[type="checkbox"] {
  display: none;
}

/* Membuat track toggle palsu */
.toggle-track {
  width: 40px;
  height: 22px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  position: relative;
  transition: background 0.3s ease;
}

/* Membuat lingkaran toggle (thumb) */
.toggle-thumb {
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Saat checkbox dicentang */
.layer-toggle input[type="checkbox"]:checked + .toggle-track {
  background: #22c55e; /* Hijau aktif */
}

.layer-toggle input[type="checkbox"]:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
}

/* Kustomisasi slider (Range Input) */
.opacity-slider {
  -webkit-appearance: none;
  appearance: none; /* Tambahkan baris ini untuk browser standar (Firefox, dll) */
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  outline: none;
  margin-top: 10px;
  margin-bottom: 5px;
}

.opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #22c55e;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
  transition: transform 0.1s;
}

.opacity-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.opacity-value-text {
  font-size: 0.8rem;
  color: #94a3b8;
  text-align: right;
  display: block;
}

/* Ikon SVG Minimalis */
.svg-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-right: 6px;
  vertical-align: middle;
}

/* ANIMASI ALIRAN AIR (JALUR AKUMULASI) */
.aliran-air {
  stroke-dasharray: 12, 12;
  animation: mengalir 1.5s linear infinite;
}
@keyframes mengalir {
  from {
    stroke-dashoffset: 24;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* Transisi halus untuk Smart Info Box */
#box-info .box-content {
  transition: all 0.3s ease;
}

/* ==========================================
   KUSTOMISASI POPUP LEAFLET (GLASSMORPHISM)
========================================== */
.leaflet-popup-content-wrapper {
  background: rgba(15, 23, 42, 0.6); /* Warna biru gelap transparan */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* Segitiga panah di bawah popup */
.leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Teks dan lebar area popup */
.leaflet-popup-content {
  margin: 15px;
  width: 250px !important; /* Lebar pas untuk foto */
  color: white;
}

/* Tombol silang (X) */
.leaflet-popup-close-button {
  color: #94a3b8 !important;
  padding-top: 5px !important;
  padding-right: 5px !important;
}
.leaflet-popup-close-button:hover {
  color: #ef4444 !important; /* Merah saat dihover */
}

/* --- CUSTOM KELOMPOK 4: DARK GLASSMORPHISM SELECT & POPUP --- */

/* Scrollbar tersembunyi tapi tetap bisa di-scroll pada box kontrol (Sidebar Kiri & Legenda Kanan) */
.custom-scroll-hidden {
  max-height: 55vh; /* Menggunakan viewport height agar adaptif */
  overflow-y: auto;
  scrollbar-width: thin; /* Firefox: Buat tipis */
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent; /* Firefox */
  padding-right: 5px;
}
.custom-scroll-hidden::-webkit-scrollbar {
  width: 4px; /* Buat sangat tipis untuk Chrome/Safari */
}
.custom-scroll-hidden::-webkit-scrollbar-track {
  background: transparent;
}
.custom-scroll-hidden::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}
.custom-scroll-hidden::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Styling Dropdown Dark Glassmorphism yang Elegan */
.select-dark-glass {
  width: 100%;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(
    48,
    54,
    63,
    0.196
  ); /* Warna dasar dropdown mirip Lampiran 4 */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.15);
  outline: none;
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 12px;
  transition: all 0.2s ease;
  appearance: none; /* Menghilangkan panah default bawaan OS */
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23f8fafc%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat, repeat;
  background-position:
    right 0.7em top 50%,
    0 0;
  background-size:
    0.65em auto,
    100%;
}
.select-dark-glass:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}
.select-dark-glass option {
  background: #1e293b;
  color: #f8fafc;
  padding: 8px;
}

/* Dark Glassmorphism Leaflet Popup */
.leaflet-popup-content-wrapper {
  background: rgba(
    15,
    23,
    42,
    0.65
  ) !important; /* <--- Diubah jadi 0.65 agar lebih transparan/nge-blur */
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4) !important;
  color: #f8fafc !important;
  padding: 0 !important;
}
.leaflet-popup-content {
  margin: 16px 18px !important; /* Margin agar tidak menempel ke tepi kotak */
  line-height: 1.4 !important;
}
.leaflet-popup-tip {
  background: rgba(
    15,
    23,
    42,
    0.65
  ) !important; /* <--- Segitiga bawah juga disamakan transparansinya */
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}
.leaflet-container a.leaflet-popup-close-button {
  color: #cbd5e1 !important;
  padding: 6px 6px 0 0 !important;
  font-size: 18px !important;
}
.leaflet-container a.leaflet-popup-close-button:hover {
  color: #ef4444 !important;
}

/* --- CUSTOM KELOMPOK 12: TOMBOL TAHUN MANGROVE --- */
.grid-tahun-mangrove {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.btn-tahun-mangrove {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  padding: 6px 0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-tahun-mangrove:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.btn-tahun-mangrove.active {
  background: #006b3c; /* Hijau Sangat Sehat */
  color: white;
  border-color: #70ad47;
  box-shadow: 0 0 10px rgba(0, 107, 60, 0.4);
}
