/* Video player panel responsive sizing and positioning to match expanded card breakpoints */
@media (min-width: 1400px) {
  .video-player-panel {
    width: clamp(40vw, 45vw, 70vw) !important;
    height: clamp(40vh, 70vh, 80vh) !important;
    left: calc(2vw + clamp(40vw, 45vw, 70vw) + 2vw) !important;
  }
}

@media (min-width: 1024px) and (max-width: 1399px) {
  .video-player-panel {
    width: clamp(40vw, 35vw, 70vw) !important;
    height: clamp(40vh, 55vh, 80vh) !important;
    left: calc(2vw + clamp(40vw, 55vw, 70vw) + 2vw) !important;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .video-player-panel {
    width: clamp(40vw, 3vw, 70vw) !important;
    height: clamp(40vh, 55vh, 80vh) !important;
    left: calc(2vw + clamp(40vw, 55vw, 70vw) + 2vw) !important;
  }
}

/* Video sections for expanded game/movie cards */
.video-sections-container {
  margin-top: clamp(0.8rem, 1.5vw, 1.2rem);
  width: 100%;
  padding-bottom: clamp(1rem, 2vw, 1.5rem);
  border-top: clamp(1px, 0.1vw, 2px) solid rgba(63, 203, 224, 0.3);
  padding-top: clamp(0.5rem, 1vw, 0.8rem);
}

.video-section {
  margin-bottom: clamp(0.8rem, 1.5vw, 1.2rem);
  border-top: clamp(1px, 0.1vw, 2px) solid rgba(25, 104, 117, 0.3);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(0.7rem, 1.2vw, 1rem) clamp(0.5rem, 1vw, 0.8rem);
  cursor: pointer;
  background-color: rgba(25, 104, 117, 0.1);
  border-radius: clamp(0.2rem, 0.4vw, 0.3rem);
  margin-bottom: clamp(0.2rem, 0.5vw, 0.4rem);
}

.section-heading h4 {
  margin: 0;
  color: #3fcbe0;
  font-size: clamp(1rem, 1.8vw, 1.3rem);
  text-shadow: 0 0 clamp(0.2rem, 0.5vw, 0.4rem) rgba(63, 203, 224, 0.3);
}

.toggle-icon {
  color: #3fcbe0;
  font-size: clamp(0.8rem, 1.4vw, 1.1rem);
  font-weight: bold;
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(1.2rem, 2vw, 1.6rem);
  height: clamp(1.2rem, 2vw, 1.6rem);
}

.video-container {
  max-height: clamp(25rem, 40vh, 35rem);
  overflow-y: auto;
  transition: max-height 0.3s ease-in-out, opacity 0.3s ease;
  margin-top: clamp(0.5rem, 1vw, 0.8rem);
  padding: 0 clamp(0.2rem, 0.5vw, 0.4rem);
}

.video-container.collapsed {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin: 0;
  padding: 0;
}

.video-wrapper {
  margin-bottom: 15px;
  position: relative;
  width: 100%;
}

.video-wrapper iframe {
  width: 100% !important; 
  max-width: 100%;
  height: clamp(180px, 25vh, 280px) !important; /* Responsive height */
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  border: 3px solid rgba(63, 203, 224, 0.3);
}

/* Fix video section styling */
.expanded-card.expanded.game-expanded .video-sections-container {
  margin-top: 20px;
  width: 100%;
  padding-bottom: 20px;
  border-top: 1px solid rgba(63, 203, 224, 0.3);
  padding-top: 10px;
}

.expanded-card.expanded.game-expanded .video-section {
  margin-bottom: 10px;
  display: block !important;
}

/* Fix collapsible behavior */
.expanded-card.expanded.game-expanded .video-container {
  max-height: 800px; /* Taller to fit all videos when expanded */
  transition: all 0.3s ease-in-out;
  overflow: hidden;
}

.expanded-card.expanded.game-expanded .video-container.collapsed {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin: 0;
  padding: 0;
  visibility: hidden; /* Actually hide the content */
  height: 0; /* Ensure it takes no space */
}

/* Ensure videos are properly displayed */
.expanded-card.expanded.game-expanded .video-wrapper iframe {
  width: 100% !important;
  max-width: 100%;
  height: clamp(180px, 25vh, 280px) !important; /* Responsive height */
  border-radius: 4px;
  margin-bottom: 15px;
}

/* Make sure the last video doesn't have unnecessary margin */
.expanded-card.expanded.game-expanded .video-wrapper:last-child {
  margin-bottom: 0;
}

/* Video section styling specific to game cards */
.expanded-card.expanded.game-expanded .video-sections-container {
  margin-top: 20px;
  width: 100%;
  padding-bottom: 20px;
  border-top: 1px solid rgba(63, 203, 224, 0.3);
  padding-top: 10px;
}

.expanded-card.expanded.game-expanded .video-section {
  margin-bottom: 20px;
  display: block !important;
}

.expanded-card.expanded.game-expanded .video-container {
  max-height: unset;
  transition: max-height 0.3s ease-in-out, opacity 0.3s ease;
}

.expanded-card.expanded.game-expanded .video-container:not(.collapsed) {
  margin-top: 10px;
  padding: 0 5px;
}

/* Movie video sections styling */
.expanded-card.expanded.movie-expanded .video-sections-container {
  margin-top: 20px;
  width: 100%;
  padding-bottom: 20px;
  border-top: 1px solid rgba(155, 77, 95, 0.3);
  padding-top: 10px;
}

.expanded-card.expanded.movie-expanded .video-section {
  margin-bottom: 15px;
  border-top: 1px solid rgba(155, 77, 95, 0.3);
}

.expanded-card.expanded.movie-expanded .section-heading {
  background-color: rgba(155, 77, 95, 0.1);
}

.expanded-card.expanded.movie-expanded .section-heading h4 {
  color: #ff8a9e;
  text-shadow: 0 0 5px rgba(155, 77, 95, 0.3);
}

.expanded-card.expanded.movie-expanded .toggle-icon {
  color: #ff8a9e;
}

.expanded-card.expanded.movie-expanded .video-wrapper iframe {
  border: 3px solid rgba(155, 77, 95, 0.3);
}

/* Video player panel */
.video-player-panel {
  position: fixed;
  top: 50% !important;
  /* The following are now set dynamically in JS for perfect alignment: */
  /* left: ...; width: ...; height: ...; */
  background: transparent;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  transform: translateY(-50%) !important; /* Center vertically like the expanded card */
  pointer-events: none; /* Start with no pointer events */
}

.video-player-panel.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto; /* Enable pointer events when active */
}

.video-player-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  z-index: 10001;
  transition: all 0.2s ease;
}

.video-player-close:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
}

.video-player-container {
  display: flex;
  width: 100%;
  height: 100%;
  background: #080b11;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
  border: 2px solid #196875; /* Match expanded card border */
  animation: videoPlayerFadeIn 0.5s forwards;
  flex-direction: column; /* Change to column layout */
}

.main-video-player {
  flex: 1;
  height: calc(100% - clamp(120px, 20vh, 200px)); /* Adjust for responsive playlist height */
  min-height: 75%; /* Ensure video always takes up at least 75% of height */
  background: #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#current-video-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

#current-video-container iframe {
  width: 100% !important;
  height: 100% !important;
  border: none;
  aspect-ratio: 16/9;
  max-height: 100%;
}

/* Make playlist horizontal and compact */
.video-playlist {
  width: 100%;
  min-width: unset;
  height: clamp(120px, 20vh, 200px); /* Responsive height */
  max-height: 25%; /* Never more than 25% of container */
  background: #111;
  border-left: none;
  border-top: 1px solid rgba(63, 203, 224, 0.2);
  display: flex;
  flex-direction: column;
}

.video-playlist h3 {
  padding: 6px 10px;
  margin: 0;
  height: 10px;
  color: #3fcbe0;
  font-size: 1em;
  text-align: center;
  background: rgba(63, 203, 224, 0.1);
  border-bottom: 1px solid rgba(63, 203, 224, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.playlist-items {
  flex: 1;
  overflow-y: hidden;
  overflow-x: auto;
  padding: 8px;
  display: flex;
  flex-direction: row; /* Horizontal layout */
  gap: 8px;
}

.playlist-item {
  display: flex;
  padding: 6px;
  margin-bottom: 0;
  margin-right: 0;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  width: 180px;
  min-width: 180px;
  height: 50px;
}

.playlist-item:hover {
  background: rgba(63, 203, 224, 0.1);
  border: 1px solid rgba(63, 203, 224, 0.3);
}

.playlist-item.active {
  background: rgba(63, 203, 224, 0.2);
  border: 1px solid rgba(63, 203, 224, 0.4);
}

.playlist-item-thumbnail {
  width: 80px;
  min-width: 80px;
  height: 100%;
  background: #000;
  overflow: hidden;
  border-radius: 3px;
  margin-right: 8px;
}

.playlist-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.playlist-item-title {
  color: #fff;
  font-size: 0.8em;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item-section {
  color: #3fcbe0;
  font-size: 0.7em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Update scrollbars for horizontal playlist */
.playlist-items::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

/* Remove responsive adjustments that are no longer needed */
@media (max-width: 1200px) {
  .video-player-container {
    width: 100%;
    height: 100%;
  }
  
  .video-playlist {
    width: 100%;
    min-width: 100%;
  }
  
  .playlist-items {
    display: flex;
    flex-wrap: nowrap;
    padding: 8px;
  }
  
  .playlist-item {
    min-width: 180px;
    margin-right: 0;
  }
}

/* Video player panel uses CSS custom properties from cards-expanded.css for consistent sizing */

/* Mobile devices behavior is handled by mobile.css */

/* Toggle button for playlist visibility - hidden by default, visible on hover */
.playlist-toggle-btn {
  position: absolute;
  bottom: clamp(120px, 20vh, 200px); /* Position right above the responsive playlist */
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 16px;
  background: rgba(63, 203, 224, 0.6);
  color: #fff;
  border: none;
  border-radius: 3px 3px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  z-index: 10001;
  transition: all 0.3s ease;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.5);
  opacity: 0; /* Hidden by default */
  pointer-events: none; /* No interaction when hidden */
}

/* Show toggle button when hovering over the video player container */
.video-player-container:hover .playlist-toggle-btn {
  opacity: 1;
  pointer-events: auto; /* Enable interactions when visible */
}

/* Adjust the toggle button position when playlist is collapsed */
.video-player-container.playlist-collapsed .playlist-toggle-btn {
  bottom: 0;
  border-radius: 3px 3px 0 0;
  /* Keep opacity at 0 by default when collapsed */
}

/* Create a hover detection zone at the bottom of the player when playlist is collapsed */
.video-player-container.playlist-collapsed::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 30px; /* Height of the detection zone */
  background: transparent;
  z-index: 10000;
}

/* Show toggle button when hovering over the bottom detection zone or the button itself */
.video-player-container.playlist-collapsed:hover .playlist-toggle-btn,
.playlist-toggle-btn:hover {
  opacity: 1;
  pointer-events: auto;
}

/* Make the button more visible on hover */
.playlist-toggle-btn:hover {
  background: rgba(63, 203, 224, 0.9);
  opacity: 1 !important; /* Force full opacity when directly hovering the button */
}

.playlist-toggle-btn .toggle-icon {
  transition: transform 0.3s ease;
}

.playlist-toggle-btn.collapsed .toggle-icon {
  transform: rotate(180deg);
}

/* Video player with collapsed playlist */
.video-player-container.playlist-collapsed .video-playlist {
  height: 0;
  min-height: 0;
  overflow: hidden;
  border-top: none;
}

.video-player-container.playlist-collapsed .main-video-player {
  height: 100%; /* Give all the space to the video when playlist is collapsed */
}

/* Adjust the toggle button position when playlist is collapsed */
.video-player-container.playlist-collapsed .playlist-toggle-btn {
  bottom: 0;
  border-radius: 3px 3px 0 0;
}

/* Animation for fadeIn */
@keyframes videoPlayerFadeIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Video player button for expanded cards */
.video-player-btn {
  position: absolute;
  top: 50px; /* Below the close button */
  right: 10px;
  width: 30px;
  height: 30px;
  background: rgba(63, 203, 224, 0.6);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  z-index: 25;
  transition: all 0.2s ease;
  box-shadow: 0 0 10px rgba(63, 203, 224, 0.4);
}

.video-player-btn:hover {
  background: rgba(63, 203, 224, 0.9);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(63, 203, 224, 0.8);
}

/* Pin and music buttons for expanded cards and video player panel */
.expanded-card .pin-video-btn {
  position: absolute;
  top: 90px; /* Below the video-player-btn */
  right: 10px;
  width: 30px;
  height: 30px;
  background: rgba(63, 203, 224, 0.6);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  z-index: 25;
  transition: all 0.2s ease;
  box-shadow: 0 0 10px rgba(63, 203, 224, 0.4);
  opacity: 0;
}

.expanded-card .music-btn {
  position: absolute;
  top: 130px; /* Below the pin-video-btn */
  right: 10px;
  width: 30px;
  height: 30px;
  background: rgba(186, 63, 224, 0.6); /* Purple shade to differentiate from pin button */
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  z-index: 25;
  transition: all 0.2s ease;
  box-shadow: 0 0 10px rgba(186, 63, 224, 0.4);
  opacity: 0;
}

/* The same button styling for video player panel */
.video-player-container .pin-video-btn {
  position: absolute;
  top: 90px;
  right: 10px;
  width: 30px;
  height: 30px;
  background: rgba(63, 203, 224, 0.6);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  z-index: 25;
  transition: all 0.2s ease;
  box-shadow: 0 0 10px rgba(63, 203, 224, 0.4);
  opacity: 0;
}

.video-player-container .music-btn {
  position: absolute;
  top: 130px;
  right: 10px;
  width: 30px;
  height: 30px;
  background: rgba(186, 63, 224, 0.6);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  z-index: 25;
  transition: all 0.2s ease;
  box-shadow: 0 0 10px rgba(186, 63, 224, 0.4);
  opacity: 0;
}

.video-player-container:hover .pin-video-btn,
.video-player-container:hover .music-btn,
.expanded-card:hover .pin-video-btn,
.expanded-card:hover .music-btn {
  opacity: 1;
}

.pin-video-btn:hover {
  background: rgba(63, 203, 224, 0.9);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(63, 203, 224, 0.8);
}

.music-btn:hover {
  background: rgba(186, 63, 224, 0.9);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(186, 63, 224, 0.8);
}

.music-btn.active {
  background: rgba(186, 63, 224, 0.9);
  box-shadow: 0 0 15px rgba(186, 63, 224, 0.8);
}

/* Movie-specific styling for buttons */
.expanded-card.expanded.movie-expanded .video-player-btn {
  background: rgba(155, 77, 95, 0.6);
  box-shadow: 0 0 10px rgba(155, 77, 95, 0.4);
}

.expanded-card.expanded.movie-expanded .video-player-btn:hover {
  background: rgba(155, 77, 95, 0.9);
  box-shadow: 0 0 15px rgba(155, 77, 95, 0.8);
}

.expanded-card.expanded.movie-expanded .pin-video-btn {
  background: rgba(155, 77, 95, 0.6);
  box-shadow: 0 0 10px rgba(155, 77, 95, 0.4);
}

.expanded-card.expanded.movie-expanded .pin-video-btn:hover {
  background: rgba(155, 77, 95, 0.9);
  box-shadow: 0 0 15px rgba(155, 77, 95, 0.8);
}

/* Movie video panel styling */
.video-player-panel[data-original-card^="movie"] .video-player-container {
  border: 2px solid #9b4d5f;
}

.video-player-panel[data-original-card^="movie"] .video-playlist {
  border-top: 1px solid rgba(155, 77, 95, 0.2);
}

.video-player-panel[data-original-card^="movie"] .video-playlist h3 {
  color: #ff8a9e;
  background: rgba(155, 77, 95, 0.1);
  border-bottom: 1px solid rgba(155, 77, 95, 0.2);
}

.video-player-panel[data-original-card^="movie"] .playlist-toggle-btn {
  background: rgba(155, 77, 95, 0.6);
}

.video-player-panel[data-original-card^="movie"] .playlist-toggle-btn:hover {
  background: rgba(155, 77, 95, 0.9);
}

.video-player-panel[data-original-card^="movie"] .pin-video-btn {
  background: rgba(155, 77, 95, 0.6);
  box-shadow: 0 0 10px rgba(155, 77, 95, 0.4);
}

.video-player-panel[data-original-card^="movie"] .pin-video-btn:hover {
  background: rgba(155, 77, 95, 0.9);
  box-shadow: 0 0 15px rgba(155, 77, 95, 0.8);
}

.video-player-panel[data-original-card^="movie"] .playlist-item.active {
  background: rgba(155, 77, 95, 0.2);
  border: 1px solid rgba(155, 77, 95, 0.4);
}

.video-player-panel[data-original-card^="movie"] .playlist-item:hover {
  background: rgba(155, 77, 95, 0.1);
  border: 1px solid rgba(155, 77, 95, 0.3);
}

.video-playlist[data-original-card^="movie"] .playlist-item-section {
  color: #ff8a9e;
}

