* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  background: #000;
  color: #fff;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
}

/* UTIL */
.hidden {
  display: none;
}
.player-section {
  margin-top: 1.8rem;
  padding: 1rem 1.2rem 1.3rem;
  background: #050516;
  border-radius: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.player-header h2 {
  font-size: 1rem;
  margin-bottom: 0.15rem;
}

.player-header p {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* 16:9 container */
.player-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  border-radius: 0.6rem;
  background: #000;
  margin-bottom: 0.5rem;
}

.player-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.player-debug {
  margin-top: 0.35rem;
  font-size: 0.7rem;
  opacity: 0.75;
  max-height: 80px;
  overflow: auto;
  background: transparent;
}

/* Ghost button style for "Close" */
.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* NAVBAR */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent);
  padding: 0.75rem 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #e50914;
}

.nav-links {
  display: flex;
  gap: 1rem;
  font-size: 0.95rem;
}

.nav-links a {
  opacity: 0.8;
}

.nav-links a.active,
.nav-links a:hover {
  opacity: 1;
  font-weight: 600;
}

.profile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: linear-gradient(135deg, #e50914, #f5a623);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

/* HERO / SEARCH SECTION */
.hero {
  padding: 4rem 5vw 1rem;
  background: radial-gradient(circle at top, #222 0, #000 60%);
}

.hero-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.hero-sub {
  font-size: 0.95rem;
  opacity: 0.8;
  margin-bottom: 1.25rem;
}

.search-bar {
  display: flex;
  max-width: 520px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.75);
}

.search-bar input {
  flex: 1;
  padding: 0.8rem 1rem;
  border: none;
  background: transparent;
  color: #fff;
  outline: none;
  font-size: 0.95rem;
}

.search-bar button {
  padding: 0.8rem 1.2rem;
  background: #e50914;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
}

.search-bar button:hover {
  background: #f40612;
}

.hero-hint {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 0.5rem;
}

/* RESULTS SECTION */
main {
  padding: 1.5rem 5vw 3rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.section-header span {
  font-size: 0.85rem;
  opacity: 0.8;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.9rem;
}

.card {
  background: #141414;
  border-radius: 0.35rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.card:hover {
  transform: scale(1.05) translateY(-4px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.8);
  z-index: 2;
}

.card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: #222;
}

.card-body {
  padding: 0.5rem 0.55rem 0.6rem;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.card-title {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  opacity: 0.8;
}

.card-id {
  font-size: 0.72rem;
  opacity: 0.75;
}

.card-actions {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.pill {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 0.05rem 0.5rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.btn-small {
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  border-radius: 0.25rem;
  background: #e50914;
  color: #fff;
  font-weight: 600;
}

.btn-small:hover {
  background: #f40612;
}

.empty-state {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-top: 1rem;
}

/* TV CONTROLS (seasons + episodes) */
.tv-controls {
  margin-top: 1.8rem;
  padding: 1rem 1.2rem 1.3rem;
  background: #050516;
  border-radius: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 0.9rem;
}

.tv-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.tv-header p {
  font-size: 0.8rem;
  opacity: 0.75;
}

.tv-season-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  font-size: 0.9rem;
}

.tv-season-row label {
  opacity: 0.85;
}

#seasonSelect {
  background: #181827;
  border-radius: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.4rem 0.8rem;
  color: #fff;
  font-size: 0.9rem;
}

#seasonSelect:focus {
  outline: none;
  border-color: #a855f7;
}

.episodes-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.episode-btn {
  background: #181827;
  border-radius: 0.4rem;
  padding: 0.5rem 0.75rem;
  min-width: 140px;
  text-align: left;
  font-size: 0.85rem;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease,
    transform 0.15s ease;
}

.episode-btn:hover {
  background: #26263a;
  transform: translateY(-1px);
}

.episode-btn.active {
  background: #a855f7;
  border-color: #c4b5fd;
}

/* SMALL SCREENS */
@media (max-width: 600px) {
  header {
    padding-inline: 4vw;
  }

  .hero {
    padding-inline: 4vw;
  }

  main {
    padding-inline: 4vw;
  }

  .nav-links {
    display: none;
  }

  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .tv-controls {
    padding-inline: 0.9rem;
  }
}

/* Container used for home rows (Popular sections) */
.home-section {
  margin-bottom: 1.6rem;
}

.home-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.2rem 0 0.4rem;
}

/* Wrapper with arrows */
.home-row-wrapper {
  position: relative;
}

/* Horizontal row of cards */
.home-row {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  scroll-behavior: smooth;
}

/* Small scrollbar for rows */
.home-row::-webkit-scrollbar {
  height: 6px;
}
.home-row::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}
.home-row::-webkit-scrollbar-track {
  background: #111;
}

/* Cards inside rows: fixed width */
.home-row .card {
  flex: 0 0 160px;
}

/* Slider buttons */
.home-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 80px;
  border-radius: 4px;
  border: none;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.85),
    rgba(0, 0, 0, 0)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.6rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 5;
}

.home-nav-btn-right {
  right: 0;
  background: linear-gradient(
    to left,
    rgba(0, 0, 0, 0.85),
    rgba(0, 0, 0, 0)
  );
}

.home-nav-btn-left {
  left: 0;
}

.home-row-wrapper:hover .home-nav-btn {
  opacity: 1;
  pointer-events: auto;
}

/* MOVIE / TV badges (if not already added) */
.pill-movie {
  background: #e50914;
  border-color: #e50914;
  color: #fff;
}

.pill-tv {
  background: #8b5cf6;
  border-color: #8b5cf6;
  color: #fff;
}
