/* ==========================================================================
   Nexus Web — Minimalist Cinema Streaming Platform
   Mobile App Color Identity: Midnight Navy, Sky Cyan (#38BDF8) & Sapphire Blue (#2563EB)
   ========================================================================== */

:root {
  /* Midnight Navy Backgrounds (Identical to Mobile App) */
  --bg-core: #030712;
  --bg-sidebar: #060d1e;
  --bg-surface: #0a142a;
  --bg-card: #0d1b38;
  --bg-card-hover: #12244a;
  --bg-glass: rgba(10, 20, 42, 0.85);
  --bg-glass-heavy: rgba(6, 13, 30, 0.94);

  --border-subtle: rgba(56, 189, 248, 0.12);
  --border-medium: rgba(56, 189, 248, 0.25);
  --border-glow: rgba(56, 189, 248, 0.5);

  /* Primary Brand Accents: Electric Sky Cyan & Sapphire Blue */
  --accent-cyan: #38bdf8;
  --accent-cyan-hover: #0ea5e9;
  --accent-cyan-glow: rgba(56, 189, 248, 0.35);
  --accent-blue: #2563eb;
  --accent-emerald: #10b981;
  --accent-gold: #fbbf24;
  --accent-crimson: #f43f5e;

  /* Brand Gradients */
  --grad-primary: linear-gradient(135deg, #38bdf8 0%, #2563eb 100%);
  --grad-hover: linear-gradient(135deg, #0ea5e9 0%, #1d4ed8 100%);
  --grad-card: linear-gradient(180deg, rgba(13, 27, 56, 0.8) 0%, rgba(10, 20, 42, 0.98) 100%);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --sidebar-width: 78px;
  --topbar-height: 72px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;

  --transition-fast: 160ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 350ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base Reset & Typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  background-color: var(--bg-core);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Minimalist Cyan Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* App Shell Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* ==========================================================================
   Left Navigation Rail (Sidebar with STANDALONE LOGO)
   ========================================================================== */
.nav-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 0.5rem;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 90;
  transition: width var(--transition-normal);
}

/* Standalone Logo: Clean, Isolated, Not Boxed or Surrounded */
.brand-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 2.25rem;
  cursor: pointer;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0;
}

.brand-icon-wrap img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 2px 10px rgba(56, 189, 248, 0.45));
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.brand-icon-wrap:hover img {
  transform: scale(1.1);
  filter: drop-shadow(0 4px 16px rgba(56, 189, 248, 0.7));
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
  align-items: center;
  flex: 1;
}

.nav-item {
  position: relative;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-item svg {
  width: 22px;
  height: 22px;
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.nav-item:hover {
  color: #fff;
  background: rgba(56, 189, 248, 0.08);
}

.nav-item.active {
  color: #fff;
  background: var(--grad-primary);
  box-shadow: 0 4px 16px var(--accent-cyan-glow);
}

.nav-item.active svg {
  transform: scale(1.08);
}

/* Tooltip on Hover */
.nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) scale(0.9);
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all var(--transition-fast);
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.nav-item:hover::after {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.nav-footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
}

/* ==========================================================================
   Main Content Area
   ========================================================================= */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* Top Bar */
.top-bar {
  height: var(--topbar-height);
  padding: 0 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 80;
  background: linear-gradient(180deg, rgba(3, 7, 18, 0.95) 0%, rgba(3, 7, 18, 0.75) 100%);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
  max-width: 680px;
}

/* Search Box */
.search-box {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.search-box svg.search-icon {
  position: absolute;
  left: 1.15rem;
  width: 18px;
  height: 18px;
  color: var(--accent-cyan);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 44px;
  padding: 0 3rem 0 3rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-input::placeholder {
  color: var(--text-dim);
}

.search-input:focus {
  background: var(--bg-card);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.search-clear-btn {
  position: absolute;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: none;
  padding: 4px;
  border-radius: var(--radius-full);
}

.search-clear-btn:hover {
  color: #fff;
}

/* Top Bar Right */
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.badge-server-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.38rem 0.9rem;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-cyan);
  cursor: pointer;
}

.status-pulse {
  width: 7px;
  height: 7px;
  background: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-cyan);
  animation: pulseCyan 2s infinite;
}

@keyframes pulseCyan {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.btn-get-apps {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 40px;
  padding: 0 1.15rem;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-get-apps:hover {
  background: rgba(56, 189, 248, 0.16);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

/* Filter Chips Bar */
.filters-bar {
  padding: 0.85rem 2.5rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(3, 7, 18, 0.5);
  border-bottom: 1px solid var(--border-subtle);
}

.filters-bar::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  padding: 0.42rem 1rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.filter-chip:hover {
  color: #fff;
  border-color: rgba(56, 189, 248, 0.3);
}

.filter-chip.active {
  background: var(--grad-primary);
  border-color: var(--accent-cyan);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px var(--accent-cyan-glow);
}

/* Views Container */
.views-container {
  flex: 1;
  padding: 1.75rem 2.5rem 4rem;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

/* ==========================================================================
   Featured Hero Cinematic Showcase
   ========================================================================== */
.hero-banner {
  position: relative;
  width: 100%;
  height: 420px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2.25rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.8);
}

@media (max-width: 768px) {
  .hero-banner {
    height: 250px;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
  }
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  transition: transform 6s ease-out;
}

.hero-banner:hover .hero-backdrop {
  transform: scale(1.025);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(3, 7, 18, 0.98) 0%,
    rgba(3, 7, 18, 0.85) 45%,
    rgba(3, 7, 18, 0.3) 80%,
    rgba(3, 7, 18, 0.1) 100%
  ),
  linear-gradient(0deg, rgba(3, 7, 18, 0.98) 0%, transparent 60%);
}

.hero-content {
  position: absolute;
  left: 3.25rem;
  bottom: 3.25rem;
  max-width: 600px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.hero-tag-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.tag-badge {
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--accent-cyan);
}

.rating-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: var(--accent-gold);
  font-size: 0.75rem;
  font-weight: 700;
}

.rating-pill svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.6vw, 3.3rem);
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.hero-meta span.dot {
  width: 4px;
  height: 4px;
  background: var(--text-dim);
  border-radius: 50%;
}

.hero-overview {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-clamp: 3;
  overflow: hidden;
}

.hero-buttons {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.6rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  height: 48px;
  padding: 0 1.85rem;
  background: var(--grad-primary);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--accent-cyan-glow);
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  background: var(--grad-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.5);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  height: 48px;
  padding: 0 1.5rem;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

/* ==========================================================================
   Catalog Sections with SMOOTH CAROUSEL ARROWS (Fixes Card Cutting!)
   ========================================================================== */
.catalog-section {
  margin-bottom: 3.25rem;
  position: relative;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.collection-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.75rem;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.28);
  color: var(--accent-cyan);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.collection-pill svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

/* Carousel Outer Wrapper with Hover Navigation Arrows */
.carousel-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.cards-carousel {
  display: flex;
  gap: 1.15rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  padding: 0.5rem 0.25rem 1.65rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.cards-carousel::-webkit-scrollbar {
  display: none;
}

/* Left & Right Smooth Scroll Buttons */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-60%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(10, 11, 14, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 25;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.8);
}

.carousel-wrap:hover .carousel-arrow {
  opacity: 1;
  pointer-events: auto;
}

.carousel-arrow:hover {
  background: #ffffff;
  color: #030712;
  border-color: #ffffff;
  transform: translateY(-60%) scale(1.1);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

.carousel-arrow.prev {
  left: -18px;
}

.carousel-arrow.next {
  right: -18px;
}

/* ==========================================================================
   Movie & Series Card Specification (Inspired by dexter.pw)
   ========================================================================== */
.media-card {
  position: relative;
  aspect-ratio: 2 / 3;
  width: 195px;
  min-width: 195px;
  flex: 0 0 195px;
  cursor: pointer;
  overflow: hidden;
  border-radius: 16px; /* rounded-2xl */
  background: #0f1015;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 24px -4px rgba(0, 0, 0, 0.6);
  transition: border-color 0.3s ease-out, box-shadow 0.3s ease-out;
  user-select: none;
  scroll-snap-align: start;
}

@media (min-width: 1440px) {
  .cards-carousel .media-card {
    width: 205px;
    min-width: 205px;
    flex: 0 0 205px;
  }
}

@media (min-width: 768px) and (max-width: 1039px) {
  .cards-carousel .media-card {
    width: 175px;
    min-width: 175px;
    flex: 0 0 175px;
  }
}

@media (max-width: 767px) {
  .cards-carousel .media-card {
    width: 148px;
    min-width: 148px;
    flex: 0 0 148px;
    border-radius: 14px;
  }
}

.media-card:hover {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 24px 48px -8px rgba(0, 0, 0, 0.85), 0 0 30px rgba(56, 189, 248, 0.14);
}

/* 1. Poster Image Layer (Micro-Zoom) */
.media-card .poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.media-card:hover .poster-img {
  transform: scale(1.08);
}

/* 2. Scrim Gradient Overlay */
.media-card .scrim-overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #0a0b0e 0%, rgba(0, 0, 0, 0.45) 55%, transparent 100%);
  opacity: 0.85;
  transition: opacity 0.3s ease-out;
  z-index: 2;
}

.media-card:hover .scrim-overlay {
  opacity: 0.95;
}

/* 3. Floating Glass Badges (Top Bar) */
.media-card .card-glass-badges {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 600;
  z-index: 10;
  pointer-events: none;
}

.media-card .badge-quality {
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.15);
  padding: 0.15rem 0.5rem;
  color: #ffffff;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.04em;
  font-size: 0.7rem;
  font-weight: 700;
}

.media-card .badge-rating {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  padding: 0.15rem 0.5rem;
  color: #fbbf24;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  font-size: 0.7rem;
  font-weight: 700;
}

.media-card .badge-rating svg {
  width: 11px;
  height: 11px;
  fill: currentColor;
}

/* 4. Centered Hover Action Trigger */
.media-card .card-play-action {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 12;
}

.media-card:hover .card-play-action {
  opacity: 1;
}

.media-card .play-btn-circle {
  display: flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #ffffff;
  color: #0a0b0e;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 255, 255, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.media-card:hover .play-btn-circle {
  transform: scale(1.1);
}

.media-card .play-svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  transform: translateX(1.5px);
}

/* 5. Bottom Metadata (Translates upward on hover) */
.media-card .card-metadata {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.85rem;
  z-index: 10;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.media-card:hover .card-metadata {
  transform: translateY(-4px);
}

.media-card .card-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.015em;
  margin-bottom: 0.2rem;
  transition: color 0.2s ease-out;
}

.media-card:hover .card-title {
  color: var(--accent-cyan);
}

.media-card .card-sub {
  margin-top: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.74rem;
  font-weight: 500;
  color: #9ca3af;
}

.media-card .card-sub span.dot {
  color: #4b5563;
  font-size: 0.65rem;
}

/* ==========================================================================
   Top 10 Ranked Rail (Oversized background numerals 1-10)
   ========================================================================== */
.ranked-card-wrap {
  position: relative;
  display: flex;
  align-items: flex-end;
  flex: 0 0 auto;
  scroll-snap-align: start;
  padding-left: 28px;
}

.rank-number {
  position: relative;
  font-size: clamp(5.5rem, 8vw, 7.8rem);
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 0.72;
  margin-right: -24px;
  margin-bottom: 12px;
  z-index: 3;
  user-select: none;
  pointer-events: none;
  color: #0b0d13;
  -webkit-text-stroke: 3px rgba(255, 255, 255, 0.35);
  text-shadow: 0 10px 25px rgba(0, 0, 0, 0.9);
  transition: transform 0.3s ease, -webkit-text-stroke-color 0.3s ease;
}

.ranked-card-wrap:hover .rank-number {
  -webkit-text-stroke-color: var(--accent-cyan);
  transform: translateX(-4px) scale(1.03);
}

@media (max-width: 768px) {
  .ranked-card-wrap {
    padding-left: 18px;
  }
  .rank-number {
    font-size: 4.8rem;
    margin-right: -18px;
    margin-bottom: 8px;
  }
}

/* Grid Layout for Movies, Series, Library, Search */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 205px));
  gap: 1.35rem;
  justify-content: start;
}

.media-grid .media-card {
  width: 100%;
  min-width: 0;
  flex: none;
}

@media (max-width: 640px) {
  .media-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
  }
}

/* ==========================================================================
   DESKTOP CINEMATIC METAMODAL / DETAIL SCREEN (ENHANCED FOR COMPUTERS)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.88);
  backdrop-filter: blur(28px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Large, Ultra-Sleek Desktop Modal Shell */
.detail-modal {
  position: relative;
  width: 100%;
  max-width: 1140px;
  max-height: 92vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.9), 0 0 40px rgba(56, 189, 248, 0.15);
  transform: translateY(20px) scale(0.97);
  transition: all var(--transition-smooth);
}

.modal-overlay.active .detail-modal {
  transform: translateY(0) scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(10, 20, 42, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-medium);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 25;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: var(--accent-cyan);
  color: #030712;
  transform: scale(1.1);
  box-shadow: 0 0 15px var(--accent-cyan-glow);
}

/* Panoramic Backdrop Header */
.detail-backdrop-header {
  position: relative;
  width: 100%;
  height: 320px;
  overflow: hidden;
}

.detail-backdrop-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  filter: blur(2px) brightness(0.65);
}

.detail-backdrop-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, var(--bg-surface) 0%, rgba(10, 20, 42, 0.5) 60%, transparent 100%),
              linear-gradient(90deg, var(--bg-surface) 0%, transparent 40%, transparent 60%, var(--bg-surface) 100%);
}

/* Desktop Split Layout Body */
.detail-body {
  position: relative;
  margin-top: -100px;
  padding: 0 3rem 3rem;
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 3rem;
  z-index: 10;
}

/* Left Column: Poster & Direct Play Actions */
.detail-poster-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.detail-poster-img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.8), 0 0 25px rgba(56, 189, 248, 0.2);
}

.detail-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Prominent Primary Watch Button */
.btn-detail-play {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  height: 50px;
  background: var(--grad-primary);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 25px var(--accent-cyan-glow);
  transition: all var(--transition-fast);
}

.btn-detail-play:hover {
  background: var(--grad-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.5);
}

.btn-watchlist {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 44px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-watchlist:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent-cyan);
}

.btn-watchlist.in-watchlist {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Right Column: Metadata, Streams & Episodes */
.detail-info-col {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.detail-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.2vw, 2.8rem);
  font-weight: 800;
  line-height: 1.15;
  color: #fff;
}

.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.genres-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.genre-tag {
  padding: 0.25rem 0.75rem;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: var(--accent-cyan);
  font-weight: 500;
}

.detail-synopsis {
  font-size: 0.96rem;
  line-height: 1.65;
  color: var(--text-muted);
}

/* Cast Avatars */
.cast-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.cast-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
  letter-spacing: 0.05em;
}

.cast-row {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.cast-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.85rem 0.35rem 0.35rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  white-space: nowrap;
}

.cast-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-card);
}

/* Series: Seasons & Episodes */
.series-section {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.season-selector {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.season-btn {
  padding: 0.5rem 1.15rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.season-btn.active {
  background: var(--grad-primary);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-cyan-glow);
}

.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.85rem;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.episode-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.episode-card:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent-cyan);
  transform: translateX(4px);
}

.episode-card.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent-cyan);
}

.episode-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Streams Section */
.streams-section {
  margin-top: 1rem;
  background: rgba(6, 13, 30, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.streams-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.streams-title {
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
}

.streams-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.stream-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.stream-item:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent-cyan);
  transform: translateX(3px);
}

.stream-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.stream-res-badge {
  padding: 0.22rem 0.55rem;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
}

.stream-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.stream-play-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* ==========================================================================
   Cinema Video Player (Full Viewport Theater Mode)
   ========================================================================== */
.player-container {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal);
}

.player-container.active {
  opacity: 1;
  visibility: visible;
}

.main-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  z-index: 4;
}

/* Sandboxed Cinema Iframe Player (Zero redirect, cropped header/footer) */
.cinema-iframe-wrapper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #030712;
  z-index: 2;
}

.cinema-iframe {
  position: absolute;
  top: -65px;
  left: 0;
  width: 100%;
  height: calc(100% + 140px);
  border: none;
  background: #030712;
}

@media (max-width: 768px) {
  .cinema-iframe {
    top: -55px;
    height: calc(100% + 120px);
  }
}

::cue {
  background-color: rgba(3, 7, 18, 0.85);
  color: #fff;
  font-family: var(--font-body);
  font-size: 1.2rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
  line-height: 1.4;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
}

.player-controls-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, transparent 22%, transparent 70%, rgba(0,0,0,0.95) 100%);
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 20;
}

.player-controls-overlay.cloud-mode {
  background: transparent;
}

.player-top-bar,
.player-bottom-bar,
.player-center-action {
  pointer-events: auto;
}

.player-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 50;
  background: linear-gradient(180deg, rgba(3, 7, 18, 0.95) 0%, rgba(3, 7, 18, 0.7) 80%, transparent 100%);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
}

.player-server-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.server-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  background: rgba(10, 20, 42, 0.85);
  border: 1px solid var(--border-medium);
  backdrop-filter: blur(10px);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.server-pill:hover,
.server-pill.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan-glow);
}

.player-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 42px;
  padding: 0 1.15rem;
  background: rgba(10, 20, 42, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.player-back-btn:hover {
  background: var(--accent-cyan);
  color: #030712;
  transform: translateX(-3px);
}

.player-title-display {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}

.player-center-action {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 0 30px var(--accent-cyan-glow);
  transition: transform var(--transition-fast);
}

.player-center-action:hover {
  transform: translate(-50%, -50%) scale(1.1);
}

.player-bottom-bar {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  width: 100%;
}

.timeline-container {
  position: relative;
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  cursor: pointer;
  transition: height var(--transition-fast);
}

.timeline-container:hover {
  height: 12px;
}

.timeline-buffered {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  width: 0%;
  pointer-events: none;
}

.timeline-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--grad-primary);
  border-radius: 4px;
  width: 0%;
  pointer-events: none;
}

.timeline-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px var(--accent-cyan-glow);
  left: 0%;
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.timeline-container:hover .timeline-thumb {
  opacity: 1;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 1.15rem;
}

.ctrl-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.ctrl-btn:hover {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
}

.time-display {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.volume-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.volume-slider {
  width: 85px;
  height: 4px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.menu-popup {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 170px;
  max-height: 250px;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  display: none;
  z-index: 50;
}

.menu-popup.active {
  display: flex;
}

.menu-item {
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.84rem;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.menu-item:hover, .menu-item.active {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Modals & Dialogs */
.dialog-box {
  width: 100%;
  max-width: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dialog-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
}

.app-download-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.app-card {
  padding: 1.35rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.app-card:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: var(--accent-cyan);
  transform: translateY(-3px);
}

.app-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
}

.app-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.app-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.toast-msg {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.85rem 1.35rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  z-index: 300;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 950px) {
  .detail-body {
    grid-template-columns: 1fr;
    margin-top: -60px;
    padding: 0 1.75rem 2rem;
  }
  .detail-poster-col {
    max-width: 200px;
  }
  .hero-content {
    left: 1.75rem;
    bottom: 1.75rem;
    right: 1.75rem;
  }
}

@media (max-width: 680px) {
  :root {
    --sidebar-width: 0px;
    --topbar-height: 60px;
  }
  .nav-sidebar {
    width: 100%;
    height: 58px;
    top: auto;
    bottom: 0;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--border-subtle);
    padding: 0 1rem;
    justify-content: space-around;
  }
  .brand-icon-wrap, .nav-footer {
    display: none;
  }
  .nav-menu {
    flex-direction: row;
    justify-content: space-around;
  }
  .main-wrapper {
    margin-left: 0;
    padding-bottom: 60px;
  }
  .top-bar {
    padding: 0 1rem;
  }
  .views-container {
    padding: 1rem 1rem 3rem;
  }
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 0.9rem;
  }
  .hero-banner {
    height: 380px;
  }
}
