:root {
  --wait-times-bar-height: 30px; /* Define the height of the scrolling wait times bar */
}

body {
  margin: 0;
  padding: 0;
  background-color: #121212;
  color: white;
  font-family: Arial, sans-serif;
  overflow-x: hidden;
}

/* Loading Overlay Styles */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #121212; /* Match body background */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999; /* Ensure it's on top of everything */
  transition: opacity 0.5s ease;
  opacity: 1; /* Initially visible */
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none; /* Allow clicks once hidden */
}

.loading-logo {
  max-width: 200px; /* Adjust size as needed */
  height: auto;
  margin-bottom: 20px;
}

.loading-spinner {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #ffffff; /* White spinner */
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}


.container {
  display: grid;
  height: 100vh; /* Default height for the stream container */
  width: 100vw;
  gap: 0;
}

/* NEW: Adjust container height when the scrolling bar is active */
body.wait-times-active .container {
  height: calc(100vh - var(--wait-times-bar-height)); /* Subtract the height of the scrolling bar */
}


.stream-container {
  position: relative;
  background-color: #000;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  transition: all 0.3s ease;
}

.stream-container.with-chat .player-container {
  width: calc(100% - 200px); /* Adjusted for 200px chat panel */
}

.player-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.yt-player {
  width: 100%;
  height: 100%;
  position: relative;
}

.channel-label {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 12px;
  z-index: 10;
  margin: 0;
  display: flex;
  max-width: 100%;
  white-space: nowrap;
  overflow: visible;
}

.channel-name-text {
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 8px;
  border-radius: 0 0 3px 0;
  transition: background-color 0.3s ease;
}

.channel-name-text:hover {
  background: rgba(0, 0, 0, 0.9);
}

.video-title {
  opacity: 0;
  background: rgba(0, 0, 0, 0);
  padding: 2px 8px;
  padding-left: 1px;
  border-radius: 0 0 3px 0;
  transition: opacity 0.3s ease, background-color 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 0px;
  max-width: none;
  display: inline-block;
  vertical-align: top;
}

/* Fullscreen overlay controls */
.fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  z-index: 1000;
  display: none;
}

.fullscreen-player-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.fullscreen-yt-player {
  width: 100%;
  height: 100%;
}

.fullscreen-controls {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 20px;
  z-index: 1001;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.fullscreen-overlay:hover .fullscreen-controls {
  opacity: 1;
}

.fullscreen-nav-btn {
  background: rgba(0,0,0,0.7);
  border: none;
  color: white;
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-nav-btn:hover {
  background: rgba(70,70,70,0.7);
}

.fullscreen-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0,0,0,0.7);
  border: none;
  color: white;
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1001;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.fullscreen-overlay:hover .fullscreen-close-btn {
  opacity: 1;
}

.fullscreen-channel-label {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(0,0,0,0.7);
  padding: 5px 15px;
  font-size: 16px;
  border-radius: 4px;
  z-index: 1001;
  max-width: 80%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.fullscreen-overlay:hover .fullscreen-channel-label {
  opacity: 1;
}

.chat-button {
  position: absolute;
  top: 50%;
  left: 8px; /* Changed from right */
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: all 0.2s ease;
  opacity: 0;
}

.stream-container:hover .chat-button {
  opacity: 1;
}

.chat-button:hover {
  background: rgba(70, 70, 70, 0.7);
}

.chat-button::after {
  content: "💬";
  font-size: 14px;
}

/* NEW: DSN Icon styles */
.dsn-icon-container {
  position: absolute;
  top: calc(50% - 60px); /* Adjust position above hide/chat buttons */
  left: 8px;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default; /* Not interactive */
  z-index: 20;
  transition: all 0.2s ease;
  opacity: 0; /* Hidden by default, will show on hover */
}

.stream-container:hover .dsn-icon-container {
  opacity: 1;
}

.dsn-icon {
  width: 18px; /* Adjust size as needed to fit the container */
  height: 18px;
  border-radius: 50%; /* Make the image rounded */
  object-fit: cover; /* Ensure the image covers the area without distortion */
}

/* Default state for desktop controls */
.chat-button, .hide-btn, .dsn-icon-container {
  display: flex; /* Always visible on desktop by default */
}

/* Default state for mobile controls (hidden on desktop) */
.mobile-controls {
  display: none;
}


@media (max-width: 768px) {
  /* Hide desktop controls on mobile */
  .chat-button, .hide-btn, .dsn-icon-container {
    display: none !important;
  }

  /* Ensure mobile controls are visible for normal mobile view (not with-chat) */
  .mobile-controls {
    display: flex; /* Overrides default display: none */
    flex-direction: column; /* Default vertical stack */
    justify-content: flex-start;
    align-items: center;
    width: 40px; /* This is the vertical bar on the left */
    height: 100%;
    padding-top: 50px;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 20;
    /* When not with-chat, it stays on the left */
    position: static; /* Reset positioning for default vertical layout */
  }

  /* Show mobile controls on mobile */
  .mobile-controls {
    display: flex; /* Overrides default display: none */
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: 40px;
    height: 100%;
    padding-top: 50px;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 20;
  }

  /* NEW: Styles for mobile controls when chat is open */
  .stream-container.with-chat .mobile-controls {
    position: absolute; /* Position absolutely within stream-container */
    top: 35vh; /* This places it right after the video player (which is 35vh tall) */
    left: 0;
    width: 100%;
    height: auto; /* Let content define height */
    flex-direction: row; /* Arrange horizontally */
    justify-content: center; /* Center buttons */
    align-items: center;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px 0; /* Vertical padding for the bar */
    z-index: 25; /* Ensure it's above chat if needed, but below player */
    /* Adjustments to make sure it's between */
    border-top: 1px solid #333; /* Visual separation */
    border-bottom: 1px solid #333; /* Visual separation */
  }

  /* Adjustments for mobile control buttons when chat is open */
  .stream-container.with-chat .mobile-control-button {
    margin: 0 5px; /* Add horizontal margin between buttons */
  }

  .container {
    grid-template-columns: 1fr !important;
    height: 100vh;
    min-height: 100vh;
  }

  .stream-container {
    flex-direction: row;
    height: auto;
    align-items: flex-start;
  }

  .stream-container.with-chat {
    flex-direction: column;
    height: 90vh;
  }

  .stream-container.with-chat .player-container {
    width: 100%;
    height: 35vh; /* This height remains, as controls go *after* it */
  }

  .stream-container .player-container {
    width: calc(100% - 40px);
    height: 30vh;
  }

  .chat-panel {
    width: 100% !important;
    /* Calculate new height: total 90vh - player 35vh - controls height (e.g. 40px) */
    /* Let's assume the controls will take about 40px including padding/borders */
    height: calc(90vh - 35vh - 40px) !important; /* 90vh - player height - controls height */
    margin-top: 40px; /* Push chat down by controls height */
    border-left: none !important;
    border-top: none; /* The border is now on the controls above */
  }

  .mobile-control-button {
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    font-size: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    transition: background-color 0.2s ease;
  }

  .mobile-control-button:hover {
    background: rgba(70, 70, 70, 0.7);
  }

  .mobile-hide-button::after {
    content: "✕";
  }

  .mobile-chat-button::after {
    content: "💬";
  }

  .mobile-unmute-button::after {
    content: "🔇";
  }

  .mobile-mute-button::after {
    content: "🔊";
  }

  /* NEW: Mobile DSN Icon styles */
  .mobile-dsn-icon-container {
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    cursor: default;
  }

  .mobile-dsn-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  /* Landscape-specific adjustments */
  .stream-container.with-chat .player-container {
    height: 60vh;
  }

  .stream-container .player-container {
    height: 60vh;
  }

  /* Adjust top for landscape video height */
  .stream-container.with-chat .mobile-controls {
    top: 60vh;
  }

  /* Total height - player height - controls height */
  .stream-container.with-chat .chat-panel {
    height: calc(100vh - 60vh - 40px) !important;
  }

  .mobile-controls {
    padding-top: 20px;
  }
}

.chat-panel {
  width: 200px; /* Changed from 300px to 200px */
  height: 100%;
  background: #1e1e1e;
  border-left: 2px solid #333;
  display: none;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.stream-container.with-chat .chat-panel {
  display: block;
}

.chat-iframe {
  width: 133.33%; /* 100% / 0.75 */
  height: 133.33%; /* 100% / 0.75 */
  border: none;
  transform: scale(0.75); /* Changed from 0.6 to 0.75 */
  transform-origin: 0 0;
  position: absolute;
  top: 0;
  left: 0;
}

.status-bubble {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  z-index: 100;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
}

.status-bubble.expanded {
  width: 150px;
  height: auto;
  border-radius: 4px;
  padding: 8px 12px;
}

.status-bubble::before {
  content: "i";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: bold;
}

.status-bubble.expanded::before {
  display: none;
}

.status-content {
  display: none;
  font-size: 12px;
}

.status-bubble.expanded .status-content {
  display: block;
}

.last-updated {
  color: #aaa;
}

/* Added styles for the hide button */
.hide-btn {
  position: absolute;
  top: calc(50% - 30px);
  left: 8px; /* Changed from right */
  right: auto; /* Ensure right positioning is removed */
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.7);
  border: none;
  color: white;
  font-size: 16px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stream-container:hover .hide-btn {
  opacity: 1;
}

.hide-btn:hover {
  background: rgba(70, 70, 70, 0.7);
}

/* Styles for the manual play button */
.play-button-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 15; /* Above player */
}

.play-button {
  font-size: 60px;
  color: white;
  pointer-events: none; /* Allows clicks to pass through to the overlay */
}

/* NEW: Styles for Placeholder Content */
.placeholder-content {
  display: none; /* Hidden by default */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  background-color: #1a1a1a; /* Darker background for placeholders */
  text-align: center;
  padding: 20px;
}

.placeholder-logo {
  max-width: 80%;
  max-height: 50%;
  height: auto;
  margin-bottom: 20px;
}

.social-links {
  display: flex;
  gap: 20px;
}

.social-links img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: transform 0.2s ease-in-out;
}

.social-links img:hover {
  transform: scale(1.1);
}

/* Styles for appealing info buttons */
.info-button {
  display: inline-block;
  background-color: #007bff; /* A nice blue background */
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-top: 5px; /* Add some space above the buttons */
  margin-bottom: 5px; /* Add some space below the buttons for better separation */
}

.info-button:hover {
  background-color: #0056b3; /* Darker blue on hover */
  transform: translateY(-2px); /* Slight lift effect */
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15); /* Enhanced shadow on hover */
}

/* NEW: Styles for Scrolling Wait Times Display */
.scrolling-wait-times {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--wait-times-bar-height); /* Use the CSS variable for height */
  background-color: rgba(0, 0, 0, 0.8); /* Semi-transparent dark background */
  color: #fff;
  display: flex; /* Use flexbox for vertical alignment */
  align-items: center; /* Vertically align content in the middle */
  overflow: hidden; /* Hide content outside the container */
  white-space: nowrap; /* Keep content on a single line */
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.5); /* Subtle shadow at the top */
  z-index: 99; /* Ensure it's above other content but below loading overlay */
}

.wait-times-content {
  display: inline-block; /* Essential for marquee effect */
  padding-left: 100%; /* Start the content off-screen to the right */
  animation: marquee 60s linear infinite; /* Adjust duration for speed */
  font-size: 14px; /* Ensure font size is set directly for consistent vertical centering */
}

.wait-times-item {
  padding: 0 15px; /* Spacing between each ride's info */
  display: inline-block; /* Keeps items in a line */
}

.wait-times-item.low-wait { color: #8bc34a; } /* Green */
.wait-times-item.medium-wait { color: #ffeb3b; } /* Yellow */
.wait-times-item.high-wait { color: #f44336; } /* Red */
.wait-times-item.closed,
.wait-times-item.down,
.wait-times-item.refurbishment { color: #9e9e9e; } /* Gray */
.wait-times-item.no-wait-info,
.wait-times-item.unknown-status { color: #ff9800; } /* Orange for N/A or no info */


@keyframes marquee {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-100%, 0); } /* Scrolls the entire content width */
}

/* Pause animation on hover */
.scrolling-wait-times:hover .wait-times-content {
  animation-play-state: paused;
}

/* Style for the hide button on the scrolling bar */
.hide-scroll-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 16px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute; /* Position relative to .scrolling-wait-times */
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100; /* Ensure it's above the text */
  transition: background-color 0.2s ease;
}

.hide-scroll-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Hide on mobile displays */
@media (max-width: 768px) {
  .scrolling-wait-times {
    display: none !important; /* Use !important to ensure it overrides other display properties */
  }
}
