/* ══════════════════════════════════════════════════════════
   AAYALOLO RIDER — CUSTOMER APP DESIGN SYSTEM
   Mobile-first · Ghana-inspired · Transit UX
══════════════════════════════════════════════════════════ */

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

/* ── Variables ──────────────────────────────────────────── */
:root {
  --primary:       #00B386;
  --primary-dark:  #009970;
  --primary-light: #E8F8F4;
  --primary-glow:  #00B38622;
  --accent:        #FFB300;
  --accent-light:  #FFF8E1;
  --danger:        #E53E3E;
  --danger-light:  #FFF0F0;
  --success:       #38A169;
  --warning:       #D69E2E;
  --info:          #3182CE;

  --bg:            #F0F4F8;
  --card:          #FFFFFF;
  --card-alt:      #F8FAFB;
  --border:        #E2E8F0;
  --border-light:  #F0F4F8;

  --text:          #1A2332;
  --text-soft:     #4A5568;
  --text-muted:    #8A9AB0;
  --text-on-primary: #FFFFFF;

  --font:          'Inter', sans-serif;
  --font-display:  'Plus Jakarta Sans', sans-serif;
  --font-mono:     'JetBrains Mono', monospace;

  --radius-sm:     8px;
  --radius:        12px;
  --radius-lg:     18px;
  --radius-xl:     24px;
  --radius-full:   999px;

  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow:        0 4px 12px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-lg:     0 10px 30px rgba(0,0,0,0.12);
  --shadow-primary:0 4px 20px rgba(0,179,134,0.35);

  --nav-h:         64px;
  --topbar-h:      60px;
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background: var(--bg);
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }
img { max-width: 100%; }

/* ── App Shell ──────────────────────────────────────────── */
.app-view {
  display: none;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + 16px);
  animation: fadeSlideUp 0.25s ease;
}
.app-view.active { display: block; }
.app-view.no-nav { padding-bottom: 0; }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-back {
  width: 36px; height: 36px; border-radius: var(--radius);
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.topbar-back:active { background: var(--border); }
.topbar-title { font-size: 17px; font-weight: 800; flex: 1; }
.topbar-action { font-size: 13px; font-weight: 700; color: var(--primary); }

/* ── Bottom Navigation ──────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: var(--nav-h);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; padding: 8px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
  color: var(--text-muted); transition: color 0.2s;
  position: relative;
}
.nav-item.active { color: var(--primary); }
.nav-item-icon { font-size: 22px; line-height: 1; }
.nav-badge {
  position: absolute; top: 4px; right: calc(50% - 14px);
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 900; min-width: 16px; height: 16px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 2px solid var(--card);
}

/* ── Page Content ───────────────────────────────────────── */
.page-content { padding: 16px; }
.section-title {
  font-size: 13px; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 12px; margin-top: 20px;
}
.section-title:first-child { margin-top: 0; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
.card + .card { margin-top: 12px; }

/* ── Hero Gradient Card ─────────────────────────────────── */
.hero-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-xl);
  padding: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-primary);
}
.hero-card::before {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.08); border-radius: 50%;
}
.hero-card::after {
  content: '';
  position: absolute; bottom: -20px; right: 30px;
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.05); border-radius: 50%;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 14px 24px;
  font-family: var(--font); font-size: 15px; font-weight: 800;
  border-radius: var(--radius-full); border: none;
  transition: all 0.15s; cursor: pointer; width: 100%;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-accent { background: var(--accent); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 4px 12px rgba(229,62,62,0.35); }
.btn-ghost { background: transparent; color: var(--primary); font-weight: 700; padding: 10px; }
.btn-sm { padding: 10px 18px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Form Inputs ─────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 700; color: var(--text-soft); margin-bottom: 6px; display: block; }
.form-input {
  width: 100%; padding: 14px 16px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: 15px; font-family: var(--font);
  color: var(--text); outline: none; transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--primary); background: var(--card); }
.form-input::placeholder { color: var(--text-muted); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238A9AB0' fill='none' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; }

/* ── PIN Input ───────────────────────────────────────────── */
.pin-row { display: flex; gap: 12px; justify-content: center; margin: 20px 0; }
.pin-box {
  width: 56px; height: 64px; background: var(--bg);
  border: 2px solid var(--border); border-radius: var(--radius);
  font-size: 28px; font-weight: 900; text-align: center;
  color: var(--text); outline: none; transition: border-color 0.2s;
  -webkit-text-security: disc;
}
.pin-box:focus { border-color: var(--primary); background: var(--card); }

/* ── Route/Bus Cards ─────────────────────────────────────── */
.route-card {
  background: var(--card); border-radius: var(--radius-lg);
  padding: 16px; box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border-light);
  margin-bottom: 10px; cursor: pointer;
  transition: all 0.2s; display: block;
}
.route-card:active { transform: scale(0.98); }
.route-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.route-icon { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.route-badge { font-family: var(--font-mono); font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); }
.route-name { font-size: 15px; font-weight: 800; }
.route-path { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.route-footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.route-stat { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-soft); }
.route-fare { margin-left: auto; font-size: 18px; font-weight: 900; color: var(--primary); }

/* ── Bus Time Cards ──────────────────────────────────────── */
.bus-time-card {
  background: var(--card); border-radius: var(--radius);
  padding: 14px 16px; border: 1.5px solid var(--border-light);
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 8px; cursor: pointer; transition: all 0.15s;
}
.bus-time-card:active { background: var(--primary-light); }
.bus-time-card.selected { border-color: var(--primary); background: var(--primary-light); }
.eta-badge {
  background: var(--accent-light); color: var(--warning);
  font-size: 22px; font-weight: 900; padding: 6px 12px;
  border-radius: var(--radius); min-width: 64px; text-align: center;
  font-family: var(--font-mono);
}
.eta-badge.soon { background: var(--danger-light); color: var(--danger); }
.bus-info { flex: 1; }
.bus-id { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.bus-seats { font-size: 13px; font-weight: 700; color: var(--text-soft); }
.battery-pill { font-size: 11px; background: var(--primary-light); color: var(--primary); padding: 3px 8px; border-radius: 20px; font-weight: 700; }

/* ── Status Badges ───────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700;
}
.badge-paid      { background: #E8F8F4; color: var(--primary); }
.badge-pending   { background: #FFF8E1; color: var(--warning); }
.badge-transit   { background: #EBF8FF; color: var(--info); }
.badge-completed { background: #F0FFF4; color: var(--success); }
.badge-cancelled { background: #FFF5F5; color: var(--danger); }

/* ── Wallet Display ──────────────────────────────────────── */
.wallet-balance { font-size: 36px; font-weight: 900; letter-spacing: -1px; }
.wallet-label { font-size: 12px; opacity: 0.8; font-weight: 600; }

/* ── Alight / Door Control UI ───────────────────────────── */
.alight-btn {
  width: 100%; padding: 20px;
  font-size: 20px; font-weight: 900;
  background: linear-gradient(135deg, var(--danger) 0%, #C53030 100%);
  color: #fff; border-radius: var(--radius-xl);
  box-shadow: 0 6px 24px rgba(229,62,62,0.40);
  letter-spacing: 0.04em;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  transition: all 0.15s;
  animation: pulseAlight 2s infinite;
}
.alight-btn:active { transform: scale(0.97); }
@keyframes pulseAlight {
  0%, 100% { box-shadow: 0 6px 24px rgba(229,62,62,0.40); }
  50% { box-shadow: 0 6px 32px rgba(229,62,62,0.65); }
}

/* Door animation */
.door-container {
  height: 200px; background: #1A2332; border-radius: var(--radius-lg);
  position: relative; overflow: hidden; margin: 20px 0;
  display: flex; align-items: center; justify-content: center;
}
.door-bg { position: absolute; inset: 0; background: linear-gradient(180deg, #243447 0%, #1A2332 100%); }
.door-left, .door-right {
  position: absolute; top: 0; bottom: 0; width: 50%;
  background: linear-gradient(180deg, #2D4A6E 0%, #1E3A5C 100%);
  display: flex; align-items: center; justify-content: center;
  transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border: 2px solid #3A5A7E;
}
.door-left  { left: 0; border-right: 3px solid #4A7A9E; transform-origin: left; }
.door-right { right: 0; border-left: 3px solid #4A7A9E; transform-origin: right; }
.door-left.open  { transform: scaleX(0); }
.door-right.open { transform: scaleX(0); }
.door-handle {
  width: 6px; height: 40px; background: #FFB300;
  border-radius: 3px; position: absolute;
}
.door-left  .door-handle { right: 10px; }
.door-right .door-handle { left: 10px; }
.door-open-text {
  position: absolute; z-index: 2; text-align: center;
  color: var(--primary); font-size: 18px; font-weight: 900; opacity: 0;
  transition: opacity 0.5s 0.8s;
}
.door-open-text.visible { opacity: 1; }
.door-window {
  width: 60%; height: 50px; background: rgba(100,180,255,0.15);
  border-radius: 8px; border: 1px solid rgba(100,180,255,0.2);
  position: absolute; top: 20px;
}

/* ── Location Check UI ───────────────────────────────────── */
.location-status {
  border-radius: var(--radius-lg); padding: 20px;
  text-align: center; margin: 16px 0;
}
.location-status.checking { background: #EBF8FF; }
.location-status.confirmed { background: var(--primary-light); }
.location-status.pending   { background: #FFF8E1; }
.location-icon { font-size: 48px; margin-bottom: 10px; }
.location-title { font-size: 18px; font-weight: 900; margin-bottom: 6px; }
.location-subtitle { font-size: 13px; color: var(--text-muted); }
.distance-meter { font-family: var(--font-mono); font-size: 28px; font-weight: 700; color: var(--warning); margin: 10px 0; }

/* ── Progress & Loader ───────────────────────────────────── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
.spinner-sm { width: 20px; height: 20px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(255,255,255,0.9);
  z-index: 200; align-items: center; justify-content: center; flex-direction: column; gap: 12px;
}
.loading-overlay.active { display: flex; }

/* ── Route Progress ──────────────────────────────────────── */
.route-progress { padding: 16px 0; }
.progress-stops { display: flex; flex-direction: column; gap: 0; }
.progress-stop { display: flex; align-items: flex-start; gap: 12px; position: relative; }
.stop-indicator { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; width: 24px; }
.stop-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--border); border: 2px solid var(--card);
  box-shadow: 0 0 0 2px var(--border); flex-shrink: 0;
}
.stop-dot.done    { background: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.stop-dot.current { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); animation: pulse 1.5s infinite; width: 18px; height: 18px; margin: -2px; }
.stop-dot.dest    { background: var(--danger); box-shadow: 0 0 0 2px var(--danger-light); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent-light); }
  50% { box-shadow: 0 0 0 6px rgba(255,179,0,0.2); }
}
.stop-line { width: 2px; height: 28px; background: var(--border); margin: 2px auto; }
.stop-line.done { background: var(--primary); }
.stop-name { font-size: 13px; font-weight: 600; padding: 1px 0; padding-bottom: 20px; }
.stop-name.done    { color: var(--text-muted); text-decoration: line-through; }
.stop-name.current { font-weight: 900; color: var(--text); font-size: 15px; }
.stop-name.dest    { font-weight: 900; color: var(--danger); }

/* ── Quick Action Grid ───────────────────────────────────── */
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.quick-btn {
  background: var(--card); border-radius: var(--radius-lg);
  padding: 16px; text-align: center; cursor: pointer;
  border: 1.5px solid var(--border-light); transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.quick-btn:active { transform: scale(0.97); background: var(--primary-light); border-color: var(--primary); }
.quick-btn-icon { font-size: 28px; margin-bottom: 6px; }
.quick-btn-label { font-size: 12px; font-weight: 800; color: var(--text-soft); }

/* ── Payment Options ─────────────────────────────────────── */
.payment-option {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; border-radius: var(--radius);
  border: 2px solid var(--border); margin-bottom: 10px;
  cursor: pointer; transition: all 0.15s;
}
.payment-option:active { transform: scale(0.98); }
.payment-option.selected { border-color: var(--primary); background: var(--primary-light); }
.payment-logo { width: 48px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; }
.payment-name { font-size: 14px; font-weight: 800; }
.payment-number { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }
.payment-select { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; }
.payment-select.checked { background: var(--primary); border-color: var(--primary); color: #fff; font-size: 12px; }

/* ── Toast ───────────────────────────────────────────────── */
.toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); width: calc(100% - 32px); max-width: 448px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--text); color: #fff; padding: 14px 18px;
  border-radius: var(--radius); font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.3s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.info    { background: var(--info); }
.toast.warning { background: var(--warning); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; margin: 20px 0;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Chips/Filters ───────────────────────────────────────── */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  padding: 7px 14px; border-radius: 20px; font-size: 12px; font-weight: 700;
  background: var(--card); border: 1.5px solid var(--border); white-space: nowrap;
  cursor: pointer; transition: all 0.15s;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Misc ────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-danger  { color: var(--danger); }
.fw-900 { font-weight: 900; }
.fs-24 { font-size: 24px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-10 { gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* ── Scrollable content area ─────────────────────────────── */
.scroll-content { overflow-y: auto; height: calc(100vh - var(--topbar-h) - var(--nav-h) - 16px); }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon { font-size: 56px; margin-bottom: 12px; }
.empty-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.empty-sub { font-size: 14px; color: var(--text-muted); }

/* ── Responsive desktop centering ───────────────────────── */
@media (min-width: 481px) {
  body { box-shadow: 0 0 60px rgba(0,0,0,0.15); }
  .bottom-nav { border-radius: 0; }
}
