/* ===================================================
   TransitPass – Industrial / Utilitarian Aesthetic
   Slab serif headlines, tight grid, amber accents
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

/* ── Variables ─────────────────────────────────── */
:root {
  --bg:        #0a0f1e;
  --surface:   #111827;
  --surface2:  #1a2235;
  --border:    #1e2d47;
  --accent:    #f0a500;
  --accent2:   #e05a00;
  --text:      #e8eaf0;
  --text-muted:#8895aa;
  --danger:    #e03b3b;
  --success:   #22c55e;
  --pending:   #f0a500;
  --font-head: 'Playfair Display', Georgia, serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-body: 'IBM Plex Sans', sans-serif;
  --radius:    4px;
  --nav-h:     64px;
}

/* ── Reset ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── Typography ────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 900; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
.mono { font-family: var(--font-mono); }

/* ── Layout ────────────────────────────────────── */
.wrapper { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.page { padding-top: calc(var(--nav-h) + 2rem); padding-bottom: 4rem; }

/* ── Topnav ────────────────────────────────────── */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(10, 15, 30, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.topnav .wrapper { display: flex; align-items: center; gap: 2rem; width: 100%; }
.topnav-brand {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.topnav-brand span { color: var(--accent); }
.topnav-links { display: flex; gap: 0.25rem; flex: 1; }
.topnav-links a {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
  white-space: nowrap;
}
.topnav-links a:hover, .topnav-links a.active {
  color: var(--text);
  background: var(--surface2);
  text-decoration: none;
}
.topnav-links a.active { color: var(--accent); }
.topnav-right { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; flex-shrink: 0; }
.topnav-role {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}
.topnav-burger { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: 0.5rem; }

/* ── Sidebar / mobile nav ──────────────────────── */
.sidebar {
  position: fixed; top: 0; left: -280px; bottom: 0; width: 280px;
  background: var(--surface); border-right: 1px solid var(--border);
  z-index: 200; transition: left 0.3s ease; padding: 5rem 1.5rem 2rem;
  display: flex; flex-direction: column; gap: 0.25rem;
}
.sidebar.open { left: 0; }
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 199; backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }
.sidebar a {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem; border-radius: var(--radius);
  color: var(--text-muted); font-size: 0.9rem; font-weight: 500;
  transition: all 0.15s;
}
.sidebar a:hover, .sidebar a.active {
  color: var(--text); background: var(--surface2); text-decoration: none;
}
.sidebar a.active { color: var(--accent); }
.sidebar-icon { width: 18px; height: 18px; opacity: 0.7; }

/* ── Cards ─────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 0.7rem; font-family: var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }

/* ── Stat Cards ────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.5rem;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--accent);
}
.stat-card.green::before { background: var(--success); }
.stat-card.red::before { background: var(--danger); }
.stat-label { font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.5rem; }
.stat-value { font-family: var(--font-head); font-size: 2.2rem; font-weight: 900; color: var(--text); line-height: 1; }
.stat-value small { font-size: 1rem; color: var(--text-muted); font-family: var(--font-mono); }
.stat-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.4rem; }

/* ── Buttons ────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.25rem; border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500;
  letter-spacing: 0.05em; border: 1px solid transparent;
  cursor: pointer; transition: all 0.15s; white-space: nowrap; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #0a0f1e; border-color: var(--accent); }
.btn-primary:hover { background: #ffc030; border-color: #ffc030; }
.btn-outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: #0a0f1e; }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.72rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 0.9rem; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* ── Forms ─────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.5rem; }
.form-control {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body); font-size: 0.9rem;
  padding: 0.65rem 0.9rem; transition: border-color 0.15s;
}
.form-control:focus { outline: none; border-color: var(--accent); }
.form-control::placeholder { color: var(--text-muted); }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.35rem; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 0.35rem; }
select.form-control { cursor: pointer; }

/* ── Tables ─────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
  font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 0.75rem 1rem; text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:hover { background: var(--surface2); }
tbody td { padding: 0.85rem 1rem; vertical-align: middle; }
tbody tr:last-child { border-bottom: none; }

/* ── Badges ─────────────────────────────────────── */
.badge {
  display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px;
  font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.05em;
  font-weight: 500; text-transform: uppercase;
}
.badge-paid    { background: rgba(34,197,94,0.15); color: var(--success); border: 1px solid rgba(34,197,94,0.3); }
.badge-pending { background: rgba(240,165,0,0.15); color: var(--pending); border: 1px solid rgba(240,165,0,0.3); }
.badge-failed  { background: rgba(224,59,59,0.15);  color: var(--danger);  border: 1px solid rgba(224,59,59,0.3); }

/* ── Alerts ─────────────────────────────────────── */
.alert { padding: 0.875rem 1.1rem; border-radius: var(--radius); border-left: 3px solid; margin-bottom: 1rem; font-size: 0.875rem; }
.alert-success { background: rgba(34,197,94,0.08); border-color: var(--success); color: var(--success); }
.alert-error   { background: rgba(224,59,59,0.08);  border-color: var(--danger);  color: var(--danger); }
.alert-info    { background: rgba(240,165,0,0.08);  border-color: var(--accent);  color: var(--accent); }

/* ── Login page ─────────────────────────────────── */
.login-page {
  min-height: 100vh; display: grid;
  grid-template-columns: 1fr 480px;
}
.login-visual {
  background: linear-gradient(135deg, #0a0f1e 0%, #0d1b35 50%, #0a1520 100%);
  display: flex; flex-direction: column; justify-content: center;
  padding: 4rem; position: relative; overflow: hidden;
}
.login-visual::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 39px, rgba(240,165,0,0.04) 40px
  ),
  repeating-linear-gradient(
    90deg, transparent, transparent 39px, rgba(240,165,0,0.04) 40px
  );
}
.login-visual-content { position: relative; z-index: 1; }
.login-visual h1 { color: var(--text); margin-bottom: 1rem; }
.login-visual h1 em { color: var(--accent); font-style: normal; }
.login-visual p { color: var(--text-muted); font-size: 1.05rem; max-width: 380px; line-height: 1.7; }
.login-features { margin-top: 3rem; display: flex; flex-direction: column; gap: 1rem; }
.login-feature { display: flex; align-items: center; gap: 0.75rem; color: var(--text-muted); font-size: 0.875rem; }
.login-feature-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.login-form-side {
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: center;
  padding: 3rem 2.5rem;
}
.login-form-side h2 { margin-bottom: 0.5rem; }
.login-form-side .sub { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 2rem; }

/* ── Dashboard grid ─────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.dash-grid-full { grid-column: 1 / -1; }

/* ── Trip card ──────────────────────────────────── */
.trip-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 1rem; align-items: center; transition: border-color 0.15s;
}
.trip-card:hover { border-color: var(--accent); }
.trip-time { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 500; color: var(--accent); text-align: center; }
.trip-time small { display: block; font-size: 0.6rem; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; }
.trip-route h3 { font-size: 1rem; margin-bottom: 0.2rem; }
.trip-route p  { font-size: 0.8rem; color: var(--text-muted); }
.trip-meta { text-align: right; }
.trip-price { font-family: var(--font-head); font-size: 1.5rem; font-weight: 900; color: var(--text); }
.trip-seats { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.trips-list { display: flex; flex-direction: column; gap: 0.75rem; }

/* ── Booking modal / panel ──────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  z-index: 300; align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem;
  width: min(480px, 95vw); max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.25rem; padding: 0.25rem; transition: color 0.15s; }
.modal-close:hover { color: var(--text); }

/* ── PWA install banner ─────────────────────────── */
.install-banner {
  display: none; position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 1rem 1.5rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 400; align-items: center; gap: 1rem;
  width: min(420px, 95vw); animation: slideUp 0.3s ease;
}
.install-banner.show { display: flex; }
.install-banner p { flex: 1; font-size: 0.85rem; color: var(--text); }
.install-banner p strong { color: var(--accent); }

/* ── Offline indicator ──────────────────────────── */
.offline-bar {
  display: none; position: fixed; top: var(--nav-h); left: 0; right: 0;
  background: var(--danger); color: #fff;
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.05em;
  text-align: center; padding: 0.4rem; z-index: 90;
}
.offline-bar.show { display: block; }
body.offline .offline-bar { display: block; }

/* ── Loading skeleton ───────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Ticket receipt ─────────────────────────────── */
.ticket {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; position: relative; overflow: hidden;
}
.ticket::after {
  content: 'TRANSITPASS'; position: absolute;
  font-family: var(--font-head); font-size: 6rem; font-weight: 900;
  color: rgba(240,165,0,0.04); top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-20deg);
  white-space: nowrap; pointer-events: none;
}
.ticket-id { font-family: var(--font-mono); font-size: 1.5rem; color: var(--accent); letter-spacing: 0.1em; }
.ticket-divider { border: none; border-top: 2px dashed var(--border); margin: 1.25rem 0; }
.ticket-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.ticket-row-label { font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.ticket-row-value { font-weight: 500; font-size: 0.9rem; }

/* ── Page transitions ───────────────────────────── */
.page-enter { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Empty state ────────────────────────────────── */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-state svg { opacity: 0.2; margin: 0 auto 1rem; }
.empty-state p { font-size: 0.875rem; }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  .login-page { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .dash-grid { grid-template-columns: 1fr; }
  .topnav-links { display: none; }
  .topnav-right .btn-sm { display: none; }
  .topnav-burger { display: flex; }
  .trip-card { grid-template-columns: 1fr; gap: 0.75rem; }
  .trip-meta { text-align: left; }
}
