/* ─── CSS Variables / Design Tokens ─────────────────────────── */
:root {
  /* Brand Colors */
  --color-primary: #00A651;
  --color-primary-dark: #007A3C;
  --color-primary-light: #E6F7EE;
  --color-primary-rgb: 0, 166, 81;
  --color-blue: #007BFF;
  --color-blue-dark: #0056CC;
  --color-blue-light: #E8F2FF;

  /* Neutrals */
  --color-bg: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-surface-2: #F1F5F9;
  --color-border: #E2E8F0;
  --color-border-light: #F1F5F9;

  /* Text */
  --color-text: #0F172A;
  --color-text-secondary: #475569;
  --color-text-muted: #94A3B8;
  --color-text-inverse: #FFFFFF;

  /* Semantic */
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-error: #EF4444;
  --color-info: #3B82F6;

  /* Typography */
  --font-heading: 'Poppins', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'Courier New', monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .08), 0 2px 6px rgba(0, 0, 0, .05);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .10), 0 4px 12px rgba(0, 0, 0, .06);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, .12), 0 8px 24px rgba(0, 0, 0, .08);
  --shadow-green: 0 4px 20px rgba(0, 166, 81, .25);
  --shadow-green-lg: 0 8px 32px rgba(0, 166, 81, .35);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(.4, 0, .2, 1);
  --transition-base: 250ms cubic-bezier(.4, 0, .2, 1);
  --transition-slow: 400ms cubic-bezier(.4, 0, .2, 1);
  --transition-bounce: 300ms cubic-bezier(.34, 1.56, .64, 1);

  /* Z-index */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;
}

/* ─── Dark Mode ──────────────────────────────────────────────── */
[data-theme="dark"] {
  --color-bg: #0D1117;
  --color-surface: #161B22;
  --color-surface-2: #21262D;
  --color-border: #30363D;
  --color-border-light: #21262D;
  --color-text: #E6EDF3;
  --color-text-secondary: #8B949E;
  --color-text-muted: #484F58;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .4);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition-slow), color var(--transition-slow);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  touch-action: manipulation;
}

a {
  touch-action: manipulation;
}

input,
select,
textarea {
  font-family: inherit;
}

/* Focus-visible for keyboard accessibility */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ─── Typography ─────────────────────────────────────────────── */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text);
}

h1 {
  font-size: var(--text-4xl);
  font-weight: 800;
}

h2 {
  font-size: var(--text-3xl);
  font-weight: 700;
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-size: var(--text-xl);
}

h5 {
  font-size: var(--text-lg);
}

h6 {
  font-size: var(--text-base);
}

p {
  margin-bottom: var(--space-4);
}

p:last-child {
  margin-bottom: 0;
}

/* ─── Container ──────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container--wide {
  max-width: 1440px;
}

.container--narrow {
  max-width: 800px;
}

/* ─── Section Spacing ────────────────────────────────────────── */
.section {
  padding: var(--space-16) 0;
}

.section--sm {
  padding: var(--space-10) 0;
}

.section--lg {
  padding: var(--space-20) 0;
}

.section-header {
  margin-bottom: var(--space-10);
}

.section-header--center {
  text-align: center;
}

.section-label {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: -.5px;
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  margin-top: var(--space-3);
  font-weight: 400;
}

/* ─── Grid ───────────────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
}

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
}

/* ─── Flex Utilities ─────────────────────────────────────────── */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-6 {
  gap: var(--space-6);
}

/* ─── Skeleton Loader ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface-2) 25%, var(--color-border) 50%, var(--color-surface-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-wave {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 1em;
  margin-bottom: .5em;
}

.skeleton-title {
  height: 1.5em;
  width: 60%;
  margin-bottom: 1em;
}

/* ─── Toast Notifications ────────────────────────────────────── */
.toast {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toast-in var(--transition-bounce) forwards;
  min-width: 280px;
  max-width: 400px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(40px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast--success {
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.toast--error {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

.toast--info {
  background: #EFF6FF;
  color: #1E40AF;
  border: 1px solid #BFDBFE;
}

.toast--warning {
  background: #FFFBEB;
  color: #92400E;
  border: 1px solid #FDE68A;
}

.toast button {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 1.2rem;
  opacity: .6;
  cursor: pointer;
}

.toast button:hover {
  opacity: 1;
}

/* ─── Badge / Tag ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .3px;
}

.badge--green {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.badge--blue {
  background: var(--color-blue-light);
  color: var(--color-blue-dark);
}

.badge--orange {
  background: #FFF7ED;
  color: #C2410C;
}

.badge--purple {
  background: #F5F3FF;
  color: #6D28D9;
}

.badge--gray {
  background: var(--color-surface-2);
  color: var(--color-text-secondary);
}

.class-badge {
  display: inline-block;
  color: #fff;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .3px;
}

/* ─── Divider ────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-6) 0;
}

/* ─── Text Utilities ─────────────────────────────────────────── */
.text-primary {
  color: var(--color-primary);
}

.text-muted {
  color: var(--color-text-muted);
}

.text-secondary {
  color: var(--color-text-secondary);
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-sm {
  font-size: var(--text-sm);
}

.text-xs {
  font-size: var(--text-xs);
}

.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Fare Display ───────────────────────────────────────────── */
.fare-amount {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: var(--text-2xl);
  color: var(--color-primary);
}

.fare-amount--lg {
  font-size: var(--text-3xl);
}

.fare-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ─── Amenity Pills ──────────────────────────────────────────── */
.amenity-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.amenity-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--color-surface-2);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-6);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

.empty-state__title {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.empty-state__text {
  color: var(--color-text-secondary);
}

/* ─── Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

.breadcrumb a {
  color: var(--color-primary);
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb span::before {
  content: '/';
  margin-right: var(--space-2);
}

/* ─── Responsive Helpers ─────────────────────────────────────── */
.hide-mobile {
  display: block;
}

.show-mobile {
  display: none;
}

@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-4);
  }

  h1 {
    font-size: var(--text-3xl);
  }

  h2 {
    font-size: var(--text-2xl);
  }

  .section {
    padding: var(--space-10) 0;
  }

  .section-title {
    font-size: var(--text-2xl);
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .hide-mobile {
    display: none;
  }

  .show-mobile {
    display: block;
  }

  .toast {
    top: auto;
    bottom: var(--space-4);
    right: var(--space-4);
    left: var(--space-4);
    min-width: unset;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: var(--text-2xl);
  }

  h2 {
    font-size: var(--text-xl);
  }
}

/* ─── Print Styles ───────────────────────────────────────────── */
@media print {
  .navbar, .footer, .toast, .navbar__overlay, .navbar__mobile,
  #darkModeToggle, .navbar__hamburger, .hero::before, .hero::after { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  a { color: #000; text-decoration: underline; }
  .card, .route-card, .operator-card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .hero { background: #f5f5f5 !important; padding: 1rem 0 !important; }
  .container { max-width: 100%; padding: 0; }
}

/* ─── Reduced Motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}