/* ==========================================================================
   style.css
   Style bersama untuk aplikasi Customer (index.html) dan Driver (driver.html).
   Mobile-first, minimalis, ringan, siap Dark Mode.
   ========================================================================== */

:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-success: #16a34a;
  --color-warning: #f59e0b;
  --color-danger: #dc2626;
  --color-bg: #f4f6f9;
  --color-surface: #ffffff;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-modal: 0 8px 30px rgba(0, 0, 0, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0f1115;
    --color-surface: #1a1d24;
    --color-text: #f3f4f6;
    --color-text-muted: #9ca3af;
    --color-border: #2a2e37;
  }
}

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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--color-bg);
  position: relative;
  padding-bottom: 24px;
}

/* ---------- Header ---------- */
.app-header {
  background: var(--color-primary);
  color: #fff;
  padding: 18px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.app-header h1 {
  font-size: 18px;
  font-weight: 700;
}

.app-header .subtitle {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
}

.status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.status-badge.online { background: rgba(22, 163, 74, 0.85); }
.status-badge.offline { background: rgba(220, 38, 38, 0.85); }

/* ---------- Card / Section ---------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px;
  margin: 16px;
}

.card h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--color-text);
}

/* ---------- Form ---------- */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
}

textarea.form-control {
  resize: vertical;
  min-height: 70px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-success { background: var(--color-success); color: #fff; }
.btn-warning { background: var(--color-warning); color: #1a1a1a; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}

.btn-sm { padding: 9px 14px; font-size: 13px; width: auto; }

/* ---------- Autocomplete Alamat (Nominatim) ---------- */
.autocomplete-wrapper {
  position: relative;
}

.suggestion-box {
  position: absolute;
  top: calc(100% - 2px);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  z-index: 20;
  max-height: 240px;
  overflow-y: auto;
}

.suggestion-item {
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover, .suggestion-item:active { background: var(--color-bg); }

.suggestion-empty {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--color-text-muted);
  text-align: center;
}

.osm-attribution {
  text-align: center;
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 10px;
}
.osm-attribution a { color: var(--color-text-muted); text-decoration: underline; }

/* ---------- Tarif Box ---------- */
.tarif-box {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  margin-bottom: 14px;
}

.tarif-box .label { font-size: 12px; opacity: 0.85; }
.tarif-box .value { font-size: 26px; font-weight: 800; margin-top: 4px; }
.tarif-box .info { font-size: 11px; opacity: 0.75; margin-top: 4px; }

/* ---------- Order Card (Driver) ---------- */
.order-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
  background: var(--color-surface);
}

.order-item .order-id {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.order-item .order-customer {
  font-size: 15px;
  font-weight: 700;
  margin: 4px 0 8px;
}

.order-item .order-route {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 8px;
}

.order-item .order-route .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.dot.jemput { background: var(--color-success); }
.dot.tujuan { background: var(--color-danger); }

.order-item .order-tarif {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-primary);
}

.status-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  margin-left: 8px;
}
.status-pill.menunggu { background: #fef3c7; color: #92400e; }
.status-pill.diterima { background: #dbeafe; color: #1e40af; }
.status-pill.pool { background: #ede9fe; color: #5b21b6; }
.status-pill.perjalanan { background: #d1fae5; color: #065f46; }
.status-pill.selesai { background: #e5e7eb; color: #374151; }

/* ---------- Modal / Popup ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}

.modal-box {
  background: var(--color-surface);
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-modal);
  animation: slideUp 0.2s ease;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-box h3 {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 4px;
}

.modal-box .modal-subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- Radio Options ---------- */
.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.radio-option.selected {
  border-color: var(--color-primary);
  background: rgba(37, 99, 235, 0.06);
}

.radio-option input { accent-color: var(--color-primary); width: 18px; height: 18px; }
.radio-option .radio-label { font-size: 14px; font-weight: 600; }

/* ---------- Pool List ---------- */
.pool-list { max-height: 320px; overflow-y: auto; margin-bottom: 14px; }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
}
.empty-state .icon { font-size: 40px; margin-bottom: 10px; }
.empty-state .text { font-size: 13px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #111827;
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-modal);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 90%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--color-danger); }
.toast.success { background: var(--color-success); }

/* ---------- Bottom Nav (Driver) ---------- */
.bottom-nav {
  position: sticky;
  bottom: 0;
  display: flex;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}

.bottom-nav .nav-item {
  flex: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: 6px 0;
  cursor: pointer;
  border: none;
  background: none;
}
.bottom-nav .nav-item.active { color: var(--color-primary); }
.bottom-nav .nav-item .nav-icon { font-size: 20px; display: block; margin-bottom: 2px; }

/* ---------- Loading Spinner ---------- */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-loader {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.page-loader .spinner {
  border-color: rgba(37, 99, 235, 0.25);
  border-top-color: var(--color-primary);
  width: 32px; height: 32px; border-width: 3px;
}

.hidden { display: none !important; }

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 20px 16px 8px;
}
