/* ==========================================================================
   RailPulse IT-CH - Design System & Modern Responsive Stylesheet
   ========================================================================== */

:root {
  /* Color Palette - Deep Navy / Railtech Dark Theme */
  --bg-main: #0b1120;
  --bg-surface: #131d31;
  --bg-card: rgba(26, 38, 64, 0.7);
  --bg-card-hover: rgba(35, 51, 84, 0.85);
  --bg-input: rgba(15, 23, 42, 0.8);

  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #38bdf8;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Brand Accents */
  --accent-it: #059669;       /* Italian Green */
  --accent-it-light: #10b981;
  --accent-ch: #dc2626;       /* Swiss Red */
  --accent-ch-light: #ef4444;
  --accent-cyan: #38bdf8;     /* Tech Cyan */
  --accent-blue: #2563eb;

  /* Status Colors */
  --status-on-time: #10b981;
  --status-delay: #f59e0b;
  --status-heavy-delay: #ef4444;
  --status-cancelled: #a855f7;
  --status-info: #38bdf8;

  /* Shadows & Glassmorphism */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-glow-cyan: 0 0 20px rgba(56, 189, 248, 0.25);
  --backdrop-blur: blur(16px);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(220, 38, 38, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(15, 23, 42, 0.6) 0px, transparent 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* Container */
.app-container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  flex: 1;
}

/* Header */
.app-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.4));
}

.brand-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #ffffff 40%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
  vertical-align: middle;
  margin-left: 0.5rem;
}

.brand-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.network-status {
  display: flex;
  gap: 0.75rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-on-time);
  box-shadow: 0 0 8px var(--status-on-time);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

.live-clock-widget {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  color: var(--accent-cyan);
  background: rgba(15, 23, 42, 0.6);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  letter-spacing: 0.05em;
}

/* User Session Widget */
.user-session-widget {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-info-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.user-icon {
  font-size: 0.95rem;
}

.user-name {
  color: var(--text-primary);
  font-weight: 700;
}

.user-role-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.user-role-badge.role-admin {
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.user-role-badge.role-user {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.btn-user-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.btn-user-action:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-audit-action:hover {
  color: var(--accent-cyan);
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.12);
}

.btn-logout-action:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.12);
}


/* Tab Navigation */
.tabs-nav {
  display: flex;
  background: var(--bg-surface);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 0.35rem;
  margin-bottom: 1.75rem;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), var(--shadow-glow-cyan);
}

/* Card & Panels */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.search-card {
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

/* Forms & Inputs */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  position: relative;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.form-input, .form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
  background: rgba(15, 23, 42, 0.95);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-swap {
  align-self: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 1.5rem;
}

.btn-swap:hover {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  transform: rotate(180deg);
}

/* Quick Suggestions / Chips */
.quick-chips-wrapper {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.quick-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 0.25rem;
}

.chip-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip-btn:hover {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  border-color: rgba(56, 189, 248, 0.3);
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: #172033;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-sm);
  max-height: 240px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  margin-top: 4px;
  display: none;
}

.autocomplete-dropdown.open {
  display: block;
}

.autocomplete-item {
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background var(--transition-fast);
}

.autocomplete-item:hover, .autocomplete-item.selected {
  background: rgba(56, 189, 248, 0.15);
  color: #ffffff;
}

/* Time Band Selector */
.time-band-buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.band-btn {
  flex: 1;
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.band-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.band-btn.active {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border-color: rgba(56, 189, 248, 0.4);
}

/* Results Display Area */
.results-container {
  min-height: 200px;
}

/* Loading State */
.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  gap: 1rem;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* Empty or Error State */
.alert-box {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  color: #fca5a5;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.alert-notice {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fde68a;
}

.alert-icon {
  font-size: 1.25rem;
  line-height: 1;
}

/* Train Status Banner / Main Card */
.train-hero-card {
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.train-hero-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--status-on-time));
}

.train-hero-card.delay-border::before {
  background: linear-gradient(90deg, var(--status-delay), var(--status-heavy-delay));
}

.train-hero-card.cancelled-border::before {
  background: var(--status-cancelled);
}

.train-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.train-id-badge {
  font-size: 1.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.train-route-title {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
}

.badge-on-time {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-on-time);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-delay {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-delay);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-heavy-delay {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-heavy-delay);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-cancelled {
  background: rgba(168, 85, 247, 0.15);
  color: var(--status-cancelled);
  border: 1px solid rgba(168, 85, 247, 0.3);
}

/* Key Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.metric-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

/* Journey Stops Timeline */
.timeline-section {
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
}

.timeline-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timeline-list {
  position: relative;
  padding-left: 2rem;
  list-style: none;
}

.timeline-list::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 8px;
  width: 2px;
  background: rgba(255, 255, 255, 0.15);
}

.timeline-item {
  position: relative;
  margin-bottom: 1.25rem;
  transition: all var(--transition-fast);
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-node {
  position: absolute;
  left: -2rem;
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.timeline-item.reached .timeline-node {
  border-color: var(--status-on-time);
  background: var(--status-on-time);
  box-shadow: 0 0 6px var(--status-on-time);
}

.timeline-item.current .timeline-node {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan);
  transform: scale(1.3);
  animation: pulse-current 1.5s infinite;
}

@keyframes pulse-current {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(56, 189, 248, 0); }
  100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

.timeline-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  background: rgba(15, 23, 42, 0.5);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.timeline-item.reached .timeline-content {
  opacity: 0.75;
}

.timeline-item.current .timeline-content {
  opacity: 1;
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.4);
}

.timeline-station {
  font-weight: 600;
  font-size: 0.95rem;
}

.timeline-times {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

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

.time-eff {
  font-weight: 700;
}

.timeline-delay {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
}

.timeline-plat {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
}

/* Route Search Results List */
.route-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.route-count {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.route-cards-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.route-card {
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: all var(--transition-normal);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  cursor: pointer;
}

.route-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.route-left {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.route-train-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.train-tag {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.route-time-flow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.35rem;
  font-weight: 800;
}

.route-arrow {
  color: var(--text-muted);
  font-weight: 400;
}

.route-stations {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.route-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  text-align: right;
}

.route-stats {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.route-duration {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.btn-track {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--accent-cyan);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-track:hover {
  background: var(--accent-cyan);
  color: #0b1120;
}

/* Station Board Table */
.board-table-wrapper {
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.board-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.board-table th {
  background: rgba(15, 23, 42, 0.8);
  padding: 0.9rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.board-table td {
  padding: 0.9rem 1.25rem;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.board-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.board-table tr {
  cursor: pointer;
}

.board-time {
  font-weight: 700;
  font-family: ui-monospace, monospace;
}

.board-train {
  font-weight: 600;
  color: var(--accent-cyan);
}

.board-destination {
  font-weight: 600;
}

.board-plat {
  font-weight: 700;
  color: #f59e0b;
}

/* Footer */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.app-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.app-footer a:hover {
  color: var(--accent-cyan);
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  .app-container {
    padding: 0.75rem 0.6rem 2rem;
  }

  .app-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
  }
  
  .header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .brand-title {
    font-size: 1.45rem;
  }

  .brand-subtitle {
    font-size: 0.82rem;
  }

  .header-meta {
    width: 100%;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .status-pill {
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
  }

  .live-clock-widget {
    font-size: 0.8rem;
    padding: 0.25rem 0.55rem;
  }

  /* Smooth scrollable tab bar */
  .tabs-nav {
    padding: 0.25rem;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tabs-nav::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    flex: 0 0 auto;
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
  }

  /* Compact card padding on mobile */
  .search-card,
  .train-hero-card,
  .timeline-section {
    padding: 1.15rem 0.9rem;
    border-radius: var(--radius-md);
  }

  .search-card {
    margin-bottom: 1.25rem;
  }

  /* Form & inputs */
  .form-grid {
    gap: 0.85rem;
  }

  .form-input, .form-select {
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
  }

  .btn-swap {
    margin: -0.35rem auto;
    width: 38px;
    height: 38px;
    align-self: center;
    z-index: 2;
  }

  #btnSearchRoute,
  #btnSearchTrain,
  #btnSearchBoard {
    width: 100%;
  }

  /* Quick chips */
  .quick-chips-wrapper {
    margin-top: 1rem;
    gap: 0.35rem;
  }

  .quick-label {
    width: 100%;
    font-size: 0.75rem;
    margin-bottom: 0.15rem;
  }

  .chip-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.55rem;
  }

  /* Route cards */
  .route-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
    gap: 0.75rem;
  }

  .route-time-flow {
    font-size: 1.2rem;
    gap: 0.5rem;
  }

  .route-right {
    width: 100%;
    justify-content: space-between;
    text-align: left;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.6rem;
  }

  /* Station Board Table - enable smooth horizontal swiping without cutting columns */
  .board-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .board-table {
    min-width: 520px;
  }

  .board-table th, .board-table td {
    padding: 0.6rem 0.7rem;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .board-destination {
    white-space: normal;
    max-width: 150px;
  }
}

/* Smartphone Specific (< 600px) */
@media (max-width: 600px) {
  /* Time band buttons into clean 2-column layout */
  .time-band-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
  }

  .time-band-buttons .band-btn:last-child {
    grid-column: 1 / -1;
  }

  .band-btn {
    padding: 0.5rem 0.35rem;
    font-size: 0.78rem;
  }

  #routeCustomTime {
    max-width: 100% !important;
  }

  /* Train hero card */
  .train-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .train-id-badge {
    font-size: 1.35rem;
  }

  .train-route-title {
    font-size: 0.9rem;
    flex-wrap: wrap;
  }

  /* Metrics in a neat 2-column mobile dashboard */
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.55rem;
  }

  .metric-card {
    padding: 0.65rem 0.75rem;
  }

  .metric-label {
    font-size: 0.7rem;
  }

  .metric-value {
    font-size: 1.1rem;
  }

  .metric-sub {
    font-size: 0.7rem;
  }

  /* Journey timeline stops */
  .timeline-list {
    padding-left: 1.4rem;
  }

  .timeline-node {
    left: -1.4rem;
    width: 13px;
    height: 13px;
    top: 6px;
  }

  .timeline-content {
    padding: 0.5rem 0.65rem;
    gap: 0.35rem;
  }

  .timeline-station {
    font-size: 0.88rem;
    width: 100%;
  }

  .timeline-times {
    font-size: 0.78rem;
    gap: 0.35rem;
    flex-wrap: wrap;
    width: 100%;
  }

  .timeline-plat {
    margin-left: auto;
  }
}