:root {
  --ocean-primary: #0284c7;
  --ocean-dark: #0369a1;
  --ocean-deep: #0c4a6e;
  --ocean-light: #e0f2fe;
  --ocean-border: #bae6fd;
  --bg: #f0f9ff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: #cbd5e1;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: linear-gradient(90deg, var(--ocean-deep), var(--ocean-primary), #0ea5e9);
  color: #fff;
  padding: 12px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 3px 12px rgba(2, 132, 199, 0.28);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; }
.brand-logo { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; background: #fff; padding: 2px; }
.env-badge { background: rgba(12, 74, 110, 0.45); padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.nav-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.nav-btn {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: none;
  padding: 8px 13px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.nav-btn.active { background: #fff; color: var(--ocean-dark); }

.container { max-width: 1220px; width: 100%; margin: 20px auto; padding: 0 16px 32px; flex: 1; }
.card {
  background: var(--card);
  border: 1px solid var(--ocean-border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.06);
}
h2, h3 { margin-top: 0; color: var(--ocean-deep); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}
.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
}
.btn-primary { background: var(--ocean-primary); color: #fff; }
.btn-primary:hover { background: var(--ocean-dark); }
.btn-green { background: var(--ocean-deep); color: #fff; }
.btn-outline { background: #fff; border: 1px solid var(--ocean-primary); color: var(--ocean-dark); }
.btn-danger { background: #dc2626; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-white { background: #fff; color: var(--ocean-deep); border: none; }

.trip-item {
  border: 1px solid var(--ocean-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #fff;
}
.trip-item.selected { border-color: var(--ocean-primary); background: var(--ocean-light); }
.price { font-size: 19px; font-weight: 800; color: var(--ocean-dark); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-hol { background: #fee2e2; color: #b91c1c; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-info { background: #e0f2fe; color: #0369a1; }

.route-banner {
  background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
  border: 1px solid var(--ocean-border);
  border-left: 5px solid var(--ocean-primary);
  border-radius: 10px;
  padding: 13px 16px;
  margin-bottom: 14px;
  color: var(--ocean-deep);
}
.route-banner-title { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.route-banner-meta { font-size: 13px; color: #334155; line-height: 1.5; }

/* --- REALISTIC COACH BUS CUTAWAY & PASSENGER VISUALIZER --- */
.cabin-layout-split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(350px, 1.15fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 960px) {
  .cabin-layout-split { grid-template-columns: 1fr; }
}

.points-box {
  background: #f8fafc;
  border: 1px solid var(--ocean-border);
  border-radius: 10px;
  padding: 12px;
}

.real-bus-stage {
  background: linear-gradient(180deg, #e0f2fe 0%, #f8fafc 100%);
  border: 1px solid var(--ocean-border);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
}
.real-bus-wrap {
  position: relative;
  padding: 0 10px;
}
.real-bus-mirrors {
  display: flex;
  justify-content: space-between;
  margin: 0 -10px -8px;
  pointer-events: none;
}
.real-bus-mirror {
  width: 14px;
  height: 22px;
  background: #0f172a;
  border: 2px solid #94a3b8;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.3);
}
.real-bus-shell {
  background: linear-gradient(180deg, #ffffff 0%, #f0f9ff 86%, #0c4a6e 87%, #075985 100%);
  border: 3px solid #0369a1;
  border-radius: 34px 34px 18px 18px;
  overflow: hidden;
  box-shadow: 0 12px 26px rgba(3, 105, 161, 0.18);
}
.real-bus-windshield {
  background: linear-gradient(180deg, #0c4a6e 0%, #0284c7 65%, #38bdf8 100%);
  color: #fff;
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #075985;
  position: relative;
}
.real-bus-headlight {
  width: 24px;
  height: 9px;
  background: linear-gradient(90deg, #fef08a, #facc15);
  border-radius: 999px;
  box-shadow: 0 0 10px #fde047;
}
.real-bus-cockpit {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #e2e8f0;
  border-bottom: 2px dashed #94a3b8;
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #1e293b;
}
.real-bus-driver-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 3px 8px;
}
.real-bus-door-box {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #dbeafe;
  border: 1px solid #60a5fa;
  border-radius: 8px;
  padding: 3px 8px;
  color: #0369a1;
}
.real-bus-decks {
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  background: #f8fafc;
}
.real-bus-deck {
  background: #ffffff;
  border: 1.5px solid #93c5fd;
  border-radius: 10px;
  padding: 8px;
}
.real-bus-deck-title {
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: #0369a1;
  padding: 3px 8px;
  border-radius: 6px;
  text-align: center;
  margin-bottom: 8px;
}
.real-berth-grid {
  display: grid;
  gap: 6px;
}
.real-berth {
  position: relative;
  border: 1.5px solid #7dd3fc;
  border-radius: 8px;
  background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
  padding: 4px 3px 5px;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.real-berth:hover:not(.is-booked):not(.is-held) {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
  border-color: #0284c7;
}
.real-berth-pillow {
  width: 72%;
  height: 7px;
  background: #ffffff;
  border: 1px solid #93c5fd;
  border-radius: 4px;
}
.real-berth-code {
  font-size: 10px;
  font-weight: 800;
  color: #0c4a6e;
  line-height: 1;
}
.real-berth.is-selected {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  border-color: #0c4a6e;
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.55);
  transform: scale(1.04);
}
.real-berth.is-selected .real-berth-pillow {
  background: #bae6fd;
  border-color: #fff;
}
.real-berth.is-selected .real-berth-code {
  color: #ffffff;
}
.real-berth.is-booked {
  background: #e2e8f0;
  border-color: #94a3b8;
  cursor: not-allowed;
  opacity: 0.85;
}
.real-berth.is-booked .real-berth-pillow {
  background: #cbd5e1;
  border-color: #94a3b8;
}
.real-berth.is-booked .real-berth-code {
  color: #64748b;
}
.real-berth.is-held {
  background: #fef3c7;
  border-color: #f59e0b;
  cursor: not-allowed;
}
.real-berth-occupant {
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.real-bus-undercarriage {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 14px;
  color: #e0f2fe;
  font-size: 11px;
  font-weight: 700;
}
.bus-wheel {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0f172a;
  border: 4px solid #cbd5e1;
  display: inline-block;
}

.bus-chassis {
  border: 2px solid #7dd3fc;
  border-radius: 24px 24px 16px 16px;
  background: linear-gradient(180deg, #f8fafc, #eff6ff);
  padding: 14px;
}
.bus-front-cabin {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(90deg, #0c4a6e, #0284c7);
  color: #fff;
  padding: 8px 14px;
  border-radius: 14px 14px 6px 6px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 700;
}

.decks-wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.deck-box {
  border: 1px solid var(--ocean-border);
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
}
.seat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.seat-btn {
  padding: 9px 6px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.seat-available { background: #e0f2fe; border-color: #38bdf8; color: #0c4a6e; }
.seat-available:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(2, 132, 199, 0.2); }
.seat-selected { background: var(--ocean-primary); border-color: var(--ocean-dark); color: #fff; }
.seat-held { background: #fef3c7; border-color: #f59e0b; color: #92400e; cursor: not-allowed; }
.seat-booked { background: #e2e8f0; border-color: #94a3b8; color: #64748b; cursor: not-allowed; text-decoration: line-through; }

/* Live Tracking Styles */
.tracking-stop-alert {
  background: linear-gradient(135deg, #fff1f2, #ffe4e6);
  border: 2px solid #fb7185;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 12px 0;
  color: #881337;
}
.tracking-move-alert {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 2px solid #4ade80;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 12px 0;
  color: #14532d;
}
.tracking-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.tracking-step {
  border: 1px solid var(--ocean-border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  font-size: 13px;
}
.tracking-step.is-passed {
  background: #f0fdf4;
  border-color: #86efac;
}
.tracking-step.is-current {
  background: #e0f2fe;
  border: 2px solid #0284c7;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.18);
}
.tracking-step.is-current-stopped {
  background: #fff1f2;
  border: 2px solid #e11d48;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.18);
}

/* Live Visualizer + Luggage Hold */
.sim-panel {
  border: 1px solid var(--ocean-border);
  border-radius: 12px;
  padding: 14px;
  background: #f8fafc;
}
.seat-sim-card {
  background: #fff;
  border: 1px solid var(--ocean-border);
  border-left: 4px solid var(--ocean-primary);
  border-radius: 9px;
  padding: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}
.luggage-bay {
  background: linear-gradient(180deg, #0c4a6e, #1e293b);
  color: #fff;
  border-radius: 10px;
  padding: 12px;
  margin-top: 8px;
}
.luggage-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px;
  margin: 8px 0;
  font-size: 20px;
}
.luggage-bar-track {
  height: 10px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  overflow: hidden;
}
.luggage-bar-fill {
  height: 100%;
  background: #38bdf8;
  transition: width 0.25s ease, background 0.25s ease;
}

/* Route Map Box */
.route-map-wrap {
  margin-top: 16px;
  border: 1px solid var(--ocean-border);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}
#leafletMap {
  height: 250px;
  border-radius: 10px;
  border: 1px solid var(--ocean-border);
  margin-top: 10px;
  z-index: 1;
}
.stops-timeline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.stop-node {
  background: var(--ocean-light);
  border: 1px solid var(--ocean-border);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12px;
}

/* Payment Online Box */
.payment-checkout-grid {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 768px) {
  .payment-checkout-grid { grid-template-columns: 1fr; }
}
.qr-preview-box {
  background: #fff;
  border: 2px dashed var(--ocean-primary);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}
.qr-preview-box img { max-width: 210px; width: 100%; border-radius: 8px; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 74, 110, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}
.modal-card {
  background: #fff;
  border-radius: 14px;
  max-width: 440px;
  width: 100%;
  padding: 22px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
}

/* Footer */
.company-footer {
  background: linear-gradient(135deg, #0c4a6e, #075985);
  color: #e0f2fe;
  padding: 28px 20px 14px;
  margin-top: auto;
}
.footer-inner {
  max-width: 1220px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.footer-brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.footer-logo { width: 42px; height: 42px; border-radius: 10px; background: #fff; padding: 2px; object-fit: cover; }
.footer-brand-title { font-size: 18px; font-weight: 800; color: #fff; }
.footer-slogan { font-size: 12px; color: #bae6fd; }
.footer-col h4 { margin: 0 0 10px; color: #fff; font-size: 15px; }
.footer-text { margin: 5px 0; font-size: 13px; color: #e0f2fe; line-height: 1.5; }
.footer-pay-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.footer-pay-pill {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(186, 230, 253, 0.3);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
}
.footer-links a { color: #7dd3fc; text-decoration: none; font-size: 13px; font-weight: 600; }
.footer-links a:hover { text-decoration: underline; }
.btn-pwa-footer {
  background: #0ea5e9;
  color: #fff;
  border: none;
  padding: 7px 12px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.footer-bottom {
  max-width: 1220px;
  margin: 18px auto 0;
  padding-top: 12px;
  border-top: 1px solid rgba(186, 230, 253, 0.25);
  text-align: center;
  font-size: 12px;
  color: #bae6fd;
}

.alert { padding: 11px 14px; border-radius: 9px; margin: 10px 0; font-size: 14px; }
.alert-err { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-info { background: #e0f2fe; border: 1px solid #7dd3fc; color: #0c4a6e; }

.hidden { display: none !important; }
.row-flex { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.muted { color: var(--muted); font-size: 13px; }
.countdown { font-weight: 800; color: #dc2626; background: #fee2e2; padding: 4px 10px; border-radius: 8px; }
