/* ================================================================
   OLOLU - Global Styles
   ================================================================ */

:root {
  /* Hijau Jamrud */
  --primary: #0B6E4F;
  --primary-dark: #084F39;
  --primary-light: #0D8A63;
  /* Emas */
  --gold: #C9A84C;
  --gold-light: #E4C26E;
  --gold-dark: #A8872F;
  --secondary: #0A3B2C;
  --accent: #0D4F3A;
  --success: #0B6E4F;
  --warning: #C9A84C;
  --danger: #DC2626;
  --info: #0E7490;
  --blue: #0E7490;
  --text: #1A2E1F;
  --text-muted: #5C7A6A;
  --border: #D4E8DF;
  --bg: #F0F7F4;
  --white: #FFFFFF;
  --shadow: 0 2px 8px rgba(11,110,79,0.12);
  --shadow-lg: 0 8px 32px rgba(11,110,79,0.18);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ================================================================
   TYPOGRAPHY
   ================================================================ */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.3; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
p { margin-bottom: 0.5rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover:not(:disabled) { background: #0d5c42; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-warning { background: var(--gold); color: white; }
.btn-warning:hover:not(:disabled) { background: var(--gold-dark); }
.btn-info { background: var(--info); color: white; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary); color: white; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--border); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: 50%; }
.btn-loading::after {
  content: '';
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.5);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ================================================================
   FORMS
   ================================================================ */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--text); font-size: 13px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color 0.2s;
  background: white;
  color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--primary); }
.form-control::placeholder { color: var(--text-muted); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ================================================================
   CARDS
   ================================================================ */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-header { padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.card-title { font-size: 1.1rem; font-weight: 700; }
.card-footer { padding-top: 16px; border-top: 1px solid var(--border); margin-top: 16px; }

/* ================================================================
   BADGES & STATUS
   ================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-success { background: #D1FAE5; color: #064E3B; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-warning { background: #FEF9EC; color: #92400E; border: 1px solid var(--gold-light); }
.badge-info { background: #CFFAFE; color: #155E75; }
.badge-secondary { background: var(--bg); color: var(--text-muted); }
.badge-primary { background: #D1FAE5; color: var(--primary-dark); }

/* ================================================================
   ALERTS
   ================================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
}
.alert-success { background: #D1FAE5; color: #064E3B; border-left: 4px solid var(--success); }
.alert-danger { background: #FEE2E2; color: #991B1B; border-left: 4px solid var(--danger); }
.alert-warning { background: #FFFBEB; color: #78350F; border-left: 4px solid var(--gold); }
.alert-info { background: #ECFEFF; color: #155E75; border-left: 4px solid var(--info); }

/* ================================================================
   MODAL
   ================================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: white;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-close {
  background: var(--border);
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ================================================================
   TOAST NOTIFICATIONS
   ================================================================ */
#toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
  width: 90%;
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: all;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }

/* ================================================================
   LOADING
   ================================================================ */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  flex-direction: column;
  gap: 16px;
}
.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-sm {
  width: 20px; height: 20px;
  border-width: 2px;
}

/* ================================================================
   NAVIGATION (Mobile Bottom Nav)
   ================================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s;
  font-size: 10px;
  font-weight: 600;
  gap: 3px;
  text-decoration: none;
}
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item svg { width: 22px; height: 22px; }
.bottom-nav-badge {
  position: absolute;
  top: 4px; right: calc(50% - 16px);
  background: var(--danger);
  color: white;
  font-size: 9px;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.bottom-nav-item { position: relative; }

/* ================================================================
   MAP CONTAINER
   ================================================================ */
#map {
  width: 100%;
  height: 100%;
  min-height: 300px;
}

/* ================================================================
   DRIVER MARKERS
   ================================================================ */
.driver-marker {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  cursor: pointer;
}
.driver-marker-siap { background: var(--info); }
.driver-marker-sibuk { background: var(--warning); }
.driver-marker-prioritas { background: var(--danger); }

/* ================================================================
   COUNTDOWN TIMER
   ================================================================ */
.countdown-ring {
  position: relative;
  width: 80px; height: 80px;
}
.countdown-ring svg { transform: rotate(-90deg); }
.countdown-ring .bg { stroke: var(--border); }
.countdown-ring .progress { 
  stroke: var(--primary);
  transition: stroke-dashoffset 1s linear;
}
.countdown-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

/* ================================================================
   STAT CARDS
   ================================================================ */
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); }

/* ================================================================
   TABLE
   ================================================================ */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ================================================================
   MISC
   ================================================================ */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.rounded { border-radius: var(--radius-sm); }
.rounded-full { border-radius: 50%; }
.overflow-hidden { overflow: hidden; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.flex-1 { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* Page wrapper */
.page { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; background: white; }
.page-content { padding: 16px; padding-bottom: 80px; }
.page-header {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-title { font-size: 1.1rem; font-weight: 700; flex: 1; }

/* Logo */
.logo {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -1px;
}
.logo span { color: var(--secondary); }

/* Status colors */
.status-siap { color: var(--info); }
.status-sibuk { color: var(--warning); }
.status-offline { color: var(--text-muted); }
.status-prioritas { color: var(--danger); }

/* Pulse animation for live indicators */
.pulse {
  animation: pulse 2s infinite;
}

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ================================================================
   RESPONSIVE (tablet/desktop)
   ================================================================ */
@media (min-width: 520px) {
  .page { box-shadow: var(--shadow-lg); }
}

/* ================================================================
   OFFER NOTIFICATION PANEL
   ================================================================ */
.offer-panel {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%; max-width: 480px;
  background: white;
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.2);
  z-index: 500;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  padding: 20px;
}
.offer-panel.active {
  transform: translateX(-50%) translateY(0);
}
.offer-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
}
.offer-biasa { background: #DBEAFE; color: #1E40AF; }
.offer-prioritas { background: #FEE2E2; color: #991B1B; animation: pulse 1s infinite; }

/* Progress bar */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 1s linear;
  border-radius: 3px;
}

/* List items */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* Gradient header */
.gradient-header {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
  color: white;
  padding: 24px 16px 20px;
}

/* Gold accent elements */
.gold-accent { color: var(--gold); }
.gold-bg { background: var(--gold); color: white; }
.gold-border { border-color: var(--gold); }
