:root {
  /* Light Mode Defaults */
  --bg-app: #f3f4f6;
  --bg-card: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --border: #e5e7eb;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --radius: 16px;
  --nav-height: 70px;
}

/* Dark Mode Theme - Applied via body.dark-mode */
body.dark-mode {
  --bg-app: #111827;
  --bg-card: #1f2937;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-light: rgba(99, 102, 241, 0.2);
  --success: #34d399;
  --success-light: rgba(16, 185, 129, 0.2);
  --warning: #fbbf24;
  --warning-light: rgba(245, 158, 11, 0.2);
  --border: #374151;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  padding-bottom: var(--nav-height); /* Space for bottom nav */
}

a {
  text-decoration: none;
  color: inherit;
}

/* Layout Utilities */
.container {
  max-width: 600px; /* Mobile app feel */
  margin: 0 auto;
  padding: 20px;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.text-center { text-align: center; }

/* Typography */
h1 { font-size: 24px; font-weight: 700; margin: 0 0 16px 0; }
h2 { font-size: 20px; font-weight: 600; margin: 0 0 12px 0; }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 8px 0; }
p { margin: 0 0 8px 0; line-height: 1.5; color: var(--text-muted); }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.font-bold { font-weight: 700; }

/* Components */
.card {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  width: 100%;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 4px 6px rgba(79, 70, 229, 0.3);
}
.btn-primary:hover { transform: translateY(-2px); background-color: var(--primary-hover); }

.btn-outline {
  background-color: transparent;
  border: 2px solid var(--border);
  color: var(--text-main);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
}

/* Badges */
.badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success { background-color: var(--success-light); color: var(--success); }
.badge-warning { background-color: var(--warning-light); color: var(--warning); }
.badge-primary { background-color: var(--primary-light); color: var(--primary); }

/* Inputs */
.input-group { margin-bottom: 16px; text-align: left; }
.label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 14px; }
.input {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  color: var(--text-main);
  outline: none;
}
.input:focus { border-color: var(--primary); ring: 2px solid var(--primary-light); }

/* Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  z-index: 100;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  font-size: 10px;
  gap: 4px;
}
.nav-item.active { color: var(--primary); }
.nav-icon {
  width: 24px;
  height: 24px;
  background-color: #eee;
  border-radius: 6px;
}
.nav-icon.placeholder { background-color: currentColor; opacity: 0.2; }

/* Specific Components */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--border);
  flex-shrink: 0;
}

.map-placeholder {
  width: 100%;
  height: 200px;
  background-color: var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-weight: 600;
  position: relative;
  overflow: hidden;
}
.map-route-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary);
  transform: rotate(-10deg);
}

.timeline {
  border-left: 2px solid var(--border);
  margin-left: 10px;
  padding-left: 20px;
}
.timeline-item {
  position: relative;
  padding-bottom: 24px;
}
.timeline-dot {
  width: 12px;
  height: 12px;
  background-color: var(--primary);
  border-radius: 50%;
  position: absolute;
  left: -27px;
  top: 4px;
  border: 2px solid var(--bg-card);
}

/* Switch for Theme Toggle */
.theme-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 20px;
  text-decoration: none;
}
