/* Chat button positions (OLD - kept for fallback/mobile/other contexts, though overridden in .desktop-controls) */
.chat-button {
  position: absolute;
  top: 50%;
  right: auto;
  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: 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: Like Video Button Styles */
.like-video-btn {
  position: absolute;
  top: calc(50% + 30px); /* Position below chat button */
  right: auto; 
  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: pointer;
  z-index: 20;
  transition: all 0.2s ease;
  opacity: 0;
  font-size: 14px; /* Adjust font size for emoji */
}

/* Position like button on the left when .chat-left class is present */
.stream-container.chat-left .like-video-btn {
  left: 8px;
  right: auto;
}

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

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


/* NEW: DSN Icon styles */
.dsn-icon-container {
  position: absolute;
  top: calc(50% - 60px); /* Adjust position above hide/chat buttons */
  right: auto;
  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 */
}

/* Position DSN icon on the left when .chat-left class is present */
.stream-container.chat-left .dsn-icon-container {
  left: 8px;
  right: auto;
}

.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%;
  object-fit: cover;
}

/* NEW: View Count display styles */
.view-count-display {
  position: absolute;
  top: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 8px;
  border-radius: 0 0 0 3px;
  font-size: 12px;
  z-index: 10;
  /* UPDATED: Transition for sliding */
  transition: background-color 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
  display: flex; /* Always visible by default */
}

/* Slide View Count Left when Right controls appear */
.controls-vis-hover.controls-pos-right .stream-container:hover .view-count-display {
    transform: translateX(calc(-1 * var(--desktop-controls-size)));
    /* DELAY REMOVED for synced slide */
}
/* Slide View Count Down when Top controls appear */
.controls-vis-hover.controls-pos-top .stream-container:hover .view-count-display {
    transform: translateY(var(--desktop-controls-size));
    /* DELAY REMOVED for synced slide */
}

/* New class for view count display on hover */
.view-count-display-on-hover {
  opacity: 0; /* Hidden by default */
}

.stream-container:hover .view-count-display-on-hover {
  opacity: 1;
}

.view-count-display:hover {
  background: rgba(0, 0, 0, 0.9);
}


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

.chat-panel {
  width: var(--chat-window-width); /* Uses the CSS variable set by JS */
  height: 100%;
  background: #1e1e1e;
  border-left: 2px solid #333; /* Default border for right chat */
  display: none;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

/* Border for left-positioned chat */
.stream-container.chat-left .chat-panel {
  border-left: none;
  border-right: 2px solid #333;
}

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

.chat-iframe {
  width: calc(100% / var(--chat-scale));
  height: calc(100% / var(--chat-scale));
  border: none;
  transform: scale(var(--chat-scale));
  transform-origin: 0 0;
  position: absolute;
  top: 0;
  left: 0;
}

/* Added styles for the hide button */
.hide-btn {
  position: absolute;
  top: calc(50% - 30px);
  right: auto;
  left: 8px;
  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;
}

/* Position hide button on the left when .chat-left class is present */
.stream-container.chat-left .hide-btn {
  left: 8px;
  right: auto;
}

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

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

/* 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;
  gap: 15px; /* Space between elements */
  color: #ccc;
  font-size: 16px;
}

.placeholder-logo1 {
  width: 100px; /* Set a fixed width */
  height: 100px; /* Set a fixed height to ensure same size */
  border-radius: 50%;
  z-index: 1;
  position: relative; /* Keep relative for z-index */
}

.placeholder-logo2 {
  width: 100px; /* Set a fixed width */
  height: 100px; /* Set a fixed height to ensure same size */
  border-radius: 50%;
  z-index: 2; /* Ensure it overlaps logo1 */
  position: relative; /* Keep relative for z-index */
  margin-left: -50px; /* Overlap logo1 by 50% of its width */
}
.placeholder-logo1:hover {
 z-index: 5;
}
.placeholder-logo2:hover {
 z-index: 5;
}
.placeholder-logo3:hover {
 z-index: 5;
}
.placeholder-logo3 {
  width: 100px; /* Set a fixed width */
  height: 100px; /* Set a fixed height to ensure same size */
  border-radius: 50%;
  z-index: 2; /* Ensure it overlaps logo1 */
  position: relative; /* Keep relative for z-index */
  margin-left: -50px; /* Overlap by 50% of its own width */
}

.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 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: 10002; /* Ensure it's above the right panel (z-index 100) and expanded info bubble (z-index 101) */
  transition: opacity 0.5s ease;
}

.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);
}

/* Original settings-cog-btn styles (now for the one inside the panel) */
.settings-cog-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: relative;
  top: auto;
  right: auto;
  z-index: 100;
  transition: background-color 0.2s ease;
  margin: 0 auto; /* Center it within its panel-item */
  padding: 0; /* Remove default padding that might affect centering */
  line-height: 1; /* Helps with vertical centering of single characters/emojis */
}

.settings-cog-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* NEW: Styles for the Info Modal (similar to Settings Modal) */
.info-modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1000; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0,0,0,0.7); /* Black w/ opacity */
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s forwards;
}

.info-modal.show {
  display: flex;
}

/* NEW: Styles for the Settings Modal */
.settings-modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1000; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0,0,0,0.7); /* Black w/ opacity */
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s forwards;
}

.settings-modal.show {
  display: flex;
}

/* MODIFIED: ALL desktop-specific modal content styles are now inside this media query */
@media (min-width: 769px) {
  .modal-content {
    background-color: #1e1e1e;
    margin: auto; /* Centers the modal horizontally and vertically within the flex container */
    padding: 15px; /* Reduced padding for more condensed display */
    border: 1px solid #888;
    width: 80%; /* Could be responsive */
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    position: relative;
    animation: slideIn 0.3s forwards;
    max-height: 80vh; /* Limit height and allow scroll */
    overflow-y: auto; /* Enable scrolling for content */
  }

  .policy-modal .modal-content {
    background-color: #1e1e1e;
    margin: auto;
    padding: 20px; /* Increased padding for better appearance */
    border: 1px solid #888;
    width: 90%; /* Responsive width */
    max-width: 1200px; /* Max width for desktop */
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    position: relative;
    animation: slideIn 0.3s forwards;
    text-align: center; /* Center text content */
  }

  .link-modal .modal-content {
    background-color: #1e1e1e;
    margin: auto;
    padding: 15px;
    border: 1px solid #888;
    width: 90%; /* Larger width for iframe content */
    max-width: 1000px; /* Max width for larger screens */
    height: 90%; /* Larger height for iframe content */
    max-height: 90vh; /* Max height for larger screens */
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    position: relative;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s forwards;
  }

  .about-modal .modal-content {
    background-color: #1e1e1e;
    margin: auto;
    padding: 15px;
    border: 1px solid #888;
    width: 80%; /* Standard width for content */
    max-width: 900px; /* Max width for readability */
    max-height: 80vh; /* Limit height and allow scroll */
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    position: relative;
    animation: slideIn 0.3s forwards;
    overflow-y: auto; /* Enable scrolling for content */
  }

  .donate-modal .modal-content {
    /* Inherits general modal-content styles, but override for wider display */
    max-width: 700px; /* Increased max-width for the donation modal */
  }
}

.modal-content h2 {
  margin-top: 0;
  color: #fff;
  border-bottom: 1px solid #333;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.modal-content .close-button {
  color: #aaa;
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.modal-content .close-button:hover,
.modal-content .close-button:focus {
  color: white;
  text-decoration: none;
  cursor: pointer;
}

#park-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 5px; /* Reduced gap for more condensed display */
  margin-bottom: 15px; /* Reduced margin */
}

#park-checkboxes label,
#general-settings-checkboxes label,
#wait-times-settings-checkboxes label { /* Apply to all sections */
  cursor: pointer;
  color: #ddd;
}

#park-checkboxes input[type="checkbox"],
#general-settings-checkboxes input[type="checkbox"],
#wait-times-settings-checkboxes input[type="checkbox"] { /* Apply to all sections */
  width: 18px;
  height: 18px;
  accent-color: #007bff; /* Highlight color for checkbox */
  margin-right: 8px; /* Space between checkbox and label */
}

#general-settings-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 15px; /* Add some space above this section */
  border-top: 1px solid #333; /* Visual separator */
  padding-top: 15px;
}

#wait-times-settings-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 15px;
  border-top: 1px solid #333;
  padding-top: 15px;
}

/* NEW: Accordion styles */
.accordion-item {
  border-top: 1px solid #333;
  padding-top: 15px;
  margin-top: 15px;
}

.accordion-header {
  background: none;
  border: none;
  color: #fff;
  font-size: 1em; /* Matches h3 font size */
  font-weight: bold;
  width: 100%;
  text-align: left;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
}

.accordion-header h3 {
  margin: 0; /* Remove default h3 margin inside button */
  color: inherit; /* Inherit color from button */
  border-bottom: none; /* Remove border from h3 */
  padding-bottom: 0; /* Remove padding from h3 */
}

.accordion-icon {
  font-size: 1.2em;
  transition: transform 0.3s ease-out;
}

.accordion-header.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.accordion-content.active {
  max-height: 500px; /* Adjust as needed to fit content */
}


.save-settings-btn {
  background-color: #007bff;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease;
  width: 100%;
}

.save-settings-btn:hover {
  background-color: #0056b3;
}

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

@keyframes slideIn {
  from { transform: translateY(-50px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.right-panel .panel-logo {
  width: 25px; /* Small logo size */
  height: 25px;
  border-radius: 50%;
  object-fit: cover;
}

/* Adjust the info and settings cog buttons within the panel */
.right-panel .settings-cog-btn,
.right-panel .panel-link-button { /* Apply to all circular buttons in the panel */
  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: relative;
  z-index: 100;
  margin: 0 auto; /* Center it within its panel-item */
  padding: 0; /* Remove default padding that might affect centering */
  line-height: 1; /* Helps with vertical centering of single characters/emojis */
}

.right-panel .settings-cog-btn:hover,
.right-panel .panel-link-button:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Tooltip styles */
.panel-item[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: -5px; /* Position to the left of the button */
  transform: translateX(-100%); /* Shift left by its own width */
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 101; /* Ensure tooltip is above other elements */
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none; /* Allows clicks to pass through to elements behind tooltip */
}

.panel-item[data-tooltip]::after {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* NEW: Styles for the Link Modal */
.link-modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1000; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0,0,0,0.7); /* Black w/ opacity */
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s forwards;
}

.link-modal.show {
  display: flex;
}

.link-modal .modal-content h2 {
  margin-top: 0;
  color: #fff;
  border-bottom: 1px solid #333;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

#link-modal-iframe {
  flex-grow: 1; /* Allow iframe to take up remaining space */
  width: 100%;
  border: none;
}

/* NEW: About Modal Styles (similar to link-modal but for content) */
.about-modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1000; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0,0,0,0.7); /* Black w/ opacity */
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s forwards;
}

.about-modal.show {
  display: flex;
}

.about-modal .modal-content h2 {
  margin-top: 0;
  color: #fff;
  border-bottom: 1px solid #333;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

#about-content {
  /* Styles for the fetched content inside the modal */
  color: #ddd;
  line-height: 1.6;
}

#about-content h3 {
  color: #fff;
  margin-top: 20px;
  margin-bottom: 10px;
}

#about-content p {
  margin-bottom: 10px;
}

#about-content a {
  color: #ADD8E6; /* Light blue for links */
  text-decoration: underline;
}


/* NEW: Max Videos Modal Styles */
.max-videos-modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1000; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0,0,0,0.7); /* Black w/ opacity */
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s forwards;
}

.max-videos-modal.show {
  display: flex;
}

.max-videos-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
  margin-bottom: 20px;
}

.max-videos-options .radio-option {
  display: flex;
  align-items: center;
}

.max-videos-options input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: #007bff;
  margin-right: 8px;
}

.max-videos-options label {
  cursor: pointer;
  color: #ddd;
}

/* NEW: Donate Modal Styles */
.donate-modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1000; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0,0,0,0.7); /* Black w/ opacity */
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s forwards;
}

.donate-modal.show {
  display: flex;
}

.donate-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

.donate-button {
  background-color: #333;
  color: white;
  padding: 10px 15px;
  border-radius: 5px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.donate-button:hover {
  background-color: #555;
  transform: translateY(-2px);
}