/* Custom styling for media containers */
.media-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-content {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* IMPROVED FULLSCREEN MODE WITH MULTIPLE SCREENS */

/* Base fullscreen container */
.fullscreen-media-mode {
  position: fixed;
  inset: 0; /* Replaces top/left/width/height */
  z-index: 10;
  background-color: #000; /* Base background */
  overflow: hidden; /* Prevent scrollbars */
  display: flex; /* Use flex for potential centering if needed */
  justify-content: center;
  align-items: center;
}

/* Grid Wrapper - Positioned absolutely within the fullscreen container */
.media-grid-single,
.media-grid-double,
.media-grid-triple {
  position: absolute;
  inset: 0; /* Fill the parent */
  display: grid;
  /* Define gap here for consistency - Use a variable for color */
  gap: 1px; 
  background-color: rgba(var(--color-primary-rgb, 139, 0, 0), 0.4); /* Divider color using variable */
}

/* Grid column definitions */
.media-grid-single {
  grid-template-columns: 1fr;
}
.media-grid-double {
  grid-template-columns: 1fr 1fr;
}
.media-grid-triple {
  grid-template-columns: 1fr 1fr 1fr;
}

/* Media container styling within the grid */
.fullscreen-media-mode .media-container {
  position: relative; /* For absolute positioning of children */
  width: 100%; /* Fill grid cell */
  height: 100%; /* Fill grid cell */
  overflow: hidden; /* Clip content */
  background-color: #080808; /* Slightly darker off-black background */
  display: flex; /* Center content like loaders/errors */
  justify-content: center;
  align-items: center;
  border: none; /* Ensure no borders */
  aspect-ratio: unset; /* Override any previous aspect ratio */
}

/* Media element wrapper (assuming .media-content-wrapper is added) */
.fullscreen-media-mode .media-content-wrapper {
    position: absolute; /* Take up full container space */
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease-out; /* For fade transitions */
}

/* Media element styling (img, video) */
.fullscreen-media-mode .media-container img,
.fullscreen-media-mode .media-container video {
  display: block; 
  width: 100%;
  height: 100%;
  object-fit: contain; /* Always use contain */
  object-position: center; 
  position: relative; 
  z-index: 1;
  transition: object-fit 0.3s ease; 
}

/* Background blur always visible */
.fullscreen-media-mode .media-container .blur-bg { 
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(12px) brightness(0.6); 
  opacity: 1; /* Always show blur */
  transition: opacity 0.5s ease;
  z-index: 0; 
  transform: scale(1.1); 
}

/* Styling for loading/error states within container */
.fullscreen-media-mode .media-container .loading-indicator,
.fullscreen-media-mode .media-container .error-message {
  padding: 1rem;
  text-align: center;
  color: var(--color-text, #F2E9E4);
  z-index: 2; /* Above potential blur */
  max-width: 80%; /* Prevent text becoming too wide */
}
.fullscreen-media-mode .media-container .loading-indicator p {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--color-accent, #C9ADA7);
}
.fullscreen-media-mode .media-container .error-message p:first-child {
  color: var(--color-primary, #8B0000);
  font-weight: bold;
  margin-bottom: 0.5rem;
  font-size: 1.1rem; /* Slightly larger error title */
}
.fullscreen-media-mode .media-container .error-message .retry-button {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Responsive adjustments for grid layouts */
@media (max-width: 1024px) and (min-width: 768px) { /* Tablet */
  .media-grid-triple {
    grid-template-columns: 1fr 1fr; /* 2 columns */
    /* Third item wraps, creating a 2x2 layout essentially */
  }
  /* Optional: Make the bottom row take full width if only one item wraps */
  .media-grid-triple .media-container:nth-child(3) {
      grid-column: 1 / -1; /* Span full width if it's the only one on the second row */
  }
}

@media (max-width: 767px) { /* Mobile */
  .media-grid-double,
  .media-grid-triple {
    grid-template-columns: 1fr; /* Single column */
    gap: 1px; /* Keep gap for dividers */
  }
}

/* --- Skip Button Styles --- */
.media-skip-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 50;
  background-color: rgba(139, 0, 0, 0.7);
  color: #F2E9E4;
  border: 1px solid rgba(242, 233, 228, 0.5);
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.media-skip-button:hover {
  opacity: 1;
  background-color: rgba(139, 0, 0, 0.9);
  transform: scale(1.05);
}

.media-container:hover .media-skip-button {
  opacity: 0.9;
}

/* Ensure skip button is always visible in triple screen layout */
.media-grid-triple .media-container .media-skip-button {
  z-index: 50; 
  opacity: 0.7;
  pointer-events: auto;
}

/* ... rest of media container styles (loading, error, blur) ... */

/* Add these optimizations to enhance video performance */
.fullscreen-media-mode .media-container video {
  /* Promote to GPU layer */
  transform: translateZ(0);
  will-change: transform;
  
  /* Rendering optimizations */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  
  /* Ensure proper sizing */
  max-width: 100%;
  max-height: 100%;
  
  /* Always keep object-fit: contain for full video visibility */
  object-fit: contain !important;
}

/* Optimize blur background rendering */
.fullscreen-media-mode .media-container .blur-bg {
  /* Reduce blur quality on lower-end devices */
  @media (max-width: 768px) {
    filter: blur(8px) brightness(0.6); /* Less intense blur for mobile */
  }
  
  /* Hardware acceleration for blur */
  transform: translateZ(0) scale(1.1);
  will-change: opacity;
  
  /* Prevent repaints */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Ensure media containers use hardware acceleration */
.media-container {
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* --- Pause Button Styles --- */
.pause-button {
  /* Base styles are applied via class string in JS */
  /* Add any additional specific styles here if needed */
}

/* --- Pause Overlay Styles --- */
#pause-overlay {
  /* Base styles applied via JS */
  opacity: 0; /* Start transparent */
  pointer-events: none; /* Allow clicks through when hidden */
}

/* Style when overlay is active (display: flex is set by JS) */
#pause-overlay[style*="display: flex"] {
  opacity: 1;
  pointer-events: auto; /* Block interactions when visible */
}

/* --- Placement adjustments for mute/pause buttons --- */
.mute-button {
  bottom: 20px; /* Match Tailwind bottom-4 */
  left: 20px; /* Match Tailwind left-4 */
  /* Adjust z-index if needed, ensure it's below potential overlays but above content */
  z-index: 95;
}

.pause-button {
  bottom: 20px; /* Match Tailwind bottom-4 */
  left: 80px; /* Position next to mute button (20px + 36px width + 24px gap approx) */
  /* Adjust z-index to be same level as mute */
  z-index: 95;
}

/* Adjust button placement in mobile landscape */
@media (max-width: 915px) and (orientation: landscape) {
  .mute-button {
    bottom: 10px !important;
    left: 10px !important;
    width: 30px !important;
    height: 30px !important;
  }
  .pause-button {
    bottom: 10px !important;
    left: 50px !important; /* Adjust position next to smaller mute button */
    width: 30px !important;
    height: 30px !important;
  }
   #pause-overlay svg {
      width: 50px;
      height: 50px;
   }
}

/* Adjust for very short height landscape */
@media (max-height: 450px) and (orientation: landscape) {
    .mute-button, .pause-button {
        bottom: 5px !important;
    }
    .pause-button {
        left: 45px !important;
    }
}

.favorite-button {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 20;
  background-color: rgba(139, 0, 0, 0.7);
  color: white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  opacity: 0.7;
}

.favorite-button:hover {
  transform: scale(1.1);
  background-color: rgba(139, 0, 0, 0.9);
  border-color: rgba(255, 255, 255, 0.8);
  opacity: 1;
}

.media-container:hover .favorite-button {
  opacity: 0.9;
}

/* Heart animation for double-click favorite */
@keyframes favoriteHeartAnimation {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.9;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0.9;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
}

.favorite-animation {
  pointer-events: none;
  position: absolute;
  z-index: 30;
}

/* ... existing styles ... */ 