:root {
  --text: #6b6375;
  --text-h: #08060d;
  --bg: #fff;
  --border: #e5e4e7;
  --code-bg: #f4f3ec;
  --accent: #aa3bff;
  --accent-bg: rgba(170, 59, 255, 0.1);
  --accent-border: rgba(170, 59, 255, 0.5);
  --social-bg: rgba(244, 243, 236, 0.5);
  --shadow:
    rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;

  --sans: system-ui, 'Segoe UI', Roboto, sans-serif;
  --heading: system-ui, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, Consolas, monospace;

  font: 18px/145% var(--sans);
  letter-spacing: 0.18px;
  color-scheme: light dark;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  @media (max-width: 1024px) {
    font-size: 16px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #9ca3af;
    --text-h: #f3f4f6;
    --bg: #16171d;
    --border: #2e303a;
    --code-bg: #1f2028;
    --accent: #c084fc;
    --accent-bg: rgba(192, 132, 252, 0.15);
    --accent-border: rgba(192, 132, 252, 0.5);
    --social-bg: rgba(47, 48, 58, 0.5);
    --shadow:
      rgba(0, 0, 0, 0.4) 0 10px 15px -3px, rgba(0, 0, 0, 0.25) 0 4px 6px -2px;
  }

  #social .button-icon {
    filter: invert(1) brightness(2);
  }
}

body {
  margin: 0;
  padding: 0;
}

#root {
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

h1,
h2 {
  font-family: var(--heading);
  font-weight: 500;
  color: var(--text-h);
}

h1 {
  font-size: 56px;
  letter-spacing: -1.68px;
  margin: 32px 0;
  @media (max-width: 1024px) {
    font-size: 36px;
    margin: 20px 0;
  }
}
h2 {
  font-size: 24px;
  line-height: 118%;
  letter-spacing: -0.24px;
  margin: 0 0 8px;
  @media (max-width: 1024px) {
    font-size: 20px;
  }
}
p {
  margin: 0;
}

code,
.counter {
  font-family: var(--mono);
  display: inline-flex;
  border-radius: 4px;
  color: var(--text-h);
}

code {
  font-size: 15px;
  line-height: 135%;
  padding: 4px 8px;
  background: var(--code-bg);
}

/* Custom Floating Map Legend styling */
.map-legend {
  position: absolute;
  bottom: 30px;
  right: 20px;
  background: white;
  padding: 12px 16px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: #333;
  z-index: 1000; /* Keeps it layered above the Leaflet tiles canvas */
  min-width: 150px;
}

.legend-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.legend-label {
  font-weight: 500;
}

.legend-divider {
  border: 0;
  border-top: 1px solid #ccc;
  margin: 10px 0;
}

/* Icon Representation Geometries */
.legend-icon {
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.circle-orange {
  width: 12px;
  height: 12px;
  background-color: #ff9f00;
  border-radius: 50%;
  margin-left: 2px;
}

/* Line Assets styling */
.legend-line {
  width: 20px;
  height: 4px;
  border-radius: 2px;
  display: inline-block;
}

.line-blue { background-color: #0000ff; }
.line-green { background-color: #008000; }
.line-yellow { background-color: #ffff00; }

/* Polygon Box Assets styling */
.legend-box {
  width: 18px;
  height: 14px;
  display: inline-block;
  border-radius: 2px;
}

.box-purple {
  background-color: rgba(128, 0, 128, 0.4);
  border: 2px solid purple;
}

/* Floating Pill-shaped Menu Bar styling */
.map-action-bar {
  position: absolute;
  top: 12px;
  left: 60px; /* Shifts it right over so it clears the map zoom panel */
  background: white;
  padding: 6px 14px;
  border-radius: 30px; /* Soft round pill border design edge */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  font-family: system-ui, -apple-system, sans-serif;
  z-index: 1000; /* Pushes element visibility above standard base map layer */
  display: flex;
  align-items: center;
  gap: 16px;
}

.action-btn {
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 20px;
  transition: all 0.2s ease;
}

/* Hover style template to test structural responsiveness */
.action-btn:hover {
  background-color: #f3f4f6;
  color: #000;
}

.action-btn.active {
  background-color: #e0e7ff;
  color: #4f46e5;
  border: 1px solid #c7d2fe;
}

.font-medium {
  font-weight: 600;
}

/* Specific formatting adjustments for the Location marker */
.location-btn {
  color: #0026e6;
  display: flex;
  align-items: center;
  gap: 4px;
}

.location-btn:hover {
  background-color: rgba(0, 38, 230, 0.08);
}

.pin-emoji {
  font-size: 14px;
}

/* Insertion Toolbar Highlight Styling */
.action-btn.btn-insert.inserting {
  background-color: #f59e0b !important;
  color: white !important;
  border-color: #d97706 !important;
  font-weight: bold;
}

/* Modal Overlay Framework wrapper */
.custom-modal-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex; justify-content: center; align-items: center;
  z-index: 9999; /* Higher than Leaflet overlays */
}

.custom-modal-container {
  background: white;
  padding: 24px;
  border-radius: 12px;
  width: 450px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  font-family: 'Segoe UI', Roboto, sans-serif;
}

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.modal-header h2 { margin: 0; font-size: 1.4rem; color: #1f2937; }
.close-x-btn { background: none; border: none; font-size: 24px; cursor: pointer; color: #9ca3af; }
.close-x-btn:hover { color: #111827; }

.coord-badge {
  background-color: #f3f4f6; color: #4b5563;
  padding: 8px 12px; border-radius: 6px;
  font-size: 0.85rem; font-family: monospace; margin-bottom: 16px;
}

.form-group { margin-bottom: 14px; display: flex; flex-direction: column; }
.form-group label { font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; color: #4b5563; }
.form-group input, .form-group select {
  padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.9rem;
}
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: #4f46e5; box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

/* Checkbox alignment metrics */
.checkbox-grid {
  display: grid; grid-template-columns: 1fr; gap: 6px;
  background: #f9fafb; padding: 10px; border-radius: 6px; border: 1px solid #e5e7eb;
}
.check-item { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; cursor: pointer; }

.submit-btn {
  width: 100%; padding: 10px; border: none; border-radius: 6px;
  font-weight: 600; font-size: 1rem; cursor: pointer; transition: background 0.2s; color: white;
}
.submit-btn.save-ibadah { background-color: #2563eb; }
.submit-btn.save-ibadah:hover { background-color: #1d4ed8; }
.submit-btn.save-miskin { background-color: #dc2626; }
.submit-btn.save-miskin:hover { background-color: #b91c1c; }

.finish-draw-btn {
  background-color: #10b981;
  color: white;
  border: 1px solid #059669;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  animation: pulse 2s infinite;
}
.finish-draw-btn:hover {
  background-color: #059669;
}