/* Dorflix - Netflix Clone Theme Styles */
:root {
  --netflix-red: #E50914;
  --netflix-red-hover: #F6121D;
  --netflix-dark-red: #B81D24;
  --bg-black: #141414;
  --bg-card: #181818;
  --bg-card-hover: #282828;
  --text-primary: #FFFFFF;
  --text-secondary: #AAAAAA;
  --text-muted: #777777;
  --border-color: #333333;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --header-height: 72px;
  --mobile-nav-height: 60px;
}

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

body {
  background-color: var(--bg-black);
  color: var(--text-primary);
  font-family: var(--font-family);
  overflow-x: hidden;
  padding-bottom: var(--mobile-nav-height);
}

/* Pins the page in place while a modal/player overlay is open — prevents
   the classic iOS Safari bug where touches "leak through" a full-screen
   overlay and scroll the covered page underneath it. */
body.scroll-locked {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}

@media (min-width: 769px) {
  body {
    padding-bottom: 0;
  }
}

/* Header & Navigation Bar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4%;
  z-index: 1000;
  background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
  transition: background-color 0.4s ease;
}

.navbar.scrolled {
  background-color: #141414;
  box-shadow: 0 4px 20px rgba(0,0,0,0.7);
}

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

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

.brand-logo img {
  height: 40px;
  width: auto;
  /* dorflix.png is now a transparent PNG with the red wordmark only. */
  transition: transform 0.2s ease;
}

.brand-logo:hover img {
  transform: scale(1.04);
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 20px;
}

.nav-item {
  color: #E5E5E5;
  font-size: 0.95rem;
  font-weight: 400;
  cursor: pointer;
  transition: color 0.2s ease;
}

.nav-item:hover, .nav-item.active {
  color: #FFFFFF;
  font-weight: 700;
}

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

/* Search Box */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 12px 8px 36px;
  border-radius: 4px;
  font-size: 0.9rem;
  outline: none;
  width: 220px;
  transition: all 0.3s ease;
}

.search-input:focus {
  background: rgba(0, 0, 0, 0.95);
  border-color: #FFFFFF;
  width: 280px;
  box-shadow: 0 0 10px rgba(255,255,255,0.2);
}

.search-icon {
  position: absolute;
  left: 10px;
  color: #AAAAAA;
  pointer-events: none;
  width: 18px;
  height: 18px;
}

.btn-settings {
  background: transparent;
  border: none;
  color: #FFFFFF;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.btn-settings:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Hero Section */
.hero {
  position: relative;
  height: 75vh;
  min-height: 480px;
  display: flex;
  align-items: flex-end;
  padding: 0 4% 80px 4%;
  background-size: cover;
  background-position: center top;
  margin-bottom: -60px;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20,20,20,0.2) 0%, rgba(20,20,20,0.6) 60%, rgba(20,20,20,1) 100%),
              linear-gradient(90deg, rgba(20,20,20,0.8) 0%, rgba(20,20,20,0) 60%);
  pointer-events: none;
}

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

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(229, 9, 20, 0.85);
  color: white;
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1.05;
  margin-bottom: 16px;
  text-shadow: 2px 2px 10px rgba(0,0,0,0.8);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.tag-match {
  color: #46d369;
  font-weight: 700;
}

.tag-quality {
  border: 1px solid rgba(255,255,255,0.4);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.75rem;
}

.hero-desc {
  font-size: 1.1rem;
  line-height: 1.5;
  color: #E5E5E5;
  margin-bottom: 24px;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.8);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 26px;
  border-radius: 4px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: #FFFFFF;
  color: #000000;
}

.btn-primary:hover {
  background-color: rgba(255, 255, 255, 0.75);
}

.btn-secondary {
  background-color: rgba(109, 109, 110, 0.7);
  color: #FFFFFF;
}

.btn-secondary:hover {
  background-color: rgba(109, 109, 110, 0.4);
}

.btn-accent {
  background-color: var(--netflix-red);
  color: #FFFFFF;
}

.btn-accent:hover {
  background-color: var(--netflix-red-hover);
}

.btn-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.btn-zip {
  padding: 8px 14px;
  font-size: 0.82rem;
  gap: 6px;
}
.btn-zip .btn-icon {
  width: 15px;
  height: 15px;
}

/* Rows & Carousels */
.main-container {
  position: relative;
  z-index: 5;
  padding: 0 4% 60px 4%;
}

.category-row {
  margin-bottom: 40px;
}

.row-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #E5E5E5;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.row-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

.carousel-container {
  position: relative;
}

.carousel-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 10px 0;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

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

/* Media Cards */
.media-card {
  flex: 0 0 calc(20% - 10px);
  min-width: 180px;
  max-width: 260px;
  background-color: var(--bg-card);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.media-card:hover {
  transform: scale(1.08) translateY(-5px);
  z-index: 10;
  box-shadow: 0 10px 25px rgba(0,0,0,0.8);
}

.card-poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  background: linear-gradient(135deg, #1f1f1f 0%, #0d0d0d 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  position: relative;
}

.poster-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.type-badge {
  background: rgba(0, 0, 0, 0.75);
  color: var(--netflix-red);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid var(--netflix-red);
  text-transform: uppercase;
}

.poster-footer {
  margin-top: auto;
}

.poster-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: white;
  text-shadow: 1px 2px 6px rgba(0,0,0,0.9);
  line-height: 1.2;
}

.card-info {
  padding: 12px;
  background-color: var(--bg-card);
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn-mini {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.btn-mini:hover {
  background: white;
  color: black;
  transform: scale(1.1);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 20px;
}

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

.modal-container {
  background: #181818;
  width: 100%;
  max-width: 850px;
  max-height: 90vh;
  border-radius: 8px;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 10px 40px rgba(0,0,0,0.9);
  border: 1px solid #2a2a2a;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #181818;
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.modal-close:hover {
  background: #333333;
}

.modal-header-banner {
  height: 320px;
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 30px;
  overflow: hidden;
}

.modal-header-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(24,24,24,0) 0%, rgba(24,24,24,1) 100%);
}

/* Desktop-only silent preview clip — fades in over the static backdrop once
   it's actually playable, sitting behind the gradient/title (::after, z-index:2). */
.banner-preview-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.9s ease;
  pointer-events: none;
}
.banner-preview-video.loaded { opacity: 1; }

.modal-banner-content {
  position: relative;
  z-index: 2;
}

.modal-title {
  font-size: 2.4rem;
  font-weight: 900;
  margin-bottom: 12px;
}

.modal-body {
  padding: 30px;
}

/* Episodes Selector */
.season-selector {
  margin: 20px 0 15px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.season-select {
  background: #242424;
  color: white;
  border: 1px solid #444;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 1rem;
  outline: none;
  cursor: pointer;
}

.episodes-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.episode-card {
  background: #222222;
  border-radius: 6px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.2s ease;
}

.episode-card:hover {
  background: #333333;
}

.episode-num {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-muted);
  width: 40px;
}

.episode-info {
  flex: 1;
  padding: 0 15px;
}

.episode-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.episode-size {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Video Player Modal */
.video-modal-container {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  background: black;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}

video.full-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
  outline: none;
}

/* GUI Configuration Settings Modal */
.settings-section {
  background: #202020;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid #2e2e2e;
}

.settings-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.85rem;
  color: #AAA;
  font-weight: 600;
}

.form-input {
  background: #141414;
  border: 1px solid #444;
  color: white;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 0.95rem;
  outline: none;
}

.form-input:focus {
  border-color: var(--netflix-red);
}

.folder-list {
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.folder-item {
  background: #141414;
  padding: 12px 16px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #333;
}

.folder-path {
  font-family: monospace;
  font-size: 0.9rem;
  color: #DDD;
  word-break: break-all;
}

.btn-delete-folder {
  background: rgba(229, 9, 20, 0.2);
  color: var(--netflix-red);
  border: 1px solid var(--netflix-red);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-delete-folder:hover {
  background: var(--netflix-red);
  color: white;
}

.add-folder-form {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.add-folder-input {
  flex: 1;
  background: #141414;
  border: 1px solid #444;
  color: white;
  padding: 10px 14px;
  border-radius: 4px;
  outline: none;
}

.add-folder-input:focus {
  border-color: var(--netflix-red);
}

/* Mobile Bottom Navigation Bar (iPhone) — floating pill, Netflix-app style */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(40, 40, 40, 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 8px 10px;
  gap: 6px;
  align-items: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #b3b3b3;
  font-size: 0.66rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  padding: 6px 16px;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}

.mobile-nav-item.active {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.16);
}

.mobile-nav-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* Poster artwork on cards */
.poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.poster-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
}

.media-card.has-art .card-poster {
  padding: 0;
}

.card-title-sm {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-genres {
  color: var(--text-secondary);
}

/* Loading state */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 100px 20px;
  color: var(--text-secondary);
}

.spinner {
  width: 46px;
  height: 46px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--netflix-red);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.enrich-progress {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 1500;
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid #333;
  color: #eee;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.6);
}

@media (max-width: 768px) {
  .enrich-progress {
    bottom: calc(var(--mobile-nav-height) + 12px);
  }
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

/* Metadata prompt banner */
.metadata-banner {
  background: linear-gradient(90deg, rgba(229,9,20,0.18), rgba(229,9,20,0.04));
  border: 1px solid rgba(229, 9, 20, 0.4);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 28px;
  font-size: 0.92rem;
  color: #eee;
}

/* Overview + chips in details modal */
.modal-overview {
  color: #cfcfcf;
  line-height: 1.6;
  font-size: 1rem;
  margin: 4px 0 20px 0;
  max-width: 720px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 20px 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid #3a3a3a;
  background: #242424;
  color: #ddd;
}

.chip:hover {
  border-color: var(--netflix-red);
  color: #fff;
  background: #2e2e2e;
}

.chip-person:hover {
  background: rgba(229, 9, 20, 0.2);
}

/* Cast row */
.section-heading {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 24px 0 14px 0;
}

.section-hint {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

.cast-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: thin;
}

.cast-card {
  flex: 0 0 100px;
  width: 100px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease;
}

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

.cast-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  background: #2a2a2a;
  margin-bottom: 8px;
  border: 2px solid transparent;
  transition: border-color 0.15s ease;
}

.cast-card:hover .cast-photo {
  border-color: var(--netflix-red);
}

.cast-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cast-noimg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: #666;
  background: #232323;
}

.cast-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.cast-char {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Browse-by-person / genre view */
.browse-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 26px;
}

.browse-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--netflix-red);
}

.browse-avatar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  background: #242424;
}

.browse-kind {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.72rem;
  color: var(--netflix-red);
  font-weight: 800;
}

.browse-title {
  font-size: 2rem;
  font-weight: 900;
  margin: 2px 0;
}

.browse-sub {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
}

.browse-card {
  cursor: pointer;
  transition: transform 0.15s ease;
}

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

.browse-poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(135deg, #1f1f1f, #0d0d0d);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.poster-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 10px;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #ccc;
}

.browse-card-title {
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Search view (Search tab) */
.search-view {
  padding-top: 8px;
}

.search-view-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #333;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 22px;
}

.search-view-icon {
  width: 22px;
  height: 22px;
  color: #b3b3b3;
  flex: 0 0 auto;
}

.search-view-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 1.05rem;
}

.search-view-input::placeholder {
  color: #9a9a9a;
}

.search-results-heading {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 16px;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  cursor: pointer;
}

.list-thumb {
  flex: 0 0 146px;
  width: 146px;
  height: 82px;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(135deg, #2a2a2a, #141414);
}

.list-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.list-thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: #666;
}

.list-row-title {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 500;
  color: #fff;
}

.list-play {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.list-play:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.08);
}

.list-play svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  margin-left: 2px;
}

.search-empty {
  color: #888;
  padding: 30px 0;
  text-align: center;
}

/* Responsive Breakpoints for Mobile/iPhone */
@media (max-width: 768px) {
  .nav-menu {
    display: none;
  }

  /* Header search hidden on mobile — the Search tab handles it. */
  .search-container {
    display: none;
  }

  body {
    padding-bottom: 90px;
  }

  .main-container {
    padding-bottom: 100px;
  }

  .mobile-nav {
    display: flex;
  }

  .hero {
    height: auto;
    min-height: 55vh;
    padding-bottom: 56px;
    /* Much smaller than desktop's -60px overlap trick — on mobile the hero
       is short enough (and titles can wrap to 2 lines) that -60px would eat
       into the Play/More Info buttons, putting the row below on top of them. */
    margin-bottom: -16px;
  }

  .hero-title {
    font-size: 2.2rem;
  }

  .hero-desc {
    font-size: 0.95rem;
    -webkit-line-clamp: 2;
  }

  /* .media-card mobile sizing (swipeable single-card carousel) is defined
     further down in the touch-paging media query, so it lives in one place. */

  .modal-container {
    max-height: 95vh;
    margin: 10px;
  }

  .modal-header-banner {
    height: 220px;
    padding: 15px;
  }

  .modal-title {
    font-size: 1.6rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .add-folder-form {
    flex-direction: column;
  }
}

/* ============================ NEW badge ============================ */
.new-badge {
  background: var(--netflix-red);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
}
.card-new { position: absolute; top: 10px; right: 10px; z-index: 2; }
.list-new { position: absolute; top: 6px; left: 6px; }

/* ==================== card play fab + progress ==================== */
.card-play-fab {
  position: absolute; bottom: 10px; right: 10px; z-index: 3;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(20,20,20,.75); border: 2px solid #fff; color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  opacity: 0; transform: translateY(6px); transition: all .2s ease;
}
.media-card:hover .card-play-fab { opacity: 1; transform: translateY(0); }
.card-play-fab svg { width: 20px; height: 20px; fill: currentColor; margin-left: 2px; }
.card-play-fab:hover { background: #fff; color: #000; }

.card-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: rgba(255,255,255,.3); z-index: 2;
}
.card-progress-fill { height: 100%; background: var(--netflix-red); }

.empty-state { text-align: center; padding: 90px 20px; color: #888; }

/* ============================ full-screen player ============================ */
.modal-overlay.player-mode { padding: 0; background: #000; backdrop-filter: none; }
.modal-overlay.player-mode .modal-container {
  max-width: none; width: 100vw; height: 100vh; height: 100dvh;
  border-radius: 0; border: none; overflow: hidden; background: #000;
}
.player-root { position: relative; width: 100%; height: 100%; background: #000; overflow: hidden; }
.dorflix-video { width: 100%; height: 100%; object-fit: contain; background: #000; }

.prep-overlay {
  position: absolute; inset: 0; z-index: 25; background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
}
.prep-label { color: #ccc; font-size: 1rem; letter-spacing: .3px; }

/* intro splash — original animated red D homage, timed to intro.mp3's exact length */
.intro-overlay {
  --intro-dur: 4.1s;
  position: absolute; inset: 0; background: #000; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .5s ease;
  overflow: hidden;
}
.intro-overlay.intro-done { opacity: 0; }
.intro-overlay::before {
  /* impact flash — brightens the whole frame on each hit */
  content: ""; position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none;
}
.intro-overlay.intro-playing::before {
  animation: introFullFlash var(--intro-dur) linear forwards;
}
.intro-D {
  width: min(40vh, 340px); height: min(40vh, 340px);
  background: url('favicon.png') center/contain no-repeat;
  position: relative;
  opacity: 0;
  transform: scale(.3);
  filter: drop-shadow(0 0 0 rgba(229,9,20,0));
}
.intro-D.intro-playing {
  animation: introD var(--intro-dur) cubic-bezier(.22,.68,.24,1) forwards;
}
.intro-D::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.9) 50%, transparent 60%);
  -webkit-mask: url('favicon.png') center/contain no-repeat;
  mask: url('favicon.png') center/contain no-repeat;
  transform: translateX(-130%);
  opacity: 0;
}
.intro-D.intro-playing::after {
  animation: introSweep var(--intro-dur) ease-in-out forwards;
}

/* Two dramatic impacts land near where the sound's two knock-booms hit,
   each with an overshoot-and-settle bounce plus a shake, building to a final punch-out.
   translate + scale are combined into one transform per step so they don't fight
   another animation for the same CSS property. */
@keyframes introD {
  0%   { transform: translate(0,0)          scale(.3);  opacity: 0; }
  8%   { transform: translate(0,0)          scale(.55); opacity: 1; }
  16%  { transform: translate(-6px,3px)     scale(1.22); filter: drop-shadow(0 0 60px rgba(229,9,20,.95)); }  /* hit 1 */
  17%  { transform: translate(5px,-2px)     scale(1.1); }
  18%  { transform: translate(-3px,2px)     scale(1.0); }
  22%  { transform: translate(0,0)          scale(.92); }
  28%  { transform: translate(0,0)          scale(1.05); filter: drop-shadow(0 0 40px rgba(229,9,20,.75)); }
  34%  { transform: translate(0,0)          scale(.99); }
  50%  { transform: translate(0,0)          scale(1.0); filter: drop-shadow(0 0 34px rgba(229,9,20,.6)); }
  62%  { transform: translate(0,0)          scale(1.0); }
  70%  { transform: translate(-10px,5px)    scale(1.42); filter: drop-shadow(0 0 90px rgba(229,9,20,1)); }    /* hit 2 (boom) */
  71%  { transform: translate(9px,-6px)     scale(1.3); }
  72%  { transform: translate(-6px,4px)     scale(1.2); }
  73%  { transform: translate(4px,-2px)     scale(1.15); }
  78%  { transform: translate(0,0)          scale(1.12); }
  86%  { transform: translate(0,0)          scale(1.2); filter: drop-shadow(0 0 70px rgba(229,9,20,.9)); }
  100% { transform: translate(0,0)          scale(1.9); opacity: 0; filter: drop-shadow(0 0 20px rgba(229,9,20,0)); }
}
@keyframes introFullFlash {
  0%, 14%  { opacity: 0; }
  16%      { opacity: .35; }
  20%, 68% { opacity: 0; }
  70%      { opacity: .55; }
  76%, 100%{ opacity: 0; }
}
@keyframes introSweep {
  0%, 12%  { transform: translateX(-130%); opacity: 0; }
  16%      { opacity: 1; }
  40%      { transform: translateX(130%); opacity: 1; }
  41%, 62% { opacity: 0; transform: translateX(-130%); }
  70%      { opacity: 1; }
  92%      { transform: translateX(130%); opacity: 1; }
  100%     { transform: translateX(130%); opacity: 0; }
}

/* controls layer */
.player-ui { position: absolute; inset: 0; z-index: 10; transition: opacity .3s ease; }
.player-ui.ui-hidden { opacity: 0; cursor: none; }

.player-top {
  position: absolute; top: 0; left: 0; right: 0; padding: 22px 26px;
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(180deg, rgba(0,0,0,.75), transparent);
}
.player-back { background: none; border: none; color: #fff; cursor: pointer; display: flex; }
.player-back svg { width: 34px; height: 34px; fill: currentColor; }
.player-title { font-size: 1.25rem; font-weight: 700; text-shadow: 0 2px 6px rgba(0,0,0,.8); }

.player-center-btn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 84px; height: 84px; border-radius: 50%;
  background: rgba(20,20,20,.55); border: 2px solid rgba(255,255,255,.9);
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.player-center-btn svg { width: 44px; height: 44px; fill: currentColor; margin-left: 4px; }
.player-center-btn.hidden { display: none; }

.player-bottom {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 0 26px 22px;
  background: linear-gradient(0deg, rgba(0,0,0,.85), transparent);
}
.scrub { height: 5px; background: rgba(255,255,255,.28); border-radius: 3px; position: relative; cursor: pointer; margin-bottom: 14px; transition: height .12s; }
.scrub:hover { height: 8px; }
.scrub-buffered { position: absolute; left: 0; top: 0; height: 100%; background: rgba(255,255,255,.4); border-radius: 3px; width: 0; }
.scrub-filled { position: absolute; left: 0; top: 0; height: 100%; background: var(--netflix-red); border-radius: 3px; width: 0; }
.scrub-knob { position: absolute; top: 50%; left: 0; width: 15px; height: 15px; background: var(--netflix-red); border-radius: 50%; transform: translate(-50%,-50%); box-shadow: 0 0 8px rgba(229,9,20,.7); }

.player-controls { display: flex; align-items: center; justify-content: space-between; }
.pc-left, .pc-right { display: flex; align-items: center; gap: 20px; }
.pc-btn { background: none; border: none; color: #fff; cursor: pointer; display: flex; align-items: center; position: relative; transition: transform .15s; }
.pc-btn:hover { transform: scale(1.12); }
.pc-btn svg { width: 30px; height: 30px; fill: currentColor; }
.pc-num { position: absolute; top: 52%; left: 50%; transform: translate(-50%,-50%); font-size: 0.56rem; font-weight: 700; }
.pc-vol { display: flex; align-items: center; gap: 8px; }
.pc-volrange { width: 0; opacity: 0; transition: all .2s ease; accent-color: var(--netflix-red); }
.pc-vol:hover .pc-volrange { width: 80px; opacity: 1; }
.pc-time { font-size: 0.92rem; color: #eaeaea; font-variant-numeric: tabular-nums; }
.player-title-sm { font-weight: 700; color: #ddd; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==================== Quality selector ==================== */
.pc-quality { position: relative; }
.pc-quality .pc-btn { display: flex; align-items: center; gap: 6px; }
.pc-quality-label { font-size: 0.8rem; font-weight: 700; color: #ddd; }
.quality-menu {
  position: absolute; bottom: 100%; right: 0; margin-bottom: 12px;
  background: rgba(20,20,20,.97); border: 1px solid #333; border-radius: 8px;
  min-width: 160px; overflow: hidden; box-shadow: 0 8px 30px rgba(0,0,0,.6); z-index: 20;
}
.quality-menu.hidden { display: none; }
.quality-opt {
  padding: 11px 16px; font-size: 0.9rem; color: #eee; cursor: pointer; white-space: nowrap;
  transition: background .12s;
}
.quality-opt:hover { background: rgba(255,255,255,.1); }
.quality-opt.active { color: var(--netflix-red); font-weight: 700; }
.quality-opt.disabled { color: #666; cursor: not-allowed; }
.quality-opt.disabled:hover { background: none; }

/* ==================== Netflix-style episode list ==================== */
.episodes-header { display: flex; justify-content: space-between; align-items: center; margin: 24px 0 6px; }
.episodes-list { display: flex; flex-direction: column; }
.ep-row { display: flex; gap: 16px; align-items: center; padding: 16px 10px; border-top: 1px solid #2b2b2b; cursor: pointer; transition: background .15s; }
.ep-row:hover { background: #262626; border-radius: 8px; }
.ep-index { font-size: 1.3rem; font-weight: 700; color: #808080; width: 26px; text-align: center; flex: 0 0 auto; }
.ep-still { position: relative; flex: 0 0 150px; width: 150px; height: 84px; border-radius: 5px; overflow: hidden; background: #333; }
.ep-still img { width: 100%; height: 100%; object-fit: cover; }
.ep-still-fallback { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 1.4rem; font-weight: 800; color: #666; }
.ep-play-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .15s; }
.ep-play-overlay svg { width: 34px; height: 34px; fill: #fff; }
.ep-row:hover .ep-play-overlay { opacity: 1; }
.ep-info { flex: 1; min-width: 0; }
.ep-title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ep-title { font-weight: 700; font-size: 1rem; }
.ep-runtime { color: #aaa; font-size: 0.85rem; flex: 0 0 auto; }
.ep-overview { color: #a8a8a8; font-size: 0.88rem; line-height: 1.45; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ep-dl { flex: 0 0 auto; }

/* ==================== In-player episode button / panel ==================== */
.player-ep-btn {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
  color: #fff; padding: 7px 14px; border-radius: 6px;
  font-size: 0.85rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.player-ep-btn:hover { background: rgba(255,255,255,.22); }
.player-ep-btn svg { width: 16px; height: 16px; fill: currentColor; }
.player-top { display: flex; align-items: center; gap: 16px; }

.episode-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(420px, 92vw);
  background: rgba(15,15,15,.97);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-left: 1px solid #2a2a2a;
  z-index: 30;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.25,.8,.3,1);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.episode-panel.open { transform: translateX(0); }
.episode-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid #2a2a2a; flex: 0 0 auto;
}
.episode-panel-list { flex: 1; overflow-y: auto; padding: 8px 12px 24px; }
.panel-ep-row {
  display: flex; gap: 12px; padding: 10px 6px; border-radius: 8px; cursor: pointer; align-items: flex-start;
  transition: background .15s;
}
.panel-ep-row:hover { background: rgba(255,255,255,.08); }
.panel-ep-row.playing { background: rgba(229,9,20,.15); }
.panel-ep-still { flex: 0 0 120px; width: 120px; height: 68px; }
.panel-ep-row .ep-title-row { gap: 6px; }
.panel-ep-row .ep-index { font-size: 0.85rem; color: #888; font-weight: 700; }
.panel-ep-row .ep-title { font-size: 0.9rem; }
.panel-ep-row .ep-overview { font-size: 0.78rem; -webkit-line-clamp: 2; margin-top: 3px; }
.playing-badge { opacity: 1 !important; background: rgba(229,9,20,.55) !important; font-size: 1.1rem; color: #fff; }

/* ==================== Next-episode skip button + up-next card ==================== */
.next-ep-btn {
  position: absolute; bottom: 110px; right: 26px; z-index: 15;
  display: flex; align-items: center; gap: 8px;
  background: rgba(40,40,40,.85); border: 1px solid rgba(255,255,255,.3);
  color: #fff; padding: 10px 18px; border-radius: 6px;
  font-size: 0.9rem; font-weight: 700; cursor: pointer;
  transition: background .15s, opacity .2s;
}
.next-ep-btn:hover { background: rgba(60,60,60,.95); }
.next-ep-btn svg { width: 18px; height: 18px; fill: currentColor; }
.next-ep-btn.hidden { display: none; }

.up-next-card {
  position: absolute; bottom: 0; right: 0; z-index: 25;
  padding: 26px; width: min(440px, 94vw);
}
.up-next-card.hidden { display: none; }
.up-next-inner {
  background: #181818; border: 1px solid #333; border-radius: 10px; padding: 18px;
  box-shadow: 0 10px 40px rgba(0,0,0,.7);
}
.up-next-label { color: var(--netflix-red); font-weight: 800; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.up-next-body { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.up-next-thumb { width: 120px; height: 68px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.up-next-title { font-weight: 700; font-size: 1.05rem; }
.up-next-sub { color: #999; font-size: 0.85rem; margin-top: 2px; }
.up-next-actions { display: flex; gap: 10px; }
.up-next-actions .btn { padding: 9px 16px; font-size: 0.9rem; }

/* ==================== Swipeable carousels (touch paging) ==================== */
.carousel-track {
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.media-card { scroll-snap-align: start; }

@media (max-width: 768px) {
  .hero-meta { flex-wrap: wrap; row-gap: 6px; }
  .browse-header { align-items: flex-start; }
  .browse-title { font-size: 1.4rem; }
  .browse-avatar { width: 64px; height: 64px; flex: 0 0 auto; }
  .banner-preview-video { display: none; } /* preview clip is desktop-only anyway */

  .player-title-sm { display: none; }
  .pc-left, .pc-right { gap: 14px; }
  .pc-btn svg { width: 26px; height: 26px; }
  .pc-vol { display: none; }
  .pc-quality-label { display: none; }
  .quality-menu { right: -10px; }
  .player-bottom { padding: 0 14px 16px; }
  .player-top { padding: 14px 16px; gap: 10px; }
  .player-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
  .player-ep-btn span, .player-ep-btn { font-size: 0.78rem; padding: 6px 10px; }
  .player-ep-btn { flex: 0 0 auto; }
  .ep-still { flex-basis: 108px; width: 108px; height: 62px; }
  .ep-overview { -webkit-line-clamp: 2; font-size: 0.82rem; }
  .ep-runtime { display: none; }

  .episode-panel { width: 100vw; }
  .next-ep-btn { right: 14px; bottom: 96px; padding: 8px 12px; font-size: 0.8rem; }
  .next-ep-btn span { display: none; }
  .up-next-card { padding: 14px; width: 100vw; }
  .up-next-thumb { width: 84px; height: 48px; }
  .up-next-title { font-size: 0.92rem; }
  .up-next-actions { flex-direction: column; }
  .up-next-actions .btn { width: 100%; justify-content: center; }
  .panel-ep-still { flex-basis: 96px; width: 96px; height: 54px; }

  .carousel-track { scroll-snap-type: x mandatory; gap: 10px; }
  .media-card { flex: 0 0 34%; scroll-snap-align: start; min-width: 0; max-width: none; }
  .card-title-sm { font-size: 0.78rem; }
  .card-meta { font-size: 0.7rem; }

  .cast-scroll { scroll-snap-type: x proximity; }
  .cast-card { scroll-snap-align: start; }
}
