/* ==========================================================================
   CP COMBOIO - ENTRECAMPOS ➔ PÓVOA DE SANTA IRIA
   Design System & Modern Stylesheet
   ========================================================================== */

:root {
  /* CP Brand & Transit Palette */
  --cp-green: #00833e;
  --cp-green-hover: #009949;
  --cp-green-glow: rgba(0, 131, 62, 0.35);
  --cp-emerald: #10b981;
  --cp-amber: #f59e0b;
  --cp-amber-bg: rgba(245, 158, 11, 0.15);
  --cp-red: #ef4444;

  /* Typography */
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Layout */
  --max-width: 580px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.35);
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Theme */
body.theme-dark {
  --bg-app: #0b1120;
  --bg-card: rgba(19, 29, 51, 0.88);
  --bg-card-subtle: rgba(26, 39, 68, 0.92);
  --bg-input: rgba(30, 46, 79, 0.90);
  --border-color: rgba(255, 255, 255, 0.12);
  --border-active: rgba(0, 131, 62, 0.6);
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --tag-bg: rgba(255, 255, 255, 0.08);
  --hero-glow: radial-gradient(circle at 50% 0%, rgba(0, 131, 62, 0.25) 0%, transparent 70%);
}

/* Light Theme (Default - Fundo Branco c/ Paisagem do Douro) */
body.theme-light {
  --bg-app: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-card-subtle: rgba(248, 250, 252, 0.92);
  --bg-input: rgba(241, 245, 249, 0.92);
  --border-color: rgba(15, 23, 42, 0.09);
  --border-active: rgba(0, 131, 62, 0.6);
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --tag-bg: rgba(15, 23, 42, 0.06);
  --hero-glow: radial-gradient(circle at 50% 0%, rgba(0, 131, 62, 0.12) 0%, transparent 70%);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  background-color: #f8fafc;
}

body {
  font-family: var(--font-stack);
  background-color: #f8fafc;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  justify-content: center;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76) 0%, rgba(248, 250, 252, 0.86) 100%),
    url('images/douro_train_bg.jpg');
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

body.theme-light {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74) 0%, rgba(248, 250, 252, 0.85) 100%),
    url('images/douro_train_bg.jpg');
}

body.theme-dark {
  background-image:
    linear-gradient(180deg, rgba(11, 17, 32, 0.88) 0%, rgba(15, 23, 42, 0.94) 100%),
    url('images/douro_train_bg.jpg');
}

.app-wrapper {
  width: 100%;
  max-width: var(--max-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px 16px 40px;
}

/* ==========================================================================
   Header Bar
   ========================================================================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px 18px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--cp-green), #047857);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 12px var(--cp-green-glow);
}

.app-title-group {
  display: flex;
  flex-direction: column;
}

.app-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.1;
}

.app-subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--cp-emerald);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-clock-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--tag-bg);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--cp-emerald);
  box-shadow: 0 0 8px var(--cp-emerald);
  animation: pulse-live 2s infinite ease-in-out;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.icon-btn {
  background: var(--tag-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:hover {
  background: var(--bg-card-subtle);
  transform: translateY(-1px);
}

/* ==========================================================================
   Line Status Bar
   ========================================================================== */
.line-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-size: 0.78rem;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.line-status-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.line-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cp-emerald);
  box-shadow: 0 0 8px var(--cp-emerald);
  flex-shrink: 0;
}

.line-status-dot.delayed {
  background: var(--cp-amber);
  box-shadow: 0 0 8px var(--cp-amber);
  animation: pulse-live 1.5s infinite;
}

.line-status-dot.disrupted {
  background: var(--cp-red);
  box-shadow: 0 0 8px var(--cp-red);
  animation: pulse-live 1s infinite;
}

.line-status-text {
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.line-status-check-btn {
  background: var(--tag-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
}

.line-status-check-btn:hover {
  background: var(--bg-input);
  border-color: var(--border-active);
}

/* ==========================================================================
   User Profile Switcher (Rui & Carla)
   ========================================================================== */
.profile-switcher-container {
  margin-bottom: 12px;
}

.profile-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 6px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.22s ease-out;
  text-align: left;
}

.profile-btn:hover {
  background: var(--tag-bg);
  color: var(--text-main);
}

.profile-btn.active {
  background: rgba(0, 131, 62, 0.12);
  border-color: var(--cp-emerald);
  color: var(--text-main);
  box-shadow: 0 2px 10px rgba(0, 131, 62, 0.15);
}

body.theme-dark .profile-btn.active {
  background: rgba(16, 185, 129, 0.18);
  border-color: var(--cp-emerald);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.2);
}

.profile-avatar {
  font-size: 1.55rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.profile-btn.active .profile-avatar {
  transform: scale(1.12);
}

.profile-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.profile-name {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-main);
  line-height: 1.2;
}

.profile-route {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.profile-btn.active .profile-route {
  color: var(--cp-emerald);
  font-weight: 700;
}

/* ==========================================================================
   Direction Selector Segmented Control
   ========================================================================== */
.direction-segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 5px;
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.dir-segment-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-stack);
  font-size: 0.84rem;
  font-weight: 700;
  padding: 10px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  white-space: nowrap;
}

.dir-segment-btn:hover {
  color: var(--text-main);
  background: var(--tag-bg);
}

.dir-segment-btn.active {
  background: var(--cp-green);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--cp-green-glow);
}

.dir-icon {
  font-size: 1.05rem;
  font-weight: 800;
}

/* ==========================================================================
   Route Switcher Bar
   ========================================================================== */
.route-switcher-card {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.station-pill {
  display: flex;
  flex-direction: column;
}

.clickable-pill {
  background: transparent;
  border: 1px solid transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.clickable-pill:hover {
  background: var(--tag-bg);
  border-color: var(--border-color);
}

.station-role {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}

.station-name {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-tag {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.station-pill.destination {
  text-align: right;
}

.swap-btn {
  background: var(--cp-green);
  border: none;
  color: #ffffff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--cp-green-glow);
  transition: var(--transition);
  flex-shrink: 0;
}

.swap-btn:hover {
  background: var(--cp-green-hover);
  transform: scale(1.08) rotate(180deg);
}

.swap-btn:active {
  transform: scale(0.95) rotate(180deg);
}

/* ==========================================================================
   Hero: Next Train Section
   ========================================================================== */
.hero-card {
  position: relative;
  background: var(--bg-card);
  background-image: var(--hero-glow);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px 20px 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.hero-top-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.status-ready {
  background: rgba(16, 185, 129, 0.15);
  color: var(--cp-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pulsing-circle {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
  animation: pulse-dot 1.5s infinite;
}

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

.top-badge-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-indicator-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--cp-emerald);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  letter-spacing: 0.02em;
  transition: var(--transition);
}

body.theme-dark .live-indicator-pill {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.live-indicator-pill.offline {
  background: var(--tag-bg);
  border-color: var(--border-color);
  color: var(--text-muted);
}

.live-indicator-pill.offline .live-pulse-dot {
  background: var(--text-muted);
  box-shadow: none;
  animation: none;
}

.live-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cp-emerald);
  box-shadow: 0 0 6px var(--cp-emerald);
  animation: pulse-live 1.8s infinite ease-in-out;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.live-pulse-dot.syncing {
  transform: scale(1.35);
  box-shadow: 0 0 10px var(--cp-emerald);
  animation: pulse-live 0.6s infinite ease-in-out;
}

.syncing-spin {
  display: inline-block;
  animation: spin 0.8s linear infinite !important;
}

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

.delay-pill {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #dc2626;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
  animation: pulse-live 1.5s infinite;
}

body.theme-dark .delay-pill {
  color: #f87171;
  background: rgba(239, 68, 68, 0.25);
}

.status-delayed {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #dc2626 !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
}

body.theme-dark .status-delayed {
  color: #f87171 !important;
}

.status-delayed .pulsing-circle {
  background: #dc2626 !important;
  box-shadow: 0 0 10px #dc2626 !important;
}

.status-cancelled {
  background: rgba(185, 28, 28, 0.2) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(185, 28, 28, 0.5) !important;
}

/* ==========================================================================
   Real-Time Delay Alert Banner
   ========================================================================== */
.delay-alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.95), rgba(254, 226, 226, 0.92));
  border: 1.5px solid rgba(239, 68, 68, 0.45);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.15);
  animation: shake-delay 0.4s ease-out;
}

body.theme-dark .delay-alert-banner {
  background: linear-gradient(135deg, rgba(69, 10, 10, 0.88), rgba(90, 14, 14, 0.92));
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

@keyframes shake-delay {
  0% { transform: translateY(-4px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.delay-alert-left {
  flex-shrink: 0;
  margin-top: 1px;
}

.delay-warning-icon {
  font-size: 1.25rem;
  display: block;
}

.delay-alert-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.delay-alert-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.delay-alert-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #dc2626;
}

body.theme-dark .delay-alert-title {
  color: #f87171;
}

.delay-alert-tag {
  background: #dc2626;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.03em;
}

.delay-alert-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.time-strikethrough {
  text-decoration: line-through;
  opacity: 0.65;
  font-family: var(--font-mono);
}

.time-strikethrough-sm {
  text-decoration: line-through;
  opacity: 0.55;
  font-size: 0.82em;
  margin-right: 6px;
  display: inline-block;
}

.time-delayed-new {
  color: #dc2626;
  font-weight: 800;
  font-family: var(--font-mono);
}

body.theme-dark .time-delayed-new {
  color: #f87171;
}

.type-pill {
  background: var(--tag-bg);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--cp-emerald);
}

.type-pill.transfer {
  color: var(--cp-amber);
  background: var(--cp-amber-bg);
  border-color: rgba(245, 158, 11, 0.3);
}

/* Countdown Display */
.countdown-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 10px 0 20px;
  text-align: center;
}

.countdown-caption {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

.countdown-value {
  font-size: 3.4rem;
  font-weight: 900;
  font-family: var(--font-mono);
  letter-spacing: -0.04em;
  color: var(--text-main);
  line-height: 1;
  margin: 6px 0 4px;
}

.countdown-value.imminent {
  color: var(--cp-amber);
  animation: pulse-imminent 1s infinite alternate;
}

@keyframes pulse-imminent {
  from { opacity: 1; }
  to { opacity: 0.75; }
}

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

/* Train Info Row */
.train-primary-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.time-block {
  display: flex;
  flex-direction: column;
}

.time-block.arrival {
  align-items: flex-end;
  text-align: right;
}

.time-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.time-large {
  font-size: 1.6rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-main);
  line-height: 1.1;
}

.duration-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  padding: 0 12px;
}

.duration-badge {
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--tag-bg);
  border: 1px solid var(--border-color);
  color: var(--cp-emerald);
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

.duration-arrow {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Train Details Banner */
.train-details-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
  gap: 10px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
}

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

.detail-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.detail-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-value.highlight {
  color: var(--cp-emerald);
}

/* Connection Guide Card */
.connection-guide-card {
  background: var(--cp-amber-bg);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
}

.guide-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--cp-amber);
  margin-bottom: 10px;
}

.connection-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--cp-amber);
  color: #000000;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-body {
  display: flex;
  flex-direction: column;
  font-size: 0.82rem;
  color: var(--text-main);
}

.step-desc {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.step-transfer-wait {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 32px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--cp-amber);
  padding: 2px 0;
}

/* Hero Actions */
.hero-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

@media (max-width: 480px) {
  .hero-actions {
    grid-template-columns: 1fr 1fr;
  }
  .hero-actions .delay-sim-btn {
    grid-column: 1 / -1;
  }
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}

.btn-secondary {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-input);
  border-color: var(--border-active);
}

.btn-secondary.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--cp-emerald);
  color: var(--cp-emerald);
}

.btn-ghost {
  background: transparent;
  border: 1px dashed var(--border-color);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--tag-bg);
  color: var(--text-main);
}

/* Stops Timeline Wrapper */
.stops-timeline-wrapper {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  animation: slide-down 0.3s ease-out;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.stops-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.stops-list {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 20px;
}

.stops-list::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border-color);
}

.stop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  position: relative;
}

.stop-marker {
  position: absolute;
  left: -20px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
}

.stop-row.active .stop-marker {
  border-color: var(--cp-emerald);
  background: var(--cp-emerald);
  box-shadow: 0 0 8px var(--cp-emerald);
}

.stop-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.stop-time {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Upcoming Section ("A Seguir")
   ========================================================================== */
.upcoming-section {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.section-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--tag-bg);
  padding: 3px 8px;
  border-radius: 8px;
}

.following-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.following-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: var(--transition);
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.following-card:hover {
  border-color: var(--cp-emerald);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.following-time-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.following-time {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.following-countdown {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cp-emerald);
}

.following-dest {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.following-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.following-num {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.following-type {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--cp-emerald);
}

.following-type.transfer {
  color: var(--cp-amber);
}

.following-delay-pill {
  font-size: 0.65rem;
  font-weight: 800;
  color: #fff;
  background: #dc2626;
  padding: 2px 6px;
  border-radius: 6px;
  vertical-align: middle;
  margin-left: 4px;
}

.following-delay-pill.suprimido {
  background: #991b1b;
}

.following-card.suprimido {
  opacity: 0.75;
  border-color: rgba(220, 38, 38, 0.45);
}

/* ==========================================================================
   Full Timetable Section
   ========================================================================== */
.timetable-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.timetable-day-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--cp-emerald);
}

.day-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: var(--bg-app);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.day-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.day-tab.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 14px;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  background: var(--tag-bg);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}

.chip:hover {
  background: var(--bg-card-subtle);
  color: var(--text-main);
}

.chip.active {
  background: var(--cp-green);
  border-color: var(--cp-green);
  color: #ffffff;
}

.timetable-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}

.train-row-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: 12px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: var(--transition);
  cursor: pointer;
}

.train-row-item:hover {
  border-color: var(--border-active);
  background: var(--bg-input);
}

.train-row-item.highlight-next {
  border-left: 3px solid var(--cp-emerald);
  background: rgba(16, 185, 129, 0.08);
}

.row-times {
  display: flex;
  flex-direction: column;
}

.row-dep {
  font-size: 1.05rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-main);
  line-height: 1.1;
}

.row-arr {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.row-center {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.row-dest {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.row-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.row-badge.direct {
  background: rgba(16, 185, 129, 0.15);
  color: var(--cp-emerald);
}

.row-badge.transfer {
  background: var(--cp-amber-bg);
  color: var(--cp-amber);
}

/* ==========================================================================
   Info Card & Tips
   ========================================================================== */
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  margin-bottom: 24px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.info-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.info-card-icon {
  font-size: 1.2rem;
}

.info-card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.info-card-content {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--cp-emerald);
  text-decoration: none;
  transition: var(--transition);
}

.link-btn:hover {
  text-decoration: underline;
  color: var(--cp-green-hover);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
}

.footer-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--cp-emerald);
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-main);
  color: var(--bg-app);
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Responsive tweaks */
@media (max-width: 420px) {
  .countdown-value {
    font-size: 2.8rem;
  }
  .time-large {
    font-size: 1.35rem;
  }
  .train-details-banner {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .metro-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Metro de Lisboa - Linha Vermelha (Perfil Carla: Bela Vista ➔ Aeroporto)
   ========================================================================== */
.metro-card {
  position: relative;
  background: var(--bg-card);
  background-image: linear-gradient(135deg, rgba(230, 25, 110, 0.08) 0%, rgba(230, 25, 110, 0.02) 100%);
  border: 1px solid rgba(230, 25, 110, 0.35);
  border-radius: var(--radius-xl);
  padding: 18px 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: var(--transition);
}

.metro-card:hover {
  border-color: rgba(230, 25, 110, 0.55);
}

.metro-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.metro-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.metro-logo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e6196e;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.82rem;
  box-shadow: 0 0 10px rgba(230, 25, 110, 0.5);
}

.metro-line-name {
  font-weight: 800;
  font-size: 0.92rem;
  color: #e6196e;
  letter-spacing: 0.02em;
}

.metro-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--cp-emerald);
}

.metro-status-pill.disrupted {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  color: #dc2626;
}

.metro-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  animation: pulse-live 1.8s infinite ease-in-out;
}

.metro-route-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.metro-route-badge {
  background: rgba(230, 25, 110, 0.15);
  color: #e6196e;
  font-weight: 800;
  font-size: 0.88rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(230, 25, 110, 0.3);
}

.metro-travel-duration {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.metro-alert-banner {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.metro-alert-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.metro-alert-content {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-main);
}

.metro-alert-content strong {
  display: block;
  color: #dc2626;
  font-size: 0.82rem;
  margin-bottom: 2px;
}

.metro-alert-content p {
  margin: 0;
  padding: 0;
  color: var(--text-secondary);
}

.metro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.metro-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.metro-box-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.metro-countdown-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.metro-countdown-val {
  font-size: 2.2rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: #e6196e;
  line-height: 1;
}

.metro-countdown-unit {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.metro-arrival-time {
  font-size: 2rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--text-main);
  line-height: 1.1;
}

.metro-time-sub {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 4px;
}

.metro-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.metro-following-item {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.metro-following-item strong {
  color: var(--text-main);
}

.metro-refresh-btn {
  background: var(--tag-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}

.metro-refresh-btn:hover {
  background: var(--bg-card);
  border-color: #e6196e;
  color: #e6196e;
}

