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

:root {
  --primary: #0F4C81;
  --primary-light: #1A6BB5;
  --primary-pale: #EBF3FC;
  --accent: #F59E0B;
  --accent-light: #FEF3C7;
  --success: #059669;
  --success-light: #D1FAE5;
  --danger: #DC2626;
  --danger-light: #FEE2E2;
  --warning: #D97706;
  --warning-light: #FEF3C7;
  --info: #0891B2;
  --info-light: #CFFAFE;
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --gray-900: #0F172A;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 10px 30px rgba(0,0,0,.1);
  --font: 'Plus Jakarta Sans', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body { font-family: var(--font); background: var(--gray-50); color: var(--gray-800); min-height: 100vh; }

/* ── TOPBAR ── */
.topbar {
  background: var(--primary);
  color: #fff;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(15,76,129,.3);
}
.topbar-brand { font-weight: 700; font-size: 18px; letter-spacing: -.3px; display: flex; align-items: center; gap: 8px; }
.topbar-brand span { font-size: 22px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user { font-size: 13px; opacity: .85; }
.btn-logout { background: rgba(255,255,255,.15); border: none; color: #fff; padding: 6px 14px; border-radius: 6px; font-size: 13px; cursor: pointer; font-family: var(--font); }
.btn-logout:hover { background: rgba(255,255,255,.25); }

/* ── CONTAINER ── */
.container { max-width: 900px; margin: 0 auto; padding: 20px 16px 80px; }
.container-wide { max-width: 1200px; margin: 0 auto; padding: 20px 16px 80px; }

/* ── CARDS ── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-weight: 700; font-size: 15px; color: var(--gray-900); }
.card-body { padding: 20px; }

/* ── STATUS BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-draft { background: var(--gray-100); color: var(--gray-600); }
.badge-dalam_pengiriman { background: var(--info-light); color: var(--info); }
.badge-terkirim { background: var(--success-light); color: var(--success); }
.badge-gagal { background: var(--danger-light); color: var(--danger); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-pale); }
.btn-ghost { background: var(--gray-100); color: var(--gray-700); }
.btn-ghost:hover { background: var(--gray-200); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.form-label span { color: var(--danger); }
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--gray-800);
  background: #fff;
  transition: border-color .15s;
  -webkit-appearance: none;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,76,129,.1); }
.form-control::placeholder { color: var(--gray-400); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* ── UPLOAD AREA ── */
.upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--gray-50);
  position: relative;
}
.upload-area:hover, .upload-area.dragover { border-color: var(--primary); background: var(--primary-pale); }
.upload-area input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-icon { font-size: 36px; margin-bottom: 8px; }
.upload-text { font-size: 14px; color: var(--gray-600); font-weight: 500; }
.upload-hint { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.upload-preview { margin-top: 12px; position: relative; display: none; }
.upload-preview img { width: 100%; max-height: 200px; object-fit: cover; border-radius: var(--radius-sm); }
.upload-preview .remove-btn { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; }

/* ── SJ LIST ITEM ── */
.sj-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  transition: background .1s;
}
.sj-item:last-child { border-bottom: none; }
.sj-item:hover { background: var(--gray-50); }
.sj-item-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.sj-item-icon.draft { background: var(--gray-100); }
.sj-item-icon.dalam_pengiriman { background: var(--info-light); }
.sj-item-icon.terkirim { background: var(--success-light); }
.sj-item-icon.gagal { background: var(--danger-light); }
.sj-item-info { flex: 1; min-width: 0; }
.sj-item-nomor { font-weight: 700; font-size: 14px; }
.sj-item-dest { font-size: 13px; color: var(--gray-500); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sj-item-meta { text-align: right; flex-shrink: 0; }
.sj-item-time { font-size: 11px; color: var(--gray-400); margin-top: 4px; }

/* ── TIMELINE ── */
.timeline { padding: 8px 0; }
.timeline-item { display: flex; gap: 14px; padding-bottom: 20px; position: relative; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:not(:last-child)::before { content: ''; position: absolute; left: 19px; top: 38px; bottom: 0; width: 2px; background: var(--gray-200); }
.timeline-dot { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--gray-200); }
.timeline-dot.done { box-shadow: 0 0 0 2px var(--success); }
.timeline-dot.active { box-shadow: 0 0 0 2px var(--primary); animation: pulse 2s infinite; }
.timeline-dot.pending { background: var(--gray-100); box-shadow: 0 0 0 2px var(--gray-200); }
@keyframes pulse { 0%,100%{box-shadow:0 0 0 2px var(--primary)} 50%{box-shadow:0 0 0 5px rgba(15,76,129,.2)} }
.timeline-content { flex: 1; padding-top: 8px; }
.timeline-title { font-weight: 700; font-size: 14px; }
.timeline-desc { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.timeline-time { font-size: 11px; color: var(--gray-400); margin-top: 4px; }

/* ── PHOTO PROOF ── */
.proof-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.proof-item { position: relative; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 4/3; background: var(--gray-100); }
.proof-item img { width: 100%; height: 100%; object-fit: cover; }
.proof-item .proof-label { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,.7)); color: #fff; font-size: 11px; font-weight: 600; padding: 20px 8px 6px; }
.proof-item .proof-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--gray-400); font-size: 13px; gap: 6px; }
.proof-item .proof-empty span { font-size: 28px; }

/* ── INFO ROWS ── */
.info-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--gray-100); gap: 12px; }
.info-row:last-child { border-bottom: none; }
.info-label { font-size: 12px; color: var(--gray-500); font-weight: 500; flex-shrink: 0; }
.info-value { font-size: 14px; font-weight: 600; color: var(--gray-800); text-align: right; }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--gray-500); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-value.blue { color: var(--primary); }
.stat-value.green { color: var(--success); }
.stat-value.amber { color: var(--warning); }
.stat-value.red { color: var(--danger); }

/* ── BOTTOM NAV (mobile) ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--gray-200);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px 6px;
  text-decoration: none;
  color: var(--gray-400);
  font-size: 10px;
  font-weight: 500;
  gap: 3px;
  transition: color .15s;
  border: none;
  background: none;
  font-family: var(--font);
  cursor: pointer;
}
.nav-item.active { color: var(--primary); }
.nav-item svg { width: 22px; height: 22px; }

/* ── LOGIN PAGE ── */
.login-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; background: var(--primary); }
.login-card { background: #fff; border-radius: 20px; padding: 32px 28px; width: 100%; max-width: 380px; box-shadow: var(--shadow-md); }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo h1 { font-size: 22px; font-weight: 800; color: var(--primary); margin-top: 8px; }
.login-logo p { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

/* ── MAP ── */
.map-container { border-radius: var(--radius-sm); overflow: hidden; height: 200px; background: var(--gray-100); }
.map-container iframe { width: 100%; height: 100%; border: none; }

/* ── ALERTS ── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; display: flex; align-items: flex-start; gap: 10px; }
.alert-success { background: var(--success-light); color: #065F46; border-left: 3px solid var(--success); }
.alert-danger { background: var(--danger-light); color: #991B1B; border-left: 3px solid var(--danger); }
.alert-info { background: var(--info-light); color: #164E63; border-left: 3px solid var(--info); }

/* ── LOADING ── */
.spinner { width: 40px; height: 40px; border: 3px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,.85); display: flex; align-items: center; justify-content: center; z-index: 999; }

/* ── SECTION TITLE ── */
.section-title { font-size: 13px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .5px; padding: 16px 20px 8px; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--gray-400); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }
.empty-state-desc { font-size: 13px; }

/* ── RESPONSIVE ── */
@media (min-width: 640px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .proof-grid { grid-template-columns: repeat(3, 1fr); }
  .sj-item-time { font-size: 12px; }
}
@media (max-width: 640px) {
  .card-body { padding: 16px; }
  .topbar-user { display: none; }
}

/* ── SEARCH BAR ── */
.search-wrap { padding: 12px 16px 0; }
.search-box { display: flex; align-items: center; background: #fff; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); overflow: hidden; }
.search-box svg { margin-left: 12px; color: var(--gray-400); flex-shrink: 0; }
.search-box input { flex: 1; border: none; outline: none; padding: 10px 12px; font-size: 14px; font-family: var(--font); background: transparent; }

/* ── FAB ── */
.fab {
  position: fixed;
  bottom: 72px;
  right: 16px;
  width: 54px;
  height: 54px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(15,76,129,.4);
  text-decoration: none;
  font-size: 24px;
  z-index: 90;
  border: none;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.fab:hover { transform: scale(1.05); }
.fab:active { transform: scale(.95); }

/* ── TRACKING PAGE (customer) ── */
.tracking-header { background: var(--primary); color: #fff; padding: 24px 20px 48px; }
.tracking-header h2 { font-size: 20px; font-weight: 800; }
.tracking-header p { font-size: 13px; opacity: .8; margin-top: 4px; }
.tracking-body { margin-top: -28px; padding: 0 16px 80px; }
.tracking-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-md); overflow: hidden; }

/* ── PHOTO VIEWER ── */
.photo-fullview { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 999; display: flex; align-items: center; justify-content: center; padding: 20px; }
.photo-fullview img { max-width: 100%; max-height: 100%; border-radius: var(--radius-sm); }
.photo-fullview-close { position: absolute; top: 16px; right: 16px; background: rgba(255,255,255,.15); border: none; color: #fff; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; }
