/* Adjust container width when the right panel is active (desktop only) */
@media (min-width: 769px) {
  body.right-panel-active .container {
    width: calc(100vw - var(--right-panel-width));
  }
}

/* NEW: Adjust container padding-top and height when mobile header is active */
@media (max-width: 768px) {
  html, body {
    overflow-y: auto; /* Allow vertical scrolling on mobile */
  }

  body.mobile-header-active .container {
    padding-top: var(--right-panel-height-mobile);
    height: 100vh; /* Full viewport height */
  }
  .container {
    min-height: 100vh;
  }

  /* Adjustments for loading screen on mobile */
  .loading-message {
    font-size: .5em; /* Smaller font size on mobile */
    margin-bottom: 20px; /* Reduced margin on mobile */

  }

  /* Adjustments for loading screen on mobile */
  .loading-message-top {
    font-size: 1.5em; /* Smaller font size on mobile */
    margin-bottom: 20px; /* Reduced margin on mobile */
  }

  .loading-logos-container {
    height: 150px; /* Reduced height for logos container */
    margin-bottom: 10px;
  }

  .loading-logo {
    max-width: 80px; /* Smaller logos on mobile */
  }

  @keyframes spin-and-move-logo1 {
    0% { transform: translateX(0) rotate(0deg); }
    50% { transform: translateX(30px) rotate(180deg); } /* Reduced movement */
    100% { transform: translateX(0) rotate(360deg); }
  }

  @keyframes spin-and-move-logo2 {
    0% { transform: translateX(0) rotate(-180deg); } /* Reduced movement */
    100% { transform: translateX(0) rotate(-360deg); }
  }
}

/* NEW: Stream container when chat is at the bottom (desktop) */
/* This block should only apply on desktop to avoid conflict with mobile's .with-chat */
@media (min-width: 769px) {
    .stream-container.with-chat.chat-bottom {
        flex-direction: column; /* Stack video and chat vertically */
    }

    .stream-container.with-chat.chat-bottom .player-container {
        width: 100%; /* Take full width */
        height: 70%; /* Player takes 70% of height */
    }

    .stream-container.with-chat.chat-bottom .chat-panel {
        width: 100%; /* Take full width */
        height: 30%; /* Chat takes 30% of height */
        border-left: none; /* Remove left border */
        border-right: none; /* Remove right border if any was inherited */
        border-top: 2px solid #333; /* Add top border for separation */
    }

    .stream-container.with-chat.chat-bottom .chat-iframe {
        width: calc(100% / var(--chat-scale));
        height: calc(100% / var(--chat-scale));
        transform: scale(var(--chat-scale));
        transform-origin: top left;
        position: static;
    }

    /* Adjust button positions for desktop when chat is at bottom */
    .stream-container.with-chat.chat-bottom .chat-button {
        bottom: 8px;
        right: 8px;
        left: auto;
        top: auto; /* Reset top positioning */
        transform: translateY(0); /* Reset transform */
    }
    .stream-container.with-chat.chat-bottom .hide-btn {
        bottom: 8px;
        right: 40px; /* Adjust left from chat button */
        left: auto;
        top: auto; /* Reset top positioning */
        transform: translateY(0); /* Reset transform */
    }
    .stream-container.with-chat.chat-bottom .like-video-btn {
        bottom: 8px;
        right: 72px; /* Adjust left from hide button */
        left: auto;
        top: auto; /* Reset top positioning */
        transform: translateY(0); /* Reset transform */
    }
    .stream-container.with-chat.chat-bottom .dsn-icon-container {
        bottom: 8px;
        right: 104px; /* Adjust left from like button */
        left: auto;
        top: auto; /* Reset top positioning */
        transform: translateY(0); /* Reset transform */
    }
}

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

  .container {
    /* grid-template-columns: 1fr !important; <-- REMOVED to allow flexbox layout for swiping */
  }

  /* Styles for mobile controls when chat is open (now the default) */
  .stream-container.with-chat {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--right-panel-height-mobile)); /* Full height minus header */
    width: 100%;
  }

  .stream-container.with-chat .channel-label {
    position: static;
    width: 100%;
    display: flex;
    justify-content: flex-start;
    flex-shrink: 0;
    order: 1;
  }

  .stream-container.with-chat .player-container {
    width: 100%;
    height: 30vh; /* Consistent height for video */
    flex-shrink: 0;
    order: 2;
  }

  .stream-container.with-chat .mobile-controls {
    width: 100%;
    height: var(--right-panel-height-mobile);
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 25;
    position: static;
    border-top: 1px solid #333;
    border-left: none;
    flex-shrink: 0;
    order: 3;
  }

  .mobile-control-button {
    margin: 0 5px;
  }

  .stream-container.with-chat .chat-panel {
    width: 100% !important;
    height: auto !important;
    flex-grow: 1;
    margin-top: 0;
    border-left: none !important;
    border-top: 1px solid #333;
    order: 4;
  }

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

  .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;
    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: "🔇"; /* Icon for muted state (click to unmute) */
  }

  .mobile-mute-button::after {
    content: "🔊"; /* Icon for unmuted state (click to mute) */
  }
  
  .mobile-like-button::after {
    content: "👍";
  }

  /* NEW: Styles for liked video button state */
  .like-video-btn.liked-video-btn,
  .mobile-like-button.liked-video-btn {
    background-color: #444; /* Dark grey to indicate it's disabled */
    cursor: not-allowed;
    opacity: 0.7;
  }

  .mobile-like-button.liked-video-btn:hover {
      background-color: #444; /* Keep color same on hover when liked */
  }

  .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;
    cursor: default;
  }

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

  /* --- START: Styles for Mobile Focus Mode (Now default on mobile) --- */
  .mobile-focus-mode .stream-container {
    flex-direction: column;
  }

  .mobile-focus-mode .stream-container .player-container {
      order: 2;
      width: 100%;
      height: 30vh;
      flex-shrink: 0;
  }

  .mobile-focus-mode .stream-container .mobile-controls {
      order: 3;
      display: flex;
      width: 100%; 
      height: var(--right-panel-height-mobile);
      flex-direction: row;
      justify-content: space-around;
      align-items: center;
      padding: 0;
      background-color: rgba(0, 0, 0, 0.7);
      z-index: 25;
      position: static;
      border-top: 1px solid #333;
      border-left: none;
      flex-shrink: 0;
  }

  .mobile-focus-mode .stream-container .chat-panel {
      order: 4;
      display: block !important;
      width: 100% !important;
      height: auto !important;
      flex-grow: 1;
      border-left: none !important;
      border-top: 1px solid #333;
  }

  /* Hide the toggle chat button as it's always on */
  .mobile-focus-mode .mobile-chat-button {
      display: none !important;
  }
  /* --- END: Styles for Mobile Focus Mode --- */
}

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

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

  .policy-modal, .settings-modal, .info-modal, .link-modal, .max-videos-modal, .donate-modal, .about-modal, .contact-report-modal, .custom-message-modal { /* Apply to all modals, including new like/subscribe and about */
    padding: 0; /* Remove padding from the modal overlay for full screen */
  }

  .modal-content {
    width: 100%; /* Full width */
    height: 100%;
    max-width: 100%; /* Override max-width */
    max-height: 100vh; /* Override max-height */
    margin: 0; /* Remove margin for full screen */
    border-radius: 0; /* Remove border-radius for full screen */
    padding: 15px; /* Keep padding for content inside */
  }

  /* START: Fullscreen Policy Modal on Mobile */
  .policy-modal .modal-content {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  /* END: Fullscreen Policy Modal on Mobile */

  /* NEW: Right panel on mobile */
  .right-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--right-panel-height-mobile); /* Use CSS variable */
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 5px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex !important;
    transition: top 0.3s ease-out; /* Smooth transition for top position */
  }

  .right-panel .panel-item {
    margin-bottom: 0;
    margin: 0 5px;
    flex-shrink: 1;
  }

  /* Remove specific bottom-item styling as it's no longer at the bottom */
  .right-panel .bottom-item {
    margin-top: 0;
    margin-bottom: 0;
  }

  /* Hide max videos button on mobile */
  #max-videos-btn-panel {
    display: none !important;
  }

  /* NEW: Hide desktop-only settings on mobile */
  .desktop-only-setting {
    display: none !important;
  }
}

/* NEW: Styles for the Right Panel (Desktop Only) */
@media (min-width: 769px) { /* Apply these styles only on desktop */
  .right-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--right-panel-width);
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.8); /* Semi-transparent dark background */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Align items to the top */
    align-items: center;
    padding-top: 10px; /* Small padding at the top */
    z-index: 100; /* Ensure it's above the streams */
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.5); /* Subtle shadow on the left */
    transition: top 0.3s ease-out; /* Smooth transition for top position */
  }

  .right-panel .panel-item {
    margin-bottom: 15px; /* UPDATED: Increased space between items on desktop */
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%; /* Take full width of the panel */
    flex-shrink: 0; /* Prevent items from shrinking */
    position: relative; /* Needed for tooltip positioning */
  }

  /* Ensure the bottom item is pushed to the bottom */
  .right-panel .bottom-item {
    margin-top: auto; /* Pushes this item and subsequent items to the bottom */
    margin-bottom: calc(10px + var(--wait-times-bar-height)); /* Add space for the wait times bar */
  }

  body.wait-times-active .right-panel .bottom-item {
      margin-bottom: calc(10px + var(--wait-times-bar-height)); /* Ensure spacing when bar is active */
  }

  body:not(.wait-times-active) .right-panel .bottom-item {
      margin-bottom: 10px; /* Default spacing when bar is not active */
  }
}

/* Adjust the container to make space for the right panel on desktop */
@media (min-width: 769px) {
  .container {
    width: calc(100vw - var(--right-panel-width)); /* Subtract panel width */
  }
}

.donate-button img {
  height: 20px; /* Adjust as needed */
  margin-right: 10px;
}

/* NEW: Styles for Embedding Disabled Placeholder */
.embedding-disabled-placeholder {
  display: none; /* Hidden by default, shown by JS when embeddable=false */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  background-color: #282828; /* Slightly darker than default background */
  text-align: center;
  padding: 20px;
  gap: 15px; /* Space between elements */
  color: #ccc;
  font-size: 16px;
}

.embedding-disabled-placeholder .disabled-thumbnail {
  max-width: 90%;
  max-height: 60%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 44px 10px rgba(0, 0, 0, 0.3);
}

.embedding-disabled-placeholder .disabled-text {
  margin: 0;
  padding: 0 10px;
  line-height: 1.4;
}

.embedding-disabled-placeholder .view-on-youtube-btn {
  background-color: #ff0000; /* YouTube red */
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.embedding-disabled-placeholder .view-on-youtube-btn:hover {
  background-color: #cc0000;
  transform: translateY(-2px);
}

/* NEW: Styles for No Streams Display */
.no-streams-display {
  display: none; /* Hidden by default */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  background-color: #121212; /* Match body background */
  color: white;
  text-align: center;
  padding-top: var(--right-panel-height-mobile); /* Space for mobile header */
  padding-bottom: var(--wait-times-bar-height); /* Space for wait times bar */
  box-sizing: border-box; /* Include padding in height calculation */
}

@media (min-width: 769px) {
  .no-streams-display {
    width: calc(100vw - var(--right-panel-width)); /* Adjust for right panel */
    padding-top: 0; /* No mobile header on desktop */
  }
}

.no-streams-message-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: #1a1a1a;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  margin-bottom: 20px;
  max-width: 90%;
}

.no-streams-logo {
  max-width: 150px;
  height: auto;
  margin-bottom: 15px;
  border-radius: 50%;
}

.no-streams-text {
  font-size: 1.2em;
  margin: 0;
  line-height: 1.5;
}

.no-streams-hub-section {
  width: 90%;
  max-width: 1200px; /* Limit max width of iframe for better readability */
  height: 60vh; /* Adjust height as needed for the iframe */
  background-color: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  display: flex; /* To center the iframe if it doesn't fill the section */
  justify-content: center;
  align-items: center;
}

.no-streams-hub-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* NEW: Loading graphic styles */
.loading-graphic {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: transparent; /* Changed to transparent */
  display: flex;
  flex-direction: column; /* Stack elements vertically */
  justify-content: center;
  align-items: center;
  z-index: 5; /* Below player, above container background */
  transition: opacity 0.3s ease;
}

.loading-graphic.hidden {
  opacity: 0;
  pointer-events: none;
}

/* NEW: Style for the group containing spinner and logo */
.loading-spinner-logo-group {
    display: flex;
    align-items: center; /* Vertically align spinner and logo */
    justify-content: center; /* Horizontally center the group */
    margin-bottom: 15px; /* Space between logo/spinner and text */
    margin-top: -20px; /* Move the group up a little */
}

.loading-graphic img.channel-img {
  width: 100px; /* Set a fixed size for the logo */
  height: 100px; /* Set a fixed size for the logo */
  border-radius: 50%;
  object-fit: contain;
  margin-left: 15px; /* Space between spinner and logo */
}

.loading-graphic .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: spinlogo 2s linear infinite;
}

@keyframes spinlogo {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(1080deg); }
}

/* NEW: Styles for the per-video like reminder banner */
.like-reminder-banner {
  position: absolute;
  bottom: -100%; /* Start hidden below the container */
  left: 0;
  width: 100%;
  height: 10%;
  background-color: rgba(0, 0, 0, 0.85);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  z-index: 25;
  transition: bottom 0.5s ease-in-out;
  font-size: 14px;
}

.like-reminder-banner.show {
  bottom: 0; /* Slide in from the bottom */
}

.like-reminder-text {
  flex-grow: 1;
  text-align: center;
  margin: 0 15px;
}

.like-reminder-banner .like-reminder-button {
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  white-space: nowrap;
  transition: background-color 0.3s ease;
}

.like-reminder-banner .like-reminder-button:hover {
  background-color: #0056b3;
}

.like-reminder-banner .like-reminder-close-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 24px;
  cursor: pointer;
  padding: 5px;
  line-height: 1;
}

.like-reminder-banner .like-reminder-close-btn:hover {
  color: white;
}


/* NEW: Contact/Report Modal Styles */
.contact-report-modal {
  display: none; /* Hidden by default */
  position: fixed; /* Sit on top */
  z-index: 1001; /* Higher z-index than other modals */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0,0,0,0.85); /* Slightly darker overlay */
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s forwards;
}

.contact-report-modal.show {
  display: flex;
}

.contact-report-modal .modal-content {
  background-color: #1e1e1e;
  margin: auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 800px;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.7);
  position: relative;
  animation: slideIn 0.3s forwards;
  text-align: center;
}

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

.contact-report-modal .modal-content p {
  margin-bottom: 10px;
  line-height: 1.5;
}

.contact-report-modal .contact-link {
  color: #ADD8E6; /* Light blue for links */
  text-decoration: underline;
  font-weight: bold;
}

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

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

/* Styles for the new "Contact Me/Report a Problem" button */
.contact-report-btn {
  background-color: #fc5050; /* Darker grey */
  color: rgb(255, 255, 255);
  padding: 8px 15px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s ease;
  width: calc(100% - 30px); /* Adjust width to account for padding of modal-content */
  margin-top: 5px; /* Space above the button */
  margin-left: 15px; /* Align with modal content padding */
  margin-right: 15px; /* Align with modal content padding */
}

.contact-report-btn:hover {
  background-color: #862727; /* Lighter grey on hover */
}

/* Styles for the bug/feature request buttons */
.bug-feature-buttons {
  display: flex;
  flex-direction: column; /* Stack buttons by default on small screens */
  gap: 10px; /* Space between buttons */
  margin-top: 15px;
}

@media (min-width: 480px) { /* Arrange side-by-side on wider screens */
  .bug-feature-buttons {
    flex-direction: row;
    justify-content: space-around; /* Distribute space evenly */
    align-items: center;
  }
}

.action-button {
  display: block; /* Make links behave like block-level elements for padding */
  flex-grow: 1; /* Allow buttons to grow and fill available space */
  background-color: #007bff; /* A nice blue background */
  color: white;
  padding: 10px 15px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-align: center; /* Center the text within the button */
  white-space: nowrap; /* Prevent text from wrapping */
  overflow: hidden; /* Hide overflow if text is too long */
  text-overflow: ellipsis; /* Add ellipsis if text is truncated */
}

.action-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 */
}
.no-link{
  text-decoration: none;
  color: white;
}

/* New styles for wait time scroll logos */
.wait-times-logos-container {
  display: inline-flex; /* Use inline-flex to keep it in the flow of text */
  align-items: center;
  height: var(--wait-times-bar-height); /* Match parent height */
  width: 52px; /* Calculated width for 3 overlapping 26px logos */
  vertical-align: middle; /* Align with text baseline */
  flex-shrink: 0; /* Prevent shrinking during scroll */
  margin-right: 15px; /* Space between logos and the "Last Updated" text */
}

.wait-times-logo {
  height: calc(var(--wait-times-bar-height) - 4px); /* Slightly smaller than bar height */
  width: auto; /* Maintain aspect ratio */
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5); /* Subtle border */
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
  position: relative; /* Allow z-index and overlap */
}

.wait-times-logo:nth-child(2) {
  margin-left: calc(-50% / 2); /* Overlap by 50% of its own width */
  z-index: 2; /* Bring to front */
}

.wait-times-logo:nth-child(3) {
  margin-left: calc(-50% / 2); /* Overlap by 50% of its own width */
  z-index: 3; /* Bring to front */
}

/* New style for the attribution message */
.wait-times-attribution {
  padding: 0 15px;
  font-size: 0.9em;
  color: #aaa; /* Lighter color for attribution */
  white-space: nowrap;
  display: inline-block;
  margin-left: 20px; /* Space before the message */
}

/* NEW: Chat Loading Overlay Styles */
.chat-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(30, 30, 30, 0.9); /* Semi-transparent dark background */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10; /* Above the iframe */
  transition: opacity 0.3s ease;
}

.chat-loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

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

.chat-loading-overlay p {
  color: #fff;
  font-size: 0.9em;
  margin: 0;
}

/* NEW: Styles for the Login/OAuth Panel Item */
.login-panel-item {
    /* Inherits panel-item styles for positioning within the right panel */
    /* Add specific styles for the button within this item */
}

.login-panel-item .settings-cog-btn {
    /* Ensure the button within the login panel item is styled like other panel buttons */
    width: 25px;
    height: 25px;
    font-size: 16px; /* For the key emoji */
    padding: 0; /* Remove padding to center icon */
    line-height: 1; /* Ensure vertical centering of emoji */
}

.login-panel-item .user-profile-pic {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.5); /* Subtle border for profile pic */
}

/* Hide the default Google Sign-In button */
.login-hidden-gsi {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
}

/* NEW: Custom Message Modal Styles (replaces alert/confirm) */
.custom-message-modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1002; /* Higher than other modals */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.85); /* Darker overlay */
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s forwards;
}

.custom-message-modal.show {
    display: flex;
}

.custom-message-modal .modal-content {
    background-color: #1e1e1e;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.7);
    position: relative;
    animation: slideIn 0.3s forwards;
    text-align: center;
}

.custom-message-modal .modal-content.error {
    border-color: #f44336; /* Red border for errors */
    box-shadow: 0 5px 20px rgba(244, 67, 54, 0.5); /* Red shadow for errors */
}

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

.custom-message-modal .modal-content p {
    margin-bottom: 20px;
    line-height: 1.5;
}

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

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

.custom-message-modal .modal-ok-button {
    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%;
}

.custom-message-modal .modal-ok-button:hover {
    background-color: #0056b3;
}

/* NEW: Focus Button Styles */
.focus-btn {
  position: absolute;
  top: calc(50% + 60px); /* Position below the like button */
  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: 20;
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

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

/* NEW: Styles for the focused stream container */
.stream-container.focused {
  border: 3px solid #00aaff; /* Bright blue border to indicate focus */
  z-index: 30; /* Bring the focused stream to the front */
  box-shadow: 0 0 20px rgba(0, 170, 255, 0.5); /* Add a glow effect */
}

/* NEW: On mobile, hide all but the first stream before the carousel is ready to prevent FOUC */
@media (max-width: 768px) {
    body:not(.mobile-focus-mode) #streams-container > .stream-container {
        display: none;
    }
    body:not(.mobile-focus-mode) #streams-container > .stream-container:first-of-type {
        display: flex; /* Ensures the first item is visible and laid out correctly */
    }
}

/* NEW: Mobile Focus Mode Styles */
.mobile-focus-mode #streams-container {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden; /* Prevent vertical scrolling/stacking */
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scroll-behavior: smooth;
}

.mobile-focus-mode .stream-container {
    flex: 0 0 100vw; /* Each stream takes full viewport width */
    scroll-snap-align: start;
    height: calc(100vh - var(--right-panel-height-mobile)); /* Full height minus header */
}

/* Hide scrollbar for the container */
.mobile-focus-mode #streams-container::-webkit-scrollbar {
    display: none;
}
.mobile-focus-mode #streams-container {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.swipe-indicator {
    position: absolute;
    top: 39%;
    transform: translateY(-50%);
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.5);
    z-index: 100;
    animation: pulse 1.5s 10;
}

.swipe-indicator.left {
    left: 10px;
}

.swipe-indicator.right {
    right: 10px;
}

@keyframes pulse {
    0% {
        transform: translateY(-50%) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translateY(-50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translateY(-50%) scale(1);
        opacity: 0.5;
    }
}

/* NEW: Mobile Focus Mode Carousel Indicator */
.mobile-focus-indicator {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    z-index: 101;
    font-size: 14px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none; /* Don't block clicks */
}

.mobile-focus-indicator.show {
    opacity: 1;
}

/* --- PWA Install Popup --- */
.pwa-install-popup {
  position: fixed;
  bottom: -200px; /* Start off-screen */
  right: 20px;
  background-color: #2a2a2e;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  padding: 15px;
  z-index: 2000;
  transition: bottom 0.5s ease-in-out;
  border: 1px solid #444;
}

.pwa-install-popup.show {
  bottom: 20px;
}

.pwa-install-popup-logo {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  margin-right: 15px;
  object-fit: cover;
}

.pwa-install-popup-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.pwa-install-popup-content p {
  margin: 0 0 8px 0;
  font-size: 1em;
  font-weight: 500;
  color: #f0f0f0;
}

.pwa-install-popup-btn {
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.9em;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.pwa-install-popup-btn:hover {
  background-color: #0056b3;
  transform: translateY(-1px);
}

.pwa-install-popup-close-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: none;
  border: none;
  color: #aaa;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 5px;
}

.pwa-install-popup-close-btn:hover {
  color: white;
}

/* Mobile styles for PWA Install Popup */
@media (max-width: 768px) {
  .pwa-install-popup {
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    width: 90%;
    max-width: 350px;
  }

  .pwa-install-popup.show {
    bottom: 70px; /* Position above potential bottom navigation bars */
  }
}

#install-pwa-btn-unavailable {
    background-color: #555;
    cursor: not-allowed;
    opacity: 0.6;
}

/* NEW: Mobile Chat Placeholder Styles */
.chat-placeholder {
  display: none; /* Hidden by default, shown on mobile */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  cursor: pointer;
  background-color: #1a1a1a;
  color: #888;
  font-size: 1.2em;
  transition: background-color 0.3s ease;
  min-height: 150px; /* Ensure it has a minimum clickable area */
}

.chat-placeholder:hover {
  background-color: #2a2a2a;
  color: #ccc;
}

.chat-placeholder-icon {
  font-size: 2em;
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  /* Show placeholder only on mobile when chat is not initiated */
  .stream-container:not(.chat-initiated) .chat-placeholder {
    display: flex;
  }

  /* Hide iframe when chat is not initiated */
  .stream-container:not(.chat-initiated) .chat-iframe {
    display: none;
  }
}
