:root {
  --dark-bg: #121212;
  --panel-bg: #1a1a1a;
  --line-bg: #222222;
  --text-color: #ffffff;
  --accent-color: #ffcc00;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Roboto', 'Helvetica Neue', sans-serif;
  background-color: var(--dark-bg);
  color: var(--text-color);
  overflow: hidden;
}

/* Text animation for flipboard effect */
@keyframes flipUp {
  0% {
    transform: rotateX(0);
    opacity: 1;
  }
  50% {
    transform: rotateX(-90deg);
    opacity: 0.2;
  }
  100% {
    transform: rotateX(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scroll {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(-100%);
  }
}

@keyframes blink {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

.container {
  max-width: 100%;
  padding: 10px;
  margin: 0 auto;
}

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

/* Weather Card Styles */
.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 20px;
}

.weather-card {
  display: flex;
  flex-direction: column;
  background-color: transparent; /* Removed background to match main page */
  border-radius: 12px;
  padding: 25px;
  color: white;
  width: 50%;
  box-shadow: none; /* Removed shadow for cleaner look */
  margin-right: 0;
  animation: fadeIn 1s ease-in-out;
}

.weather-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 10px;
}

.weather-location {
  font-weight: 500;
  font-size: 1.5rem; /* increased from 1.2rem */
  color: var(--accent-color);
}

.weather-content {
  display: flex;
  width: 100%;
  height: 100%;
}

.weather-temp {
  font-size: 3.5rem;
  font-weight: bold;
  margin-bottom: 10px;
}

.weather-text-container {
  width: 50%;
  padding-right: 15px;
}

.weather-icon-container {
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
}

.weather-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 150px; /* Ensures container stays at minimum height */
}

.weather-icon-symbol {
  font-size: 7rem !important;
  color: var(--accent-color);
  display: block;
  margin: 0;
  padding-left: 20px;
}

.weather-icon-image {
  width: auto;
  height: 225px; /* Increased by 50% from 150px to 225px */
  display: block;
  filter: drop-shadow(0 0 10px rgba(255, 204, 0, 0.7)) brightness(1.2); /* Enhance glow and brightness */
  margin: 0;
  padding-left: 10px;
  transition: all 0.3s ease; /* Smooth transitions */
}

.weather-content {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 220px;
  align-items: center;
}

.weather-details {
  font-size: 1.1rem; /* increased from 0.9rem */
  display: flex;
  flex-direction: column;
  gap: 6px; /* increased from 5px */
}

.weather-detail-item {
  display: flex;
  align-items: center;
}

.weather-detail-label {
  color: #aaa;
  margin-right: 5px;
}

.weather-description {
  font-size: 1.1em;
  margin-bottom: 0.5em;
  text-transform: capitalize;
  transition: color 0.3s ease;
}

.weather-description:empty::before,
.weather-description:only-child::before {
  content: 'Loading weather data...';
  color: #aaa;
  font-style: italic;
}

.weather-error {
  color: #ff6b6b !important;
  border-bottom: 1px solid #ff6b6b;
}

.mock-data {
  color: #ffcc00 !important;
  border-bottom: 1px dotted #ffcc00;
  display: inline-block;
  position: relative;
  cursor: help;
}

.debug .weather-card * {
  outline: 1px solid rgba(255, 0, 0, 0.2);
}

.debug::after {
  content: 'DEBUG MODE';
  position: fixed;
  bottom: 5px;
  right: 5px;
  background: rgba(255, 0, 0, 0.7);
  color: white;
  padding: 3px 6px;
  font-size: 10px;
  border-radius: 3px;
  z-index: 9999;
}

.api-status {
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  margin: 10px 0;
  padding: 5px 10px;
  background-color: rgba(34, 34, 34, 0.8);
  border-radius: 4px;
  border-left: 4px solid #FFC107;
}

.api-status.error {
  color: #ff4444;
  font-size: 1.2em;
  padding: 2rem;
  text-align: center;
  background-color: rgba(255, 68, 68, 0.1);
  border-radius: 8px;
  margin: 1rem;
  border-left: 4px solid #ff4444;
}

.notice {
  color: #ffcc00;
  font-size: 1.2em;
  padding: 2rem;
  text-align: center;
  background-color: rgba(255, 204, 0, 0.1);
  border-radius: 8px;
  margin: 1rem;
  border-left: 4px solid #ffcc00;
}

.error-text {
  color: #ff4444;
  font-weight: bold;
}

.api-status-indicator {
  margin-left: 5px;
}

.update-status {
  font-size: 0.9rem;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
}

#api-status-indicator .material-icons {
  font-size: 1rem;
  margin-right: 5px;
}

#api-status-indicator.online .material-icons {
  color: #4CAF50; /* green */
  text-shadow: 0 0 8px #4CAF50, 0 0 12px #4CAF50;
}

#api-status-indicator.offline .material-icons {
  color: #F44336; /* red */
  text-shadow: 0 0 8px #F44336, 0 0 12px #F44336;
}

#api-status-indicator.yellow .material-icons {
  color: #FFC107; /* yellow */
  text-shadow: 0 0 8px #FFC107, 0 0 12px #FFC107;
}

.datetime-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px 0;
  background-color: transparent; /* Removed background to match main page */
  border-radius: 5px;
  margin: 0;
  width: 50%;
  text-align: center;
  box-sizing: border-box;
}

.clock {
  font-family: 'Roboto', sans-serif;
  font-size: 8rem; /* Reduced from 9.3rem to balance larger weather card */
  font-weight: bold;
  color: var(--accent-color);
  text-shadow: 0 0 15px rgba(255, 204, 0, 0.3);
  line-height: 1.1;
}

.date {
  font-family: 'Roboto', sans-serif;
  font-size: 2.7rem; /* Reduced by 1/3 from 4rem */
  color: var(--text-color);
  margin-top: 10px;
  letter-spacing: 2px;
}

.board-container {
  background-color: var(--panel-bg);
  border-radius: 5px;
  margin: 10px auto;
  padding: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.board-container > * {
  margin: 10px 0;
}

#departures-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 400px; /* Increased minimum height */
  max-height: none; /* Remove max height restriction */
  overflow-y: visible; /* Allow content to expand beyond the container */
  border-radius: 5px;
  background-color: var(--panel-bg);
  margin: 10px 0;
}

.board {
  padding: 10px;
  overflow-x: hidden;
  overflow-y: auto;
}

.board-header {
  display: flex;
  background-color: var(--panel-bg);
  padding: 8px 0;
  font-size: 0.9rem;
  font-weight: bold;
  position: sticky;
  top: 0;
  z-index: 10;
}

.departure-row {
  display: flex;
  margin-bottom: 10px;
  height: 42px;
  animation: fadeIn 0.5s ease-in;
  border-bottom: 1px solid rgba(80, 80, 80, 0.2);
  padding-bottom: 10px;
}

.column {
  padding: 10px;
  text-align: left;
}

.column.time { width: 8.5%; }
.column.departs-in { width: 5.75%; }
.column.line { width: 4%; } /* Reduced by 50% */
.column.vehicle { width: 6%; } /* Reduced by 25% */
.column.platform { width: 8%; }
.column.destination { width: 24%; } /* Updated per requirements */
.column.stop { width: 26%; } /* Updated per requirements */
.column.occupancy { width: 8.625%; } /* Increased by 50% */
.column.eta { width: 10%; } /* New ETA column */

/* Vehicle type grouping styles */
.vehicle-group-header {
  display: flex;
  align-items: center;
  padding: 10px;
  background-color: rgba(0, 0, 0, 0.3);
  border-left: 4px solid #FFC107;
  margin: 10px 0 0 0;
  font-weight: bold;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #FFC107;
}

.vehicle-group-header .material-icons {
  margin-right: 10px;
  font-size: 24px;
}

/* Styling for column headers under each vehicle group */
.group-column-header {
  display: flex;
  flex-direction: row;
  padding: 10px;
  background-color: rgba(255, 193, 7, 0.1);
  border-bottom: 2px solid #FFC107;
  font-weight: bold;
  font-size: 0.85rem;
  margin-bottom: 10px;
  color: #CCC;
  width: 100%;
  align-items: center;
  justify-content: flex-start; /* Ensure content is aligned to the left */
}

.group-column-header .column {
  text-align: left !important; /* Force left alignment */
  padding-left: 8px;
  white-space: nowrap; /* Prevent column headers from wrapping */
  overflow: hidden; /* Hide overflow */
  text-overflow: ellipsis; /* Show ellipsis for overflowed text */
}

/* Match column widths in headers with the departure rows */
.group-column-header .column.time, .col-time, th.column.time { width: 8.5%; }
.group-column-header .column.departs-in, .col-departs, th.column.departs-in { width: 5.75%; }
.group-column-header .column.line, .col-line, th.column.line { width: 4%; }
.group-column-header .column.vehicle, .col-vehicle, th.column.vehicle { width: 6%; }
.group-column-header .column.platform, .col-platform, th.column.platform { width: 8%; }
.group-column-header .column.destination, .col-destination, th.column.destination { width: 20%; }
.group-column-header .column.stop, .col-stop, th.column.stop { width: 25%; }
.group-column-header .column.occupancy, .col-occupancy, th.column.occupancy { width: 8.625%; }
.group-column-header .column.eta, .col-arrival, th.column.eta { width: 10%; }

.vehicle-type-divider {
  height: 2px;
  background-color: #FFC107;
  margin: 20px 0;
  box-shadow: 0 0 8px rgba(255, 193, 7, 0.6);
}

/* Occupancy status text styles - enhanced for better visibility */
.occupancy-green {
  color: #4CAF50;
  font-weight: bold;
  text-shadow: 0 0 2px rgba(76, 175, 80, 0.5);
}

.occupancy-orange {
  color: #FF9800;
  font-weight: bold;
  text-shadow: 0 0 2px rgba(255, 152, 0, 0.5);
}

.occupancy-red {
  color: #F44336;
  font-weight: bold;
  text-shadow: 0 0 2px rgba(244, 67, 54, 0.5);
}

.occupancy-gray {
  color: #9E9E9E;
  font-weight: bold;
  text-shadow: 0 0 2px rgba(158, 158, 158, 0.5);
}

/* Color coding for urgent departures - extremely important styles */
.splitflap.departs-in-flip.departs-urgent,
.splitflap.departs-in.departs-urgent {
  color: #F44336 !important;
  animation: blink 1s infinite;
  font-weight: bold;
}

/* Styling for delayed ETAs */
.splitflap.eta-flip.delayed {
  color: #F44336 !important;
  font-weight: bold;
}

.splitflap.departs-in-flip.departs-soon,
.splitflap.departs-in.departs-soon {
  color: #FFC107 !important;
  font-weight: bold;
}

/* Animations for flipboard effect */
.splitflap {
  display: inline-block;
  transform-style: preserve-3d;
  perspective: 500px;
  font-size: 0.9rem;
}

.splitflap-flip {
  animation: flipUp 0.5s cubic-bezier(0.5, 0, 0.5, 1.2);
}

.vehicle-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 28px;
  width: 28px;
  font-size: 1rem;
}

.vehicle-icon-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  padding-top: 5px;
}

/* Travel Alerts removed as requested */

footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #888;
  margin-top: 10px;
}

/* Media Queries */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .api-status, .update-status {
    margin-top: 10px;
  }
  
  .board-header, .departure-row {
    font-size: 0.8rem;
  }
  
  .departure-row {
    height: 60px;
    font-size: 1.3rem;
  }
  
  .alerts-container {
    height: 70px;
  }
  
  .alerts-scrolling {
    font-size: 1.5rem;
  }
}

/* Board Layouts */
.board-container {
  margin-bottom: 30px;
}

/* Section title styling */
.section-title {
  background-color: #222222;
  color: #FFFFFF;
  text-align: center;
  padding: 10px 0;
  margin: 10px 0;
  font-size: 1.5rem;
  font-weight: bold;
  border-top: 2px solid #FFC107;
  border-bottom: 2px solid #FFC107;
}

.board-container:not(:last-child) {
  border-bottom: 1px solid #444;
  margin-bottom: 15px;
  padding-bottom: 15px;
}

/* Table layout */
.departures-table {
  width: 100%;
  table-layout: fixed; /* Fixed layout for precise column control */
  border-collapse: collapse;
  border-spacing: 0;
  background-color: #1a1a1a;
  margin-bottom: 20px;
  min-height: 200px; /* Ensure table has enough height to show rows */
}

/* Common header styling for all tables */
.departures-table th {
  text-transform: uppercase;
  background-color: #222;
  color: #FFC107;
  font-weight: bold;
  padding: 8px 5px; /* Reduced padding for more compact headers */
  border-bottom: 2px solid #444;
  text-align: left; /* Left-aligned text */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 32px; /* Fixed height for all table headers */
  line-height: 16px; /* Consistent line height */
}

.departures-table td {
  padding: 4px 8px; /* Further reduced vertical padding */
  vertical-align: middle;
  border-bottom: 1px solid #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0; /* Forces truncation when combined with overflow:hidden */
  text-align: left; /* Left-aligned text */
  height: 28px; /* Further reduced row height for more compact display */
  line-height: 16px; /* Reduced line height for more compact text */
}

/* Ensure table cells don't break their content */
.departures-table td span {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* Ensure consistent row heights across all departure tables */
.departures-table tr {
  height: 40px;
}

.departures-table td {
  padding: 8px;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Zebra striping for rows */
.departures-table tr:nth-child(even) {
  background-color: #222;
  color: #fff;
  display: table-row;
  visibility: visible;
}

.departures-table tr:nth-child(odd) {
  background-color: #1a1a1a;
  color: #fff;
  display: table-row;
  visibility: visible;
}

/* Cell styling for departure urgency */
.departs-urgent {
  color: #FF3D00;
  font-weight: bold;
  animation: blink 1s infinite;
}

.departs-soon {
  color: #FF9800;
  font-weight: bold;
}

@keyframes blink {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* No data message styling */
.no-data-message {
  text-align: center;
  padding: 20px;
  color: #999;
  font-style: italic;
}

/* Essential table layout controls */
.departures-table th,
.departures-table td {
  box-sizing: border-box;
}

/* Fixed column widths for 7 columns (PLATFORM removed) */
.departures-table th:nth-child(1),
.departures-table td:nth-child(1) { width: 8%; } /* TIME */

.departures-table th:nth-child(2),
.departures-table td:nth-child(2) { width: 10%; } /* DEPARTS */

.departures-table th:nth-child(3),
.departures-table td:nth-child(3) { width: 12%; } /* LINE */ 

.departures-table th:nth-child(4),
.departures-table td:nth-child(4) { width: 20%; } /* DESTINATION - increased by 5% */

.departures-table th:nth-child(5),
.departures-table td:nth-child(5) { width: 24.5%; } /* STOP & PLATFORM - reduced by 30% */

.departures-table th:nth-child(6),
.departures-table td:nth-child(6) { width: 15.5%; } /* SEATS - reduced by 25% */

.departures-table th:nth-child(7),
.departures-table td:nth-child(7) { width: 10%; } /* ARRIVAL */

/* Material Icons styling for better DakBoard compatibility */
.material-icons {
  font-size: 24px;
  vertical-align: middle;
  display: inline-block;
}

/* Status indicator styling (for occupancy) */
.status-container {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
}

.status-text {
  font-size: 0.9rem;
}

/* No longer needed after Vehicle column removal */

/* Travel Cards Styling */

.travel-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: minmax(120px, auto);
  gap: 20px;
  padding: 10px;
}

.travel-card {
  background-color: #222;
  border-radius: 5px;
  display: flex;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  height: auto;
  min-height: 0;
}

.card-left {
  width: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon {
  font-size: 20px;
  color: #fff;
}

.card-icon .material-icons {
  font-size: 24px;
}

.card-right {
  flex: 1;
  padding: 8px;
}

.card-name {
  font-weight: bold;
  font-size: 1rem;
  margin-bottom: 4px;
}

.card-duration {
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 2px;
}

.delay-time {
  font-size: 0.9rem;
  margin-left: 5px;
  font-weight: bold;
}

.card-distance {
  font-size: 0.85rem;
  color: #ccc;
}

/* Delay classes for travel cards */
.no-delay .card-duration {
  color: #4CAF50; /* Green */
}

.mild-delay .card-duration {
  color: #FFEB3B; /* Yellow */
}

.moderate-delay .card-duration {
  color: #FF9800; /* Orange */
}

.severe-delay .card-duration {
  color: #F44336; /* Red */
}

/* Travel Section Styles */
/* Section spacing halved from 90px to 45px as per requirements */
.travel-section {
  margin-top: 10px;
  margin-bottom: 10px;
}

.section-header {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--line-bg);
  padding: 10px;
  border-top: 2px solid var(--accent-color);
  border-bottom: 2px solid var(--accent-color);
  position: relative;
  margin-bottom: 10px;
}

.section-header h2 {
  font-size: 1.8rem;
  letter-spacing: 2px;
  margin: 0;
  color: var(--text-color);
}

.travel-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 15px;
  padding: 15px;
}

.travel-card {
  flex: 1 1 calc(25% - 15px);
  min-width: 200px;
  background-color: var(--panel-bg);
  border-radius: 5px;
  padding: 15px;
  display: flex;
  flex-direction: row;
  position: relative;
  border: 1px solid #444;
  border-bottom: 2px solid var(--accent-color);
}

.card-left {
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-right {
  width: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
}

.card-icon .material-icons {
  font-size: 6rem;
  color: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-name {
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 5px;
}

.card-duration {
  font-size: 1.8rem;
  font-weight: bold;
  margin: 5px 0;
}

.card-distance {
  font-size: 0.9rem;
  color: #aaa;
  margin-bottom: 5px;
}

.card-error {
  color: #f44336;
}

/* Traffic delay styling */
.travel-card.severe-delay {
  background-color: rgba(244, 67, 54, 0.15); /* Red with transparency */
  border: 1px solid rgba(244, 67, 54, 0.4);
}

.travel-card.moderate-delay {
  background-color: rgba(255, 152, 0, 0.15); /* Orange with transparency */
  border: 1px solid rgba(255, 152, 0, 0.4);
}

.travel-card.mild-delay {
  background-color: rgba(255, 193, 7, 0.15); /* Amber with transparency */
  border: 1px solid rgba(255, 193, 7, 0.4);
}

.travel-card.no-delay {
  background-color: rgba(76, 175, 80, 0.1); /* Green with transparency */
  border: 1px solid rgba(76, 175, 80, 0.2);
}

.normal-time {
  font-size: 0.8rem;
  opacity: 0.7;
  display: block;
  margin-top: 4px;
}

/* Adjust travel cards layout for better fit */
.travel-section {
  margin: 10px 0;
  padding: 0 10px;
  display: flex;
  flex-direction: column;
}

.travel-cards {
  padding: 10px;
}

.travel-card {
  padding: 10px;
  margin: 0;
}
