/* Custom CSS Enhancements for StreamFlix Modern Dark Theme */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --primary-red: #e50914;
  --primary-red-hover: #b80710;
  --bg-dark: #070709;
  --card-dark: #121217;
  --card-border: rgba(255, 255, 255, 0.08);
}

html, body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: #f3f4f6;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  position: relative;
}

*, *::before, *::after {
  box-sizing: border-box;
}

img, video, iframe {
  max-width: 100%;
}

h1, h2, h3, h4, .font-heading {
  font-family: 'Outfit', sans-serif;
}

/* Strict 16:9 Aspect Ratio enforcement */
.aspect-16-9 {
  aspect-ratio: 16 / 9;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: #0a0a0d;
}

::-webkit-scrollbar-thumb {
  background: #23232c;
  border-radius: 9999px;
  border: 2px solid #0a0a0d;
}

::-webkit-scrollbar-thumb:hover {
  background: #e50914;
}

/* Ambient Backlight (Glow Effect behind player) */
.ambient-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  height: 85%;
  background: radial-gradient(circle, rgba(229, 9, 20, 0.22) 0%, rgba(99, 102, 241, 0.12) 40%, transparent 70%);
  filter: blur(55px);
  z-index: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

/* Pulsing radar waves behind the Play button */
@keyframes radar-wave {
  0% {
    transform: scale(0.95);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.3;
  }
  100% {
    transform: scale(1.75);
    opacity: 0;
  }
}

.radar-pulse-1 {
  animation: radar-wave 2.4s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.radar-pulse-2 {
  animation: radar-wave 2.4s cubic-bezier(0.2, 0.8, 0.2, 1) infinite 0.8s;
}

/* Play button hover bounce & shine */
.play-btn-glow {
  box-shadow: 0 0 30px rgba(229, 9, 20, 0.55), 0 0 60px rgba(229, 9, 20, 0.25);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.play-btn-glow:hover {
  box-shadow: 0 0 45px rgba(229, 9, 20, 0.85), 0 0 85px rgba(229, 9, 20, 0.45);
  transform: scale(1.08);
}

/* Shimmer animation on badges */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.badge-shimmer {
  background: linear-gradient(90deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.06) 100%);
  background-size: 200% 100%;
  animation: shimmer 3s infinite linear;
}

/* Smooth Fade transition for player unlock */
.player-transition {
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s;
}

/* Cinema / Theater Mode Active State */
body.cinema-mode-active {
  background-color: #000000;
}

body.cinema-mode-active .cinema-dimmable {
  opacity: 0.15;
  filter: blur(2px);
  pointer-events: none;
  transition: all 0.5s ease;
}

body.cinema-mode-active #playerContainerWrapper {
  z-index: 45;
  position: relative;
  max-width: 860px !important;
}

/* Netflix style card hover zoom */
.movie-card {
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease;
}

.movie-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 14px 28px rgba(0,0,0,0.55), 0 10px 10px rgba(0,0,0,0.35);
}

/* HTML5 Video Styling */
video::-webkit-media-controls-panel {
  background-image: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0));
}

/* ============================================================== */
/* CLEAN RESPONSIVE SMART PLAYER (IFRAME & VIDEO)                */
/* Native 1:1 touch coordinate mapping - All buttons 100% work!  */
/* ============================================================== */
#playerFrame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: #000;
  border-radius: 1rem;
}

#movieIframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  background-color: #000;
  transform: none !important;
  pointer-events: auto !important;
  z-index: 10;
}

#playerThumbnailOverlay.hidden {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* Mobile Responsive Optimization */
@media (max-width: 640px) {
  #playerContainerWrapper {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto;
    margin-right: auto;
  }

  #playerFrame {
    width: 100% !important;
    aspect-ratio: 16 / 9;
    min-height: 220px;
  }

  #movieIframe {
    width: 100% !important;
    height: 100% !important;
    transform: none !important;
  }

  .ambient-glow {
    width: 80% !important;
    height: 70% !important;
    filter: blur(30px) !important;
  }

  /* Server buttons container wraps neatly on small screens */
  #serverButtonsContainer {
    width: 100%;
  }

  .server-btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}
