/* CLI Trains Style Sheet - Minimalist Monochrome Aesthetic */
@import url('https://cdn.jsdelivr.net/npm/@fontsource/departure-mono@5.0.1/index.css');

:root {
  --bg: #000000;
  --bg-card: #000000;
  --border-color: #222222;
  --green: #ffffff; /* Main text/action elements are now clean white */
  --green-dim: rgba(255, 255, 255, 0.08);
  --green-text-dim: #888888;
  --yellow: #ffb300; /* Amber for late/warning accents only */
  --yellow-dim: rgba(255, 179, 0, 0.08);
  --red: #ff3333; /* Red for cancelled status only */
  --red-dim: rgba(255, 51, 51, 0.08);
  --text: #ffffff; /* White base text */
  --text-dim: #777777; /* Muted grey for subheaders and captions */
  --terminal-font: 'Departure Mono', Consolas, Monaco, 'Courier New', Courier, monospace;
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--terminal-font);
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.05em;
  padding-bottom: 50px; /* Space for alerts footer */
}

/* App Container Layout */
.terminal-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 15px;
  max-width: 1200px;
  margin: 0 auto;
}

/* HEADER BAR styling */
.terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 10px;
}

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

.app-title {
  font-size: 1.15rem;
  font-weight: normal;
  text-transform: uppercase;
}

.refresh-countdown {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.clock-display {
  font-size: 1.05rem;
  color: var(--text);
}

/* Blinking Animation */
.blinking {
  animation: blink 1.2s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* MAIN CONTENT */
.terminal-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

/* CARD BOARDS GRID (Subtle borderless tables) */
.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 25px;
}

.board-card {
  background-color: var(--bg-card);
  border: none; /* Removed thick green borders */
  display: flex;
  flex-direction: column;
}

.card-header {
  border-bottom: 1px solid var(--border-color); /* Clean solid border */
  padding: 8px 0;
  background-color: transparent;
}

.card-title {
  display: block;
  font-size: 0.95rem;
  font-weight: bold;
  text-transform: uppercase;
}

.card-subtitle {
  display: block;
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-top: 3px;
}

.card-body {
  padding: 12px 0;
  flex: 1;
}

/* TABLE DEPARTURE DATA ROW ALIGNMENTS */
.table-header {
  display: flex;
  font-size: 0.72rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  margin-bottom: 10px;
  color: var(--text-dim);
  font-weight: bold;
}

.board-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.departure-row {
  display: flex;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #111111;
}

.departure-row:last-child {
  border-bottom: none;
}

/* Table columns widths */
.col-time {
  width: 14%;
  font-weight: bold;
}
.col-dest {
  width: 53%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 10px;
}
.col-plat {
  width: 12%;
  text-align: center;
}
.col-status {
  width: 21%;
  text-align: right;
  font-weight: bold;
}

/* Row states colors - Used for functional status ONLY */
.status-ontime {
  color: var(--text); /* Nominal is clean white */
}
.status-late {
  color: var(--yellow); /* Warning is amber */
}
.status-cancelled {
  color: var(--red); /* Cancelled is red */
  text-decoration: line-through;
}
.status-departed {
  color: #444444; /* Departed is dark grey */
}

.row-cancelled {
  opacity: 0.65;
}

.row-departed {
  opacity: 0.4;
}

.departed-separator {
  height: 1px;
  background-color: var(--border-color);
  margin: 8px 0;
}

.operator-tag {
  color: var(--text-dim);
  font-size: 0.72rem;
}

.loading-row {
  text-align: center;
  padding: 20px 0;
  color: var(--text-dim);
  font-style: italic;
}

/* COLLAPSIBLE SECTION */
.collapsible-section {
  border: none;
  background-color: transparent;
}

.collapsible-header {
  padding: 12px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: transparent;
  border-bottom: 1px solid var(--border-color);
  user-select: none;
}

.collapsible-header:hover {
  opacity: 0.8;
}

.collapse-icon {
  font-weight: bold;
  color: var(--text-dim);
}

.collapsible-title {
  font-size: 0.82rem;
  font-weight: bold;
}

.collapsible-content {
  padding: 12px 0;
  border-top: none;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
  overflow: hidden;
}

.collapsed {
  display: none;
}

/* ROW 2 ACTIONS GRID */
.action-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 25px;
  margin-top: 15px;
}

.action-card {
  border: none;
}

/* FORMS AND INPUTS */
.terminal-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 600px;
}

.input-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.input-group label {
  width: 110px;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.input-group input {
  flex: 1;
  background-color: #000;
  border: 1px solid var(--border-color);
  color: var(--text);
  font-family: var(--terminal-font);
  padding: 8px 12px;
  outline: none;
  font-size: 0.9rem;
}

.input-group input:focus {
  border-color: #666666;
}

/* Datalist Webkit Customizer */
input::-webkit-calendar-picker-indicator {
  filter: invert(0.6);
  cursor: pointer;
}

/* BUTTONS (Sleek minimalist invert on hover) */
.button-group {
  display: flex;
  gap: 12px;
  margin-top: 5px;
}

.cli-btn {
  flex: 1;
  background-color: transparent;
  border: 1px solid var(--text);
  color: var(--text);
  font-family: var(--terminal-font);
  padding: 10px 15px;
  cursor: pointer;
  font-size: 0.82rem;
  text-align: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.cli-btn:hover {
  background-color: var(--text);
  color: var(--bg); /* Inverted monochrome style on hover */
}

.cli-btn:active {
  background-color: #e5e5e5;
  color: var(--bg);
}

.danger-btn {
  border-color: #555555;
  color: var(--text-dim);
}

.danger-btn:hover {
  background-color: #ff3333;
  color: #000000;
  border-color: #ff3333;
}

.font-departure {
  font-family: var(--terminal-font);
}

/* CUSTOM QUERY RESULTS BOARD */
.custom-results-board {
  margin-top: 25px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.custom-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  font-size: 0.9rem;
}

.results-route {
  font-weight: bold;
}

.results-crs {
  color: var(--text-dim);
}

.hidden {
  display: none !important;
}

/* FOOTER LIVE ALERTS TICKER */
.terminal-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 36px;
  background-color: #000;
  border-top: 1px solid var(--border-color); /* Thin solid divider */
  display: flex;
  align-items: center;
  z-index: 999;
  font-size: 0.82rem;
}

.ticker-label {
  background-color: #000000;
  color: var(--yellow); /* Amber warning accent for ticker title */
  border-right: 1px solid var(--border-color);
  font-weight: bold;
  padding: 0 15px;
  height: 100%;
  display: flex;
  align-items: center;
  text-transform: uppercase;
  z-index: 1000;
  white-space: nowrap;
}

.ticker-wrap {
  overflow: hidden;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
}

.ticker {
  display: inline-block;
  white-space: nowrap;
  padding-left: 100%;
  animation: marquee 45s linear infinite;
  color: var(--text); /* Alert messages scroll in white, only highlighting warnings internally */
}

@keyframes marquee {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-100%, 0, 0); }
}

/* Pause marquee on hover or mobile tap-and-hold */
.ticker-wrap:hover .ticker, .ticker-wrap:active .ticker {
  animation-play-state: paused;
  cursor: pointer;
}

/* Responsive Overrides */
@media(max-width: 600px) {
  body {
    font-size: 13px;
  }
  .table-header, .departure-row {
    font-size: 0.8rem;
  }
  .col-time { width: 16%; }
  .col-dest { width: 44%; }
  .col-plat { width: 14%; }
  .col-status { width: 26%; }
  
  .terminal-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 15px;
  }
  .header-right {
    width: 100%;
    justify-content: space-between;
    border-top: 1px dashed var(--border-color);
    padding-top: 6px;
    margin-top: 2px;
  }
  .app-title {
    font-size: 1rem;
  }
}
