/*
  CineStream — Premium Design System
  Colors, Variables, Base Styles, and Accessibility Utilities
*/

/* ── Accessibility: Skip Navigation ─────────────────────────────────────────── */
.skip-to-main {
  position: absolute;
  top: -100px;
  left: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--primary, #ff4757);
  color: #fff;
  font-weight: 700;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  z-index: 99999;
  transition: top 0.2s ease;
}

.skip-to-main:focus {
  top: 0;
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* ── Screen-reader only text ─────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────────── */
.breadcrumb-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted, #b3b3b3);
}

.breadcrumb-list a {
  color: var(--text-muted, #b3b3b3);
  text-decoration: none;
}

.breadcrumb-list a:hover {
  color: var(--primary, #ff4757);
}

.breadcrumb-list li+li::before {
  content: '›';
  margin-right: 0.4rem;
  color: var(--text-muted, #b3b3b3);
}

/* ── Search clear button reset ───────────────────────────────────────────────── */
.search-clear-btn {
  background: none;
  border: none;
  color: var(--text-muted, #b3b3b3);
  cursor: pointer;
  padding: 0;
  margin-left: 8px;
  font-size: 1rem;
  line-height: 1;
}

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

/* Custom Search Clear/Cancel Button (Webkit) */
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 20px;
  width: 20px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b3b3b3'><path d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  cursor: pointer;
  margin-right: 4px;
  transition: transform 0.2s;
}

input[type="search"]::-webkit-search-cancel-button:hover {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'><path d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/></svg>");
  transform: scale(1.1);
}


:root {
  --primary: #e50914;
  /* Netflix Red */
  --primary-hover: #b20710;
  --bg-dark: #0f0f0f;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-modal: rgba(15, 15, 15, 0.98);
  --text-main: #ffffff;
  --text-muted: #b3b3b3;
  --glass: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.12);
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
  --transition-smooth: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1), filter 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 12px;
  --hindi-badge: #ff0000;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow-x: clip;
  line-height: 1.5;
  padding-top: 110px;
  touch-action: pan-y;
}

/* Scrollbar Global */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  /* Added height for any default horizontal scroll */
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Specific Premium Horizontal Scrollbar for Continue Watching & Favorites */
#recently-viewed-grid,
#favorites-grid,
.category-row-scroll {
  /* Firefox support */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) var(--glass);
}

#recently-viewed-grid::-webkit-scrollbar,
#favorites-grid::-webkit-scrollbar,
.category-row-scroll::-webkit-scrollbar {
  height: 6px;
}

#recently-viewed-grid::-webkit-scrollbar-track,
#favorites-grid::-webkit-scrollbar-track,
.category-row-scroll::-webkit-scrollbar-track {
  background: var(--glass);
  border-radius: 10px;
  margin: 0px 10px;
}

#recently-viewed-grid::-webkit-scrollbar-thumb,
#favorites-grid::-webkit-scrollbar-thumb,
.category-row-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
}

#recently-viewed-grid::-webkit-scrollbar-thumb:hover,
#favorites-grid::-webkit-scrollbar-thumb:hover,
.category-row-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
  cursor: pointer;
}

/* Layout Utilities */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 2rem;
}

@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }
}

.section-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 2rem 0 1.2rem;
  color: white;
  letter-spacing: -0.5px;
  position: relative;
  display: inline-block;
  font-family: 'Outfit', sans-serif;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 40px;
  height: 4px;
  background: var(--primary);
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(229, 9, 20, 0.5);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

/* Glassmorphism utility */
.glass {
  background: var(--glass);
  /* backdrop-filter disabled for mobile performance */
  border: 1px solid var(--glass-border);
}

@supports (backdrop-filter: blur(12px)) {
  @media (min-width: 769px) {
    .glass {
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }
  }
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #ff3d47);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: calc(var(--border-radius) / 2);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-size: 1rem;
}

.btn-primary:hover {
  box-shadow: 0 8px 24px rgba(229, 9, 20, 0.4);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--glass);
  color: white;
  border: 1px solid var(--glass-border);
  padding: 12px 24px;
  border-radius: calc(var(--border-radius) / 2);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-decoration: none;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Sticky Navbar */
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  height: 110px;
  display: flex;
  align-items: center;
  transition: background-color 0.3s ease-out, border-color 0.3s ease-out, box-shadow 0.3s ease-out;
  background: linear-gradient(to bottom, rgba(15, 15, 15, 0.9), transparent);
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

nav.scrolled {
  background: #0f0f0f;
  border-bottom: 1px solid var(--glass-border);
  height: 110px;
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.logo span {
  color: white;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
}

.nav-links a.active {
  font-weight: 700;
  text-shadow: 0 0 12px rgba(229, 9, 20, 0.5);
}

.search-container {
  position: relative;
  width: 100%;
  max-width: 300px;
  display: flex;
  align-items: center;
  transition: max-width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.search-btn-submit {
  position: absolute;
  right: 4px;
  left: auto;
  width: 32px;
  height: 32px;
  background-color: var(--primary);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  z-index: 2;
  border: none;
  cursor: pointer;
  outline: none;
  transition: background-color 0.2s ease;
}

.search-btn-submit:hover {
  background-color: #ff3d47;
}

.search-container input {
  width: 100%;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 10px 65px 10px 15px;
  border-radius: 50px;
  color: white;
  outline: none;
  transition: var(--transition-smooth);
}

.search-container input::placeholder {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
  letter-spacing: 0.2px;
}

.search-container input:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--primary);
}

.search-container:focus-within {
  max-width: 400px;
}

#search-clear {
  position: absolute;
  right: 42px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
  z-index: 2;
  transition: color 0.2s;
}

#search-clear:hover {
  color: white;
}

/* Mobile Responsive Navbar */
@media (max-width: 768px) {
  body {
    padding-top: 105px;
  }

  nav {
    height: auto;
    padding: 10px 0;
  }

  .nav-content {
    flex-direction: column;
    gap: 15px;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    gap: 15px;
  }

  .search-container {
    width: 100%;
    max-width: 100% !important;
  }

  .search-container input:focus {
    width: 100%;
  }

  .search-container:focus-within {
    max-width: 100% !important;
  }

  #modal-language {
    display: none !important;
  }

  .modal-meta {
    font-size: 0.85rem !important;
    gap: 10px !important;
  }
}

/* Movie Grid */
.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2rem;
  padding: 2rem 0;
}

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

  #search-results-container {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 2.5rem 0 3rem;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 42px;
  height: 42px;
  padding: 0 10px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.page-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
}

.page-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(229, 9, 20, 0.4);
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-ellipsis {
  color: var(--text-muted);
  padding: 0 4px;
  font-size: 0.95rem;
  line-height: 42px;
}

/* Movie Card */
.movie-card {
  position: relative;
  border-radius: var(--border-radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-card);
  aspect-ratio: 2/3;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
}

.movie-card * {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  pointer-events: none;
}

/* Invisible filler cards to complete the last grid row before View More button */
.movie-card-placeholder {
  aspect-ratio: 2/3;
  visibility: hidden;
  pointer-events: none;
}

.movie-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: var(--shadow-premium);
  z-index: 10;
}

.movie-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), filter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
}

.movie-card.loaded img {
  opacity: 1;
}

.movie-card:not(.loaded):not(.skeleton) {
  background: #1a1a1a;
  position: relative;
  overflow: hidden;
}
.movie-card:not(.loaded):not(.skeleton)::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.06) 50%, transparent 100%);
  animation: shimmer 1.6s infinite linear;
  will-change: transform;
}

.movie-card:hover img {
  filter: brightness(0.6);
}

.movie-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem 1rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.movie-card:hover .movie-card-info {
  transform: translateY(0);
  opacity: 1;
}

.movie-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hindi-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--primary);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

.lang-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  color: white;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hindi-badge {
  background: rgba(244, 67, 54, 0.85); /* Red for Hindi */
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.english-badge {
  background: rgba(25, 118, 210, 0.85); /* Blue for English */
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.type-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

@media (max-width: 768px) {
  .type-badge {
    top: 6px;
    left: 6px;
    padding: 1px 3px;
    font-size: 0.48rem;
  }
}

/* Day badge for upcoming cards — top-right corner */
.day-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #e50914, #b0060f);
  color: #fff;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 6px rgba(229, 9, 20, 0.5);
  z-index: 3;
}

/* Schedule time/note badge — bottom of the card image */
.schedule-badge {
  position: absolute;
  bottom: 44px;
  /* sits just above the info strip */
  left: 0;
  right: 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.0) 100%);
  color: rgba(255, 255, 255, 0.92);
  padding: 4px 6px 3px;
  font-size: 0.55rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.02em;
  z-index: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Skeleton Loading */
.skeleton {
  background: #1a1a1a;
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.06) 50%, transparent 100%);
  animation: shimmer 1.6s infinite linear;
  will-change: transform;
}

/* Filters Component */
.filters-section {
  padding: 0.5rem 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.6rem;
  align-items: center;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  margin-bottom: 1.5rem;
  scrollbar-width: none;
  /* Firefox */
  justify-content: flex-start;
}

.filters-section::-webkit-scrollbar {
  display: none;
  /* Safari and Chrome */
}

@media (min-width: 769px) {
  .filters-section {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .filters-section {
    display: none !important;
  }
}

.category-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(229, 9, 20, 0.15);
  border: 1px solid rgba(229, 9, 20, 0.3);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  text-decoration: none;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  height: 34px;
  flex-shrink: 0;
}

.category-filter-btn:hover,
.category-filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 4px 15px rgba(229, 9, 20, 0.3);
}

.filter-chip,
.filter-dropdown-select {
  padding: 6px 14px;
  border-radius: 50px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: var(--transition-smooth);
  color: var(--text-muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.filter-chip:hover,
.filter-chip.active,
.filter-dropdown-select:hover,
.filter-dropdown-select.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

#genre-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23b3b3b3' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C2.185 5.355 2.408 5 2.811 5h9.447c.403 0 .626.355.361.658l-4.796 5.482a.503.503 0 0 1-.776 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 12px) center;
  padding-right: 30px;
  cursor: pointer;
  outline: none;
}

#genre-select option {
  background: var(--bg-dark);
  color: white;
}

/* Modal System */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-modal);
  z-index: 10005;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-content {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #000;
  border-radius: 0;
  overflow-y: auto;
  box-shadow: 0 0 50px rgba(0, 0, 0, 1);
  display: flex;
  flex-direction: column;
  transform: scale(0.97) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Modal hero fills more height on full-screen modal */
.modal-overlay.active .modal-hero {
  height: 50vh;
  overflow: visible;
}

.modal-hero {
  position: relative;
  width: 100%;
  height: 50vh;
  overflow: visible;
}

.modal-hero iframe {
  width: 100%;
  height: 100%;
  border: none;
  touch-action: auto;
}

.modal-hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, transparent 60%, #000);
  pointer-events: none;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 9999;
  /* Ensure it's always on top */
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: 0.3s;
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--primary);
  transform: rotate(90deg);
}

.modal-sound-toggle {
  position: absolute;
  top: 20px;
  right: 70px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 8px 15px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  z-index: 100;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-back-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  z-index: 9999;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: 0.3s;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-back-btn:hover {
  background: var(--primary);
  transform: translateY(-1px);
}

.modal-body {
  padding: 2rem;
  display: flex;
  gap: 2rem;
  position: relative;
  z-index: 10;
  margin-top: 0;
}

.modal-poster-container {
  position: relative;
  width: 250px;
  flex-shrink: 0;
  animation: slideUp 0.8s ease;
  margin-bottom: 0;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-poster {
  width: 100%;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 1);
  border: 4px solid #1a1a1a;
  display: block;
}

.watch-overlay-btn {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  box-shadow: 0 4px 20px rgba(229, 9, 20, 0.6);
  z-index: 5;
  white-space: nowrap;
}

.watch-overlay-btn:hover {
  transform: translateX(-50%) translateY(-2px);
}

.modal-details {
  flex: 1;
  padding-top: 0;
  display: flex;
  flex-direction: column;
}

.modal-details h2 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.modal-meta {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  font-weight: 600;
}

.modal-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.rating-star {
  color: #ffcc00;
}

.modal-description {
  font-size: 1.1rem;
  color: #ccc;
  max-width: 800px;
  margin-bottom: 2rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: all 0.3s ease;
}

.modal-description.expanded {
  display: block !important;
  -webkit-line-clamp: unset !important;
  line-clamp: unset !important;
  overflow: visible !important;
}

.modal-ad {
  margin: 1.5rem 0;
  display: flex;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
  align-items: center;
}

.admin-panel {
  display: none;
  background: #1a1a1a;
  padding: 2rem;
  border-radius: var(--border-radius);
  margin-top: 2rem;
}

.admin-panel.active {
  display: block;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 3000;
}

#no-trailer {
  flex-shrink: 0 !important;
  width: 100% !important;
  padding: 8px 4px !important;
  order: -1;
}

/* Never show #no-trailer on anime/movie detail view */
.modal-overlay:not(.watching) #no-trailer {
  display: none !important;
}

.toast {
  background: #333;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  box-shadow: var(--shadow-premium);
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
  border-left: 4px solid var(--primary);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
  }

  to {
    transform: translateX(0);
  }
}

@media (max-width: 900px) {

  /* ── Modal Overlay: full viewport on mobile ── */
  .modal-overlay {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    padding: 0 !important;
    display: flex !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }

  /* ── Modal content: flex column, fill parent fully ── */
  .modal-overlay.active .modal-content,
  .modal-content {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    transform: none !important;
    box-sizing: border-box !important;
  }

  /* ── Hero trailer: hidden on mobile details view, full height when watching ── */
  .modal-hero {
    display: none !important;
    height: 160px !important;
    min-height: 130px;
    flex-shrink: 0 !important;
    width: 100% !important;
    overflow: hidden;
  }

  /* Show hero only when watching video on mobile */
  .modal-overlay.watching .modal-hero {
    display: block !important;
  }

  /* ── No-trailer ad banner: compact strip right after hero on mobile ── */
  #no-trailer {
    flex-shrink: 0 !important;
    width: 100% !important;
    padding: 8px 4px !important;
    order: -1;
  }

  #no-trailer>div {
    width: 100% !important;
    max-width: 100% !important;
    justify-content: center;
  }

  .modal-overlay.watching .modal-content {
    overflow: hidden !important;
  }

  .modal-overlay.watching .modal-hero {
    flex: none !important;
    height: 50vh !important;
    height: 50dvh !important;
    max-height: 50vh !important;
    min-height: 0 !important;
  }

  /* ── Modal body: natural height, scrolls inside modal-content ── */
  .modal-body {
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 100vw;
    flex: 1;
    margin: 0 !important;
    padding: 1rem 0.75rem 2rem;
    box-sizing: border-box;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .modal-body::-webkit-scrollbar {
    display: none;
  }

  /* ── Poster: smaller on mobile ── */
  .modal-poster-container {
    width: 120px !important;
    flex-shrink: 0;
    margin-bottom: 0.15rem !important;
  }

  .mobile-only-meta {
    display: flex !important;
    color: var(--text-muted);
    font-size: 0.82rem;
  }

  /* ── Details: tighter text ── */
  .modal-details {
    width: 100%;
  }

  .modal-details h2 {
    font-size: 1.35rem !important;
    line-height: 1.3;
    margin-top: -5px !important;
    margin-bottom: 0.35rem;
  }

  .modal-meta {
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.78rem;
    margin-bottom: 0.75rem;
  }

  #modal-rating,
  #modal-year {
    display: none !important;
  }

  .modal-description {
    font-size: 0.85rem;
    margin: 0 auto 1.5rem;
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }

  #modal-seo-content {
    padding: 1rem 1.25rem !important;
  }

  .ssr-seo-modal-inner h3 {
    font-size: 1.05rem !important;
  }

  .ssr-seo-modal-inner .faq-question {
    font-size: 0.85rem !important;
  }

  .ssr-seo-modal-inner .faq-answer {
    font-size: 0.8rem !important;
  }

  /* Buttons row */
  .modal-details h2 {
    order: -4 !important;
  }

  .modal-meta {
    order: -3 !important;
  }

  #modal-dubbed-languages {
    order: -2 !important;
  }

  .modal-action-buttons {
    order: -1;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem !important;
    margin-top: 0 !important;
  }

  /* Share and Watch buttons on mobile: Share on left, Watch/Resume on right */
  .modal-action-buttons {
    order: -1;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    width: 100% !important;
    margin-bottom: 0.75rem !important;
    margin-top: 0 !important;
  }

  #modal-share-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
    padding: 0 16px !important;
    height: 44px !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    color: #fff !important;
    font-size: 0.88rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  #modal-share-btn * {
    pointer-events: none !important;
  }

  #modal-share-btn:hover,
  #modal-share-btn:active {
    background: rgba(255, 255, 255, 0.22) !important;
  }

  #modal-watch-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 !important;
    height: 44px !important;
    padding: 0 16px !important;
    border-radius: 8px !important;
    font-size: 0.92rem !important;
    white-space: nowrap !important;
    max-width: none !important;
    width: auto !important;
  }

  /* Close button position */
  .modal-close {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
  }

  /* Sound toggle: smaller on mobile */
  .modal-sound-toggle {
    top: 10px;
    right: 52px;
    padding: 4px 9px;
    font-size: 0.72rem;
    gap: 3px;
    border-radius: 14px;
  }

  .modal-sound-toggle span {
    display: none;
    /* hide "Muted" text, keep only icon */
  }

  /* Poster: bigger on mobile */
  .modal-poster-container {
    width: 160px !important;
  }

}

/* Additional styles for very small screens (iPhone SE) */
@media (max-width: 375px) {

  /* Ensure buttons are visible on small screens */
  .modal-action-buttons {
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
  }

  #modal-share-btn {
    padding: 0 12px !important;
    font-size: 0.8rem !important;
    height: 40px !important;
  }

  #modal-watch-btn {
    padding: 0 10px !important;
    font-size: 0.82rem !important;
    height: 40px !important;
  }
}

/* Professional Footer Styling */
.main-footer {
  background-color: #0a0a0a;
  padding: 60px 0 20px;
  margin-top: 80px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: #fff;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 30px;
  padding-bottom: 40px;
}

.footer-brand p {
  color: #888;
  font-size: 0.9rem;
  margin-top: 10px;
}

.footer-links {
  display: flex;
  gap: 25px;
  flex-wrap: wrap;
}

.footer-links a {
  color: #bbb;
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-bottom {
  text-align: center;
  padding-top: 25px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-bottom p {
  color: #666;
  font-size: 0.85rem;
}

/* Mobile Responsive Footer */
@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 40px;
  }

  .footer-links {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
  }

  .footer-links strong {
    display: none !important;
  }

  .footer-links a {
    font-size: 0.8rem !important;
  }

  .footer-bottom {
    max-width: 80%;
    margin: 0 auto;
    padding-top: 15px;
  }

  /* Reduce SEO Hero size on mobile */
  #seo-hero {
    padding: 0.8rem 0 0.2rem !important;
    margin-bottom: 0.2rem !important;
  }

  #seo-hero h1 {
    font-size: 1.1rem !important;
  }

  #seo-hero p {
    font-size: 0.76rem !important;
    line-height: 1.45 !important;
  }
}

/* Info Pages Professional Styling */
.info-container {

  min-height: 80vh;
}

.info-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 60px;
  margin-top: 40px;
}

.info-content h1 {
  font-size: 2.8rem;
  color: var(--primary);
  margin-bottom: 25px;
  display: flex;
  align-items: center;
  gap: 15px;
  text-transform: capitalize;
}

.info-content p {
  font-size: 1.1rem;
  line-height: 1.9;
  color: #ccc;
  margin-bottom: 20px;
  text-transform: capitalize;
}

.contact-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 40px;
  border-radius: 20px;
  height: fit-content;
  text-transform: capitalize;
}

.contact-card h3 {
  font-size: 1.5rem;
  margin-bottom: 25px;
  color: #fff;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
  padding-bottom: 5px;
  text-transform: capitalize;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
}

.contact-item i {
  width: 45px;
  height: 45px;
  background: rgba(229, 9, 20, 0.1);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.contact-item .text h4 {
  font-size: 0.9rem;
  color: #888;
  margin-bottom: 3px;
}

.contact-item .text p {
  font-size: 1.1rem;
  color: #fff;
  margin: 0;
}

@media (max-width: 992px) {
  .info-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }


}

/* Final Global Responsiveness Polish */
.container {
  width: 92%;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 1200px) {
  #movie-container {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) {
  #movie-container {
    grid-template-columns: repeat(3, 1fr);
  }

  .logo {
    font-size: 1.5rem;
  }
}

@media (max-width: 600px) {
  #movie-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .nav-content {
    padding: 15px 0;
  }

  .logo {
    font-size: 1.3rem;
  }

  .info-content h1 {
    font-size: 2rem;
  }

  .contact-card {
    padding: 25px;
  }
}

#trailer-video {
  pointer-events: none;
}

/* Trailer / Player container — always black so first open has zero flash */
#trailer-container {
  background: #000;
  /* GPU-composite layer so paint is instant */
  will-change: contents;
  contain: strict;
}

/* Modal Loading Screen Overlay */
.modal-loading-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 15, 15, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-loading-screen .loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: modal-spin 0.8s infinite linear;
}

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

/* APK Download Button styling */
.logo-wrapper {
  display: flex;
  align-items: center;
}

.apk-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(229, 9, 20, 0.15);
  border: 1px solid rgba(229, 9, 20, 0.3);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  text-decoration: none;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all var(--transition-smooth);
  cursor: pointer;
  height: 38px;
}

.apk-download-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(229, 9, 20, 0.3);
}

.apk-download-btn svg.apk-icon {
  width: 17px;
  height: 17px;
  stroke: currentColor;
}

@media (max-width: 768px) {
  .nav-content {
    position: relative;
  }

  .apk-download-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 0 12px;
    width: auto;
    height: 36px;
    border-radius: 18px;
    justify-content: center;
    background: rgba(229, 9, 20, 0.15);
  }

  .apk-download-btn svg.apk-icon {
    width: 18px;
    height: 18px;
  }
}

/* ── Info Pages Navigation Overrides ── */
.info-nav {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 80px !important;
  z-index: 999999 !important;
  background: #0f0f0f !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  display: flex !important;
  align-items: center !important;
  pointer-events: auto !important;
}

.info-nav * {
  pointer-events: auto !important;
}

.info-nav .nav-content {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
  height: 100% !important;
  padding: 0 20px !important;
}

.info-nav .nav-actions {
  display: flex !important;
  gap: 12px !important;
  align-items: center !important;
}

.info-nav .apk-download-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  background: rgba(229, 9, 20, 0.15) !important;
  border: 1px solid rgba(229, 9, 20, 0.3) !important;
  color: white !important;
  padding: 0 16px !important;
  border-radius: 20px !important;
  text-decoration: none !important;
  font-family: 'Outfit', sans-serif !important;
  font-weight: 600 !important;
  font-size: 0.85rem !important;
  height: 38px !important;
  cursor: pointer !important;
  position: static !important;
}

.info-nav .apk-download-btn:hover {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 4px 15px rgba(229, 9, 20, 0.3) !important;
}

.info-nav .btn-primary {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: linear-gradient(135deg, var(--primary), #ff3d47) !important;
  color: white !important;
  padding: 0 16px !important;
  border-radius: 20px !important;
  font-weight: 600 !important;
  font-size: 0.85rem !important;
  height: 38px !important;
  text-decoration: none !important;
  cursor: pointer !important;
}

@media (max-width: 768px) {
  .info-nav {
    height: 70px !important;
  }

  .info-nav .nav-content {
    padding: 0 12px !important;
  }

  .info-nav .apk-download-btn,
  .info-nav .btn-primary {
    height: 34px !important;
    padding: 0 12px !important;
    font-size: 0.8rem !important;
  }

  .info-nav .nav-actions {
    gap: 8px !important;
  }
}

/* AV Avatar / Icon Perfect Circle */
.logo-img,
.avatar,
.user-avatar,
.av-avatar,
.av-icon,
.avatar-icon {
  width: 32px;
  height: 32px;
  border-radius: 50% !important;
  object-fit: cover !important;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Native Ads: 2 in a Row on Mobile Devices ── */
@media (max-width: 768px) {

  /* Enforce flex-row wrap on the wrapper to keep two separate ad divs side-by-side */
  .ad-native-wrapper {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: flex-start !important;
    gap: 8px !important;
    padding: 0 4px !important;
  }

  .ad-native-wrapper>div {
    flex: 1 1 calc(50% - 8px) !important;
    max-width: calc(50% - 8px) !important;
    width: calc(50% - 8px) !important;
    min-height: 100px !important;
  }

  /* Ensure the ad container itself spans full width (not restricted to 50%) */
  .ad-native-wrapper>div[id^="container-"] {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Force internal layout of a single native ad widget to show as a 2-column grid */
  .ad-native-wrapper [id^="container-"]>div {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .ad-native-wrapper [id^="container-"]>div>div {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }
}

/* ── Close Modal and Back Button Video Player Positioning ── */

/* In laptop view, hide the close-modal button when watching the video */
@media (min-width: 769px) {
  .modal-overlay.watching #close-modal {
    display: none !important;
  }
}

/* In mobile view, place close-modal and back-to-details outside the video player at the top */
@media (max-width: 768px) {
  .modal-overlay.watching .modal-hero {
    margin-top: 50px !important;
    height: auto !important;
    max-height: 42vh !important;
    aspect-ratio: 16 / 9 !important;
    flex-shrink: 0 !important;
    overflow: hidden !important;
  }

  .modal-overlay.watching .modal-back-btn {
    position: absolute !important;
    top: -42px !important;
    left: 10px !important;
    background: #1a1a1a !important;
    border-radius: 20px !important;
    z-index: 10010 !important;
    height: 34px !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 12px !important;
    font-size: 0.8rem !important;
  }

  .modal-overlay.watching .modal-close {
    position: absolute !important;
    top: 8px !important;
    right: 10px !important;
    background: #1a1a1a !important;
    border-radius: 50% !important;
    z-index: 10010 !important;
    width: 34px !important;
    height: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
}

/* Responsive scale for video player ad overlay card so it never clips on mobile */
.player-ad-card {
  transform-origin: center center;
  max-width: 95vw !important;
}

@media (max-width: 480px),
(max-height: 480px) {
  .player-ad-card {
    transform: scale(0.8) !important;
  }
}

@media (max-width: 360px),
(max-height: 380px) {
  .player-ad-card {
    transform: scale(0.68) !important;
  }
}

@media (max-height: 280px) {
  .player-ad-card {
    transform: scale(0.55) !important;
  }
}

/* Core Web Vitals Optimization: Skip rendering offscreen elements until needed */
.main-footer {
  content-visibility: auto;
  contain-intrinsic-size: 300px;
}

.ssr-seo-details {
  content-visibility: auto;
  contain-intrinsic-size: 500px;
}

/* Schedule & Day Badges */
.schedule-badge {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: var(--primary);
  color: white;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.58rem;
  font-weight: 700;
  z-index: 2;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  max-width: calc(100% - 20px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
  .schedule-badge {
    bottom: 4px;
    left: 4px;
    padding: 1px 3px;
    font-size: 0.48rem;
  }

  .day-badge {
    top: 6px;
    right: 6px;
    padding: 2px 5px;
    font-size: 0.52rem;
  }
}

/* ── Recently Viewed: smaller on mobile ──────────────────────────────────── */
@media (max-width: 768px) {
  #recently-viewed-section {
    margin-bottom: 1rem !important;
  }

  #recently-viewed-section .section-title {
    font-size: 0.9rem;
    margin-bottom: 0;
  }

  #recently-viewed-grid {
    gap: 0.9rem !important;
    margin-top: 0.9rem !important;
    padding-bottom: 0.6rem !important;
  }

  /* Shrink each card in the row */
  #recently-viewed-grid .movie-card,
  .category-row-scroll .movie-card {
    width: 110px !important;
    min-width: 110px !important;
    flex: 0 0 110px !important;
  }

  #recently-viewed-grid .movie-card img,
  .category-row-scroll .movie-card img {
    width: 110px !important;
    height: 165px !important;
  }

  #recently-viewed-grid .movie-title,
  .category-row-scroll .movie-title {
    font-size: 0.72rem !important;
  }

  #recently-viewed-grid .movie-card-info,
  .category-row-scroll .movie-card-info {
    padding: 0.35rem !important;
  }
}

/* Global Selection Reset for Clickable/Interactive Elements */
button,
select,
option,
a,
label,
.tab-btn,
.category-filter-btn,
.filter-chip,
.filter-dropdown-select,
[role="button"],
[role="tab"],
[role="menuitem"],
.episode-badge,
.schedule-badge,
.day-badge,
.type-badge,
.logo,
.logo *,
.logo-text,
.nav-link,
#custom-episode-selectors *,
.episode-selector,
.server-btn,
.btn-primary,
.btn-secondary {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

/* Modal Body Back Button */
.modal-body-back-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 9999;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
  padding: 0;
  flex-shrink: 0;
}

.modal-body-back-btn:hover {
  background: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(229, 9, 20, 0.4);
}

@media (max-width: 768px) {
  .modal-body-back-btn {
    top: 10px;
    left: 10px;
    width: 36px;
    height: 36px;
  }
}

/* Hide back button when watching the video player */
.modal-overlay.watching .modal-body-back-btn {
  display: none !important;
}


/* ═══════════════════════════════════════════════════════════════════════════
   Third-Party Vignette / Ad Popup Protection
   Prevents our global CSS resets from breaking injected ad styles on mobile.
   The vignette script (n6wxm.com) injects its own HTML/CSS into <body>.
   Our * reset (margin/padding/box-sizing) and overflow-x:hidden on body
   can strip those styles — especially on mobile browsers.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Isolate any high-z-index fixed overlay from our resets */
body>div[style*="z-index: 2147483647"],
body>div[style*="z-index:2147483647"],
body>div[style*="position: fixed"][style*="z-index"],
body>div[style*="position:fixed"][style*="z-index"] {
  all: revert !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif !important;
}

/* Ensure vignette popup buttons don't get our margin/padding reset */
body>div[style*="z-index: 2147483647"] button,
body>div[style*="z-index: 2147483647"] a,
body>div[style*="z-index: 2147483647"] div,
body>div[style*="z-index: 2147483647"] span,
body>div[style*="z-index: 2147483647"] p,
body>div[style*="z-index: 2147483647"] img,
body>div[style*="position: fixed"][style*="z-index"] button,
body>div[style*="position: fixed"][style*="z-index"] a,
body>div[style*="position: fixed"][style*="z-index"] div,
body>div[style*="position: fixed"][style*="z-index"] img {
  all: revert !important;
}

/* Mobile: fix stacking context issue caused by overflow-x:hidden on body */
@media (max-width: 768px) {

  /* Re-allow fixed positioning to work correctly on mobile for ad overlays */
  body>div[style*="position: fixed"],
  body>div[style*="position:fixed"] {
    -webkit-transform: none !important;
    transform: none !important;
    -webkit-touch-callout: default !important;
    pointer-events: auto !important;
  }
}

/* ── Search Suggestions Dropdown ─────────────────────────────────────────── */
.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  background: rgba(15, 15, 15, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  z-index: 9999;
  max-height: 350px;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  padding: 8px 0;
}

.search-suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  color: var(--text-muted);
}

.search-suggestion-item:hover,
.search-suggestion-item:focus {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.search-suggestion-item img {
  width: 32px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  background: #181524;
}

.search-suggestion-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-suggestion-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-suggestion-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Mobile Bottom Nav */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  top: auto;
  left: 0;
  width: 100%;
  background: rgba(20, 20, 25, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  padding: 6px 0;
  padding-bottom: env(safe-area-inset-bottom, 6px);
  justify-content: space-around;
  align-items: center;
}

.mobile-bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 500;
  gap: 3px;
  transition: all 0.3s ease;
}

.mobile-bottom-nav .nav-item i {
  font-size: 1.05rem;
}

.mobile-bottom-nav .nav-item.active {
  color: var(--primary);
}

.mobile-bottom-nav .nav-item:active {
  transform: scale(0.9);
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
  }

  /* Add padding to body so content isn't hidden behind the nav */
  body {
    padding-bottom: 50px;
  }
}




@media (max-width: 768px) {
  #ad-webview-container {
    height: 75% !important;
    max-height: 500px !important;
  }
}

/* ── Mobile & Tablet: Season / Episode / Server dropdowns chote ── */
@media (max-width: 1024px) {
  #custom-episode-selectors {
    gap: 4px !important;
    flex-wrap: wrap !important;
  }

  #custom-episode-selectors select,
  #player-server-select,
  #modal-lang-select {
    padding: 3px 6px !important;
    font-size: 0.7rem !important;
    height: 28px !important;
    min-width: 0 !important;
    max-width: 110px !important;
    border-radius: 4px !important;
  }

  /* Player control bar compact on mobile/tablet */
  #player-control-bar {
    padding: 6px 10px !important;
    min-height: 38px !important;
    gap: 6px !important;
  }
}


/* ═══════════════════════════════════════════════════════════
   CineStream Custom Dropdown  (.cs-select)
   List is positioned by JS (position:fixed), only button needs CSS here
   ═══════════════════════════════════════════════════════════ */

.cs-select {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
  flex-shrink: 0;
}

/* ── Trigger button ── */
.cs-select-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(22, 22, 22, 0.97);
  border: 1.5px solid rgba(229, 9, 20, 0.5);
  border-radius: 10px;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 9px 14px;
  cursor: pointer;
  white-space: nowrap;
  min-width: 120px;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  letter-spacing: 0.01em;
}

.cs-select-btn .cs-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.cs-select-btn .cs-arrow {
  font-size: 0.7rem;
  color: #e50914;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

/* ── Open state ── */
.cs-select.open .cs-select-btn {
  border-color: #e50914;
  background: rgba(229, 9, 20, 0.12);
  box-shadow: 0 0 0 2px rgba(229,9,20,0.2);
}

.cs-select.open .cs-arrow {
  transform: rotate(180deg);
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .cs-select-btn {
    font-size: 0.82rem;
    padding: 8px 12px;
    min-width: 105px;
  }
}

/* ── Custom Scrollbar for Dropdown (All Devices) ── */
.cs-select-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(229, 9, 20, 0.7) transparent;
}
.cs-select-list::-webkit-scrollbar {
  width: 5px;
  background: transparent;
}
.cs-select-list::-webkit-scrollbar-track {
  background: rgba(15, 15, 15, 0.5);
  border-radius: 10px;
  margin: 6px 0;
}
.cs-select-list::-webkit-scrollbar-thumb {
  background: rgba(229, 9, 20, 0.7);
  border-radius: 10px;
}
.cs-select-list::-webkit-scrollbar-thumb:hover {
  background: rgba(229, 9, 20, 1);
}
/* Search Page Overlay */
.search-page-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-dark);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(15px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

.search-page-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.search-page-header {
  display: flex;
  align-items: center;
  padding: 15px;
  background: rgba(15, 15, 15, 0.95);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.search-page-back-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.2rem;
  padding: 10px;
  cursor: pointer;
  margin-right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-page-form {
  display: flex;
  flex: 1;
  position: relative;
  align-items: center;
}

.search-page-form input {
  width: 100%;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 12px 80px 12px 20px;
  border-radius: 25px;
  color: white;
  outline: none;
  font-size: 1rem;
}

.search-page-form input:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.1);
}

.search-page-form input[type="search"]::-webkit-search-cancel-button {
  display: none;
  -webkit-appearance: none;
}

.search-page-submit {
  position: absolute;
  right: 15px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 10px;
}

.search-page-submit i, .search-page-form #search-clear {
  font-size: 1rem;
}

.search-page-form #search-clear {
  position: absolute;
  right: 60px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 10px;
}

.search-page-form input {
  padding-right: 100px;
}

@media (min-width: 768px) {
  .search-page-submit i, .search-page-form #search-clear {
    font-size: 1.1rem;
  }
  .search-page-submit {
    right: 20px;
  }
  .search-page-form #search-clear {
    right: 75px;
  }
  .search-page-form input {
    padding-right: 115px;
  }
}

.search-page-content {
  padding: 20px 15px;
  flex: 1;
}

.search-suggestions-page {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0 -15px 20px -15px;
}


/* ── Desktop watching layout: Sidebar for episodes ── */
@media (min-width: 1025px) {
  .modal-overlay.watching .modal-content {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: wrap;
    align-items: flex-start;
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
  }
  .modal-overlay.watching .modal-hero {
    width: calc(100% - 350px) !important;
    height: 100vh !important;
    height: 100dvh !important;
    flex: none !important;
  }
  .modal-overlay.watching #player-control-bar {
    width: 350px !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border-left: 1px solid rgba(255,255,255,0.1);
    border-bottom: none !important;
    overflow-y: auto !important;
    padding: 16px !important;
    padding-bottom: 60px !important;
    box-sizing: border-box !important;
  }
  .modal-overlay.watching #responsive-ad-container {
    display: none !important;
  }
  .modal-overlay.watching .modal-body {
    display: none !important;
  }
  .modal-overlay.watching #horizontal-episode-list {
    display: flex !important;
    flex-wrap: wrap !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    justify-content: flex-start;
    gap: 8px !important;
    width: 100% !important;
  }

  .all-ep-box {
    display: none !important;
  }
}

/* ── Mobile & Tablet watching layout: Episode boxes wrap & scroll ── */
@media (max-width: 1024px) {
  .modal-overlay.watching .modal-content {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
  }

  .modal-overlay.watching .modal-hero {
    margin-top: 50px !important;
    width: 100% !important;
    height: auto !important;
    max-height: 42vh !important;
    aspect-ratio: 16 / 9 !important;
    flex-shrink: 0 !important;
    overflow: hidden !important;
  }

  .modal-overlay.watching #player-control-bar {
    flex: 1 1 0 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    padding: 10px 14px 10px !important;
    box-sizing: border-box !important;
  }

  .modal-overlay.watching #horizontal-episode-list {
    display: flex !important;
    flex-wrap: wrap !important;
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    gap: 8px !important;
    row-gap: 8px !important;
    justify-content: flex-start !important;
    align-content: flex-start !important;
    width: 100% !important;
    padding-bottom: 50px !important;
    box-sizing: border-box !important;
  }

  .modal-overlay.watching #horizontal-episode-list .ep-box {
    flex-shrink: 0;
    padding: 7px 14px !important;
    font-size: 0.85rem !important;
    border-radius: 8px !important;
    text-align: center;
  }

  #horizontal-episode-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(229, 9, 20, 0.4) transparent;
  }
}

.ep-box {
  padding: 8px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: rgba(255,255,255,0.8);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.ep-box.active {
  background: rgba(229,9,20,0.2);
  border-color: #e50914;
  color: #e50914;
  font-weight: 700;
}
.ep-box:hover:not(.active) {
  background: rgba(255,255,255,0.1);
}

.modal-overlay.watching #responsive-ad-container {
  display: none !important;
}

/* Never show the FAQ/SEO block inside the player layout */
.modal-overlay.watching #modal-seo-content {
  display: none !important;
}

