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

body {
  margin: 0;
  background: #050509;
  color: #fff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

/* TOP NAV */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent);
  z-index: 20;
}

.logo {
  font-weight: 700;
  font-size: 1.4rem;
  color: #e50914;
  margin-right: 24px;
}

/* Desktop tabs */
.nav-tabs-wrap {
  display: flex;
  gap: 8px;
}

.nav-tab {
  background: transparent;
  border: none;
  color: #ccc;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.nav-tab.active {
  background: #e50914;
  color: #fff;
}

/* Search */
.search-wrap {
  margin-left: auto;
}

#searchInput {
  background: rgba(0, 0, 0, 0.7);
  border-radius: 999px;
  border: 1px solid #333;
  padding: 6px 12px;
  color: #fff;
  min-width: 200px;
}

/* HAMBURGER BUTTON */
.menu-btn {
  display: none;
  margin-left: 10px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  align-items: center;
  justify-content: center;
}

.menu-icon {
  width: 18px;
  height: 12px;
  position: relative;
  display: inline-block;
  border-top: 2px solid #fff;
  border-radius: 999px;
}

.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #fff;
  border-radius: 999px;
}

.menu-icon::before {
  top: 0;
}

.menu-icon::after {
  bottom: 0;
}

/* MOBILE MENU DRAWER */
.menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 40;
}

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

.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(320px, 86vw);
  background: #0e0e12;
  border-left: 1px solid #222;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  z-index: 45;
  display: flex;
  flex-direction: column;
}

.mobile-menu.open {
  transform: translateX(0);
}

.mobile-menu-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid #1b1b1f;
}

.mobile-menu-title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.menu-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mobile-menu-body {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.menu-item {
  width: 100%;
  text-align: left;
  padding: 12px 12px;
  border-radius: 10px;
  border: 1px solid #222;
  background: #111;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
}

.menu-item.active {
  border-color: rgba(229, 9, 20, 0.9);
  box-shadow: 0 0 0 1px rgba(229, 9, 20, 0.35) inset;
}

/* HERO */
.hero {
  position: relative;
  height: 70vh;
  min-height: 420px;
  color: #fff;
  margin-bottom: 24px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.7);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #050509 0%, transparent 60%);
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 120px 48px 48px;
  max-width: 640px;
}

.hero-title {
  font-size: 2.6rem;
  margin: 0 0 8px;
}

.hero-meta {
  font-size: 0.95rem;
  color: #ccc;
  margin-bottom: 12px;
}

.hero-overview {
  font-size: 0.95rem;
  color: #ddd;
  max-height: 4.5em;
  overflow: hidden;
  margin-bottom: 16px;
}

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

/* BUTTONS */
.btn {
  border-radius: 4px;
  border: none;
  padding: 8px 16px;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-primary {
  background: #e50914;
  color: #fff;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid #555;
  color: #fff;
}

/* ROWS */
main {
  padding: 72px 24px 48px;
}

.row {
  margin-bottom: 24px;
}

.row h2 {
  font-size: 1.2rem;
  margin: 0 0 8px;
}

.row-cards {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  touch-action: pan-x;
}

.row-cards::-webkit-scrollbar {
  height: 6px;
}

.row-cards::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 999px;
}

/* CARDS */
.card {
  position: relative;
  min-width: 140px;
  max-width: 140px;
  background: #111;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  scroll-snap-align: start;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.card-img-wrap {
  width: 100%;
  aspect-ratio: 2 / 3;
  background: #222;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 6px;
}

.card-title {
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* WATCHLIST QUICK REMOVE BUTTON */
.card-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.card-remove:hover {
  background: rgba(229, 9, 20, 0.85);
}

/* SEARCH */
.search-row {
  margin-top: 16px;
}

.search-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.search-count {
  font-size: 0.85rem;
  color: #aaa;
}

.search-empty {
  font-size: 0.9rem;
  color: #aaa;
  margin-bottom: 8px;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-backdrop.open {
  display: flex;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  align-items: flex-start;
  padding: 72px 12px 24px;
}

.modal {
  background: #111;
  border-radius: 8px;
  max-width: 900px;
  width: 100%;
  max-height: calc(100vh - 96px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.modal-body {
  display: flex;
  gap: 16px;
  padding: 16px;
  min-height: 0;
}

.modal-left {
  flex: 0 0 220px;
}

.modal-right {
  flex: 1;
  min-width: 0;
}

.modal-poster {
  width: 100%;
  border-radius: 6px;
  display: block;
}

.modal-title {
  margin: 0 0 4px;
  font-size: 1.4rem;
}

.modal-meta {
  font-size: 0.9rem;
  color: #aaa;
  margin-bottom: 8px;
}

.modal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.info-chip {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: #222;
}

.modal-overview {
  font-size: 0.9rem;
  color: #ddd;
  margin-bottom: 8px;
}

.modal-runtime {
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.season-box {
  border-top: 1px solid #222;
  padding-top: 8px;
  margin-top: 8px;
}

#seasonSelect {
  background: #111;
  color: #fff;
  border-radius: 4px;
  border: 1px solid #333;
  padding: 4px 8px;
  margin-bottom: 8px;
}

.episode-list {
  max-height: 200px;
  overflow-y: auto;
  border-radius: 4px;
  border: 1px solid #222;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.episode-item {
  padding: 6px 8px;
  font-size: 0.85rem;
  border-bottom: 1px solid #222;
  cursor: pointer;
}

.episode-item:hover {
  background: #1b1b1b;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 999px;
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* PLAYER MODALS */
.modal-player {
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.player-frame-wrap {
  position: relative;
  padding-top: 56.25%;
  background: #000;
}

.player-frame-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .top-nav {
    padding: 0 12px;
  }

  .logo {
    font-size: 1.15rem;
    margin-right: 12px;
  }

  /* hide desktop tabs, show hamburger */
  .nav-tabs-wrap {
    display: none;
  }

  .menu-btn {
    display: inline-flex;
  }

  #searchInput {
    min-width: 140px;
  }

  main {
    padding: 72px 12px 48px;
  }

  .hero-content {
    padding: 96px 16px 32px;
  }

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

  .modal-body {
    flex-direction: column;
  }

  .modal-left {
    flex: 0 0 auto;
    max-width: 280px;
  }
}
