/* ==============================================================================
   GeoPortal Pendidikan Jatim - KUGI (Provinsi Jawa Timur)
   Design System & Modern Spatial Stylesheet
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Colors */
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --primary-dark: #1e3a8a;
  --primary-subtle: #eff6ff;
  
  --sma-color: #2563eb;
  --smk-color: #ea580c;
  --slb-color: #059669;
  --negeri-color: #0284c7;
  --swasta-color: #7c3aed;
  
  --bg-app: #0f172a;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --surface-hover: #f1f5f9;
  
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --header-height: 64px;
  --sidebar-width: 380px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-app);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

/* ==============================================================================
   1. NAVBAR / HEADER
   ============================================================================== */
.navbar {
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
  flex-shrink: 0;
}

.brand-info h1 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  text-transform: uppercase;
}

.brand-badge.rbi {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.brand-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.coord-display {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 8px;
}

.coord-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.btn {
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  background: transparent;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}
.btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-icon-only {
  width: 38px;
  padding: 0;
  justify-content: center;
}

/* ==============================================================================
   2. MAIN CONTAINER & SIDEBAR
   ============================================================================== */
.app-container {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 500;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

.sidebar.collapsed {
  transform: translateX(-100%);
  position: absolute;
  height: 100%;
}

.sidebar-toggle-btn {
  position: absolute;
  left: var(--sidebar-width);
  top: 16px;
  z-index: 600;
  background: #ffffff;
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  width: 30px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.08);
  color: var(--text-muted);
  transition: var(--transition);
}
.sidebar.collapsed ~ .sidebar-toggle-btn {
  left: 0;
  border-left: 1px solid var(--border);
}
.sidebar.collapsed ~ .sidebar-toggle-btn i,
.sidebar.collapsed ~ .sidebar-toggle-btn svg {
  transform: rotate(180deg);
}
.sidebar-toggle-btn:hover {
  color: var(--primary);
  background: #f8fafc;
}

/* Sidebar Tabs */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  padding: 6px 6px 0 6px;
  gap: 3px;
}

.tab-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 3px;
  font-size: 0.71rem;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: var(--transition);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  white-space: nowrap;
}
.tab-btn:hover {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.7);
}
.tab-btn.active {
  color: var(--primary);
  background: #ffffff;
  border-bottom-color: var(--primary);
}

.tab-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  line-height: 13px;
  transition: var(--transition);
}
.tab-btn.active .tab-badge {
  background: #2563eb;
  color: #ffffff;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sidebar-content::-webkit-scrollbar { width: 6px; }
.sidebar-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 18px;
}
.tab-panel.active {
  display: flex;
}

/* Section Header */
.section-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

/* Metric / KPI Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.metric-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.metric-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}
.metric-card.total::before { background: var(--primary); }
.metric-card.sma::before { background: var(--sma-color); }
.metric-card.smk::before { background: var(--smk-color); }
.metric-card.slb::before { background: var(--slb-color); }

.metric-val {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}
.metric-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Filter Controls */
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.input-control, .select-control {
  width: 100%;
  height: 40px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  color: var(--text-main);
  background-color: #ffffff;
  outline: none;
  transition: var(--transition);
}
.input-control:focus, .select-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.pill-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill-btn {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: var(--transition);
}
.pill-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.pill-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

/* Search Box with Clear Button */
.search-wrapper {
  position: relative;
}
.search-wrapper input {
  padding-left: 36px;
  padding-right: 32px;
}
.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}
.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  display: none;
}
.search-clear:hover { color: #475569; }

/* KUGI Info Box */
.kugi-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 0.78rem;
  line-height: 1.5;
}
.kugi-card-header {
  font-weight: 700;
  color: #1e3a8a;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.kugi-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed #e2e8f0;
}
.kugi-row:last-child { border-bottom: none; }
.kugi-key { font-weight: 600; color: #475569; font-family: 'JetBrains Mono', monospace; font-size: 0.74rem; }
.kugi-val { color: #0f172a; font-weight: 500; }

/* ==============================================================================
   3. MAP CANVAS & FLOATING CONTROLS
   ============================================================================== */
.map-wrapper {
  flex: 1;
  position: relative;
  height: 100%;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Leaflet Controls Customization (Anti-Collision with Sidebar Toggle) */
.leaflet-top .leaflet-control-zoom {
  margin-top: 72px !important;
  margin-left: 14px !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
  overflow: hidden !important;
}

.leaflet-control-zoom a {
  background: #ffffff !important;
  color: #1e293b !important;
  width: 32px !important;
  height: 32px !important;
  line-height: 32px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  border-bottom: 1px solid #f1f5f9 !important;
  transition: all 0.2s ease !important;
}

.leaflet-control-zoom a:last-child {
  border-bottom: none !important;
}

.leaflet-control-zoom a:hover {
  background: #f8fafc !important;
  color: #2563eb !important;
}

/* ==========================================================================
   INA-GEOPORTAL STYLE RIGHT SIDEBAR (TANAHAIR.INDONESIA.GO.ID)
   ========================================================================== */

.map-right-sidebar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 550;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 6px 4px;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.12);
  gap: 3px;
  user-select: none;
}

/* Individual Rail Button */
.rail-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}
.rail-btn:hover {
  background: #f1f5f9;
  color: #1e40af;
  border-color: #cbd5e1;
}
.rail-btn.active {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border-color: #93c5fd !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2) !important;
}
.rail-btn.active-area {
  background: #ecfdf5 !important;
  color: #047857 !important;
  border-color: #a7f3d0 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25) !important;
}
.rail-btn svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.1px;
}

/* Tooltip (Left Popout) */
.rail-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  right: calc(100% + 9px);
  top: 50%;
  transform: translateY(-50%) scale(0.95);
  background: #0f172a;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  font-family: 'Inter', -apple-system, sans-serif;
}
.rail-btn[data-tooltip]::before {
  content: "";
  position: absolute;
  right: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: transparent transparent transparent #0f172a;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
  z-index: 1000;
}
.rail-btn[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) scale(1);
}
.rail-btn[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Divider between rail groups */
.rail-divider {
  width: 24px;
  height: 1px;
  background: #e2e8f0;
  margin: 3px 0;
}

/* Flyout Panel (Basemap Switcher) */
.rail-flyout-panel {
  display: none;
  position: absolute;
  top: 0;
  right: 50px;
  width: 285px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: -4px 6px 24px rgba(0, 0, 0, 0.14);
  padding: 14px;
  z-index: 600;
}
.rail-flyout-panel.show {
  display: block;
  animation: flyoutSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes flyoutSlide {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

.rail-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}
.rail-panel-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  transition: all 0.15s;
}
.rail-panel-close:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* Basemap Card List in Flyout */
.basemap-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.basemap-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #f8fafc;
}
.basemap-card:hover {
  background: #ffffff;
  border-color: #93c5fd;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}
.basemap-card.active {
  background: #eff6ff;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.basemap-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
}
.basemap-card-icon.rbi-icon { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.basemap-card-icon.sat-icon { background: linear-gradient(135deg, #10b981, #047857); }
.basemap-card-icon.osm-icon { background: linear-gradient(135deg, #64748b, #334155); }
.basemap-card-icon.dark-icon { background: linear-gradient(135deg, #334155, #0f172a); }
.basemap-card-icon svg { width: 16px; height: 16px; }

.basemap-card-info {
  flex: 1;
  min-width: 0;
}
.basemap-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  color: #0f172a;
}
.basemap-card.active .basemap-card-title span:first-child {
  color: #1d4ed8;
}
.basemap-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}
.basemap-badge.rbi { background: #dbeafe; color: #1e40af; }
.basemap-badge.sat { background: #dcfce7; color: #166534; }
.basemap-badge.osm { background: #f1f5f9; color: #475569; }
.basemap-badge.dark { background: #e2e8f0; color: #0f172a; }

.basemap-card-desc {
  font-size: 0.68rem;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.25;
}
.basemap-check {
  display: none;
  color: #2563eb;
  flex-shrink: 0;
}
.basemap-card.active .basemap-check {
  display: flex;
  align-items: center;
}
.basemap-check svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5px;
}

/* Floating Measurement Notification Banner */
.measure-banner {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  background: #ffffff;
  border: 2px solid #2563eb;
  border-radius: 999px;
  padding: 8px 18px;
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.35);
  display: none;
  align-items: center;
  gap: 14px;
  animation: slideDown 0.25s ease;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.measure-banner.active {
  display: flex;
}
.measure-banner.area-mode {
  border-color: #10b981;
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.35);
}
@keyframes slideDown {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.measure-banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e293b;
}

.map-measuring, .map-measuring .leaflet-container {
  cursor: crosshair !important;
}

/* Measurement Segment Distance Badges */
.measure-segment-div {
  background: transparent !important;
  border: none !important;
}
.measure-segment-pill {
  background: rgba(255, 255, 255, 0.94);
  border: 1.5px solid #dc2626;
  color: #b91c1c;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  pointer-events: none;
  backdrop-filter: blur(4px);
  transform: translateY(-50%);
}

.measure-tooltip {
  background: #0f172a !important;
  border: 1px solid #334155 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  font-size: 0.72rem !important;
  padding: 3px 8px !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
}
.measure-tooltip::before {
  border-top-color: #0f172a !important;
}

/* Floating Legend */
.floating-legend {
  position: absolute;
  bottom: 24px;
  right: 16px;
  z-index: 500;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  width: 250px;
  max-height: 480px;
  overflow-y: auto;
  transition: var(--transition);
}
.floating-legend::-webkit-scrollbar {
  width: 5px;
}
.floating-legend::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
.legend-header {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #334155;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  cursor: pointer;
}
.legend-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.legend-sec-title {
  font-size: 0.68rem;
  font-weight: 800;
  color: #1e40af;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 8px;
  margin-bottom: 6px;
  padding-bottom: 3px;
  border-bottom: 1px dashed #cbd5e1;
}
.legend-items > div:first-child .legend-sec-title {
  margin-top: 0;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.74rem;
  color: #334155;
  font-weight: 600;
  margin-bottom: 3px;
}
.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}
.legend-color.sma { background: var(--sma-color); }
.legend-color.smk { background: var(--smk-color); }
.legend-color.slb { background: var(--slb-color); }
.legend-color.boundary { 
  background: transparent; 
  border: 2px dashed #0284c7; 
  border-radius: 3px; 
  width: 16px; 
  height: 10px; 
}

/* Rawan Bencana Marker & Cluster Styles */
.rawan-cluster-icon {
  background-color: rgba(185, 28, 28, 0.9) !important;
  color: #ffffff !important;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 13px;
  border: 3px solid rgba(254, 226, 226, 0.7);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}
.rawan-icon-dot {
  width: 14px;
  height: 14px;
  background-color: #ef4444;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* ==============================================================================
   4. CUSTOM LEAFLET MARKERS & POPUP
   ============================================================================== */
.custom-school-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
  border: 2.5px solid #ffffff;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.custom-school-icon:hover {
  transform: scale(1.22);
  z-index: 9999 !important;
}
.custom-school-icon.sma { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.custom-school-icon.smk { background: linear-gradient(135deg, #fb923c, #ea580c); }
.custom-school-icon.slb { background: linear-gradient(135deg, #10b981, #047857); }

/* Marker Cluster Customization */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
  background: rgba(37, 99, 235, 0.2) !important;
  border-radius: 50%;
}
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
  background: linear-gradient(135deg, #2563eb, #1e40af) !important;
  color: #ffffff !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-weight: 800 !important;
  font-size: 0.82rem !important;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35) !important;
}

/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
  padding: 0 !important;
  border-radius: var(--radius-lg) !important;
  overflow: hidden !important;
  box-shadow: var(--shadow-xl) !important;
  border: 1px solid var(--border) !important;
}
.leaflet-popup-content {
  margin: 0 !important;
  width: 330px !important;
  line-height: 1.4 !important;
}

.kugi-popup {
  display: flex;
  flex-direction: column;
}
.kugi-popup-header {
  padding: 14px 16px;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #ffffff;
}
.kugi-popup-title {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.kugi-badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.kugi-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  text-transform: uppercase;
}
.kugi-badge.akreditasi-a { background: #10b981; }
.kugi-badge.akreditasi-b { background: #3b82f6; }
.kugi-badge.akreditasi-c { background: #f59e0b; }

.kugi-popup-body {
  padding: 14px 16px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
}
.popup-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid #f1f5f9;
}
.popup-row:last-child { border-bottom: none; }
.popup-key {
  color: #64748b;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  flex-shrink: 0;
}
.popup-val {
  color: #0f172a;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.kugi-popup-footer {
  padding: 10px 16px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
}
.btn-popup {
  flex: 1;
  height: 32px;
  font-size: 0.74rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  transition: var(--transition);
}
.btn-popup:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}
.btn-popup.primary {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}
.btn-popup.primary:hover {
  background: #1d4ed8;
}

/* ==============================================================================
   5. DRAWER TABEL ATRIBUT KUGI
   ============================================================================== */
.attribute-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 380px;
  background: #ffffff;
  border-top: 2px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
  z-index: 700;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.attribute-drawer.open {
  transform: translateY(0);
}

.drawer-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}
.drawer-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}
.drawer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-scroll-wrap {
  flex: 1;
  overflow: auto;
  padding: 0 20px 20px 20px;
}
.table-scroll-wrap::-webkit-scrollbar { height: 8px; width: 8px; }
.table-scroll-wrap::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.kugi-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8rem;
  margin-top: 10px;
}
.kugi-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  border-bottom: 2px solid #cbd5e1;
  white-space: nowrap;
  z-index: 2;
}
.kugi-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  white-space: nowrap;
}
.kugi-table tbody tr:hover td {
  background: #f8fafc;
}

/* ==============================================================================
   6. MODAL EXPORT & DIALOGS
   ============================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  border: 1px solid var(--border);
  animation: modalIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}
.modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: #0f172a; }

.modal-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.export-option-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
}
.export-option-card:hover {
  border-color: var(--primary-light);
  background: #f8fafc;
  transform: translateY(-1px);
}
.export-info h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}
.export-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==============================================================================
   7. METADATA MODAL (ISO 19115-3 / SNI 8843-1:2019)
   ============================================================================== */
.modal-card.modal-lg {
  max-width: 920px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.meta-tabs {
  display: flex;
  overflow-x: auto;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  gap: 6px;
}

.meta-tab-btn {
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: var(--transition);
}

.meta-tab-btn:hover {
  color: var(--primary);
}

.meta-tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  background: #ffffff;
}

.meta-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.meta-tab-pane {
  display: none;
}
.meta-tab-pane.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.meta-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.meta-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.meta-box-header {
  font-size: 0.8rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.meta-kv {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.77rem;
  border-bottom: 1px dashed #f1f5f9;
}
.meta-kv:last-child {
  border-bottom: none;
}
.meta-k {
  color: #64748b;
  font-weight: 600;
}
.meta-v {
  color: #0f172a;
  font-weight: 700;
  text-align: right;
}

.meta-text-block {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.8rem;
  line-height: 1.6;
  color: #334155;
}

.xml-code-container {
  position: relative;
  background: #0f172a;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #334155;
}

.xml-code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  color: #94a3b8;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
}

.xml-code-box {
  max-height: 400px;
  overflow: auto;
  padding: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: #e2e8f0;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Desktop helper classes for mobile components */
.btn-mobile-catalog { display: none; }
.sidebar-mobile-top-bar { display: none; }
.sidebar-backdrop { display: none; }

/* ==============================================================================
   8. RESPONSIVE MEDIA QUERIES (OPTIMASI HP & TABLET)
   ============================================================================== */
@media (max-width: 768px) {
  /* 1. Header Navbar di HP */
  .navbar {
    padding: 0 8px !important;
    height: 52px !important;
    gap: 6px !important;
  }
  .brand-wrapper {
    gap: 6px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
    margin-right: 6px !important;
  }
  .brand-logo {
    width: 24px !important;
    height: 24px !important;
    border-radius: 6px !important;
    flex-shrink: 0 !important;
  }
  .brand-logo svg {
    width: 14px !important;
    height: 14px !important;
  }
  .brand-info {
    min-width: 0 !important;
    overflow: hidden !important;
    flex: 1 1 auto !important;
  }
  .brand-info h1 {
    font-size: clamp(0.76rem, 3.2vw, 0.85rem) !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0 !important;
    letter-spacing: -0.02em !important;
  }
  .brand-sub, .coord-display {
    display: none !important;
  }
  .nav-actions {
    gap: 3px !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
  }
  /* Sembunyikan tombol ekstra di navbar HP agar rapi */
  #btn-nav-metadata,
  #btn-nav-wms,
  #btn-nav-export,
  #btn-reset-view,
  #btn-fullscreen {
    display: none !important;
  }
  .nav-actions .btn {
    height: 30px !important;
    font-size: 0.72rem !important;
  }
  /* Sembunyikan teks tombol sekunder navbar agar pas di HP */
  .nav-actions .btn:not(.btn-mobile-catalog) span {
    display: none !important;
  }
  .nav-actions .btn:not(.btn-mobile-catalog) {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    border-radius: 6px !important;
    justify-content: center !important;
  }
  .nav-actions .btn:not(.btn-mobile-catalog) svg {
    width: 14px !important;
    height: 14px !important;
  }
  .btn-mobile-catalog {
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
    padding: 0 7px !important;
    height: 30px !important;
    font-size: 0.71rem !important;
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    border-radius: 6px !important;
  }
  .btn-mobile-catalog svg {
    width: 13px !important;
    height: 13px !important;
  }
  .btn-mobile-catalog span {
    display: inline !important;
  }

  /* 2. Sidebar Drawer di HP (Off-Canvas Slider) */
  .sidebar {
    position: absolute !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(86vw, 340px) !important;
    max-width: 340px !important;
    height: 100% !important;
    z-index: 1200 !important;
    box-shadow: 6px 0 28px rgba(0, 0, 0, 0.28) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    transform: translateX(-100%); /* Tersembunyi default di HP agar peta langsung terlihat */
  }
  .sidebar:not(.collapsed) {
    transform: translateX(0) !important;
  }
  .sidebar-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar-close-mobile-btn {
    display: flex !important;
    color: #ef4444 !important;
    margin-left: auto;
    border-left: 1px solid #fee2e2;
    background: #fff5f5;
  }
  .sidebar-close-mobile-btn:hover {
    background: #fee2e2;
  }

  /* 3. Backdrop Gelap saat Sidebar Terbuka di HP */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1150;
  }
  .sidebar-backdrop.show {
    display: block !important;
  }

  /* 4. Tombol Toggle Sidebar Kiri (WAJIB TAMPIL DI HP) */
  .sidebar-toggle-btn {
    display: flex !important;
    position: absolute !important;
    top: 14px !important;
    z-index: 1250 !important;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  .sidebar.collapsed ~ .sidebar-toggle-btn {
    left: 0 !important;
    width: 32px !important;
    height: 42px !important;
    border-radius: 0 8px 8px 0 !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-left: none !important;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.15) !important;
  }
  .sidebar:not(.collapsed) ~ .sidebar-toggle-btn {
    left: min(86vw, 340px) !important;
  }

  /* Header Mobile Drawer & Tombol Tutup */
  .sidebar-mobile-top-bar {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 10px 14px !important;
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    flex-shrink: 0 !important;
  }
  .mobile-drawer-close-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    background: #fee2e2 !important;
    color: #dc2626 !important;
    border: 1px solid #fecaca !important;
    border-radius: 6px !important;
    padding: 5px 10px !important;
    font-size: 0.74rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: background 0.15s ease !important;
  }
  .mobile-drawer-close-btn:hover {
    background: #fecaca !important;
  }

  /* 5. Toolbar Cepat Kanan (Ina-Geoportal Rail) di HP */
  .map-right-sidebar {
    top: 10px !important;
    right: 8px !important;
    padding: 4px 3px !important;
    gap: 2px !important;
    z-index: 900 !important;
  }
  .rail-btn {
    width: 32px !important;
    height: 32px !important;
  }
  .rail-btn svg {
    width: 15px !important;
    height: 15px !important;
  }
  .rail-flyout-panel {
    right: 42px !important;
    width: min(280px, calc(100vw - 56px)) !important;
    max-height: calc(100vh - 120px) !important;
    overflow-y: auto !important;
  }

  /* 6. Penyesuaian Kontrol Zoom Leaflet */
  .leaflet-top.leaflet-left {
    margin-top: 60px !important;
    margin-left: 8px !important;
  }
  .leaflet-bottom.leaflet-left {
    margin-bottom: 84px !important;
    margin-left: 12px !important;
  }

  /* 7. Banner Prompt di HP: Tampilkan Hanya Tombol Tambahkan Peta Sekolah (Teks dan Ikon Dihilangkan) */
  .map-catalog-prompt {
    bottom: 72px !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    max-width: calc(100vw - 28px) !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    z-index: 990 !important;
    gap: 0 !important;
  }
  .map-catalog-prompt .prompt-icon,
  .map-catalog-prompt .prompt-content {
    display: none !important;
  }
  .map-catalog-prompt .btn {
    height: 42px !important;
    padding: 0 18px !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    border-radius: 9999px !important;
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    color: #ffffff !important;
    border: 1.5px solid rgba(255, 255, 255, 0.6) !important;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45), 0 2px 6px rgba(0, 0, 0, 0.15) !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
  }
  .map-catalog-prompt .btn:active {
    transform: scale(0.96) !important;
  }

  /* 8. Sembunyikan Legenda Simbol KUGI di HP */
  #floating-legend,
  .floating-legend {
    display: none !important;
  }

  /* 9. Floating Measurement Banner */
  .measure-banner {
    top: 8px !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    transform: none !important;
  }
}

/* ==============================================================================
   9. KATALOG SIMPUL JARINGAN & LAYER AKTIF (INSPIRASI TANAHAIR.INDONESIA.GO.ID)
   ============================================================================== */
.catalog-header-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
}

.catalog-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
  overflow: hidden;
  margin-bottom: 12px;
}

.catalog-group-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  color: #1e293b;
}

.catalog-group-count {
  font-size: 0.68rem;
  font-weight: 600;
  color: #64748b;
  background: #e2e8f0;
  padding: 1px 7px;
  border-radius: 999px;
}

.catalog-card {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}
.catalog-card:last-child {
  border-bottom: none;
}
.catalog-card:hover {
  background: #fafafa;
}

.catalog-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.catalog-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
}

.catalog-info-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.catalog-info-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  transform: scale(1.08);
}

.catalog-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.meta-tag {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}
.tag-kugi {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.tag-type {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.tag-scale {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.catalog-desc {
  font-size: 0.74rem;
  color: #64748b;
  line-height: 1.4;
  margin-bottom: 10px;
}

.catalog-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.catalog-status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.catalog-status-badge.status-inactive {
  color: #64748b;
}
.catalog-status-badge.status-inactive .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
}
.catalog-status-badge.status-active {
  color: #059669;
}
.catalog-status-badge.status-active .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 0.74rem;
}

/* Layer Aktif Tab */
.layers-empty-state {
  text-align: center;
  padding: 32px 18px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  margin-top: 10px;
}

.empty-icon-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #eff6ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.active-layer-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.layer-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.layer-card-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.layer-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #2563eb;
}

.layer-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.layer-btn-remove {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.layer-btn-remove:hover {
  color: #ef4444;
  background: #fef2f2;
}

.layer-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #f1f5f9;
}

.layer-slider-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  min-width: 55px;
}

.layer-slider {
  flex: 1;
  height: 4px;
  accent-color: #2563eb;
  cursor: pointer;
}

.layer-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.filter-layer-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 16px;
}

/* Floating Catalog Prompt on Map */
.map-catalog-prompt {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 12px 18px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 600px;
  width: calc(100% - 40px);
  animation: promptSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
@keyframes promptSlideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.prompt-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #eff6ff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid #dbeafe;
}

.prompt-content {
  flex: 1;
  min-width: 0;
}

.prompt-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
}

.prompt-sub {
  font-size: 0.74rem;
  color: #64748b;
  line-height: 1.35;
}

/* ==============================================================================
   10. MODAL ANALISIS PERFORMA (SEPERTI TANAHAIR.INDONESIA.GO.ID)
   ============================================================================== */
.perf-modal-card {
  width: 100%;
  max-width: 530px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: modalScaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.perf-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.perf-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.perf-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  text-transform: uppercase;
}

.perf-close-btn {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.perf-close-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

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

.perf-layer-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 3px;
  line-height: 1.35;
}

.perf-layer-url {
  font-size: 0.72rem;
  color: #64748b;
  font-family: 'JetBrains Mono', monospace;
  word-break: break-all;
  margin-bottom: 18px;
}

.perf-checks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.perf-check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.perf-check-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ecfdf5;
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.perf-check-info {
  flex: 1;
}

.perf-check-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
}

.perf-check-status {
  font-size: 0.74rem;
  font-weight: 600;
  margin-top: 1px;
}
.perf-check-status.text-green {
  color: #059669;
}

.perf-legend-row {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.7rem;
  color: #64748b;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
}

.perf-dot-item {
  display: flex;
  align-items: center;
}

.perf-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}
.dot-green { background: #10b981; }
.dot-yellow { background: #f59e0b; }
.dot-red { background: #ef4444; }
.dot-orange { background: #f97316; }

.perf-notice-box {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.78rem;
  color: #065f46;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}

.perf-modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid #f1f5f9;
  background: #fafafa;
}

.perf-btn-cancel {
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.perf-btn-cancel:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.perf-btn-add {
  height: 38px;
  padding: 0 20px;
  border-radius: 8px;
  border: none;
  background: #0f172a;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}
.perf-btn-add:hover {
  background: #1e293b;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
  transform: translateY(-1px);
}

/* Map Tooltip KUGI & Landing Standard */
.map-tooltip {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 8px 10px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
  font-family: 'Inter', sans-serif !important;
  pointer-events: none !important;
}
.map-tooltip::before {
  border-top-color: #cbd5e1 !important;
}
.map-tooltip strong {
  color: #0f172a;
}

/* ==============================================================================
   WMS OGC MODAL STYLING
   ============================================================================== */
.wms-url-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.wms-url-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.wms-input-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.wms-url-input {
  flex: 1;
  min-width: 250px;
  height: 38px;
  padding: 0 12px;
  font-family: monospace;
  font-size: 0.85rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #0f172a;
}
.wms-url-input:focus {
  border-color: #8b5cf6;
  outline: none;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.wms-layers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.wms-layer-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wms-layer-code {
  font-family: monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: #2563eb;
}
.wms-layer-desc {
  font-size: 0.76rem;
  color: #64748b;
  line-height: 1.4;
}
.wms-tabs-nav {
  display: flex;
  border-bottom: 2px solid #e2e8f0;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
}
.wms-tab-btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}
.wms-tab-btn:hover {
  color: #0f172a;
}
.wms-tab-btn.active {
  color: #8b5cf6;
  border-bottom-color: #8b5cf6;
}
.wms-tab-pane {
  display: none;
}
.wms-tab-pane.active {
  display: block;
}
.wms-guide-step {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-start;
}
.wms-step-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #8b5cf6;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.wms-step-text {
  font-size: 0.82rem;
  color: #334155;
  line-height: 1.5;
}
.wms-code-box {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 8px;
  padding: 12px 14px;
  font-family: monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-x: auto;
}

/* ==========================================================================
   KUGI MAP DATA LABELS & TOGGLE SWITCHES
   ========================================================================== */

/* Compact Toggle Switch */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
  flex-shrink: 0;
  vertical-align: middle;
}
.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
  margin: 0;
  pointer-events: none;
}
.switch-toggle .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .25s ease;
  border-radius: 20px;
}
.switch-toggle .slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: .25s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.switch-toggle input:checked + .slider {
  background-color: #2563eb;
}
.switch-toggle input:checked + .slider:before {
  transform: translateX(14px);
}

/* Leaflet Marker Label Div Icon Reset */
.map-label-div-icon {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Catalog Card Label Option Row */
.catalog-label-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 10px 0;
  padding: 6px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.2s ease;
}
.catalog-label-option:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* Floating Tool Active State */
.tool-btn.active {
  background: #eff6ff !important;
  border-color: #3b82f6 !important;
  color: #1d4ed8 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* KUGI Map Centroid Labels (Choropleth Polygons) */
.map-kugi-label {
  position: absolute;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  z-index: 450;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.map-kugi-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 8px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  line-height: 1.15;
}

.map-kugi-badge .label-title {
  font-size: 9.5px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.map-kugi-badge .label-val {
  font-size: 10px;
  font-weight: 800;
  margin-top: 1px;
}

.label-val-apk {
  color: #38bdf8; /* Sky Blue */
}
.label-val-apm {
  color: #4ade80; /* Bright Green */
}
.label-val-ats {
  color: #f87171; /* Coral Red */
}
.label-val-stunting {
  color: #fb923c; /* Bright Orange */
}
.label-val-sekolah {
  color: #93c5fd; /* Soft Blue */
}
.label-val-rawan {
  color: #fb7185; /* Rose */
}

/* Point Micro Label for School Points */
.school-micro-label {
  position: absolute;
  transform: translate(-50%, -100%);
  margin-top: -9px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 460;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
.school-micro-label .school-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #cbd5e1;
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  font-size: 9px;
  font-weight: 700;
  color: #0f172a;
}
.school-micro-label.rawan-micro .school-pill {
  border-color: #fca5a5;
  background: #fff5f5;
  color: #991b1b;
}
