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

html, body { height: 100%; font-family: 'Segoe UI', system-ui, sans-serif; overflow: hidden; }

#map { position: absolute; inset: 0; }

.hidden { display: none !important; }

/* ---------- Top bar ---------- */
#topbar {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; gap: 10px; align-items: center; z-index: 10;
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }

#brand {
  background: #1a73e8; color: #fff; font-weight: 800; font-size: 20px;
  padding: 8px 14px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.3);
  white-space: nowrap;
}
#brand span { color: #ffd54f; }

#searchwrap { position: relative; flex: 1; max-width: 420px; }
#search {
  width: 100%; padding: 11px 14px; border: none; border-radius: 12px;
  font-size: 15px; box-shadow: 0 2px 8px rgba(0,0,0,.3); outline: none;
}
#results {
  position: absolute; top: 48px; left: 0; right: 0;
  background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,.3); list-style: none; z-index: 20;
}
#results li { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #eee; }
#results li:last-child { border-bottom: none; }
#results li:hover { background: #f1f5fb; }
#results li b { display: block; font-size: 14px; color: #1a1a1a; }
#results li small { color: #777; font-size: 12px; }

/* ---------- Speedometer ---------- */
#speed {
  position: absolute; bottom: 20px; left: 12px; z-index: 10;
  background: rgba(20,20,20,.85); color: #fff; border-radius: 14px;
  padding: 8px 12px; text-align: center; min-width: 64px;
}
#speed b { font-size: 24px; display: block; line-height: 1; }
#speed small { font-size: 11px; color: #bbb; }

/* ---------- Report button & picker ---------- */
#btn-report {
  position: absolute; bottom: 160px; right: 12px; z-index: 10;
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  background: #e53935; color: #fff; box-shadow: 0 3px 10px rgba(0,0,0,.4);
}
#btn-report svg { width: 28px; height: 28px; }
#btn-report:hover { background: #c62828; }

#typepicker {
  position: absolute; bottom: 228px; right: 12px; z-index: 11;
  background: #fff; border-radius: 16px; padding: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,.35); width: 240px;
}
#typepicker h3 { font-size: 15px; margin-bottom: 10px; color: #333; }
#typegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.typebtn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 4px; border: 1px solid #e0e0e0; border-radius: 12px;
  background: #fafafa; cursor: pointer; font-size: 12px; color: #333;
}
.typebtn:hover { background: #f0f4ff; border-color: #1a73e8; }
.typebtn svg { width: 24px; height: 24px; }

/* ---------- Report banner ---------- */
#reportbanner {
  position: absolute; top: 70px; left: 50%; transform: translateX(-50%);
  background: #e53935; color: #fff; padding: 10px 16px; border-radius: 12px;
  z-index: 15; font-size: 14px; display: flex; gap: 12px; align-items: center;
  box-shadow: 0 3px 10px rgba(0,0,0,.3); max-width: 92vw;
}
#reportbanner button {
  background: #fff; color: #e53935; border: none; border-radius: 8px;
  padding: 5px 12px; font-weight: 600; cursor: pointer;
}

/* ---------- Route panel ---------- */
#routepanel {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 12;
  background: #fff; border-radius: 18px 18px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,.3);
  max-height: 45vh; display: flex; flex-direction: column;
}
#routesummary {
  padding: 14px 16px 6px; font-size: 15px; font-weight: 600; color: #1a73e8;
}
#routesummary small { color: #666; font-weight: 400; }
.route-actions { display: flex; gap: 8px; padding: 6px 16px 10px; }
.route-actions button {
  flex: 1; padding: 8px; border: none; border-radius: 10px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  background: #e8f0fe; color: #1a73e8;
}
.route-actions button.danger { background: #fdecea; color: #c62828; }
.route-actions button.active { background: #1a73e8; color: #fff; }
#steps {
  overflow-y: auto; padding: 0 16px 16px; list-style: none;
}
#steps li {
  padding: 9px 4px; border-bottom: 1px solid #f0f0f0; font-size: 13px;
  display: flex; justify-content: space-between; gap: 10px;
}
#steps li.next { background: #e8f0fe; border-radius: 8px; font-weight: 600; }
#steps li small { color: #999; white-space: nowrap; }

/* ---------- Report markers ---------- */
.report-marker {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2.5px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4);
  cursor: pointer; color: #fff;
}
.report-marker svg { width: 20px; height: 20px; }

/* ---------- Simulasi kereta ---------- */
.car-marker { width: 34px; height: 34px; }
.car-marker svg {
  width: 100%; height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.5));
  transition: transform .15s linear;
}

/* ---------- Popups ---------- */
.maplibregl-popup-content { border-radius: 12px; padding: 12px 14px; font-size: 13px; }
.maplibregl-popup-content h4 { font-size: 14px; margin-bottom: 4px; }
.maplibregl-popup-content .meta { color: #888; font-size: 11px; margin-bottom: 6px; }
.maplibregl-popup-content .note { color: #555; margin-bottom: 8px; }
.popbtn {
  border: none; border-radius: 8px; padding: 6px 12px; font-size: 12px;
  font-weight: 600; cursor: pointer; background: #e8f0fe; color: #1a73e8;
  margin-right: 6px;
}
.popbtn.confirm { background: #e8f5e9; color: #2e7d32; }

/* ---------- Toast ---------- */
#toast {
  position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: rgba(25,25,25,.92); color: #fff; padding: 10px 18px;
  border-radius: 12px; font-size: 13px; z-index: 30; max-width: 90vw;
  text-align: center;
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  #brand { font-size: 16px; padding: 7px 10px; }
  #routepanel { max-height: 55vh; }
}
