/* Main Layout */
body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  overflow-x: hidden;
}

.main-container {
  display: flex;
  height: calc(100vh - 150px);
  width: 100vw;
  margin: 20px 0;
}

/* Sidebar Styles */
.gis-sidebar {
  width: 350px;
  background: white;
  padding: 20px;
  overflow-y: auto;
  border-right: 1px solid #e2e8f0;
  box-shadow: 2px 0 5px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-section {
  padding-bottom: 15px;
  border-bottom: 1px solid #e2e8f0;
}

.section-title {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 15px;
  color: #2d3748;
  display: flex;
  align-items: center;
}

/* Search Box */
.search-box {
  display: flex;
  margin-bottom: 15px;
}

.search-box input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 4px 0 0 4px;
  outline: none;
}

.search-box button {
  padding: 8px 15px;
  background-color: #2c3e50;
  color: white;
  border: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
}

.search-box button:hover {
  background-color: #1a252f;
}

/* Filter Dropdowns */
select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  margin-bottom: 10px;
  outline: none;
}

/* Legend Styles */
.legend {
  background: white;
  padding: 10px;
  border-radius: 5px;
  box-shadow: 0 0 5px rgba(0,0,0,0.1);
}

.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.legend-color {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
}

/* Stats Styles */
.stats p {
  margin-bottom: 5px;
  font-size: 0.9rem;
}

.stats span {
  font-weight: 600;
}

/* Kecamatan Grid */
.kecamatan-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.kecamatan-item {
  padding: 8px 12px;
  background-color: #f8f9fa;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.kecamatan-item:hover {
  background-color: #e9ecef;
  transform: translateY(-2px);
}

/* Map Container */
.map-container {
  flex: 1;
  height: calc(100% - 40px);
  margin: 20px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
}

/* Attribution */
.attribution {
  font-size: 12px;
  color: #666;
  text-align: center;
  margin-top: auto;
  padding-top: 15px;
}

/* Header and Footer */
header, footer {
  width: 100vw;
}

.header-content, .footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

/* Responsive */
@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
    height: auto;
  }
  
  .gis-sidebar {
    width: 100%;
    height: auto;
    max-height: 400px;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }
  
  .map-container {
    height: 500px;
    margin: 20px;
  }
  
  .kecamatan-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Popup Styles */
.popup-content {
  max-width: 300px;
}

.popup-content h4 {
  margin-top: 0;
  margin-bottom: 10px;
  color: #2c3e50;
}

.popup-content table {
  width: 100%;
  /* Perbaikan utama untuk pie chart */
.pie-chart-wrapper {
  height: 180px; /* Ukuran lebih kecil */
  width: 100%;
  margin: 0 auto;
}

/* Penyesuaian container */
.chart-container {
  background-color: rgba(0, 0, 0, 0.5);
  padding: 1rem;
  border-radius: 0.5rem;
  border: 2px solid #4CAF50;
  margin-bottom: 1rem;
  height: auto; /* Hapus fixed height */
  overflow: hidden; /* Pastikan tidak ada scroll */
}

/* Layout grid pie chart */
.grid-cols-1.md\:grid-cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* Responsive mobile */
@media (max-width: 640px) {
  .pie-chart-wrapper {
    height: 100px;
  }
  .chart-title {
    font-size: 5px; /* Judul lebih kecil di mobile */
  }
}