/* ============================================================
   WebGIS - style.css
   Design: Red & White Theme (Merah Putih)
   Font: Plus Jakarta Sans + JetBrains Mono
============================================================ */

/* --- Reset & Variables ---------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 300px;
  --sidebar-bg: #ffffff;
  --sidebar-border: rgba(0,0,0,0.08);
  --sidebar-text: #334155;
  --sidebar-text-muted: #64748b;
  --sidebar-hover: #f1f5f9;
  --accent: #e11d48; /* Merah cantik */
  --accent-glow: rgba(225, 29, 72, 0.25);
  --green: #16a34a;
  --red: #e11d48;
  --amber: #d97706;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-md: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font);
  font-size: 14px;
  background: #f1f5f9;
  color: var(--sidebar-text);
}

/* --- Scrollbar ------------------------------------------ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }

/* ============================================================
   SIDEBAR
============================================================ */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  height: 100vh;
  max-height: 100vh;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 900;
  overflow: hidden; /* Changed: overflow handled by sidebar-scrollable child */
  transition: transform var(--transition), width var(--transition);
  box-shadow: 2px 0 20px rgba(0,0,0,0.03);
}

.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-w)));
}

/* Sidebar Header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-logo { display: flex; align-items: center; gap: 10px; }

.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), #be123c);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  box-shadow: 0 4px 12px var(--accent-glow);
  flex-shrink: 0;
}

.logo-title {
  display: block;
  font-size: 16px; font-weight: 800;
  color: #0f172a; letter-spacing: -0.3px;
}

.logo-sub {
  display: block;
  font-size: 10.5px; font-weight: 500;
  color: var(--sidebar-text-muted);
  letter-spacing: 0.5px; text-transform: uppercase;
}

.sidebar-toggle {
  width: 30px; height: 30px;
  border: 1px solid var(--sidebar-border);
  border-radius: 8px; background: transparent;
  color: var(--sidebar-text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--sidebar-hover); color: #0f172a; border-color: rgba(0,0,0,0.15); }

/* Sidebar Section */
.sidebar-section {
  padding: 10px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.section-label {
  font-size: 10px; font-weight: 700;
  color: var(--sidebar-text-muted);
  letter-spacing: 1.2px; text-transform: uppercase;
  margin-bottom: 8px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.stat-card {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--sidebar-border);
  transition: transform var(--transition);
}
.stat-card:hover { transform: translateY(-1px); border-color: rgba(0,0,0,0.15); }

.stat-icon { font-size: 18px; line-height: 1; }

.stat-value {
  font-size: 22px; font-weight: 800;
  color: #0f172a; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 10px; color: var(--sidebar-text-muted); margin-top: 2px; font-weight: 600; }

.stat-blue  { border-left: 3px solid #3b82f6; }
.stat-amber { border-left: 3px solid var(--amber); }
.stat-green { border-left: 3px solid var(--green); }
.stat-red   { border-left: 3px solid var(--red); }

/* Coverage Bar */
.coverage-bar-wrap { }
.coverage-bar-header {
  display: flex; justify-content: space-between;
  font-size: 11.5px; color: var(--sidebar-text);
  margin-bottom: 6px; font-weight: 600;
}
.coverage-bar-header strong { color: var(--accent); font-size: 13px; }

.coverage-bar-track {
  height: 6px; background: rgba(0,0,0,0.06);
  border-radius: 99px; overflow: hidden;
}
.coverage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), #fb7185);
  border-radius: 99px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

/* Tool Grid */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}

.tool-btn {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; padding: 6px 4px;
  background: var(--surface);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  cursor: pointer; font-family: var(--font);
  font-size: 10px; font-weight: 600;
  transition: all var(--transition);
  letter-spacing: 0.3px;
}
.tool-btn:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.tool-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.tool-icon { font-size: 18px; }

.help-text {
  font-size: 10px; color: var(--sidebar-text-muted);
  line-height: 1.4; padding: 6px 8px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--sidebar-border);
}

/* Layer List */
.layer-list { display: flex; flex-direction: column; gap: 4px; }

.layer-item {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer; transition: background var(--transition);
  font-size: 12.5px; color: #0f172a; font-weight: 500;
  user-select: none;
}
.layer-item:hover { background: var(--sidebar-hover); }
.layer-item input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent); }

.layer-dot {
  width: 10px; height: 10px;
  border-radius: 50%; flex-shrink: 0;
}

/* Legend */
.legend-list { display: flex; flex-direction: column; gap: 4px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--sidebar-text); font-weight: 500; padding: 2px 0; }
.legend-marker {
  width: 12px; height: 12px;
  background: #e11d48; border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 2px rgba(225,29,72,0.3);
  flex-shrink: 0;
}
.legend-circle {
  width: 14px; height: 14px;
  border-radius: 50%; flex-shrink: 0;
}
.legend-line {
  width: 22px; height: 3px;
  border-radius: 2px; flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 10.5px; color: var(--sidebar-text-muted);
  font-weight: 500;
  display: flex; align-items: center; justify-content: space-between;
}

.btn-logout-footer {
  font-size: 10.5px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  transition: opacity var(--transition);
}
.btn-logout-footer:hover { opacity: 0.7; }

/* Sidebar User Info */
.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  background: linear-gradient(135deg, rgba(225,29,72,0.04), transparent);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #be123c);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 14px; font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.user-detail {
  display: flex; flex-direction: column;
}

.user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
}

.user-role {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.btn-logout {
  width: 30px; height: 30px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  background: #ffffff;
  color: var(--sidebar-text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-logout:hover {
  background: #ffe4e6;
  border-color: var(--accent);
  color: var(--accent);
}

/* Open button (collapsed state) */
.sidebar-open-btn {
  position: fixed;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  z-index: 901;
  width: 36px; height: 36px;
  background: var(--sidebar-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  color: var(--sidebar-text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  transition: all var(--transition);
}
.sidebar-open-btn:hover { background: var(--surface-2); color: #0f172a; border-color: rgba(0,0,0,0.15); }

/* ============================================================
   MAP CONTAINER
============================================================ */
#mapContainer {
  position: fixed;
  left: var(--sidebar-w);
  top: 0; right: 0; bottom: 0;
  transition: left var(--transition), right var(--transition);
}

#mapContainer.with-right-sidebar {
  right: var(--right-sidebar-w);
}

#mapContainer.full-width { left: 0; }

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

/* Loading overlay */
.map-loading {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; z-index: 500;
  color: #0f172a; font-size: 14px; font-weight: 600;
  backdrop-filter: blur(4px);
  transition: opacity 0.4s;
}
.map-loading.hidden { opacity: 0; pointer-events: none; }

.loading-spinner {
  width: 38px; height: 38px;
  border: 3px solid rgba(0,0,0,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   TOAST NOTIFICATIONS
============================================================ */
.toast-container {
  position: absolute;
  bottom: 24px; right: 16px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 800; pointer-events: none;
}

.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600;
  color: white;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  pointer-events: all; max-width: 320px;
  backdrop-filter: blur(8px);
}
.toast.success { background: rgba(22,163,74,0.95); }
.toast.error   { background: rgba(225,29,72,0.95); }
.toast.info    { background: rgba(59,130,246,0.95); }
.toast.warning { background: rgba(217,119,6,0.95); }
.toast.fade-out { animation: toastOut 0.3s forwards; }

@keyframes toastIn {
  from { transform: translateX(60px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  to { transform: translateX(60px); opacity: 0; }
}

/* ============================================================
   MODAL
============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  backdrop-filter: blur(3px);
  transition: opacity var(--transition);
}
.modal-backdrop.hidden { display: none; }

.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: 480px; max-width: calc(100vw - 32px);
  max-height: calc(100vh - 60px);
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.modal.hidden { display: none; }
.modal.modal-sm { width: 380px; }

@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, -52%) scale(0.93); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
  flex-shrink: 0;
  background: #f8fafc;
}

.modal-title-wrap { display: flex; align-items: center; gap: 12px; }

.modal-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center;
  justify-content: center; font-size: 20px;
  flex-shrink: 0;
  background: #ffe4e6 !important;
  color: var(--accent) !important;
}

.modal-title { font-size: 16px; font-weight: 800; color: #0f172a; }
.modal-subtitle { font-size: 11px; color: var(--sidebar-text-muted); margin-top: 2px; font-weight: 500; }

.modal-close {
  width: 30px; height: 30px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px; background: #ffffff;
  color: var(--sidebar-text-muted); cursor: pointer;
  font-size: 14px; transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.modal-close:hover { background: #ffe4e6; border-color: var(--accent); color: var(--accent); }

.modal-body {
  padding: 18px 20px;
  overflow-y: auto; flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(0,0,0,0.06);
  display: flex; gap: 8px; justify-content: flex-end;
  flex-shrink: 0;
  background: #f8fafc;
}

/* --- Form Elements ------------------------------------ */
.form-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: 11.5px; font-weight: 700;
  color: var(--sidebar-text-muted);
  letter-spacing: 0.5px; text-transform: uppercase;
  margin-bottom: 6px;
}
.form-label small { font-size: 10px; text-transform: none; font-weight: 500; color: #94a3b8; }
.req { color: var(--accent); }

.form-input {
  width: 100%;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  color: #0f172a;
  font-family: var(--font);
  font-weight: 500;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: none;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder { color: #94a3b8; font-weight: 400; }
.form-input[readonly] { background: #f1f5f9; cursor: default; color: #64748b; }
.form-input.mono { font-family: var(--font-mono); font-size: 12px; }
.form-input option { background: #ffffff; }

/* Radio Tabs */
.radio-tabs { display: flex; gap: 6px; }
.radio-tab {
  flex: 1; position: relative;
}
.radio-tab input { position: absolute; opacity: 0; width: 0; height: 0; }
.radio-tab span {
  display: block; text-align: center;
  padding: 8px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600;
  cursor: pointer; color: var(--sidebar-text);
  transition: all var(--transition);
}
.radio-tab input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Range */
.range-wrap {
  display: flex; align-items: center; gap: 8px;
}
.range-min, .range-max {
  font-size: 10px; color: var(--sidebar-text-muted);
  font-family: var(--font-mono); flex-shrink: 0; font-weight: 600;
}
.range-input {
  flex: 1; height: 4px; cursor: pointer;
  accent-color: var(--accent);
  -webkit-appearance: none;
  background: rgba(0,0,0,0.1);
  border-radius: 99px;
  outline: none;
}
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%; background: var(--accent);
  box-shadow: 0 2px 6px var(--accent-glow);
  cursor: pointer; border: 2px solid white;
}

/* Geocode wrap */
.geocode-wrap { position: relative; }
.geocode-status {
  position: absolute; top: 8px; right: 10px;
  font-size: 11px; color: var(--sidebar-text-muted); font-weight: 500;
}

/* Status Jangkauan Card */
.status-jangkauan-card {
  background: #f8fafc;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.sj-label { font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--sidebar-text-muted); margin-bottom: 4px; }
.sj-value { font-size: 15px; font-weight: 800; color: #0f172a; }
.sj-value.dalam { color: var(--green); }
.sj-value.luar  { color: var(--accent); }
.sj-ditangani { font-size: 11.5px; color: var(--sidebar-text-muted); margin-top: 3px; font-weight: 500; }

/* --- Buttons ------------------------------------------ */
.btn {
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  font-family: var(--font);
  font-size: 13px; font-weight: 700;
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
  justify-content: center;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover { background: #be123c; transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-primary:active { transform: none; }

.btn-ghost {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.15);
  color: var(--sidebar-text);
}
.btn-ghost:hover { background: #f1f5f9; color: #0f172a; border-color: rgba(0,0,0,0.25); }

.btn-danger { background: var(--accent); color: white; }
.btn-danger:hover { background: #be123c; }

.btn-sm { padding: 5px 12px; font-size: 11.5px; }

/* --- Hidden ------------------------------------------- */
.hidden { display: none !important; }

/* ============================================================
   LEAFLET CUSTOMIZATIONS
============================================================ */

/* Popup */
.leaflet-popup-content-wrapper {
  background: #ffffff !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md) !important;
  color: #334155 !important;
  padding: 0 !important;
  overflow: hidden;
}
.leaflet-popup-tip { background: #ffffff !important; border-top: 1px solid rgba(0,0,0,0.08); border-left: 1px solid rgba(0,0,0,0.08); }
.leaflet-popup-content { margin: 0 !important; }

.popup-card {
  padding: 14px 16px;
  min-width: 200px;
}
.popup-title {
  font-size: 14px; font-weight: 800;
  color: #0f172a; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.popup-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-dalam { background: #dcfce7; color: #166534; }
.badge-luar  { background: #ffe4e6; color: #9f1239; }
.badge-fp    { background: #f1f5f9; color: #475569; }

.popup-row {
  display: flex; gap: 6px;
  font-size: 12px; margin-bottom: 4px;
  color: #64748b; font-weight: 500;
}
.popup-row strong { color: #0f172a; min-width: 80px; font-weight: 700; }

.popup-actions {
  display: flex; gap: 6px;
  padding: 10px 16px;
  border-top: 1px solid rgba(0,0,0,0.06);
  background: #f8fafc;
}

.popup-btn {
  flex: 1; padding: 6px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 6px;
  background: #ffffff; cursor: pointer;
  font-size: 11px; font-weight: 700;
  color: var(--sidebar-text); font-family: var(--font);
  transition: all 0.15s;
  text-align: center;
}
.popup-btn:hover { background: #f1f5f9; color: #0f172a; }
.popup-btn.del:hover { background: #ffe4e6; border-color: var(--accent); color: var(--accent); }

/* Zoom / Attribution */
.leaflet-control-zoom a {
  background: #ffffff !important;
  border-color: rgba(0,0,0,0.1) !important;
  color: #0f172a !important;
  font-weight: 700 !important;
}
.leaflet-control-zoom a:hover { background: #f8fafc !important; color: var(--accent) !important; }
.leaflet-control-attribution { background: rgba(255,255,255,0.9) !important; color: #64748b !important; font-size: 10px !important; font-weight: 500 !important; }
.leaflet-control-attribution a { color: var(--accent) !important; font-weight: 600 !important; }

/* Scale */
.leaflet-control-scale-line {
  background: rgba(255,255,255,0.9) !important;
  border-color: rgba(0,0,0,0.3) !important;
  color: #0f172a !important;
  font-size: 10px !important;
  font-weight: 600 !important;
}

/* ============================================================
   SEARCH BOX
============================================================ */
.sidebar-search {
  padding: 16px 16px 0;
  position: relative;
  z-index: 50;
}
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 12px;
  color: #94a3b8;
}
#searchInput {
  width: 100%;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: var(--radius-sm);
  padding: 10px 12px 10px 36px;
  color: #0f172a;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  transition: all var(--transition);
}
#searchInput:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow);
}
#searchInput::placeholder {
  color: #94a3b8; font-weight: 400;
}

.search-results {
  position: absolute;
  top: calc(100% + 4px); 
  left: 16px; right: 16px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: var(--radius-md);
  max-height: 280px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.search-results.hidden {
  display: none !important;
}
.search-item {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
  transition: background var(--transition);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #f8fafc; }

.search-item-title { font-size: 13px; font-weight: 800; color: #0f172a; }
.search-item-type { font-size: 10.5px; color: var(--accent); font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; }
.search-item-empty { padding: 14px; text-align: center; font-size: 12px; color: var(--sidebar-text-muted); font-weight: 500; }

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 900px) {
  :root { --sidebar-w: 260px; }
}

@media (max-width: 680px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    max-width: 85vw;
    z-index: 1050;
    border-right: none;
    border-top-right-radius: 16px;
    border-bottom-right-radius: 16px;
    box-shadow: 0 0 40px rgba(0,0,0,0.15);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  #mapContainer {
    left: 0 !important;
  }
  .sidebar-open-btn {
    display: flex !important;
    top: 20px;
    left: 20px;
    z-index: 1000;
    width: 44px; height: 44px;
    border-radius: 12px;
    background: white;
    color: var(--accent);
    box-shadow: 0 4px 15px rgba(225,29,72,0.2);
  }
  .modal { 
    width: calc(100vw - 32px); 
    max-height: calc(100vh - 40px); 
  }
  .form-row { grid-template-columns: 1fr; }
  
  .toast-container {
    bottom: 24px; left: 16px; right: 16px;
    align-items: center;
  }
  .toast {
    width: 100%; max-width: 100%;
    justify-content: center;
  }
}

/* --- Utility ------------------------------------------ */
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mb-8  { margin-bottom: 8px; }

/* ============================================================
   CUSTOM PREMIUM MAP MARKERS & LEGEND
   ============================================================ */
.custom-marker {
  position: relative;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

/* Base Shadow/Indicator */
.custom-marker::after {
  content: '';
  position: absolute;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 50%;
  filter: blur(2px);
  transform: rotate(45deg);
  z-index: -1;
  transition: all 0.25s ease;
}

.custom-marker .marker-icon {
  transform: rotate(45deg);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hover effects */
.custom-marker:hover {
  transform: rotate(-45deg) scale(1.15) translateY(-3px);
  z-index: 1000 !important;
}

/* FP (Fasilitas Publik) Pin */
.fp-marker {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #f43f5e, #be123c);
  box-shadow: 0 4px 10px rgba(225, 29, 72, 0.45);
}
.fp-marker::after {
  width: 10px;
  height: 10px;
  bottom: -11px;
  left: 11px;
}
.fp-marker:hover {
  box-shadow: 0 6px 14px rgba(225, 29, 72, 0.6);
}

/* PM (Penduduk Miskin) Pins */
.pm-marker-dalam {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #10b981, #047857);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
}
.pm-marker-dalam::after {
  width: 8px;
  height: 8px;
  bottom: -10px;
  left: 10px;
}
.pm-marker-dalam:hover {
  box-shadow: 0 6px 12px rgba(16, 185, 129, 0.55);
}

.pm-marker-luar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #f43f5e, #be123c);
  box-shadow: 0 4px 8px rgba(225, 29, 72, 0.4);
}
.pm-marker-luar::after {
  width: 8px;
  height: 8px;
  bottom: -10px;
  left: 10px;
}
.pm-marker-luar:hover {
  box-shadow: 0 6px 12px rgba(225, 29, 72, 0.55);
}

/* Point Pins (SPBU) */
.point-marker-24 {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #10b981, #047857); /* Pertamina Green */
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
}
.point-marker-24::after {
  width: 6px;
  height: 6px;
  bottom: -9px;
  left: 9px;
}
.point-marker-24:hover {
  box-shadow: 0 6px 12px rgba(16, 185, 129, 0.55);
}

.point-marker-normal {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #f43f5e, #be123c); /* Pertamina Red */
  box-shadow: 0 3px 6px rgba(225, 29, 72, 0.35);
}
.point-marker-normal::after {
  width: 6px;
  height: 6px;
  bottom: -9px;
  left: 9px;
}
.point-marker-normal:hover {
  box-shadow: 0 5px 10px rgba(225, 29, 72, 0.5);
}

/* Legend items style matching new markers */
.legend-marker-wrapper {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.legend-pin {
  width: 11px;
  height: 11px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg) translateY(-1px) translateX(1px);
  border: 1.2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  flex-shrink: 0;
}
.legend-pin.fp {
  background: linear-gradient(135deg, #f43f5e, #be123c);
}
.legend-pin.pm-dalam {
  background: linear-gradient(135deg, #10b981, #047857);
}
.legend-pin.pm-luar {
  background: linear-gradient(135deg, #f43f5e, #be123c);
}

/* ============================================================
   RIGHT SIDEBAR (PANEL KANAN)
============================================================ */
:root {
  --right-sidebar-w: 320px;
}

#rightSidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--right-sidebar-w);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid rgba(225, 29, 72, 0.1);
  display: flex;
  flex-direction: column;
  z-index: 850;
  transition: transform var(--transition);
  box-shadow: -6px 0 40px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

#rightSidebar.right-collapsed {
  transform: translateX(100%);
}

/* Right Sidebar Header */
.right-sidebar-header {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(225, 29, 72, 0.08);
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(225,29,72,0.04) 0%, rgba(255,255,255,0) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.right-sidebar-title {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.right-sidebar-title-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent), #be123c);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  box-shadow: 0 2px 8px var(--accent-glow);
  flex-shrink: 0;
}

.right-sidebar-close {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 7px;
  background: #fff;
  color: var(--sidebar-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-size: 13px;
  flex-shrink: 0;
}
.right-sidebar-close:hover {
  background: #ffe4e6;
  border-color: var(--accent);
  color: var(--accent);
}

/* Search inside Right Sidebar */
.right-search-wrap {
  padding: 14px 16px 8px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  position: relative;
  z-index: 10;
}

.right-search-inner {
  position: relative;
  display: flex;
  align-items: center;
}

.right-search-inner svg {
  position: absolute;
  left: 11px;
  color: #94a3b8;
  pointer-events: none;
}

#rightSearchInput {
  width: 100%;
  background: #f8fafc;
  border: 1.5px solid rgba(0,0,0,0.10);
  border-radius: 10px;
  padding: 9px 12px 9px 34px;
  color: #0f172a;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  transition: all var(--transition);
  outline: none;
}

#rightSearchInput:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

#rightSearchInput::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

/* Smooth UX for Toggle Button */
#rightSidebarToggleBtn {
  transition: all var(--transition);
}
#rightSidebarToggleBtn.hidden {
  display: flex !important; /* Override global hidden */
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(20px);
}

/* Right Sidebar Count Badge */
.right-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(225,29,72,0.08);
  border-radius: 99px;
  padding: 2px 10px;
  letter-spacing: 0.3px;
}

.right-sidebar-meta {
  padding: 8px 16px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.right-sidebar-meta-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--sidebar-text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Scrollable Card List */
.right-card-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.right-card-list::-webkit-scrollbar { width: 4px; }
.right-card-list::-webkit-scrollbar-track { background: transparent; }
.right-card-list::-webkit-scrollbar-thumb {
  background: rgba(225,29,72,0.18);
  border-radius: 4px;
}
.right-card-list::-webkit-scrollbar-thumb:hover {
  background: rgba(225,29,72,0.45);
}

/* ─── DATA CARD (Premium Modern) ─── */
.data-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255,255,255,0.6);
  flex-shrink: 0;
}

.data-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: linear-gradient(180deg, var(--accent), #fb7185);
  border-radius: 16px 0 0 16px;
  opacity: 0;
  transform: scaleY(0);
  transform-origin: center;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
}

.data-card:hover {
  transform: translateY(-4px);
  border-color: rgba(225, 29, 72, 0.4);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 30px rgba(225, 29, 72, 0.12), 0 4px 8px rgba(0,0,0,0.06);
}

.data-card:hover::before {
  opacity: 1;
  transform: scaleY(1);
}

.data-card:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.08);
}

.data-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.data-card-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
  transition: transform 0.3s ease;
}

.data-card:hover .data-card-icon-wrap {
  transform: scale(1.1) rotate(5deg);
}

.dc-icon-spbu   { background: linear-gradient(135deg, #dcfce7, #bbf7d0); color: #166534; }
.dc-icon-pm     { background: linear-gradient(135deg, #ffe4e6, #fecdd3); color: #991b1b; }
.dc-icon-fp     { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #1e40af; }
.dc-icon-jalan  { background: linear-gradient(135deg, #fef9c3, #fef08a); color: #854d0e; }
.dc-icon-poly   { background: linear-gradient(135deg, #f3e8ff, #e9d5ff); color: #6b21a8; }
.dc-icon-geo    { background: linear-gradient(135deg, #e0f2fe, #bae6fd); color: #075985; }

.data-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.data-card-name {
  font-size: 14.5px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font);
}

.data-card-sub {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 500;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-card-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  flex-shrink: 0;
  align-self: flex-start;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.badge-24jam     { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0;}
.badge-tidak24   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca;}
.badge-dalam-jk  { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0;}
.badge-luar-jk   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca;}
.badge-shm       { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0;}
.badge-hgb       { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe;}
.badge-hgu       { background: #fef9c3; color: #854d0e; border: 1px solid #fef08a;}
.badge-hp        { background: #f3e8ff; color: #6b21a8; border: 1px solid #e9d5ff;}
.badge-geo       { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0;}

.data-card-coords {
  font-size: 11px;
  color: #64748b;
  font-family: var(--font-mono);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin-top: 6px;
  align-self: flex-start;
  transition: background 0.3s ease;
}

.data-card:hover .data-card-coords {
  background: #f1f5f9;
  color: #334155;
}

.data-card-footer {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.04);
  width: 100%;
}
.data-card-footer span, .data-card-footer span[class^="badge-"] {
  font-size: 10px !important;
}

/* Tab System for Modul Utuh */
.right-tabs {
  display: flex;
  gap: 0;
  padding: 10px 12px 0;
  border-bottom: 1.5px solid rgba(0,0,0,0.07);
  flex-shrink: 0;
  overflow-x: auto;
}

.right-tabs::-webkit-scrollbar { height: 0; }

.right-tab-btn {
  padding: 7px 14px;
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  font-size: 11px;
  font-weight: 700;
  color: var(--sidebar-text-muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: var(--font);
  letter-spacing: 0.2px;
  margin-bottom: -1.5px;
}

.right-tab-btn:hover { color: var(--accent); }
.right-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Skeleton Loading */
.skeleton-card {
  background: #f8fafc;
  border: 1.5px solid rgba(0,0,0,0.05);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-shrink: 0;
}

.skeleton-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  flex-shrink: 0;
}

.skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.skeleton-line {
  height: 10px;
  border-radius: 99px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-30 { width: 30%; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  text-align: center;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(225,29,72,0.08), rgba(225,29,72,0.04));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  border: 1.5px solid rgba(225,29,72,0.1);
}

.empty-state-title {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}

.empty-state-sub {
  font-size: 12px;
  color: var(--sidebar-text-muted);
  font-weight: 500;
  line-height: 1.5;
  max-width: 220px;
}

/* Right Sidebar Toggle Button (on map) */
#rightSidebarToggleBtn {
  position: fixed;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 851;
  width: 36px;
  height: 70px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(225,29,72,0.15);
  border-radius: 12px;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  box-shadow: -4px 0 20px rgba(225,29,72,0.1);
  transition: all var(--transition);
}

#rightSidebarToggleBtn:hover {
  background: var(--accent);
  color: white;
  border-color: transparent;
  box-shadow: -4px 0 20px rgba(225,29,72,0.3);
  transform: translateY(-50%) scale(1.05);
}

#rightSidebarToggleBtn.hidden {
  display: none !important;
}

.rs-toggle-label {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
}

/* Map container adjustment for right sidebar */
#mapContainer {
  transition: left var(--transition), right var(--transition);
}

#mapContainer.with-right-sidebar {
  right: var(--right-sidebar-w);
}

/* ============================================================
   STATS BUTTON (Left Sidebar)
============================================================ */

/* Sidebar Footer - always visible at bottom of sidebar */
.sidebar-footer {
  flex-shrink: 0;
  padding: 12px 14px 16px;
  border-top: 1px solid var(--sidebar-border);
  background: rgba(255,255,255,0.96);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-footer-copy {
  font-size: 9.5px;
  text-align: center;
  color: var(--sidebar-text-muted);
  opacity: 0.6;
  line-height: 1.5;
}

.btn-statistik {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--accent) 0%, #be123c 100%);
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 700;
  transition: all var(--transition);
  box-shadow: 0 4px 16px var(--accent-glow);
  letter-spacing: 0.2px;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn-statistik::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; bottom: 0;
  width: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s ease;
}

.btn-statistik:hover::before { left: 100%; }

.btn-statistik:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(225,29,72,0.4);
}

.btn-statistik:active { transform: translateY(0); }

.btn-statistik-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.btn-statistik-text {
  flex: 1;
  text-align: left;
}

.btn-statistik-text strong {
  display: block;
  font-size: 12.5px;
}

.btn-statistik-text small {
  font-size: 9.5px;
  font-weight: 500;
  opacity: 0.8;
  display: block;
}

.btn-statistik-arrow {
  font-size: 14px;
  opacity: 0.7;
  flex-shrink: 0;
}

/* ============================================================
   CHART MODAL
============================================================ */
#chartModal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: backdropIn 0.25s ease;
}

#chartModal.hidden { display: none; }

@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.chart-modal-box {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 700px;
  max-height: calc(100vh - 60px);
  overflow: hidden;
  box-shadow: 0 25px 80px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  animation: chartModalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes chartModalIn {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.chart-modal-header {
  padding: 20px 22px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(225,29,72,0.04) 0%, #fff 60%);
}

.chart-modal-icon {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, var(--accent), #be123c);
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  box-shadow: 0 4px 14px var(--accent-glow);
  flex-shrink: 0;
}

.chart-modal-meta {
  flex: 1;
}

.chart-modal-title {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.4px;
}

.chart-modal-subtitle {
  font-size: 11.5px;
  color: var(--sidebar-text-muted);
  font-weight: 500;
  margin-top: 3px;
}

.chart-modal-close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 9px;
  background: #fff;
  color: var(--sidebar-text-muted);
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.chart-modal-close:hover {
  background: #ffe4e6;
  border-color: var(--accent);
  color: var(--accent);
}

.chart-modal-body {
  padding: 20px 22px 22px;
  overflow-y: auto;
  flex: 1;
}

/* Stat Summary Row inside Chart Modal */
.chart-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.chart-stat-mini {
  background: #f8fafc;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: center;
}

.chart-stat-mini-val {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.chart-stat-mini-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--sidebar-text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Chart canvas wrapper */
.chart-canvas-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-canvas-wrap canvas {
  max-width: 100%;
}

/* Dashboard Mini Charts (for modul utuh) */
.chart-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.chart-mini-card {
  background: #f8fafc;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 14px;
  padding: 14px;
}

.chart-mini-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--sidebar-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

/* ============================================================
   RESPONSIVE – Right Sidebar
============================================================ */
@media (max-width: 900px) {
  :root { --right-sidebar-w: 280px; }
}

@media (max-width: 680px) {
  #rightSidebar {
    width: 90vw;
    max-width: 320px;
    border-radius: 16px 0 0 16px;
    border-left: 1px solid rgba(225,29,72,0.15);
  }

  #mapContainer.with-right-sidebar {
    right: 0;
  }

  .chart-modal-box {
    max-width: calc(100vw - 32px);
    max-height: calc(100svh - 40px);
  }

  .chart-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   mb-4 utility
============================================================ */
.mb-4 { margin-bottom: 4px; }

/* ============================================================
   MANAJEMEN DATA PENDUDUK (MODUL BANTUAN)
============================================================ */

/* Tombol Sidebar Kanan Premium */
.btn-manajemen {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #e11d48 0%, #fb7185 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(225, 29, 72, 0.3);
  position: relative;
  overflow: hidden;
}

.btn-manajemen::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; bottom: 0;
  width: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.6s ease;
}

.btn-manajemen:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(225, 29, 72, 0.5);
}

.btn-manajemen:hover::after {
  left: 100%;
}

/* Tabel Manajemen */
.mj-table th {
  border-bottom: 2px solid #e2e8f0;
}
.mj-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.85rem;
  vertical-align: middle;
}
.mj-table tbody tr:hover {
  background: #f8fafc;
}

/* Custom Dropdown Badge Premium */
.mj-dropdown {
  position: relative;
  display: inline-block;
  font-family: var(--font), sans-serif;
}

.mj-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  user-select: none;
}
.mj-dropdown-toggle .caret {
  font-size: 8px;
  opacity: 0.7;
  transition: transform 0.2s;
}
.mj-dropdown.open .mj-dropdown-toggle .caret {
  transform: rotate(180deg);
}

.mj-dropdown-toggle.belum { background: #ffe4e6; color: #be123c; border-color: #fda4af; }
.mj-dropdown-toggle.proses { background: #fef3c7; color: #b45309; border-color: #fcd34d; }
.mj-dropdown-toggle.sudah { background: #dcfce7; color: #15803d; border-color: #86efac; }

.mj-dropdown-toggle:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.mj-dropdown-menu {
  position: absolute;
  min-width: 140px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  border: 1px solid rgba(0,0,0,0.05);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  padding: 4px;
  opacity: 0;
  visibility: hidden;
  transform: scaleY(0.9);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}
.mj-dropdown.open .mj-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: scaleY(1);
}

.mj-dropdown-item {
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
  color: #334155;
  text-align: left;
}
.mj-dropdown-item:hover {
  background: #f1f5f9;
}
.mj-dropdown-item.belum:hover { background: #ffe4e6; color: #be123c; }
.mj-dropdown-item.proses:hover { background: #fef3c7; color: #b45309; }
.mj-dropdown-item.sudah:hover { background: #dcfce7; color: #15803d; }

/* SweetAlert2 Foto Popup Customization */
.swal2-container.swal2-center {
  z-index: 9999999 !important;
}
.swal-foto-popup {
  border-radius: 16px !important;
  overflow: hidden !important;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2) !important;
  padding: 0 !important;
  background: #ffffff !important;
}
.swal-foto-popup .swal2-image {
  margin: 0 !important;
  width: 100% !important;
  border-radius: 16px 16px 0 0 !important;
  object-fit: cover !important;
}
.swal-foto-popup .swal2-actions {
  margin-top: 10px !important;
  padding-bottom: 15px !important;
}

/* Tab Filter */
.mj-tab {
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  color: #64748b;
  border: 1px solid transparent;
}
.mj-tab.active {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #e2e8f0;
}

/* ============================================================
   PRINT CSS (Cetak Laporan)
============================================================ */
@media print {
  /* Pastikan elemen lain disembunyikan */
  body > *:not(#manajemenModal), 
  #sidebar, 
  #rightSidebar, 
  #mapContainer, 
  #rightSidebarToggleBtn,
  .modal-backdrop,
  .modal-close,
  .manajemen-filter,
  .btn-primary[onclick="window.print()"] {
    display: none !important;
  }

  /* Aktifkan warna background & print color exact agar badge tetap berwarna */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: white !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  #manajemenModal {
    display: block !important;
    position: static !important;
    transform: none !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: none !important;
    animation: none !important;
    background: white !important;
  }

  #manajemenModal .modal-body {
    background: white !important;
    overflow: visible !important;
    max-height: none !important;
    padding: 0 !important;
  }

  .table-responsive {
    overflow: visible !important;
    max-height: none !important;
    padding: 0 !important;
  }

  .mj-table {
    width: 100% !important;
    box-shadow: none !important;
    border: 1px solid #e2e8f0 !important;
  }

  .mj-table th, .mj-table td {
    border: 1px solid #e2e8f0 !important;
  }

  @page {
    size: landscape;
    margin: 1cm;
  }
}


