/* ============================================================ */
/* CINEHD 4K ULTRA HD STREAMING ENGINE THEME STYLES             */
/* Optimized for Sub-1.2s LCP, CLS: 0 & Hardware Acceleration  */
/* ============================================================ */

:root {
  --chd-primary: #f59e0b;
  --chd-primaryHover: #d97706;
  --chd-primaryLight: #fef08a;
  --chd-primaryGlow: rgba(245, 158, 11, 0.45);
  --chd-goldGradient: linear-gradient(135deg, #fde047 0%, #f59e0b 50%, #d97706 100%);
  --chd-dark: #080a0f;
  --chd-surface: #0e121a;
  --chd-card: #131822;
  --chd-cardHover: #1a2230;
  --chd-border: rgba(255, 255, 255, 0.08);
  --chd-borderGlow: rgba(245, 158, 11, 0.35);
  --chd-muted: #1e2638;
}

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

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  background-color: var(--chd-dark);
  color: #ffffff;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================ */
/* HERO & CINEMATIC VIGNETTES                                   */
/* ============================================================ */
.hero-vignette {
  background: linear-gradient(
    90deg,
    rgba(8, 10, 15, 0.96) 0%,
    rgba(8, 10, 15, 0.82) 34%,
    rgba(8, 10, 15, 0.35) 60%,
    transparent 82%
  );
  transform: translateZ(0);
  will-change: opacity;
}

.hero-bottom-fade {
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(8, 10, 15, 0.5) 45%,
    #080a0f 100%
  );
  transform: translateZ(0);
}

/* Zero CLS Typography */
.brand-title {
  font-family: Impact, "Arial Black", -apple-system, sans-serif;
  letter-spacing: 1.5px;
  font-weight: 900;
}

/* Performance: Content Visibility for Below-the-fold Sections */
.cv-auto {
  content-visibility: auto;
  contain-intrinsic-size: 1px 500px;
}

/* ============================================================ */
/* HORIZONTAL SCROLL RAILS                                      */
/* ============================================================ */
.chd-rail {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.75rem 4px 1.5rem 4px;
  transform: translateZ(0);
  gap: 1rem;
}

.chd-rail::-webkit-scrollbar {
  display: none;
}

/* ============================================================ */
/* 16:9 WIDESCREEN 4K SPOTLIGHT CARDS (Movie-Box Inspiration)   */
/* ============================================================ */
.widescreen-item {
  position: relative;
  flex: 0 0 auto;
  user-select: none;
  display: block;
  /* 3.2 cards on large screens, 2.3 on tablets, 1.25 on mobile */
  width: calc((100% - 3 * 1rem) / 3.4);
}

@media (max-width: 1280px) {
  .widescreen-item {
    width: calc((100% - 2 * 1rem) / 2.5);
  }
}

@media (max-width: 768px) {
  .widescreen-item {
    width: calc((100% - 1 * 0.75rem) / 1.35);
  }
}

.chd-widescreen-card {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 1rem;
  overflow: hidden;
  background-color: var(--chd-card);
  border: 1px solid var(--chd-border);
  transition: transform 0.28s cubic-bezier(0.2, 0, 0.2, 1), box-shadow 0.28s ease, border-color 0.28s ease;
  transform: translateZ(0);
}

.widescreen-item:hover .chd-widescreen-card {
  transform: scale(1.03) translateY(-4px) translateZ(0);
  border-color: rgba(245, 158, 11, 0.65);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.9), 0 0 25px rgba(245, 158, 11, 0.3);
}

/* ============================================================ */
/* TOP 10 NUMBERED SLIDER CARDS                                 */
/* ============================================================ */
.top10-item {
  position: relative;
  flex: 0 0 auto;
  user-select: none;
  display: block;
}

@media (min-width: 1350px) {
  .top10-item {
    width: calc((100% - 6 * 1rem) / 7);
  }
}

@media (min-width: 1100px) and (max-width: 1349px) {
  .top10-item {
    width: calc((100% - 5 * 1rem) / 6);
  }
}

@media (min-width: 850px) and (max-width: 1099px) {
  .top10-item {
    width: calc((100% - 4 * 0.75rem) / 5);
  }
}

@media (min-width: 640px) and (max-width: 849px) {
  .top10-item {
    width: calc((100% - 3 * 0.75rem) / 4);
  }
}

@media (max-width: 639px) {
  .top10-item {
    width: calc((100% - 1.5 * 0.5rem) / 2.35);
  }
}

.chd-rank-num {
  font-family: "Arial Black", Impact, sans-serif;
  font-size: clamp(4rem, 6.2vw, 7.2rem);
  line-height: 0.78;
  font-weight: 900;
  color: #080a0f;
  -webkit-text-stroke: 3.5px #334155;
  letter-spacing: -4px;
  position: absolute;
  bottom: -4px;
  left: 0;
  z-index: 10;
  pointer-events: none;
  user-select: none;
  transition: -webkit-text-stroke 0.25s ease, color 0.25s ease, text-shadow 0.25s ease;
}

.chd-rank-num.double-digit {
  letter-spacing: -8px;
  font-size: clamp(3.2rem, 5.2vw, 6.2rem);
}

.top10-item:hover .chd-rank-num {
  -webkit-text-stroke: 3.5px #f59e0b;
  color: rgba(245, 158, 11, 0.4);
  text-shadow: 0 0 25px rgba(245, 158, 11, 0.55);
}

/* ============================================================ */
/* STANDARD 2:3 POSTER CARD                                     */
/* ============================================================ */
.standard-item {
  position: relative;
  flex: 0 0 auto;
  user-select: none;
  display: block;
}

@media (min-width: 1350px) {
  .standard-item {
    width: calc((100% - 6 * 1rem) / 7);
  }
}

@media (min-width: 1100px) and (max-width: 1349px) {
  .standard-item {
    width: calc((100% - 5 * 1rem) / 6);
  }
}

@media (min-width: 850px) and (max-width: 1099px) {
  .standard-item {
    width: calc((100% - 4 * 0.75rem) / 5);
  }
}

@media (min-width: 640px) and (max-width: 849px) {
  .standard-item {
    width: calc((100% - 3 * 0.75rem) / 4);
  }
}

@media (max-width: 639px) {
  .standard-item {
    width: calc((100% - 2 * 0.5rem) / 3.15);
  }
}

.chd-card {
  transition: transform 0.25s cubic-bezier(0.2, 0, 0.2, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  transform-origin: center center;
  transform: translateZ(0);
  contain: layout style paint;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--chd-border);
}

.chd-card:hover {
  transform: scale(1.05) translateY(-4px) translateZ(0);
  z-index: 30;
  border-color: rgba(245, 158, 11, 0.65);
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.9), 0 0 25px rgba(245, 158, 11, 0.35);
}

/* ============================================================ */
/* MOOD CAPSULE STRIP                                           */
/* ============================================================ */
.capsule-strip {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  gap: 0.6rem;
  padding: 0.25rem 0;
}

.capsule-strip::-webkit-scrollbar {
  display: none;
}

.capsule-pill {
  flex: 0 0 auto;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  background: rgba(19, 24, 34, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  font-weight: 600;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.capsule-pill:hover,
.capsule-pill.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.6);
  color: #fef08a;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.2);
}

/* ============================================================ */
/* INTERACTIVE TABBED SWITCHER                                  */
/* ============================================================ */
.tab-switcher {
  display: inline-flex;
  background: rgba(14, 18, 26, 0.9);
  padding: 0.25rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  gap: 0.25rem;
}

.tab-btn {
  padding: 0.4rem 1.1rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #94a3b8;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  background: transparent;
}

.tab-btn.active {
  background: var(--chd-goldGradient);
  color: #080a0f;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.4);
}

/* ============================================================ */
/* ROW NAVIGATION CHEVRONS                                      */
/* ============================================================ */
.row-nav-btn {
  background: rgba(14, 18, 26, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: background 0.15s ease, opacity 0.2s ease, transform 0.15s ease, border-color 0.15s ease;
}

.row-nav-btn:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.6);
}

@media (max-width: 768px) {
  .row-nav-btn {
    opacity: 0.9 !important;
    width: 34px !important;
    height: 52px !important;
    background: rgba(14, 18, 26, 0.92) !important;
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 8px;
    z-index: 35 !important;
  }
}

/* ============================================================ */
/* ACCORDION FAQ                                                */
/* ============================================================ */
.chd-faq-bar {
  background-color: var(--chd-card);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.chd-faq-bar:hover {
  background-color: var(--chd-cardHover);
  border-color: rgba(245, 158, 11, 0.4);
}

.chd-faq-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.5, 0, 0.1, 1), padding 0.2s ease;
  contain: paint;
}

.chd-faq-content.open {
  max-height: 450px;
}


/* ============================================================ */
/* THEATER MODE & AMBIENT GLOW PLAYER                           */
/* ============================================================ */
.player-ambient-glow {
  position: relative;
}

.player-ambient-glow::before {
  content: '';
  position: absolute;
  inset: -12px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.22) 0%, rgba(217, 119, 6, 0.08) 50%, transparent 75%);
  filter: blur(24px);
  z-index: 0;
  pointer-events: none;
  border-radius: 1.5rem;
}

.theater-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.94);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

body.theater-active .theater-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================ */
/* OPTIMIZED CINEMA PLAYER DIMENSIONS (DESKTOP / LAPTOP)        */
/* ============================================================ */
#player-section {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

#player-container {
  max-height: 520px;
  width: 100%;
}

@media (min-width: 1280px) {
  #player-container {
    max-height: 550px;
  }
}

#stream-iframe,
#trailer-iframe {
  max-height: 520px;
  width: 100%;
  height: 100%;
}

@media (min-width: 1280px) {
  #stream-iframe,
  #trailer-iframe {
    max-height: 550px;
  }
}

@media (max-width: 640px) {
  #player-section {
    max-width: 100%;
  }
  #player-container,
  #stream-iframe,
  #trailer-iframe {
    max-height: none;
  }
}

body.theater-active #player-section {
  max-width: 1280px !important;
  position: relative;
  z-index: 50;
  box-shadow: 0 0 100px rgba(0, 0, 0, 1), 0 0 40px rgba(245, 158, 11, 0.3);
}

body.theater-active #player-container,
body.theater-active #stream-iframe,
body.theater-active #trailer-iframe {
  max-height: 75vh !important;
}

/* ============================================================ */
/* SERVER SELECTOR PILLS                                        */
/* ============================================================ */
.server-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  background: #131822;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  font-weight: 700;
  color: #cbd5e1;
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
}

.server-pill:hover {
  background: #1a2230;
  border-color: rgba(245, 158, 11, 0.4);
  color: #ffffff;
}

.server-pill.active {
  background: linear-gradient(135deg, #fde047 0%, #f59e0b 50%, #d97706 100%);
  color: #080a0f;
  border-color: #f59e0b;
  box-shadow: 0 2px 14px rgba(245, 158, 11, 0.45);
}

.server-ping-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background-color: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

/* ============================================================ */
/* TV EPISODES: NOW PLAYING AUDIO-WAVE ANIMATION                */
/* ============================================================ */
.audio-wave {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.audio-bar {
  width: 2.5px;
  background: #f59e0b;
  border-radius: 1px;
  animation: wave 1s ease-in-out infinite;
}

.audio-bar:nth-child(2) { animation-delay: 0.2s; }
.audio-bar:nth-child(3) { animation-delay: 0.4s; }

@keyframes wave {
  0%, 100% { height: 3px; }
  50% { height: 12px; }
}

/* ============================================================ */
/* MOBILE SLIDE-OUT DRAWER & BACKDROP (100% OPAQUE OBSIDIAN)    */
/* ============================================================ */
#mobile-drawer {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  bottom: 0 !important;
  width: 18.5rem !important;
  max-width: 85vw !important;
  height: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
  display: flex !important;
  flex-direction: column !important;
  background-color: #0c1017 !important; /* 100% Solid Opaque Obsidian */
  background: #0c1017 !important;
  color: #ffffff !important;
  border-right: 1px solid rgba(245, 158, 11, 0.25) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.95), 0 0 35px rgba(0, 0, 0, 0.9) !important;
  transform: translateX(-100%) !important;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  will-change: transform;
  z-index: 999999 !important;
  overflow: hidden !important;
}

#mobile-drawer.open {
  transform: translateX(0) !important;
}

#mobile-drawer-backdrop {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  width: 100vw !important;
  height: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
  display: block !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease !important;
  z-index: 999998 !important;
  background-color: rgba(0, 0, 0, 0.85) !important;
  background: rgba(0, 0, 0, 0.85) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#mobile-drawer-backdrop.open {
  opacity: 1 !important;
  pointer-events: auto !important;
}

@media (min-width: 768px) {
  #mobile-drawer, #mobile-drawer-backdrop {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
    transform: translateX(-100%) !important;
  }
}
/* ============================================================ */
.mini-player-docked {
  position: fixed !important;
  bottom: 1.25rem !important;
  right: 1.25rem !important;
  width: 320px !important;
  max-width: calc(100vw - 2.5rem) !important;
  z-index: 50 !important;
  border-radius: 1rem !important;
  border: 1.5px solid rgba(245, 158, 11, 0.4) !important;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.95), 0 0 30px rgba(245, 158, 11, 0.3) !important;
  overflow: hidden !important;
  background: #080a0f !important;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
  animation: miniPlayerSlideIn 0.35s ease-out !important;
}

@media (min-width: 640px) {
  .mini-player-docked {
    width: 380px !important;
  }
}

@keyframes miniPlayerSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================================ */
/* CINEHD GOLD TOAST NOTIFICATION                               */
/* ============================================================ */
#gold-toast {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(-30px);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: #0c1017;
  border: 1px solid #f59e0b;
  box-shadow: 0 10px 30px rgba(0,0,0,0.85), 0 0 25px rgba(245,158,11,0.35);
  border-radius: 9999px;
  color: #fde047;
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#gold-toast.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
