/* General Resets */
html, body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  height: 100%; /* Ensure the body takes full height */
  overflow-x: hidden; /* Prevent horizontal scrolling */
  box-sizing: border-box;
}

/* Ensures that the box model calculation includes padding and border in the element's width and height */
*,
*::before,
*::after {
  box-sizing: inherit;
}

/* Footer Styling */
.footer {
  background-color: #2f2a2a; /* Dark background */
  color: #dfdfdf; /* Light text color */
  text-align: center;
  padding: 10px 0;
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  width: 100%; /* Full width */
  z-index: 100; /* Ensure the footer appears on top when necessary */
}

.footer-content {
  max-width: 90%; /* Limit the width of content */
  margin: 0 auto;
}

.footer a {
  color: #dfdfdf;
  text-decoration: underline;
}

.footer a:hover {
  color: #ffffff;
}

/* Responsive adjustments for the footer font size on small screens */
@media (max-width: 390px) {
  .footer {
    font-size: 12px; 
  }
}

/* Info-Box Styling */
.info-container {
  background-color: transparent; /* Transparent background */
  border: none; /* No border */
  box-shadow: none; /* No shadow */
  padding: 0; /* No padding */
  margin: 0 auto; /* Center the container */
  max-width: 1200px; /* Max width for large screens */
  text-align: center; /* Center text */
  padding: 0 20px; /* Add some horizontal padding */
}

.title {
  font-family: 'Italiana', serif;
  font-size: 48px; /* Default font size */
  color: #333; /* Darker text color */
  margin-bottom: 20px;
  margin-top: 40px;
}

/* Responsive adjustments for the title font size and margins */
@media (max-width: 768px) {
  .title {
    font-size: 40px; /* Slightly smaller on medium screens */
    margin-top: 30px;
  }
}

@media (max-width: 390px) {
  .title {
    font-size: 34px; /* Smaller on very small screens */
    margin-top: 20px;
  }
}

.description {
  font-family: 'Open Sans', serif;
  font-size: 19px; /* Default font size */
  line-height: 1.5; /* Ensure readability with proper line height */
  color: #555; /* Light gray text */
  margin: 0 auto; /* Center the text */
  max-width: 80%; /* Restrict width */
  padding: 0 20px;
  margin-bottom: 40px;
}

/* Responsive adjustments for description's font size, width, and padding */
@media (max-width: 768px) {
  .description {
    font-size: 18px;
    max-width: 90%;
    padding: 0 10px;
  }
}

@media (max-width: 390px) {
  .description {
    font-size: 16px; 
    max-width: 95%;
    padding: 0 5px;
    margin-bottom: 30px;
  }
}

/* General Styling for the Map */
#map {
  width: 100vw; /* Full viewport width */
  height: calc(100vh - 380px); /* Dynamic height based on viewport */
  max-width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 0; /* Ensure map is below other elements when needed */
}

/* Responsive adjustments for map height */
@media (max-width: 768px) {
  #map {
    height: calc(100vh - 400px); /* Increase height on smaller screens */
  }
}

@media (max-width: 390px) {
  #map {
    height: calc(100vh - 460px); /* Further increase height for very small screens */
  }
}

/* Styling for the Reset Button Container */
#reset-container {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%); /* Center the button horizontally */
  z-index: 999; /* Ensure button appears on top */
}

/* Reset Button Styling */
.reset-map-button {
  background-color: #ebeaea;
  border: 1px solid #000;
  color: #000;
  font-family: 'Open Sans', sans-serif;
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s, color 0.3s; /* Smooth transition on hover */
}

/* Hover effect for the reset button */
.reset-map-button:hover {
  background-color: #e0e0e0;
  border-color: #555;
  color: #555;
}

/* Legend section styling */
.legend-section {
  display: flex;
  align-items: center; /* Vertically center items */
  justify-content: center; /* Horizontally center items */
  flex-wrap: wrap; /* Wrap items on smaller screens */
  margin: 20px auto;
  max-width: 90%; /* Restrict max width */
  font-family: 'Open Sans', sans-serif;
  padding: 10px;
}

.legend-title {
  font-weight: bold;
  font-family: 'Open Sans', sans-serif;
  font-size: 18px;
  margin-right: 20px; /* Spacing between legend title and items */
  margin-bottom: 5px;
}

/* Flexbox to align legend items properly */
.legend-items {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px; /* Space between items */
}

.legend-item {
  display: flex;
  align-items: center;
  margin-right: 10px;
}

/* Small colored box in the legend */
.legend-color {
  display: inline-block;
  width: 20px;
  height: 10px;
  margin-right: 5px;
  border-radius: 2px;
}

.legend-label {
  font-family: 'Open Sans', sans-serif;
  font-size: 18px;
  color: black;
}

/* Scroll Button for more data */
.scroll-button {
  display: block;
  position: relative;
  margin: 20px auto;
  padding: 10px 20px;
  font-family: 'Open Sans', serif;
  font-size: 18px;
  background-color: #333;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  z-index: 3;
  transition: background-color 0.3s, color 0.3s;
}

.scroll-button:hover {
  background-color: #555;
}

/* Unified Styling for control buttons */
.control-button,
.ranking-toggle-button {
  font-size: 18px; 
  height: 40px; 
  padding: 0 15px;
  cursor: pointer;
  border: 1px solid #333; 
  background-color: #333; 
  color: white;
  outline: none;
  border-radius: 5px;
  font-family: 'Open Sans', sans-serif;
  text-align: center;
  width: 230px; 
  flex: 1; 
}

/* Active state styling for buttons */
.control-button.active,
.ranking-toggle-button.active {
  background-color: #555; 
}

/* Hover effect for buttons */
.control-button:hover,
.ranking-toggle-button:hover {
  background-color: #555; 
}

/* Dropdown styling */
.control-dropdown {
  appearance: none; /* Remove default dropdown arrow */
  height: 40px;
  width: 150px;
  padding: 0 15px;
  border: 1px solid #333;
  background-color: #333;
  color: white;
  background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23FFFFFF" d="M2 4l4 4 4-4"/></svg>'); /* Custom arrow */
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  border-radius: 5px;
  font-family: 'Open Sans', sans-serif;
  text-align: center;
}

/* Dropdown focus styling */
.control-dropdown:focus {
  border-color: #888;
}

/* Dropdown wrapper for alignment */
.dropdown-wrapper {
  display: flex;
  align-items: center; 
  background-color: #333;
  border-radius: 5px;
  padding: 0 10px;
}

/* Dropdown label */
.dropdown-title {
  font-size: 18px;
  font-family: 'Open Sans', sans-serif;
  color: white;
  margin-right: 0px;
  height: 40px;
  display: flex;
  align-items: center;
  font-weight: normal;
}

/* Toggle button container styling */
.toggle-button-container,
.ranking-toggle-button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px; /* Space between buttons */
  max-width: 500px;
  margin: 20px auto; 
}

/* Popup window styling */
.popup-window {
  position: absolute; 
  width: 300px; 
  height: auto; 
  background-color: white;
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 20; 
  display: none; 
  left: 5%; 
  top: 30%; 
}

/* Popup Title Styling */
.popup-title {
  font-size: 20px;
  font-family: 'Open Sans', sans-serif;
  color: #333;
  font-weight: bold;
  margin-bottom: 5px;
}

/* Line Description Styling */
.line-description {
  font-size: 18px;
  font-family: 'Open Sans', sans-serif;
  color: #333;
  margin-bottom: 20px;
}

/* Additional Information Styling */
#additional-info {
  font-size: 16px;
  font-family: 'Open Sans', sans-serif;
  color: #555;
  margin-bottom: 15px;
}

/* Circle Container in Popup */
.circle-container {
  display: flex;
  justify-content: space-around;
  margin-top: 10px;
}

.circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: bold;
  color: black;
}

.circle.delayed {
  background-color: rgba(255, 165, 0, 0.6);
}

.circle.cancelled {
  background-color: rgba(255, 0, 0, 0.6);
}

/* Label under circles */
.circle-label {
  font-size: 14px;
  text-align: center;
  margin-top: 5px;
  font-family: 'Open Sans', sans-serif;
}

/* Data Section Container Styling */
.data-section {
  padding: 50px 20px;
  background-color: #f4f4f4; /* Light background color */
  text-align: center;
  min-height: calc(100vh - 100px); /* Adjust height dynamically */
  width: 100%; 
  box-sizing: border-box; 
  overflow-x: hidden; 
}

/* Chart container styling */
.chart-container {
  padding: 20px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 1000px; 
  margin: 20px auto; 
}

/* Ensure charts are responsive */
.chart-container canvas {
  display: block;
  width: 100% !important;  
  height: auto !important;  
}

/* Responsive Design for small screens (390px and below) */
@media (max-width: 390px) {
  .chart-container {
    padding: 5px; 
  }

  .chart-container canvas {
    height: 360px !important;  
  }
}

/* Responsive Design for tablets */
@media (max-width: 768px) {
  .chart-container {
    padding: 5px; 
  }

  .chart-container canvas {
    height: 400px !important;  
  }
}

/* Main Title in Data Section */
.data-title {
  font-size: 42px;
  margin-bottom: 20px;
  margin-top: -10px;
  font-family: 'Italiana', serif;
  color: #333;
}

/* Subtitle Styling in Data Section */
.additional-title {
  font-size: 24px;
  margin-top: 50px;
  margin-bottom: 30px;
  text-align: center;
  color: #333;
  font-family: 'Open Sans', sans-serif;
}

/* Responsive Design for Subtitles */
@media (max-width: 768px) {
  .additional-title {
    font-size: 20px;
  }
}

@media (max-width: 390px) {
  .additional-title {
    font-size: 18px;
    margin-top: 40px;
    margin-bottom: 20px;
  }
}

/* Unified Styling for Toggle Buttons */
.control-button,
.ranking-toggle-button {
  font-size: 14px;
  height: 40px;
  padding: 0 15px;
  cursor: pointer;
  border: 1px solid #333;
  background-color: #333;
  color: white;
  outline: none;
  border-radius: 5px;
  font-family: 'Open Sans', sans-serif;
  text-align: center;
  width: 230px;
  flex: 1;
}

/* Hover effect for buttons */
.control-button:hover,
.ranking-toggle-button:hover {
  background-color: #555;
}

/* Active state for buttons */
.ranking-toggle-button.active,
.control-button.active {
  background-color: #555;
  border: 1px solid #888;
  color: #fff;
}

/* Active button hover state */
.ranking-toggle-button.active:hover,
.control-button.active:hover {
  background-color: #444;
}

/* Dropdown-specific styling */
.control-dropdown {
  appearance: none;
  height: 40px;
  width: 150px;
  padding: 0 15px;
  border: 1px solid #333;
  background-color: #333;
  color: white;
  background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23FFFFFF" d="M2 4l4 4 4-4"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  border-radius: 5px;
  font-family: 'Open Sans', sans-serif;
  text-align: center;
}

/* Focus state styling for dropdown */
.control-dropdown:focus {
  border-color: #888;
}

/* Dropdown wrapper */
.dropdown-wrapper {
  display: flex;
  align-items: center;
  background-color: #333;
  border-radius: 5px;
  padding: 0 10px;
}

/* Dropdown label styling */
.dropdown-title {
  font-size: 14px;
  font-family: 'Open Sans', sans-serif;
  color: white;
  margin-right: 0px;
  height: 40px;
  display: flex;
  align-items: center;
  font-weight: normal;
}

/* Button container styling */
.toggle-button-container,
.ranking-toggle-button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  max-width: 500px;
  margin: 20px auto;
}

/* Subtitle Styling */
.subtitle {
  font-size: 24px;
  margin-top: 50px;
  margin-bottom: 30px;
  color: #333;
  text-align: center;
  font-family: 'Open Sans', sans-serif;
}

/* Responsive adjustments for subtitles */
@media (max-width: 768px) {
  .subtitle {
    font-size: 20px;
  }
}

@media (max-width: 390px) {
  .subtitle {
    font-size: 18px;
    margin-top: 40px;
    margin-bottom: 20px;
  }
}

/* Chart Explanation */
.chart-explanation {
  max-width: 1000px;
  margin: 20px auto;
  font-size: 16px;
  font-family: 'Open Sans', sans-serif;
  line-height: 1.5;
  color: #555;
  padding: 10px;
  background-color: #f9f9f9;
  border-radius: 5px;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
  text-align: justify;
  max-height: 150px;
  overflow-y: auto;
  border: 1px solid #ccc;
}

/* Hide scrollbar on small devices */
@media (max-width: 390px) {
  .chart-explanation::-webkit-scrollbar {
    display: none;
  }

  .reset-map-button {
    font-size: 12px;
  }

  .scroll-button {
    font-size: 14px;
  }

  .control-button,
  .ranking-toggle-button {
    width: 50px;
  }

  .control-dropdown {
    width: 50px;
  }

  .popup-window {
    width: 50vw;
    left: 4%;
  }

  .popup-title {
    font-size: 14px;
  }

  .line-description {
    font-size: 12px;
  }

  .chart-explanation {
    font-size: 12px;
    padding: 8px;
  }

  /* Legend Styling Adjustments */
  .legend-section {
    flex-direction: column;
    padding: 10px;
  }

  .legend-title {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .legend-items {
    gap: 4px;
  }

  .legend-item {
    font-size: 10px;
  }

  .legend-label {
    font-size: 14px;
  }
}

/* Responsive Design for Tablets */
@media (max-width: 768px) {
  .reset-map-button {
    font-size: 14px;
  }

  .scroll-button {
    font-size: 18px;
  }

  .control-button,
  .ranking-toggle-button {
    width: 180px;
  }

  .control-dropdown {
    width: 160px;
  }

  .chart-explanation {
    font-size: 16px;
    padding: 20px;
  }

  .legend-section {
    flex-direction: row;
    padding: 10px;
  }

  .legend-title {
    font-size: 18px;
  }

  .legend-items {
    gap: 10px;
  }

  .legend-item {
    font-size: 16px;
  }
}
/* Dropdown-specific styling */
.control-dropdown {
  appearance: none;
  height: 40px;
  width: 150px;
  padding: 0 15px;
  border: 1px solid #333;
  background-color: #333;
  color: white;
  background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23FFFFFF" d="M2 4l4 4 4-4"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  border-radius: 5px;
  font-family: 'Open Sans', sans-serif;
  text-align: center;
}

/* Focus state styling for dropdown */
.control-dropdown:focus {
  border-color: #888;
}

/* Dropdown wrapper */
.dropdown-wrapper {
  display: flex;
  align-items: center;
  background-color: #333;
  border-radius: 5px;
  padding: 0 10px;
}

/* Dropdown label styling */
.dropdown-title {
  font-size: 14px;
  font-family: 'Open Sans', sans-serif;
  color: white;
  margin-right: 0px;
  height: 40px;
  display: flex;
  align-items: center;
  font-weight: normal;
}

/* Button container styling */
.toggle-button-container,
.ranking-toggle-button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  max-width: 500px;
  margin: 20px auto;
}

/* Subtitle Styling */
.subtitle {
  font-size: 24px;
  margin-top: 50px;
  margin-bottom: 30px;
  color: #333;
  text-align: center;
  font-family: 'Open Sans', sans-serif;
}

/* Responsive adjustments for subtitles */
@media (max-width: 768px) {
  .subtitle {
    font-size: 20px;
  }
}

@media (max-width: 390px) {
  .subtitle {
    font-size: 18px;
    margin-top: 40px;
    margin-bottom: 20px;
  }
}

/* Chart Explanation */
.chart-explanation {
  max-width: 1000px;
  margin: 20px auto;
  font-size: 16px;
  font-family: 'Open Sans', sans-serif;
  line-height: 1.5;
  color: #555;
  padding: 10px;
  background-color: #f9f9f9;
  border-radius: 5px;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
  text-align: justify;
  max-height: 150px;
  overflow-y: auto;
  border: 1px solid #ccc;
}

/* Hide scrollbar on small devices */
@media (max-width: 390px) {
  .chart-explanation::-webkit-scrollbar {
    display: none;
  }

  .reset-map-button {
    font-size: 12px;
  }

  .scroll-button {
    font-size: 14px;
  }

  .control-button,
  .ranking-toggle-button {
    width: 50px;
  }

  .control-dropdown {
    width: 50px;
  }

  .popup-window {
    width: 50vw;
    left: 4%;
  }

  .popup-title {
    font-size: 14px;
  }

  .line-description {
    font-size: 12px;
  }

  .chart-explanation {
    font-size: 12px;
    padding: 8px;
  }

  /* Legend Styling Adjustments */
  .legend-section {
    flex-direction: column;
    padding: 10px;
  }

  .legend-title {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .legend-items {
    gap: 4px;
  }

  .legend-item {
    font-size: 10px;
  }

  .legend-label {
    font-size: 14px;
  }
}

/* Responsive Design for Tablets */
@media (max-width: 768px) {
  .reset-map-button {
    font-size: 14px;
  }

  .scroll-button {
    font-size: 18px;
  }

  .control-button,
  .ranking-toggle-button {
    width: 180px;
  }

  .control-dropdown {
    width: 160px;
  }

  .chart-explanation {
    font-size: 16px;
    padding: 20px;
  }

  .legend-section {
    flex-direction: row;
    padding: 10px;
  }

  .legend-title {
    font-size: 18px;
  }

  .legend-items {
    gap: 10px;
  }

  .legend-item {
    font-size: 16px;
  }
}
