/* ============================================================
   PIKNI v7.0 — Design System
   Font: Montserrat | Colors: Black & White Minimal
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800;900&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Montserrat', -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --black:   #0a0a0a;
  --white:   #ffffff;
  --g50:     #f9f9f9;
  --g100:    #f0f0f0;
  --g200:    #e0e0e0;
  --g300:    #c0c0c0;
  --g400:    #909090;
  --g500:    #606060;
  --g600:    #404040;
  --green:   #22c55e;
  --red:     #ef4444;
  --yellow:  #f59e0b;
  --blue:    #3b82f6;
  --r-sm:    8px;
  --r-md:    12px;
  --r-lg:    16px;
  --r-xl:    20px;
  --r-full:  999px;
  --nav-h:   64px;
  --top-h:   56px;
  --safe-b:  env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  background: var(--white);
  background-color: #ffffff;
  color: var(--black);
  overscroll-behavior: none;
}

/* ── LAYOUT ─────────────────────────────────────────────── */
.app { display: flex; flex-direction: column; min-height: 100vh; max-width: 480px; margin: 0 auto; position: relative; }

.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  background: var(--white);
  background-color: #ffffff;
  border-bottom: 1px solid var(--g100);
}
.topbar.dark { background: var(--black); border-bottom-color: #222; }
.topbar .logo { display: flex; align-items: center; gap: 8px; }
.topbar .logo img { width: 22px; height: 22px; object-fit: contain; }
.topbar .logo span { font-weight: 800; font-size: 16px; letter-spacing: .5px; }
.topbar.dark .logo span { color: var(--white); }

.content {
  flex: 1;
  padding: 20px;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 20px);
  overflow-y: auto;
}
.content.no-nav { padding-bottom: 20px; }
.content.no-pad { padding: 0; }

/* ── BOTTOM NAV ─────────────────────────────────────────── */
.bnav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--white);
  background-color: #ffffff;
  border-top: 1px solid var(--g100);
  display: flex; align-items: center;
  z-index: 100;
}
.bnav-items { display: flex; width: 100%; }
.bnav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; padding: 8px 4px;
  color: var(--g400); font-size: 10px; font-weight: 600;
  letter-spacing: .3px; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  transition: color .15s;
}
.bnav-item.active { color: var(--black); }
.bnav-item svg { width: 22px; height: 22px; }

/* ── PRELOADER ──────────────────────────────────────────── */
#pl {
  position: fixed; inset: 0; background: var(--white);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; transition: opacity .3s;
}
#pl.out { opacity: 0; pointer-events: none; display: none; }
.pl-logo { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pl-logo img { width: 48px; height: 48px; object-fit: contain; }
.pl-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--black); animation: plpulse 1s ease-in-out infinite; }
@keyframes plpulse { 0%,100%{opacity:.3} 50%{opacity:1} }

/* ── TOAST ──────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
  left: 50%; transform: translateX(-50%) translateY(8px);
  background: var(--black); color: var(--white);
  padding: 10px 20px; border-radius: var(--r-full);
  font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: all .25s; white-space: nowrap;
  z-index: 500;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.no-nav { bottom: calc(var(--safe-b) + 20px); }

/* ── TYPOGRAPHY ─────────────────────────────────────────── */
.h1 { font-size: 28px; font-weight: 800; letter-spacing: -1px; line-height: 1.15; }
.h2 { font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.h3 { font-size: 17px; font-weight: 700; }
.body { font-size: 15px; font-weight: 400; line-height: 1.5; }
.small { font-size: 13px; color: var(--g500); }
.tiny { font-size: 11px; color: var(--g400); font-weight: 500; letter-spacing: .3px; }
.label { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--g400); }

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 16px 24px;
  border-radius: var(--r-lg); border: none; cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-size: 15px; font-weight: 700; letter-spacing: .2px;
  transition: all .15s; text-decoration: none;
  gap: 8px;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--black); color: var(--white); }
.btn-primary:hover { background: #222; }
.btn-secondary { background: var(--g100); color: var(--black); }
.btn-secondary:hover { background: var(--g200); }
.btn-outline { background: transparent; color: var(--black); border: 1.5px solid var(--g200); }
.btn-outline:hover { border-color: var(--black); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-success { background: var(--green); color: var(--white); }
.btn-sm { padding: 10px 16px; font-size: 13px; border-radius: var(--r-md); }
.btn-xs { padding: 7px 12px; font-size: 12px; border-radius: var(--r-sm); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── INPUTS ─────────────────────────────────────────────── */
.input-group { margin-bottom: 16px; }
.input-label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--g500); margin-bottom: 6px; }
.input {
  width: 100%; padding: 14px 16px;
  border: 1.5px solid var(--g200); border-radius: var(--r-md);
  font-family: 'Montserrat', sans-serif; font-size: 15px;
  background: var(--white);
  background-color: #ffffff; color: var(--black);
  transition: border-color .15s; outline: none;
}
.input:focus { border-color: var(--black); }
.input::placeholder { color: var(--g300); }
.input-hint { font-size: 12px; color: var(--g400); margin-top: 5px; }

/* ── CARDS ──────────────────────────────────────────────── */
.card {
  background: var(--white);
  background-color: #ffffff; border: 1.5px solid var(--g100);
  border-radius: var(--r-xl); padding: 20px;
  margin-bottom: 12px;
}
.card-flat { background: var(--g50); border-radius: var(--r-xl); padding: 20px; margin-bottom: 12px; }
.card-dark { background: var(--black); border-radius: var(--r-xl); padding: 20px; margin-bottom: 12px; color: var(--white); }

/* ── LIST ITEM ──────────────────────────────────────────── */
.list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--g100);
}
.list-item:last-child { border-bottom: none; }

/* ── BADGE ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
}
.badge-pending   { background: #fef9c3; color: #a16207; }
.badge-searching { background: #dbeafe; color: #1d4ed8; }
.badge-assigned  { background: #dcfce7; color: #15803d; }
.badge-active    { background: #dcfce7; color: #15803d; }
.badge-completed { background: var(--g100); color: var(--g600); }
.badge-cancelled { background: #fee2e2; color: #b91c1c; }
.badge-scheduled { background: #ede9fe; color: #6d28d9; }
.badge-online    { background: #dcfce7; color: #15803d; }
.badge-offline   { background: var(--g100); color: var(--g500); }
.badge-pending-driver { background: #fef3c7; color: #92400e; display: inline-flex; align-items: center; justify-content: center; padding: 5px 14px; border-radius: 999px; white-space: nowrap; width: fit-content; }
.badge-approved  { background: #dcfce7; color: #15803d; }
.badge-rejected  { background: #fee2e2; color: #b91c1c; }
.badge-banned    { background: #fee2e2; color: #b91c1c; }

/* ── DIVIDER ────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--g100); margin: 16px 0; }

/* ── EMPTY STATE ────────────────────────────────────────── */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 20px; gap: 12px; }
.empty-icon { font-size: 48px; }
.empty-title { font-size: 17px; font-weight: 700; }
.empty-sub { font-size: 14px; color: var(--g400); text-align: center; }

/* ── SPINNER ────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--g200); border-top-color: var(--black);
  border-radius: 50%; animation: spin .7s linear infinite;
}
.spinner-white { border-color: rgba(255,255,255,.3); border-top-color: var(--white); }
.spinner-dark  { width: 18px; height: 18px; border: 2px solid rgba(0,0,0,.1); border-top-color: #000; border-radius: 50%; animation: spin .6s linear infinite; }
.spinner-wrapper { display: flex; align-items: center; justify-content: center; width: 100%; }
.spinner-fixed { width: 18px; height: 18px; border: 2px solid #ccc; border-top: 2px solid #333; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── MODAL / BOTTOM SHEET ───────────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 200; display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.overlay.open { opacity: 1; pointer-events: all; }
.sheet {
  width: 100%; max-width: 480px;
  background: var(--white);
  background-color: #ffffff; border-radius: 20px 20px 0 0;
  padding: 24px 20px calc(32px + var(--safe-b));
  transform: translateY(40px); transition: transform .25s;
}
.overlay.open .sheet { transform: translateY(0); }
.sheet-handle { width: 36px; height: 4px; background: var(--g200); border-radius: 2px; margin: 0 auto 20px; }

/* ── SECTION LABEL ──────────────────────────────────────── */
.section-label {
  font-size: 11px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: var(--g400);
  margin-bottom: 12px; margin-top: 4px;
}

/* ── AVATAR ─────────────────────────────────────────────── */
.avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--g100); display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: var(--g500);
  overflow: hidden; flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 72px; height: 72px; font-size: 28px; }
.avatar-xl { width: 96px; height: 96px; font-size: 36px; }

/* ── UTILS ──────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; } .mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--g400); }
.text-success { color: var(--green); }
.text-danger { color: var(--red); }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── MAP COMPONENTS ──────────────────────────────────────── */
.pikni-map {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}

/* Driver marker — lingkaran hitam dengan ikon mobil */
.pikni-driver-marker {
  width: 36px;
  height: 36px;
  background: #0a0a0a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.35), 0 0 0 3px rgba(255,255,255,.9);
  transition: transform .3s ease;
}

/* Pickup marker — pin merah */
.pikni-pickup-marker {
  width: 14px;
  height: 14px;
  background: #ef4444;
  border-radius: 50%;
  border: 2.5px solid white;
  box-shadow: 0 2px 6px rgba(239,68,68,.5);
}

/* Center pin untuk picker mode */
.pikni-center-pin {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -100%);
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.pikni-pin-head {
  width: 18px;
  height: 18px;
  background: #0a0a0a;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  border: 2.5px solid white;
}
.pikni-pin-tail {
  width: 2px;
  height: 8px;
  background: #0a0a0a;
  margin-top: -1px;
}

/* Search suggestions */
.map-suggestions {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: white;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 20;
  overflow: hidden;
  max-height: 200px;
  overflow-y: auto;
}
.map-suggestion-item {
  padding: 12px 16px;
  font-size: 13px;
  font-family: Montserrat, sans-serif;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-suggestion-item:hover { background: #f9f9f9; }
.map-suggestion-item:last-child { border-bottom: none; }

/* Map container di trip card */
.trip-map-container {
  height: 180px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
}

/* Center button */
.map-center-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  background: white;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  z-index: 10;
  font-family: Montserrat, sans-serif;
}

/* Map picker fullscreen overlay */
.map-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: white;
  display: flex;
  flex-direction: column;
}
.map-picker-map {
  flex: 1;
  position: relative;
}
.map-picker-bottom {
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  background: white;
  border-top: 1px solid #f0f0f0;
}
.map-picker-addr {
  font-size: 13px;
  font-weight: 600;
  font-family: Montserrat, sans-serif;
  color: #333;
  margin-bottom: 12px;
  min-height: 18px;
}
.map-search-wrap {
  position: relative;
  margin-bottom: 12px;
}
