/* ==========================================================================
   Jajanan Bestie — Driver App
   Design concept: "dashboard ojek malam" — asphalt dark surface, amber
   streetlamp accent for waiting/attention, cool blue for in-progress,
   green for done. Condensed display type reads like route signage;
   mono type carries IDs, prices and timestamps like a meter readout.
   ========================================================================== */

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

:root {
  --bg: #12151a;
  --surface: #1c2028;
  --surface-2: #232833;
  --line: #2c313c;

  --amber: #ffb020;
  --amber-dim: #4a3a1a;
  --blue: #4c9eeb;
  --blue-dim: #1c2f42;
  --green: #33c481;
  --green-dim: #163527;
  --red: #ff5a5f;
  --red-dim: #3a1e20;

  --text: #f5f3ee;
  --text-dim: #9aa0ac;
  --text-faint: #5c6270;

  --radius: 14px;
  --radius-sm: 9px;

  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background:
    radial-gradient(1200px 400px at 50% -10%, rgba(255,176,32,0.08), transparent 60%),
    var(--bg);
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.hidden { display: none !important; }

/* ---------- Screens ---------- */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 18px 90px;
  animation: fade-in .22s ease;
}
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.back-btn {
  background: var(--surface);
  color: var(--text);
  width: 36px; height: 36px;
  border-radius: 10px;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}

.screen-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: .3px;
  text-transform: uppercase;
}

/* ---------- Login ---------- */
#screen-login {
  justify-content: center;
  padding-bottom: 20px;
}

.brand {
  text-align: center;
  margin-bottom: 40px;
}

.brand-mark {
  font-size: 46px;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 18px rgba(255,176,32,.35));
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 34px;
  text-transform: uppercase;
  letter-spacing: .5px;
  line-height: 1;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--amber);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 6px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.field input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
  padding: 14px 14px;
  border-radius: var(--radius-sm);
}

.field input:focus {
  border-color: var(--amber);
}

.btn-primary {
  width: 100%;
  background: var(--amber);
  color: #1a1305;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 15px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

.btn-primary:active { transform: scale(.98); }

.login-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
  min-height: 16px;
}

/* ---------- Dashboard header ---------- */
.dash-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.greeting {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  text-transform: uppercase;
}

.greeting span { color: var(--amber); }

.online-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 6px 6px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
}

.online-toggle .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-faint);
}

.online-toggle.on { border-color: var(--green); color: var(--green); }
.online-toggle.on .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }

.switch {
  width: 40px; height: 22px;
  background: var(--surface-2);
  border-radius: 999px;
  position: relative;
  transition: background .2s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform .2s, background .2s;
}
.online-toggle.on .switch { background: var(--green-dim); }
.online-toggle.on .switch::after { transform: translateX(18px); background: var(--green); }

/* ---------- Section labels ---------- */
.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 22px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---------- Order cards ---------- */
.order-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 14px 16px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--status-color, var(--text-faint));
}

.order-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.order-id {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
}

.order-price {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  color: var(--amber);
}

.order-route {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
}

.order-route .arrow { color: var(--text-faint); margin: 0 4px; }

.status-pill {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--status-bg, var(--surface-2));
  color: var(--status-color, var(--text-dim));
}

.btn-ambil {
  align-self: flex-end;
  background: var(--amber-dim);
  color: var(--amber);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
}
.btn-ambil:active { transform: scale(.97); }

.empty-state {
  text-align: center;
  padding: 34px 10px;
  color: var(--text-faint);
  font-size: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ---------- Detail pesanan ---------- */
.detail-status {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--status-color, var(--amber));
  margin-bottom: 4px;
}

/* route progress — signature element: dotted route line between
   pickup and drop-off, echoing the real delivery journey */
.route-progress {
  display: flex;
  align-items: center;
  margin: 6px 0 20px;
}
.route-progress .node {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--text-faint);
  background: var(--bg);
  flex-shrink: 0;
}
.route-progress .node.active {
  border-color: var(--amber);
  background: var(--amber);
  box-shadow: 0 0 10px rgba(255,176,32,.5);
}
.route-progress .node.done {
  border-color: var(--green);
  background: var(--green);
}
.route-progress .track {
  flex: 1;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 11px);
  margin: 0 4px;
}
.route-progress .track.done {
  background: var(--green);
}

.info-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.info-block h4 {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-block .name { font-size: 16px; font-weight: 600; margin-bottom: 2px; }
.info-block .addr { font-size: 14px; color: var(--text-dim); line-height: 1.45; }

.info-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.info-actions a, .info-actions button {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 9px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.item-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.item-row:last-child { border-bottom: none; }
.item-row .qty { color: var(--text-faint); font-family: var(--font-mono); margin-right: 6px; }
.item-note { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.total-row .label { font-size: 13px; color: var(--text-dim); }
.total-row .amount { font-family: var(--font-mono); font-size: 20px; font-weight: 600; color: var(--amber); }

.action-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  justify-content: center;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 60%, transparent);
}
.action-bar-inner { width: 100%; max-width: 480px; }

.btn-action {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.btn-action.stage-menuju { background: var(--blue); color: #071624; }
.btn-action.stage-diambil { background: var(--blue); color: #071624; }
.btn-action.stage-antar { background: var(--amber); color: #1a1305; }
.btn-action.stage-selesai { background: var(--green); color: #06231a; }
.btn-action:active { transform: scale(.98); }

/* ---------- Riwayat ---------- */
.riwayat-summary {
  display: flex;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
}
.riwayat-summary .item { text-align: center; flex: 1; }
.riwayat-summary .item + .item { border-left: 1px solid var(--line); }
.riwayat-summary .num { font-family: var(--font-mono); font-size: 20px; font-weight: 600; color: var(--amber); }
.riwayat-summary .label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }

.history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
}
.history-row .hid { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); }
.history-row .htime { font-size: 12px; color: var(--text-faint); }
.history-row .hicon { font-size: 16px; margin-right: 8px; }

/* ---------- Profil ---------- */
.profile-hero {
  text-align: center;
  padding: 20px 0 24px;
}
.profile-avatar {
  width: 74px; height: 74px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--amber);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 28px;
  margin: 0 auto 10px;
}
.profile-name { font-family: var(--font-display); font-size: 22px; font-weight: 700; text-transform: uppercase; }
.profile-sub { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); margin-top: 2px; }

.btn-secondary {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  padding: 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.btn-secondary.danger { color: var(--red); border-color: var(--red-dim); }

/* ---------- Bottom nav (dashboard cluster) ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  justify-content: center;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-inner {
  width: 100%; max-width: 480px;
  display: flex;
}

.nav-btn {
  flex: 1;
  background: none;
  color: var(--text-faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 0 8px;
  font-size: 11px;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: .3px;
  position: relative;
}
.nav-btn .icon { font-size: 19px; }
.nav-btn.active { color: var(--amber); }
.nav-btn.active::before {
  content: '';
  position: absolute;
  top: 0; left: 30%; right: 30%;
  height: 2px;
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber);
  border-radius: 2px;
}
