:root {
  --primary: #0f766e;
  --primary-dark: #0d5c56;
  --odc: #7c3aed;
  --odp: #2563eb;
  --pelanggan: #16a34a;
  --feeder: #dc2626;
  --bg: #f1f5f9;
  --sidebar-bg: #0f172a;
  --card: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #334155;
  --success: #10b981;
  --danger: #ef4444;
  --radius: 10px;
  --shadow: 0 4px 12px rgba(0,0,0,0.15);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: #1e293b;
  overflow: hidden;
  height: 100vh;
}

.app-container {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 380px;
  min-width: 340px;
  background: var(--sidebar-bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  box-shadow: 4px 0 20px rgba(0,0,0,0.2);
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, #0f766e, #134e4a);
  border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-header .subtitle {
  font-size: 0.8rem;
  color: #99f6e4;
  margin-top: 0.25rem;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.panel h2 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #f1f5f9;
}

.panel h2 i {
  color: #2dd4bf;
}

/* Upload */
.upload-zone {
  border: 2px dashed #475569;
  border-radius: 8px;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #0f172a;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: #2dd4bf;
  background: #134e4a33;
}

.upload-zone i {
  font-size: 2rem;
  color: #2dd4bf;
  margin-bottom: 0.5rem;
}

.upload-zone p {
  font-size: 0.85rem;
  color: var(--muted);
}

.info-box {
  margin-top: 0.75rem;
  padding: 0.6rem 0.8rem;
  background: #134e4a;
  border-radius: 6px;
  font-size: 0.85rem;
}

.info-box.hidden {
  display: none;
}

/* Buttons */
.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-group.vertical {
  flex-direction: column;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s;
  color: white;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

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

.btn-odc { background: var(--odc); flex: 1; }
.btn-odp { background: var(--odp); flex: 1; }
.btn-pelanggan { background: var(--pelanggan); flex: 1; }
.btn-primary { background: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-export { background: #1e40af; }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.8rem; }
.btn-block { width: 100%; margin-top: 0.5rem; }

.btn.active {
  outline: 2px solid white;
  outline-offset: 2px;
}

.hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

/* Form */
.form-group {
  margin-bottom: 0.75rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
  color: #cbd5e1;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0f172a;
  color: white;
  font-size: 0.9rem;
}

.form-group small {
  font-size: 0.7rem;
  color: var(--muted);
}

.coord-input {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.coord-input label {
  font-size: 0.8rem;
  color: #cbd5e1;
  display: block;
  margin-bottom: 0.4rem;
}

.coord-row {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.coord-row input {
  flex: 1;
  padding: 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0f172a;
  color: white;
  font-size: 0.85rem;
}

.coord-input select {
  width: 100%;
  margin-bottom: 0.4rem;
  padding: 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0f172a;
  color: white;
}

/* Results */
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.result-item {
  background: #0f172a;
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
}

.result-item .label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.result-item .value {
  font-size: 1rem;
  font-weight: 700;
  color: #2dd4bf;
}

/* Point list */
.point-list {
  max-height: 180px;
  overflow-y: auto;
  font-size: 0.8rem;
}

.point-list .empty {
  color: var(--muted);
  text-align: center;
  padding: 0.5rem;
}

.point-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.3rem;
  background: #0f172a;
  border-left: 3px solid;
}

.point-item.odc { border-color: var(--odc); }
.point-item.odp { border-color: var(--odp); }
.point-item.pelanggan { border-color: var(--pelanggan); }

.point-item .name {
  font-weight: 600;
}

.point-item .coords {
  font-size: 0.7rem;
  color: var(--muted);
}

.point-item .del {
  background: transparent;
  border: none;
  color: #f87171;
  cursor: pointer;
  padding: 0.2rem;
}

/* Map */
.map-container {
  flex: 1;
  position: relative;
}

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

.map-toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.tool-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: white;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #334155;
}

.tool-btn:hover {
  background: #f1f5f9;
}

.mode-indicator {
  background: white;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  color: #334155;
}

/* Leaflet marker icons custom */
.marker-odc, .marker-odp, .marker-pelanggan {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: white;
  font-size: 14px;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.marker-odc { background: var(--odc); }
.marker-odp { background: var(--odp); }
.marker-pelanggan { background: var(--pelanggan); }

/* Responsive */
@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    max-height: 45vh;
    min-width: unset;
  }
  .map-container {
    height: 55vh;
  }
}

/* Scrollbar */
.sidebar-content::-webkit-scrollbar,
.point-list::-webkit-scrollbar {
  width: 6px;
}
.sidebar-content::-webkit-scrollbar-track,
.point-list::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-content::-webkit-scrollbar-thumb,
.point-list::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 3px;
}
