/* ==========================================================================
   NJ Transit AI Chatbot - Main Styles
   ========================================================================== */

:root {
  --primary: #347d9c;
  --accent: #ff6b6b;
  --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  --chat-bg: #ffffff;
  --user-bubble: #71568f;
  --bot-bubble: #f4f4f4;
  --text-main: #2d3436;
  --text-light: #636e72;
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  --top-bar-height: 62px;
}

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

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  padding: 20px;
  color: var(--text-main);
}

.container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 40px);
  min-height: 600px;
  position: relative;
}

.site-top-bar {
  position: sticky;
  top: 0;
  z-index: 1200;
  height: var(--top-bar-height);
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
}

.site-top-bar img {
  height: 34px;
  width: auto;
  display: block;
}

.site-top-bar-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: #2d3436;
}

/* Trip info toolbar & popup */
.trip-info-btn {
  background: transparent !important;
  border: 2px solid #71568f !important;
  color: #71568f;
  margin-right: 6px;
}

.trip-info-btn:hover {
  background: rgba(113, 86, 143, 0.1) !important;
}

.trip-info-btn img {
  display: block;
  width: 20px;
  height: 20px;
  filter: brightness(0) saturate(100%) invert(35%) sepia(15%) saturate(1200%)
    hue-rotate(240deg) brightness(0.9) contrast(0.9);
}

.trip-info-popup {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 10px;
  min-width: 260px;
  max-width: 320px;
  background: white;
  border: 2px solid #71568f;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 14px 16px;
  z-index: 1100;
  display: none;
  font-size: 14px;
}

.trip-info-popup.is-open {
  display: block;
}

.trip-info-popup::after {
  content: "";
  position: absolute;
  bottom: -8px;
  right: 24px;
  width: 14px;
  height: 14px;
  background: white;
  border-right: 2px solid #71568f;
  border-bottom: 2px solid #71568f;
  transform: rotate(45deg);
}

.trip-info-popup-label {
  font-weight: 600;
  color: var(--text-main);
  font-size: 12px;
  margin-bottom: 6px;
}

.trip-info-popup-value {
  color: var(--text-light);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 12px;
}

.trip-info-popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trip-info-popup-btn {
  background: rgba(113, 86, 143, 0.1);
  color: #71568f;
  border: 1px solid #71568f;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.trip-info-popup-btn:hover {
  background: rgba(113, 86, 143, 0.2);
}

.trip-info-popup-empty {
  color: var(--text-light);
  font-size: 13px;
}

/* Header & Chat */
.header {
  text-align: center;
  margin-bottom: 25px;
  color: #2d3436;
}

.header-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  display: block;
  margin: 0 auto 10px;
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.feedback-link {
  font-size: 13px;
  margin-top: 8px;
  opacity: 0.9;
}

.feedback-link a {
  color: #1f5f8b;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.feedback-link a:hover {
  color: #154766;
}

.chat-container {
  background: var(--chat-bg);
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.messages::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

.messages {
  flex: 1;
  padding: 25px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.messages-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.message {
  display: flex;
  gap: 12px;
  animation: fadeIn 0.3s ease;
  width: 100%;
}

.message.user {
  flex-direction: row-reverse;
  align-self: flex-end;
  max-width: 85%;
}

.message.bot {
  align-self: flex-start;
  max-width: 85%;
  padding-right: 10px;
}

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

.message-content {
  padding: 14px 18px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 15px;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  min-width: 300px;
}

.message.bot .message-content {
  background: var(--bot-bubble);
  color: var(--text-main);
  /* border-bottom-left-radius: 4px; */
  border: 1px solid #eee;
}

.message.user .message-content {
  background: var(--user-bubble);
  color: white;
  display: flex;
  align-items: center;
}

.message-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  /* background: #eee; */
  overflow: hidden;
  /* transform: translateY(0.5rem); */
}

.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* transform: translateY(0.5rem); */
}

.message.user .message-avatar img {
  width: 60%;
  height: 60%;
  filter: brightness(0) saturate(100%) invert(35%) sepia(15%) saturate(1200%)
    hue-rotate(240deg) brightness(0.9) contrast(0.9);
}

.message.user .message-avatar {
  background: rgb(157 136 180 / 20%);
}

/* Trip Result & Timeline */
.trip-result {
  background: white;
  border: 1px solid #e1e8ed;
  border-radius: 12px;
  margin-top: 0px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
}

.message.bot .message-content {
  max-width: 100%;
}

.message.bot .message-content ul.intent-help-list {
  margin: 0.35em 0 0.75em 0;
  padding-left: 1.25em;
}

/* Align trip option and rewards cards with bot message content (avatar + gap) */
.trip-option {
  margin-left: 60px;
}

.message-content.trip-option {
  padding: 0;
}

.rewards-option {
  margin-left: 60px;
}

.message.rewards-option .message-content {
  padding: 0;
}

.trip-header {
  padding: 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.trip-fare-badge {  
  background: #e8f5e9;
  color: #1e6b22;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid #d5f1d8;
  margin-left: 8px;
    
}

.trip-stats-row {
  padding: 12px 16px;
  display: flex;
  gap: 16px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
  color: var(--text-light);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.timeline-container {
  padding: 20px 16px;
  position: relative;
}

.timeline-leg {
  display: flex;
  position: relative;
  padding-bottom: 0;
}

.timeline-leg:last-child {
  padding-bottom: 0;
}

.timeline-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 30px;
  margin-right: 12px;
  flex-shrink: 0;
}

.timeline-node {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 2px #ccc;
  background: white;
  z-index: 2;
}

.timeline-node.start {
  background: #28a745;
  box-shadow: 0 0 0 2px #28a745;
}

.timeline-node.end {
  background: #dc3545;
  box-shadow: 0 0 0 2px #dc3545;
}

.timeline-node.transfer {
  background: white;
  width: 10px;
  height: 10px;
}

.timeline-container {
  transition: all 0.3s ease;
}

.timeline-container.collapsed {
  display: none;
}

.toggle-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 12px;
  transition: background 0.2s;
  /* margin-left: auto; */
  display: flex;
  align-items: center;
  gap: 4px;
}

.toggle-btn:hover {
  background: rgba(79, 109, 122, 0.1);
}

.timeline-line {
  width: 2px;
  flex-grow: 1;
  background: #e0e0e0;
  margin-top: 2px;
  margin-bottom: 0;
  min-height: 20px;
}

.timeline-line.walk {
  border-left: 2px dotted #999;
  background: transparent;
  width: 0;
}

.timeline-line.transit {
  background: var(--primary);
  width: 3px;
}

.timeline-content {
  flex: 1;
  padding-top: -2px;
  padding-bottom: 24px;
}

.timeline-leg:last-child .timeline-content {
  padding-bottom: 0;
}

.leg-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.leg-meta {
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
}

.leg-realtime-note {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
  margin-bottom: 4px;
}

.leg-realtime-note--cancelled {
  color: #c0392b;
  display: none;
}

.leg-realtime-note--late {
  color: #d35400;
}

.leg-realtime-note:empty {
  display: none;
}

/* Realtime: "Arriving in X min" pill (estimated minutes only, no estimated time) */
.leg-arriving-in {
  margin-top: 8px;
  margin-bottom: 4px;
}

.leg-arriving-in-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  background-color: #0d8050;
  padding: 4px 8px;
  border-radius: 16px;
  white-space: nowrap;
}

.leg-arriving-in-pill--cancelled {
  background-color: #c0392b;
}

.leg-arriving-in-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
}

.leg-arriving-in-pill--cancelled .leg-arriving-in-icon {
  width: 12px;
  height: 12px;
}

.leg-details {
  font-size: 13px;
  color: var(--text-light);
  background: #fafafa;
  padding: 8px;
  border-radius: 6px;
  margin-top: 4px;
}

/* Trip time points (Board at / Arrive at) */
.leg-segment {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.segment-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  line-height: 1.4;
}

.segment-row.walk-to-board {
  color: var(--text-light);
  font-size: 12px;
}

.segment-row.walk-to-board .segment-walk-dir {
  color: #666;
  font-style: italic;
}

.segment-time {
  flex-shrink: 0;
  background: var(--bot-bubble);
  color: var(--text-main);
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.segment-loc {
  color: var(--text-main);
  font-weight: 400;
  min-width: 0;
}

/* ATIS stop skip tag (Onstopclosed / Offstopclosed) */
.leg-stop-skip-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background-color: #c0392b;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  margin-right: 6px;
  gap: 4px;
}

.leg-stop-skip-icon {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
}

.leg-skip-alert {
  margin-top: 4px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #c0392b;
}

/* Input Area */
.input-area {
  position: relative;
  padding: 10px;
  background: var(--chat-bg);
  border-top: 1px solid #f0f0f0;
}

.input-form {
  background: #f1f3f4;
  padding: 3px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  transition:
    border 0.2s,
    background 0.2s;
}

.input-form:focus-within {
  background: white;
  border-color: #71568f;
  box-shadow: 0 0 0 3px rgba(113, 86, 143, 0.1);
}

.input-form input {
  border: none;
  background: transparent;
  padding: 8px 10px;
  flex: 1;
  font-size: 15px;
}

.input-form input:focus {
  outline: none;
}

.input-form button {
  background: #71568f;
  color: white;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
}

.input-form button:hover {
  transform: scale(1.05);
}

#sendBtn img {
  filter: brightness(0) invert(1);
  transform: translateX(1px);
}

/* Voice button */
.voice-btn {
  background: transparent !important;
  border: 2px solid #71568f !important;
  color: #71568f;
  margin-right: 6px;
}

.voice-btn img {
  filter: brightness(0) saturate(100%) invert(35%) sepia(15%) saturate(1200%)
    hue-rotate(240deg) brightness(0.9) contrast(0.9);
}

.voice-btn:hover {
  background: rgba(113, 86, 143, 0.1) !important;
}

.voice-btn.recording {
  background: #dc3545 !important;
  border-color: #dc3545 !important;
  color: white;
  animation: pulse 1.5s infinite;
}

.voice-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  display: none;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
  }
}

/* Quick suggestions */
.quick-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.quick-suggestion {
  background: white;
  border: 1px solid #cddbe2;
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-suggestion:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Typing indicator */
.typing-indicator {
  background: white;
  padding: 12px 16px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  display: none;
}

.typing-indicator.active {
  display: flex;
  gap: 4px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #bbb;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* Recommendations */
.recommendations-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.recommendation-card {
  background: white;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
}

.recommendation-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.1);
}

/* Stadium event list (Ticketmaster): image left, text right */
.recommendation-card.stadium-event-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

.recommendation-card.stadium-event-card:hover {
  transform: translateY(-2px);
}

.stadium-event-thumb {
  flex: 0 0 96px;
  width: 96px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: #e8ecf0;
}

.stadium-event-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stadium-event-body {
  flex: 1;
  min-width: 0;
}

/* Welcome screen */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 10px;
  max-height: 100%;
  overflow: visible;
}

.welcome-logo {
  width: 50px;
  height: 50px;
  margin-bottom: 10px;
  border-radius: 50%;
  overflow: hidden;
  /* background: rgba(113, 86, 143, 0.1); */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  flex-shrink: 0;
}

.welcome-logo img {
  width: 150%;
  height: 150%;
  object-fit: contain;
}

.welcome-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
  text-align: center;
}

.welcome-subtitle {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 12px;
  text-align: center;
}

.functionality-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 100%;
}

.functionality-card {
  background: white;
  padding: 10px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
}

.functionality-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(113, 86, 143, 0.15);
  border-color: #71568f;
}

.functionality-card-header {
  display: flex;
  align-items: baseline;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.functionality-card-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.functionality-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.functionality-card-desc {
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.3;
}

.welcome-screen .extracted-info {
  background: rgba(113, 86, 143, 0.08);
  border: 1px solid rgba(113, 86, 143, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 100%;
}

.welcome-screen .extracted-info-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-main);
  margin-bottom: 12px;
}

.welcome-screen .extracted-info-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid rgba(113, 86, 143, 0.1);
}

.welcome-screen .extracted-info-item:last-child {
  border-bottom: none;
}

.welcome-screen .extracted-info-label {
  font-weight: 600;
  color: var(--text-main);
  margin-right: 12px;
}

.welcome-screen .extracted-info-value {
  color: var(--text-light);
  text-align: right;
}

.rec-name {
  font-weight: 600;
  font-size: 1.1em;
  color: var(--text-main);
  margin-bottom: 4px;
}

.rec-desc {
  font-size: 0.95em;
  color: var(--text-light);
  margin-bottom: 8px;
  line-height: 1.4;
}

.rec-address {
  font-size: 0.85em;
  color: var(--primary);
  margin-bottom: 8px;
  font-weight: 500;
}

.rec-action {
  font-size: 0.85em;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Transit cards & tables */
.transit-card {
  background: white;
  padding: 16px;
  border-radius: 12px;
  margin-top: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  /* border: 1px solid rgba(0, 0, 0, 0.05); */
  border-top: none;
  font-size: 0.95em;
  overflow-x: auto;
  width: 100%;
  box-sizing: border-box;
}

.transit-card.whats-nearby-widget {
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.transit-card.nearby-buses-widget {
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.transit-card.bus-stops-widget {
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.transit-card h4 {
  margin: 0 0 12px 0;
  color: var(--primary);
  font-size: 1.1em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.transit-departures-subheader {
  margin: 0 0 8px 0 !important;
  font-size: 0.85em !important;
  color: #888 !important;
}

.nearby-landmark-entry {
  border-top: 1px solid #eee;
  border-right: 1px solid #eee;
  border-bottom: 1px solid #eee;
}

.transit-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

/* Departures: compact so all info fits without truncation */
.transit-table-departures {
  table-layout: fixed;
  font-size: 0.8em;
  border-collapse: separate;
  border-spacing: 0 0;
}

.transit-table-departures th,
.transit-table-departures td {
  padding: 6px 2px;
  overflow: hidden;
  box-sizing: border-box;
}

.transit-table-departures .transit-td-train {
  min-width: 0;
  overflow: hidden;
}

.transit-table-departures .transit-td-train .train-id-badge {
  max-width: 100%;
  display: inline-block;
  vertical-align: middle;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
}

.transit-table-departures .transit-td-dest,
.transit-table-departures .transit-td-status {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.transit-table-departures .transit-td-time {
  white-space: nowrap;
  font-weight: 600;
}

.transit-table-departures .transit-td-trk {
  text-align: left;
}

.transit-table th {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 2px solid #f0f0f0;
  color: #888;
  font-weight: 600;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.transit-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #f9f9f9;
  color: var(--text-main);
  vertical-align: middle;
}

.transit-table tr:last-child td {
  border-bottom: none;
}

.transit-table tr.clickable {
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.transit-table tr.clickable:hover {
  background-color: rgba(113, 86, 143, 0.1);
  border-left-color: #71568f;
  box-shadow: 0 2px 6px rgba(113, 86, 143, 0.15);
}

.transit-table tr.clickable:active {
  background-color: rgba(113, 86, 143, 0.15);
  box-shadow: 0 1px 3px rgba(113, 86, 143, 0.2);
}

.status-badge {
  font-weight: 600;
  font-size: 0.9em;
}

.status-cancelled {
  color: #e74c3c;
}

.status-late {
  color: #e67e22;
}

.filter-chip {
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid #ddd;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9em;
  color: #333;
}

.filter-chip:hover {
  background-color: #f1f1f1;
}

.filter-chip.active {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
}

.status-ontime {
  color: #27ae60;
}

.status-allaboard {
  color: #27ae60;
  font-weight: 700;
}

.train-id-badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85em;
  display: inline-block;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.route-badge {
  padding: 6px 6px;
  margin-right: 2px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.alert-box {
  background-color: #fff8e1;
  color: #856404;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  font-size: 0.9em;
  border-left: 4px solid #ffc107;
  display: flex;
  gap: 8px;
  line-height: 1.5;
}

/* Departures widget: collapsed alerts by default */
.departures-alerts-collapse {
  margin-bottom: 12px;
}

.departures-alerts-summary {
  background-color: #fff8e1;
  color: #856404;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.9em;
  border-left: 4px solid #ffc107;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  user-select: none;
}

.departures-alerts-summary::-webkit-details-marker,
.departures-alerts-summary::marker {
  display: none;
}

/* Collapsed: show "View alerts" + down chevron */
.departures-alerts-label-collapse {
  display: none;
}

.departures-alerts-chevron {
  margin-left: auto;
  font-size: 0.85em;
  opacity: 0.9;
}

.departures-alerts-collapse:not([open]) .departures-alerts-chevron::before {
  content: "▼";
}

/* Open: show "Collapse alerts" + up chevron, grey background */
.departures-alerts-collapse[open] .departures-alerts-summary {
  background-color: #e9ecef;
  color: #495057;
  border-left-color: #adb5bd;
}

.departures-alerts-collapse[open] .departures-alerts-label-view {
  display: none;
}

.departures-alerts-collapse[open] .departures-alerts-label-collapse {
  display: inline;
}

.departures-alerts-collapse[open] .departures-alerts-chevron::before {
  content: "▲";
}

@keyframes departures-alerts-open {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.departures-alerts-body {
  margin-top: 8px;
}

/* Reset when closed so animation runs again on each open */
.departures-alerts-collapse:not([open]) .departures-alerts-body {
  animation: none;
}

.departures-alerts-collapse[open] .departures-alerts-body {
  animation: departures-alerts-open 0.28s ease-out;
}

/* Embed mode */
body.embed-mode {
  background: transparent;
  padding: 0;
  overflow: hidden;
}

body.embed-mode .site-top-bar,
body.embed-mode .header,
body.embed-mode .footer-link {
  display: none !important;
}

body.embed-mode .container {
  max-width: 100%;
  margin: 0;
  height: 100vh;
}

body.embed-mode .chat-container {
  height: 100vh;
  border-radius: 0;
  box-shadow: none;
}

body.embed-mode .embed-feedback-link {
  text-align: center;
  font-size: 12px;
  color: #636e72;
  padding: 6px 12px 0px;
  transform: translateY(2px);
}

body.embed-mode .embed-feedback-link a {
  color: #1f5f8b;
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.embed-mode .embed-feedback-link a:hover {
  color: #154766;
}

body.embed-mode .copy-feedback-email-btn {
  margin-left: 6px;
  border: 1px solid #c7d0d6;
  background: #fff;
  color: #4f5c65;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
  transform: translateY(-1px);
}

body.embed-mode .copy-feedback-email-btn:hover {
  border-color: #9eb0bc;
  color: #2f3a40;
}

/* Embed view: ensure timeline has same comfortable padding on larger screens */
@media (min-width: 601px) {
  body.embed-mode .timeline-container {
    padding-left: 20px;
  }
}

/* ==========================================================================
   Responsive styles (max-width: 600px)
   ========================================================================== */
@media (max-width: 600px) {
  .site-top-bar {
    display: flex;
  }

  .welcome-screen {
    padding: 0px 8px;
  }

  .welcome-logo {
    width: 70px;
    height: 70px;
    margin-bottom: 10px;
    padding: 10px;
  }

  .welcome-title {
    font-size: 20px;
  }

  .welcome-subtitle {
    font-size: 15px;
    margin-top: 4px;
    margin-bottom: 18px;
  }

  .functionality-cards {
    gap: 12px;
  }

  .functionality-card {
    padding: 12px 12px;
    background: #fff;
    border: 2px solid #71568f;
    box-shadow: 0 2px 8px rgba(113, 86, 143, 0.2);
    min-height: 44px;
    transition:
      transform 0.15s ease,
      box-shadow 0.15s ease,
      background 0.15s ease;
  }

  .functionality-card:active {
    transform: scale(0.98);
    background: rgba(113, 86, 143, 0.08);
    box-shadow: 0 1px 4px rgba(113, 86, 143, 0.25);
  }

  .functionality-card-header {
    margin-bottom: 4px;
  }

  .functionality-card-icon {
    font-size: 18px;
  }

  .functionality-card-title {
    font-size: 16px;
  }

  .functionality-card-desc {
    font-size: 13px;
  }

  body {
    padding: 0;
    background: var(--chat-bg);
  }

  .container {
    max-width: 100%;
    margin: 0;
    height: calc(100vh - var(--top-bar-height));
  }

  .header {
    display: none;
  }

  .header h1,
  .header p {
    display: none;
  }

  .chat-container {
    border-radius: 0;
    box-shadow: none;
    height: calc(100vh - var(--top-bar-height));
    max-height: none;
    min-height: 300px;
  }

  .messages-container {
    position: fixed;
    top: var(--top-bar-height);
    bottom: 83px;
    overflow-y: scroll;
    height: auto;
    left: 0;
    right: 0;
    width: 100%;
  }

  body.embed-mode .messages-container {
    top: 0;
  }

  .messages {
    padding: 15px;
  }

  .message-content {
    padding: 10px 14px;
    font-size: 14px;
    max-width: 100%;
    width: 100%;
    border-radius: 12px;
  }

  .message {
    max-width: 100%;
    width: 100%;
    padding-right: 0;
  }

  .input-area {
    padding: 8px 10px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    background: var(--chat-bg);
    border-top: 1px solid #e0e0e0;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
  }

  .trip-info-popup {
    min-width: 200px;
    max-width: calc(100vw - 20px);
    right: 10px;
    margin-bottom: 8px;
    padding: 12px 14px;
  }

  .trip-info-popup-btn {
    font-size: 11px;
    padding: 5px 10px;
  }

  .input-form {
    max-width: 100%;
    box-sizing: border-box;
  }

  .input-form input {
    font-size: 16px;
    max-width: 100%;
  }

  .messages {
    padding: 15px;
  }

  .transit-card {
    padding: 12px;
    margin-top: 8px;
    border-radius: 8px;
    /* border: 1px solid #eee; */
    box-shadow: none;
  }

  .transit-table th,
  .transit-table td {
    padding: 8px 4px;
    font-size: 0.85em;
  }

  .timeline-container {
    padding: 14px 8px;
  }

  .timeline-left {
    width: 20px;
    margin-right: 8px;
  }

  .timeline-node {
    width: 10px;
    height: 10px;
  }

  .message-content {
    background: transparent;
    width: calc(85%);
    /* min-width: calc(85% - 60px); 
    max-width: calc(85% - 60px) */
  }

  .trip-option {
    margin-left: 60px;
  }

  .rewards-option {
    margin-left: 60px;
  }

  /* What's Nearby: stack buttons under text on small screens */
  .nearby-landmark-entry .nearby-landmark-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .nearby-landmark-entry .nearby-landmark-actions {
    flex-wrap: wrap;
    flex-shrink: 0;
  }
}
