:root {
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --paper: #f5f5f7;
  --cobalt: #0071e3;
  --cobalt-press: #0060c0;
  --free: #34c759;
  --taken: #ff3b30;
  --premium: #ff9500;
  --hairline: rgba(0, 0, 0, 0.08);

  --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display',
    'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Menlo', 'Consolas', monospace;

  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-blur: saturate(180%) blur(20px);
  --card-radius: 20px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.03);
  --shadow-2: 0 10px 30px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #fafafc 0%, var(--paper) 240px);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-width: 320px;
}

.mono { font-family: var(--font-mono); }

/* ---------- App header (translucent, Apple nav-bar style) ---------- */

.app-header {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--ink);
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-header a.app-title { text-decoration: none; color: inherit; }

.app-title {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.nav-actions { display: flex; align-items: center; gap: 14px; font-size: 0.88rem; }
.nav-actions a, .nav-actions button {
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.nav-actions .nav-cta {
  background: var(--cobalt);
  color: #fff;
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 600;
}

main {
  padding: 24px 16px 80px;
  max-width: 720px;
  margin: 0 auto;
}

a { color: var(--cobalt); }

:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
  border-radius: 4px;
}

.hidden { display: none !important; }

/* ---------- Headings / hero ---------- */

.hero {
  position: relative;
  padding: 8px 4px 24px;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -60px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(0, 113, 227, 0.14) 0%, rgba(0, 113, 227, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

.hero > * { position: relative; z-index: 1; }

.hero-badge {
  display: inline-block;
  background: rgba(0, 113, 227, 0.1);
  color: var(--cobalt);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.status-line {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 4px 0 6px;
  color: var(--ink);
}

.hero-sub {
  color: var(--muted);
  font-size: 0.94rem;
  margin: 0;
}

.feature-strip {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 24px;
}

.feature {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

.feature-icon {
  font-size: 1.3rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 4px 0 18px;
}

/* ---------- Cards / panels (shared chrome) ---------- */

.panel, .card {
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-1);
  padding: 22px 20px;
  margin-bottom: 16px;
}

/* ---------- Forms ---------- */

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.field { margin-bottom: 16px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], select {
  font: inherit;
  font-size: 1rem;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  min-height: 44px;
  appearance: none;
  -webkit-appearance: none;
}

input:focus, select:focus {
  border-color: var(--cobalt);
  outline: none;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

.btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.98rem;
  border: none;
  border-radius: 12px;
  padding: 13px 22px;
  min-height: 44px;
  background: var(--cobalt);
  color: #fff;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s ease, transform 0.08s ease;
}

.btn:active { background: var(--cobalt-press); transform: scale(0.99); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }

.btn.secondary {
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.92rem;
  border: 1px solid var(--hairline);
}

.btn.danger { background: var(--taken); }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Search form ---------- */

.swap-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }
.swap-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--hairline);
  background: var(--paper); cursor: pointer; font-size: 1.1rem; color: var(--muted);
}

.popular-routes { margin-top: 18px; }
.popular-routes h3 { font-size: 0.9rem; color: var(--muted); margin: 0 0 10px; font-weight: 600; }
.route-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--hairline); border-radius: 999px;
  padding: 8px 14px; margin: 0 8px 8px 0; font-size: 0.85rem; cursor: pointer;
}
.route-chip:hover { border-color: var(--cobalt); color: var(--cobalt); }

/* ---------- Choose-your-ride cards ---------- */

.ride-option-row { display: flex; align-items: center; gap: 14px; }

.ride-icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(0, 113, 227, 0.14), rgba(0, 113, 227, 0.05));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.ride-info { flex: 1; min-width: 0; }
.ride-price { text-align: right; flex-shrink: 0; }
.ride-price .trip-price { font-size: 1rem; }

/* ---------- Trip result cards ---------- */

.trip-card {
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  box-shadow: var(--shadow-1);
  padding: 18px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}
.trip-card:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }

.trip-card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.trip-operator { font-weight: 700; font-size: 1rem; }
.trip-tier {
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 8px; border-radius: 999px; color: #fff; background: var(--muted);
}
.trip-tier.PREMIUM { background: var(--premium); }
.trip-tier.STANDARD { background: var(--cobalt); }
.trip-tier.BUDGET { background: var(--free); }

.trip-times {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  font-family: var(--font-mono); font-size: 1.1rem; font-weight: 600;
}
.trip-times .arrow { color: var(--muted); font-size: 0.85rem; flex: 1; text-align: center; }
.trip-duration { font-size: 0.72rem; color: var(--muted); text-align: center; margin-top: 2px; font-family: var(--font-body); }

.trip-card-bottom {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hairline);
}
.trip-price { font-size: 1.15rem; font-weight: 700; }
.trip-seats-left { font-size: 0.78rem; color: var(--muted); }
.trip-seats-left.low { color: var(--taken); font-weight: 600; }

/* ---------- Trip detail ---------- */

.trip-summary { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.trip-via { font-size: 0.82rem; color: var(--muted); margin-top: 6px; }

/* ---------- Generic seat grid (driven by src/seatLayout.js) ---------- */

.legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 14px 0 16px;
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 500;
}
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.legend .dot.free { background: var(--free); }
.legend .dot.taken { background: var(--taken); }
.legend .dot.selected { background: var(--cobalt); }

.wheel-row { display: flex; justify-content: center; margin-bottom: 10px; }
.wheel-icon { width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; opacity: 0.7; }

.seat-grid { display: flex; flex-direction: column; gap: 8px; margin: 4px auto 0; max-width: 340px; }

.seat-row { display: grid; gap: 6px; align-items: center; }

.aisle-gap { position: relative; }
.aisle-gap::after {
  content: '';
  position: absolute;
  left: 50%; top: 0; bottom: 0; width: 1px;
  background: repeating-linear-gradient(to bottom, #d2d2d7 0 4px, transparent 4px 9px);
  transform: translateX(-50%);
}

.seat-btn {
  font: inherit;
  font-family: var(--font-mono);
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  min-height: 40px;
  border: none;
  border-radius: 10px;
  background: color-mix(in srgb, var(--free) 20%, #fff);
  color: color-mix(in srgb, var(--free) 85%, #0a2b0d);
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.15s ease, background 0.15s ease;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--free) 55%, transparent);
}

.seat-btn:hover { transform: translateY(-2px) scale(1.06); }
.seat-btn:active { transform: scale(0.95); }

.seat-btn.taken {
  background: color-mix(in srgb, var(--taken) 14%, #fff);
  color: color-mix(in srgb, var(--taken) 70%, #4a0d0a);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--taken) 40%, transparent);
  cursor: not-allowed;
}
.seat-btn.taken:hover { transform: none; }

.seat-btn.selected {
  background: var(--cobalt);
  color: #fff;
  box-shadow: inset 0 0 0 1.5px var(--cobalt-press);
}

@media (prefers-reduced-motion: reduce) {
  .seat-btn:hover { transform: none; }
}

.sticky-selection {
  position: sticky;
  top: 66px; /* just under the sticky app-header */
  z-index: 4;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

/* ---------- Checkout ---------- */

.summary-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 0.92rem; }
.summary-row.total { font-weight: 700; font-size: 1.05rem; border-top: 1px solid var(--hairline); margin-top: 6px; padding-top: 12px; }
.seat-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.seat-pill {
  background: rgba(0, 113, 227, 0.1); color: var(--cobalt); border-radius: 999px;
  padding: 4px 10px; font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700;
}

.card-art {
  background: linear-gradient(135deg, #1d1d1f, #3a3a3d);
  border-radius: 16px;
  padding: 20px;
  color: #fff;
  margin-bottom: 18px;
}
.card-art .card-number { font-family: var(--font-mono); font-size: 1.15rem; letter-spacing: 0.12em; }
.card-art .card-sub { font-size: 0.7rem; opacity: 0.7; margin-top: 10px; text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- Boarding-pass ticket ---------- */

.ticket {
  position: relative;
  display: flex;
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  box-shadow: var(--shadow-2);
  overflow: hidden;
  margin-bottom: 16px;
}

.ticket::before, .ticket::after {
  content: '';
  position: absolute;
  right: 88px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--hairline);
  z-index: 2;
}
.ticket::before { top: -10px; }
.ticket::after { bottom: -10px; }

.ticket-main { flex: 1; padding: 18px 20px 16px; min-width: 0; }

.ticket-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.ticket-brand { font-weight: 700; font-size: 0.82rem; letter-spacing: 0.12em; color: var(--cobalt); }
.ticket-route { font-size: 0.74rem; color: var(--muted); font-weight: 500; }

.ticket-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px 12px; }
.ticket-field label { font-size: 0.64rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 2px; }
.ticket-field strong { font-size: 0.98rem; font-weight: 600; display: block; }
.ticket-seats strong { font-size: 1.3rem; font-weight: 700; color: var(--cobalt); }

.ticket-desc { margin-top: 12px; font-size: 0.85rem; color: var(--muted); border-top: 1px solid var(--hairline); padding-top: 10px; }

.ticket-stub {
  width: 96px; flex-shrink: 0;
  border-left: 2px dashed #d2d2d7;
  background: rgba(0, 113, 227, 0.05);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 10px;
}

.barcode {
  width: 54px; height: 52px;
  background: repeating-linear-gradient(to right, var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 7px, transparent 7px 9px);
  border-radius: 2px;
  opacity: 0.85;
}

.ticket-stub-code { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.06em; text-align: center; }
.ticket.cancelled { opacity: 0.55; }
.ticket-cancelled-badge {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  background: var(--taken); color: #fff; font-size: 0.62rem; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.06em;
}

/* ---------- Empty / error states ---------- */

.notice {
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: var(--shadow-1);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 0.92rem;
  color: var(--ink);
}
.notice.error { color: var(--taken); border-color: rgba(255, 59, 48, 0.25); }
.notice.success { color: #1b7a34; border-color: rgba(52, 199, 89, 0.3); }

.notice::before { content: 'ℹ️'; margin-right: 8px; }
.notice.error::before { content: '⚠️'; }
.notice.success::before { content: '✅'; }

/* ---------- Tooltip ---------- */

#tooltip {
  position: fixed; z-index: 10;
  background: rgba(29, 29, 31, 0.92);
  backdrop-filter: blur(8px);
  color: #fff; padding: 9px 13px; border-radius: 10px;
  font-size: 0.85rem; max-width: 260px; pointer-events: none; display: none;
  box-shadow: var(--shadow-2);
}
#tooltip.visible { display: block; }

/* ---------- Footer ---------- */

footer.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 16px;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
}

/* ---------- Admin dashboard ---------- */

.admin-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.admin-tab {
  font: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  white-space: nowrap;
  background: #fff;
  border: 1px solid var(--hairline);
  color: var(--muted);
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
}

.admin-tab.active { background: var(--cobalt); color: #fff; border-color: var(--cobalt); }

.admin-panel {
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-1);
  padding: 20px;
  margin-bottom: 16px;
}

.admin-section-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 10px; }

.admin-grid-2 { display: grid; grid-template-columns: 1fr; gap: 24px; }

.admin-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
}
.admin-row:last-child { border-bottom: none; }

.admin-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.admin-row-main strong { font-size: 0.94rem; }
.admin-row-side { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.admin-row-side .btn { width: auto; padding: 7px 14px; font-size: 0.82rem; min-height: 0; }

.admin-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}
.admin-form .field { margin-bottom: 12px; }
.admin-form .btn { width: auto; padding: 10px 18px; }

/* ---------- Responsive ---------- */

@media (min-width: 820px) {
  main { max-width: 760px; }

  .admin-shell { max-width: 1040px; }
  .admin-grid-2 { grid-template-columns: 1fr 1fr; }
  .admin-row { align-items: center; }
}

@media (max-width: 360px) {
  main { padding-left: 12px; padding-right: 12px; }
  .panel, .card, .admin-panel { padding: 18px 16px; }
  .admin-row { flex-direction: column; }
  .admin-row-side { align-items: flex-start; width: 100%; }
  .admin-row-side .btn { width: 100%; }
}
