/* ==========================================================================
   MovieBox Web - Netflix-Style Modern UI with Transparent Player & 9 Themes
   Zero Cloudflare Pages Worker Cost - Optimized CSS
   ========================================================================== */

:root {
  /* Default Theme: MovieBox Cyan (matches MovieBox-TUI default) */
  --bg-primary: #0a0d14;
  --bg-secondary: #101622;
  --bg-tertiary: #172133;
  --bg-elevated: #1e293b;
  --bg-glass: rgba(16, 22, 34, 0.75);
  --bg-glass-card: rgba(23, 33, 51, 0.65);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.35);

  --accent-primary: #0ea5e9;
  --accent-glow: rgba(14, 165, 233, 0.4);
  --accent-secondary: #38bdf8;
  --accent-gradient: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  --accent-text: #0ea5e9;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --shadow-hud: 0 20px 40px rgba(0, 0, 0, 0.65);
}

/* Theme 2: Netflix Red */
[data-theme="netflix-red"] {
  --bg-primary: #141414;
  --bg-secondary: #181818;
  --bg-tertiary: #232323;
  --bg-elevated: #2f2f2f;
  --bg-glass: rgba(20, 20, 20, 0.8);
  --bg-glass-card: rgba(35, 35, 35, 0.7);
  --border-glow: rgba(229, 9, 20, 0.4);
  --accent-primary: #e50914;
  --accent-glow: rgba(229, 9, 20, 0.45);
  --accent-secondary: #f40612;
  --accent-gradient: linear-gradient(135deg, #b81d24 0%, #e50914 100%);
  --accent-text: #e50914;
}

/* Theme 3: Midnight Blue */
[data-theme="midnight-blue"] {
  --bg-primary: #060913;
  --bg-secondary: #0d1322;
  --bg-tertiary: #131c33;
  --bg-elevated: #1a2542;
  --accent-primary: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.4);
  --accent-gradient: linear-gradient(135deg, #1d4ed8 0%, #60a5fa 100%);
  --accent-text: #60a5fa;
}

/* Theme 4: Dracula Purple */
[data-theme="dracula"] {
  --bg-primary: #181622;
  --bg-secondary: #211d30;
  --bg-tertiary: #2a253c;
  --bg-elevated: #362f4c;
  --accent-primary: #bd93f9;
  --accent-glow: rgba(189, 147, 249, 0.4);
  --accent-gradient: linear-gradient(135deg, #ff79c6 0%, #bd93f9 100%);
  --accent-text: #bd93f9;
}

/* Theme 5: Nord Frost */
[data-theme="nord"] {
  --bg-primary: #1e222a;
  --bg-secondary: #242933;
  --bg-tertiary: #2e3440;
  --bg-elevated: #3b4252;
  --accent-primary: #88c0d0;
  --accent-glow: rgba(136, 192, 208, 0.4);
  --accent-gradient: linear-gradient(135deg, #81a1c1 0%, #88c0d0 100%);
  --accent-text: #88c0d0;
}

/* Theme 6: Cyberpunk Neon Green */
[data-theme="cyberpunk"] {
  --bg-primary: #050a06;
  --bg-secondary: #0c160e;
  --bg-tertiary: #132216;
  --bg-elevated: #1b301f;
  --accent-primary: #00ff88;
  --accent-glow: rgba(0, 255, 136, 0.4);
  --accent-gradient: linear-gradient(135deg, #059669 0%, #00ff88 100%);
  --accent-text: #00ff88;
}

/* Theme 7: Sunset Orange */
[data-theme="sunset-orange"] {
  --bg-primary: #140d0a;
  --bg-secondary: #1c1410;
  --bg-tertiary: #281d17;
  --bg-elevated: #362720;
  --accent-primary: #f97316;
  --accent-glow: rgba(249, 115, 22, 0.4);
  --accent-gradient: linear-gradient(135deg, #ea580c 0%, #fb923c 100%);
  --accent-text: #fb923c;
}

/* Theme 8: Tokyo Night */
[data-theme="tokyo-night"] {
  --bg-primary: #13141f;
  --bg-secondary: #1a1b26;
  --bg-tertiary: #24283b;
  --bg-elevated: #2f354f;
  --accent-primary: #7aa2f7;
  --accent-glow: rgba(122, 162, 247, 0.4);
  --accent-gradient: linear-gradient(135deg, #bb9af7 0%, #7aa2f7 100%);
  --accent-text: #7aa2f7;
}

/* Theme 9: Monokai Gold */
[data-theme="monokai"] {
  --bg-primary: #19181a;
  --bg-secondary: #221f22;
  --bg-tertiary: #2d2a2e;
  --bg-elevated: #3a363b;
  --accent-primary: #ffd866;
  --accent-glow: rgba(255, 216, 102, 0.4);
  --accent-gradient: linear-gradient(135deg, #ff6188 0%, #ffd866 100%);
  --accent-text: #ffd866;
}

/* Reset & Global */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* Header & Navigation Bar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  z-index: 100;
  background: linear-gradient(180deg, rgba(10, 13, 20, 0.95) 0%, rgba(10, 13, 20, 0.75) 60%, transparent 100%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.navbar.scrolled {
  background: var(--bg-primary);
  border-bottom-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--accent-glow);
  color: #fff;
  font-weight: 900;
  font-size: 20px;
}

.brand-text {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(180deg, #ffffff 40%, var(--accent-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-glow);
  color: var(--accent-text);
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}

.nav-link {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link:hover {
  color: #fff;
  background: var(--bg-glass-card);
}

.nav-link.active {
  color: #fff;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 0 12px var(--accent-glow);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Provider Switcher Badge */
.provider-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.provider-badge:hover {
  background: var(--accent-glow);
  color: #fff;
  transform: translateY(-1px);
}

.provider-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
}

/* Search Bar in Header */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 240px;
  height: 38px;
  padding: 0 36px 0 38px;
  background: var(--bg-glass-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: #fff;
  font-family: var(--font-main);
  font-size: 13px;
  outline: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-input:focus {
  width: 320px;
  border-color: var(--accent-primary);
  box-shadow: 0 0 16px var(--accent-glow);
  background: var(--bg-tertiary);
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-shortcut {
  position: absolute;
  right: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 5px;
  background: var(--bg-elevated);
  border-radius: 4px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Action Icon Buttons */
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-glass-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.icon-btn:hover {
  color: #fff;
  background: var(--bg-tertiary);
  border-color: var(--border-glow);
  transform: translateY(-1px);
}

.badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--accent-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ==========================================================================
   Hero Featured Section (Netflix-Style)
   ========================================================================== */
.hero-section {
  position: relative;
  height: 82vh;
  min-height: 580px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  padding: 0 60px 100px 60px;
  overflow: hidden;
}

.hero-backdrop-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.hero-backdrop-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  filter: brightness(0.65) contrast(1.1);
  transform: scale(1.02);
  transition: transform 10s ease;
}

.hero-gradient-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(180deg, rgba(10, 13, 20, 0.4) 0%, transparent 40%),
    linear-gradient(90deg, rgba(10, 13, 20, 0.95) 0%, rgba(10, 13, 20, 0.7) 45%, transparent 75%),
    linear-gradient(0deg, var(--bg-primary) 0%, rgba(10, 13, 20, 0.8) 25%, transparent 60%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 680px;
}

.hero-badge-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.hero-provider-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  color: #fff;
  letter-spacing: 0.5px;
  box-shadow: 0 0 14px var(--accent-glow);
}

.hero-rating {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #facc15;
  font-weight: 700;
  font-size: 13px;
}

.hero-quality {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  color: #e2e8f0;
}

.hero-title {
  font-size: 54px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 14px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.hero-overview {
  font-size: 16px;
  line-height: 1.6;
  color: #cbd5e1;
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.hero-buttons {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn-primary {
  padding: 14px 28px;
  border-radius: var(--radius-md);
  background: #ffffff;
  color: #000000;
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.25);
}

.btn-primary:hover {
  background: var(--accent-secondary);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 10px 30px var(--accent-glow);
}

.btn-secondary {
  padding: 14px 24px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.btn-icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon-circle:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: var(--accent-primary);
  color: var(--accent-secondary);
  transform: scale(1.08);
}

.btn-icon-circle.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
}

/* ==========================================================================
   Content Sections & Netflix Carousels
   ========================================================================== */
.main-content {
  position: relative;
  z-index: 3;
  margin-top: -60px;
  padding: 0 48px 80px 48px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.section-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.section-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-pill {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-glow);
  color: var(--accent-text);
  border-radius: var(--radius-sm);
}

.carousel-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.carousel-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-glass-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.carousel-btn:hover {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Horizontal Scroll Carousel */
.media-carousel {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 10px 4px 18px 4px;
}

.media-carousel::-webkit-scrollbar {
  height: 4px;
}
.media-carousel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

/* Card Styles */
.media-card {
  flex: 0 0 190px;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.media-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.8), 0 0 20px var(--accent-glow);
  border-color: var(--accent-primary);
  z-index: 10;
}

.card-poster-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: #111;
}

.card-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

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

.card-overlay-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  transform: translateX(6px);
  transition: all 0.2s ease;
}

.media-card:hover .card-overlay-actions {
  opacity: 1;
  transform: translateX(0);
}

.card-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(10, 13, 20, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.card-action-btn:hover {
  background: var(--accent-primary);
  transform: scale(1.1);
}

.card-action-btn.liked {
  color: var(--danger);
  border-color: var(--danger);
}

.card-badge-type {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Card Progress Bar for History */
.card-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
}

.card-progress-fill {
  height: 100%;
  background: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
}

.card-meta {
  padding: 10px 12px 12px 12px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.card-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
}

/* TV Channel Cards */
.tv-card {
  flex: 0 0 240px;
  background: var(--bg-glass-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tv-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
  background: var(--bg-tertiary);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5), 0 0 14px var(--accent-glow);
}

.tv-logo-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tv-logo-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.tv-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.tv-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-group {
  font-size: 11px;
  color: var(--text-muted);
}

.tv-live-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--danger);
  font-weight: 700;
  font-family: var(--font-mono);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* ==========================================================================
   IN-APP NETFLIX-STYLE VIDEO PLAYER (Multi-Size, Transparent HUD, Gestures)
   ========================================================================== */
.player-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(16px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.player-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Player Container & Size Modes */
.player-container {
  position: relative;
  width: 90vw;
  max-width: 1200px;
  aspect-ratio: 16 / 9;
  background: #000000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 30px var(--accent-glow);
  border: 1px solid var(--border-glow);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Size: Theater Mode */
.player-container.size-theater {
  width: 98vw;
  max-width: 100%;
  height: 92vh;
  aspect-ratio: auto;
  border-radius: var(--radius-md);
}

/* Size: Mini / Picture-in-Picture */
.player-container.size-pip {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: 90vw;
  aspect-ratio: 16 / 9;
  z-index: 1001;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 20px var(--accent-glow);
}

/* Size: Fullscreen */
.player-container.size-fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  border-radius: 0;
  border: none;
}

/* Video Frame & HTML5 Player */
.video-surface-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

.native-video-elem {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.iframe-video-elem {
  width: 100%;
  height: 100%;
  border: none;
}

/* Aspect Ratio Modifiers */
.player-container.ratio-21-9 .native-video-elem {
  aspect-ratio: 21 / 9;
  object-fit: cover;
}
.player-container.ratio-4-3 .native-video-elem {
  aspect-ratio: 4 / 3;
}
.player-container.ratio-cover .native-video-elem {
  object-fit: cover;
}

/* ==========================================================================
   TRANSPARENT HUD & GESTURE SYSTEM
   ========================================================================== */
.player-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 32px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, transparent 25%, transparent 70%, rgba(0, 0, 0, 0.9) 100%);
  opacity: 1;
  transition: opacity 0.3s ease;
  z-index: 20;
}

.player-hud.idle {
  opacity: 0;
}

.player-hud * {
  pointer-events: auto;
}

/* HUD Top Header */
.hud-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hud-title-box {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hud-back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-back-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.hud-meta-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-main-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.hud-sub-info {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Glass Buttons on HUD */
.hud-pill-btn {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.hud-pill-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* 2x Speed Hold Indicator Badge */
.speed-hold-badge {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  background: rgba(14, 165, 233, 0.85);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 25px var(--accent-glow);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 30;
}

.speed-hold-badge.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Double-Tap Gesture Zones (Left/Right) */
.gesture-zone {
  position: absolute;
  top: 15%;
  height: 70%;
  width: 35%;
  z-index: 10;
  pointer-events: auto;
  cursor: pointer;
}

.gesture-zone.left {
  left: 0;
}

.gesture-zone.right {
  right: 0;
}

/* Double-Tap Animated Ripple Bubble */
.double-tap-bubble {
  position: absolute;
  top: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  border: 2px solid var(--accent-primary);
  color: #fff;
  transform: translateY(-50%) scale(0.6);
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 0 30px var(--accent-glow);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 25;
}

.double-tap-bubble.left {
  left: 12%;
}

.double-tap-bubble.right {
  right: 12%;
}

.double-tap-bubble.animate {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}

.double-tap-bubble span {
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font-mono);
  margin-top: 4px;
}

/* HUD Bottom Bar (Timeline & Controls) */
.hud-bottom-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Custom Seekbar */
.seekbar-wrapper {
  position: relative;
  width: 100%;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.seekbar-track {
  position: relative;
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  transition: height 0.2s ease;
}

.seekbar-wrapper:hover .seekbar-track {
  height: 8px;
}

.seekbar-buffer {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  width: 0%;
}

.seekbar-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--accent-primary);
  border-radius: 3px;
  width: 0%;
  box-shadow: 0 0 10px var(--accent-primary);
}

.seekbar-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%) scale(0);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
  transition: transform 0.2s ease;
}

.seekbar-wrapper:hover .seekbar-thumb {
  transform: translate(-50%, -50%) scale(1);
}

/* Seekbar Tooltip */
.seekbar-tooltip {
  position: absolute;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.seekbar-wrapper:hover .seekbar-tooltip {
  opacity: 1;
}

/* HUD Controls Row */
.hud-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hud-controls-left, .hud-controls-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.play-pause-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  color: #000000;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.4);
}

.play-pause-btn:hover {
  background: var(--accent-secondary);
  color: #fff;
  transform: scale(1.08);
  box-shadow: 0 0 20px var(--accent-glow);
}

.time-display {
  font-family: var(--font-mono);
  font-size: 13px;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Volume Slider in HUD */
.volume-control-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-slider {
  width: 75px;
  height: 4px;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

/* Server Selector Dropdown on Player HUD */
.server-select-pill {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.server-select-pill option {
  background: #141824;
  color: #fff;
}

/* ==========================================================================
   EPISODE DRAWER (In-Player Sidebar)
   ========================================================================== */
.episode-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: 340px;
  height: 100%;
  background: rgba(10, 13, 20, 0.95);
  backdrop-filter: blur(18px);
  border-left: 1px solid var(--border-glow);
  z-index: 40;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.episode-drawer.open {
  transform: translateX(0);
}

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

.drawer-title {
  font-size: 16px;
  font-weight: 700;
}

.drawer-episodes-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-ep-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-glass-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.drawer-ep-item:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
}

.drawer-ep-item.active {
  background: var(--accent-glow);
  border-color: var(--accent-primary);
  color: #fff;
}

/* ==========================================================================
   MOVIEBOX-TUI TERMINAL SLASH COMMAND HUD (/browse, /history, /favorites, etc.)
   ========================================================================== */
.terminal-hud-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(14px);
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
}

.terminal-hud-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.terminal-box {
  width: 640px;
  max-width: 92vw;
  background: #0d1117;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.9), 0 0 40px var(--accent-glow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.terminal-header {
  height: 38px;
  background: #161b22;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.terminal-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.terminal-title {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.terminal-prompt {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-primary);
}

.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 16px;
  outline: none;
}

.terminal-suggestions-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.terminal-cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-mono);
}

.terminal-cmd-item:hover, .terminal-cmd-item.selected {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-glow);
}

.cmd-name {
  font-weight: 700;
  color: var(--accent-text);
  font-size: 13px;
}

.cmd-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   MODALS (Details, Settings, Download, Help)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 720px;
  max-width: 95vw;
  max-height: 90vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.9);
  overflow-y: auto;
  padding: 32px;
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: var(--danger);
  transform: scale(1.1);
}

/* Details Modal Banner */
.details-hero {
  position: relative;
  width: 100%;
  height: 280px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 24px;
}

.details-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.details-hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(0deg, var(--bg-secondary) 0%, transparent 80%);
}

/* Download Code Blocks */
.code-box {
  background: #090d16;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  word-break: break-all;
  margin-top: 6px;
}

.copy-btn {
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-glow);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.copy-btn:hover {
  background: var(--accent-primary);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 28px;
  left: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 3000;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: rgba(16, 22, 34, 0.95);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-glow);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  animation: slideIn 0.3s ease forwards;
}

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

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .navbar { padding: 0 20px; }
  .nav-links { display: none; }
  .hero-section { padding: 0 24px 60px 24px; height: 75vh; }
  .hero-title { font-size: 36px; }
  .main-content { padding: 0 20px 60px 20px; margin-top: -30px; }
  .media-card { flex: 0 0 150px; }
  .player-container { width: 96vw; }
}

@media (max-width: 600px) {
  .search-input { width: 140px; }
  .search-input:focus { width: 200px; }
  .hero-title { font-size: 28px; }
  .hero-buttons { gap: 8px; }
  .btn-primary, .btn-secondary { padding: 10px 18px; font-size: 13px; }
  .media-card { flex: 0 0 130px; }
}
