/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: #111; color: #e0e0e0; min-height: 100vh; }
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font: inherit; border: none; background: none; }

/* ── Variables ───────────────────────────────────────────────── */
:root {
  --red:        #e50914;
  --red-dark:   #b0060f;
  --bg:         #111111;
  --bg2:        #1a1a1a;
  --bg3:        #222222;
  --bg4:        #2a2a2a;
  --border:     #333;
  --text:       #e0e0e0;
  --muted:      #888;
  --radius:     6px;
}

/* ── Header ──────────────────────────────────────────────────── */
.site-header {
  background: #0d0d0d;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.site-header .wrap {
  max-width: 1300px; margin: 0 auto; padding: 0 20px;
  height: 56px; display: flex; align-items: center; gap: 24px;
}
.logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logo svg { width: 28px; height: 28px; }
.logo span.logo-text { font-size: 1.2rem; font-weight: 700; color: #fff; letter-spacing: -0.3px; line-height: 1; }
.logo .logo-red { color: var(--red); font-weight: 700; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: #bbb; font-size: 0.85rem; font-weight: 500;
  padding: 6px 12px; border-radius: var(--radius);
  transition: color .15s, background .15s;
}
.nav a:hover, .nav a.active { color: #fff; background: var(--bg3); }

.header-search {
  margin-left: auto; display: flex; align-items: center;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; flex: 0 1 280px;
}
.header-search input {
  flex: 1; background: none; border: none; outline: none;
  padding: 8px 12px; color: #fff; font-size: 0.85rem;
}
.header-search input::placeholder { color: var(--muted); }
.header-search button {
  padding: 8px 12px; color: var(--muted); display: flex;
  transition: color .15s;
}
.header-search button:hover { color: var(--red); }
.header-search svg { width: 16px; height: 16px; }

.burger { display: none; flex-direction: column; gap: 5px; padding: 6px; margin-left: auto; }
.burger span { display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px; }

/* ── Wrap ────────────────────────────────────────────────────── */
.wrap { max-width: 1300px; margin: 0 auto; padding: 0 20px; }
.main-wrap { padding: 28px 0 60px; min-height: calc(100vh - 56px); }

/* ── Trending section ────────────────────────────────────────── */
.trending-section { padding: 0; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.section-head h2 {
  font-size: 1rem; font-weight: 700; letter-spacing: 1.5px;
  color: #fff; border-left: 3px solid var(--red); padding-left: 10px;
}
.tab-btns { display: flex; gap: 8px; }
.tab-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--radius);
  font-size: 0.82rem; font-weight: 600;
  background: var(--bg3); color: var(--muted);
  border: 1px solid var(--border);
  transition: all .15s;
}
.tab-btn svg { width: 14px; height: 14px; }
.tab-btn.active { background: var(--red); color: #fff; border-color: var(--red); }
.tab-btn:hover:not(.active) { color: #fff; border-color: #555; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Card Grid ───────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.card { display: flex; flex-direction: column; }
.card-img {
  position: relative; aspect-ratio: 2/3;
  background: var(--bg3); border-radius: var(--radius); overflow: hidden;
}
.card-img img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .3s;
}
.card:hover .card-img img { transform: scale(1.04); }
.card-type {
  position: absolute; top: 6px; left: 6px;
  font-size: 0.6rem; font-weight: 700; padding: 2px 6px;
  border-radius: 3px; text-transform: uppercase; letter-spacing: .5px;
}
.card-type.movie { background: var(--red); color: #fff; }
.card-type.tv    { background: #1565c0;   color: #fff; }
.card-rating {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(0,0,0,.75); font-size: 0.7rem; font-weight: 600;
  padding: 2px 6px; border-radius: 3px; color: #ffd700;
}
.card-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.5); opacity: 0; transition: opacity .2s;
}
.card:hover .card-play { opacity: 1; }
.card-play svg { width: 44px; height: 44px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.6)); }
.card-meta { padding: 7px 2px 4px; }
.card-title {
  font-size: 0.82rem; font-weight: 600; color: #ddd;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px;
}
.card-year { font-size: 0.72rem; color: var(--muted); }

.see-all-wrap { margin-top: 24px; text-align: center; }
.see-all-btn {
  display: inline-block; padding: 9px 28px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); color: #ccc; font-size: 0.85rem;
  font-weight: 500; transition: all .15s;
}
.see-all-btn:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* ── Watch Page ──────────────────────────────────────────────── */
.watch-page .wrap { max-width: 960px; }
.watch-title {
  font-size: 1.6rem; font-weight: 700; color: #fff;
  margin-bottom: 18px; text-align: center;
}

/* Player box */
.player-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 28px;
}
.player-frame {
  position: relative; width: 100%; aspect-ratio: 16/9; background: #000;
}
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }

/* Server selector */
.server-selector {
  padding: 14px 16px; border-top: 1px solid var(--border);
  background: var(--bg3);
}
.server-label {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted); margin-bottom: 10px;
}
.server-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.server-btn {
  padding: 6px 20px; border-radius: var(--radius);
  font-size: 0.82rem; font-weight: 600;
  background: var(--bg4); border: 1px solid var(--border); color: #bbb;
  transition: all .15s;
}
.server-btn:hover { color: #fff; border-color: #555; }
.server-btn.active { background: var(--red); border-color: var(--red); color: #fff; }

/* Episode controls */
.episode-controls {
  padding: 14px 16px; border-top: 1px solid var(--border);
}

/* Season tabs */
.season-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px;
}
.season-tab {
  padding: 5px 14px; border-radius: var(--radius);
  font-size: 0.78rem; font-weight: 600;
  background: var(--bg4); border: 1px solid var(--border); color: #bbb;
  transition: all .15s;
}
.season-tab:hover { color: #fff; border-color: #555; }
.season-tab.active { background: #1565c0; border-color: #1565c0; color: #fff; }

/* Episode buttons */
.ep-btns {
  display: flex; flex-wrap: wrap; gap: 6px;
  max-height: 180px; overflow-y: auto;
  padding-right: 4px;
}
.ep-btns::-webkit-scrollbar { width: 4px; }
.ep-btns::-webkit-scrollbar-track { background: var(--bg3); }
.ep-btns::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
.ep-btn {
  padding: 5px 12px; border-radius: var(--radius);
  font-size: 0.78rem; font-weight: 500;
  background: var(--bg4); border: 1px solid var(--border); color: #bbb;
  transition: all .15s; white-space: nowrap;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.ep-btn:hover { color: #fff; border-color: #555; }
.ep-btn.active { background: var(--red); border-color: var(--red); color: #fff; }

/* Watch info */
.watch-info {
  display: flex; gap: 24px; margin-bottom: 36px;
}
.watch-poster {
  flex-shrink: 0; width: 160px;
}
.watch-poster img {
  width: 100%; border-radius: var(--radius);
  border: 1px solid var(--border);
}
.watch-meta { flex: 1; }
.meta-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.meta-tag {
  padding: 3px 10px; border-radius: 4px;
  font-size: 0.78rem; font-weight: 600;
  background: var(--bg3); border: 1px solid var(--border); color: #ccc;
}
.meta-tag.rating { color: #ffd700; }
.meta-tag.ended  { color: #f87171; border-color: #f87171; background: rgba(248,113,113,.1); }
.meta-tag.running { color: #4ade80; border-color: #4ade80; background: rgba(74,222,128,.1); }
.genre-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.genre-tag {
  padding: 3px 10px; border-radius: 20px; font-size: 0.75rem;
  background: rgba(229,9,20,.12); border: 1px solid rgba(229,9,20,.3); color: #f88;
}
.watch-overview {
  font-size: 0.88rem; line-height: 1.7; color: #aaa; margin-bottom: 14px;
}
.credit { font-size: 0.82rem; color: #999; margin-bottom: 6px; }
.credit span { color: #ccc; font-weight: 600; }
.imdb-btn {
  display: inline-block; margin-top: 12px; padding: 7px 18px;
  background: #f5c518; color: #000; font-size: 0.8rem; font-weight: 700;
  border-radius: var(--radius); transition: opacity .15s;
}
.imdb-btn:hover { opacity: .85; }

/* ── Browse pages ────────────────────────────────────────────── */
.browse-header { margin-bottom: 24px; }
.browse-header h1 { font-size: 1.4rem; font-weight: 700; color: #fff; margin-bottom: 14px; }
.filter-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-tab {
  padding: 6px 16px; border-radius: var(--radius); font-size: 0.82rem; font-weight: 600;
  background: var(--bg3); border: 1px solid var(--border); color: #bbb;
  transition: all .15s;
}
.filter-tab:hover { color: #fff; border-color: #555; }
.filter-tab.active { background: var(--red); border-color: var(--red); color: #fff; }
.browse-sub { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.browse-sub a { color: #7ab3f0; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 36px 0 0;
}
.page-btn {
  padding: 8px 20px; border-radius: var(--radius);
  background: var(--bg3); border: 1px solid var(--border);
  color: #ccc; font-size: 0.85rem; font-weight: 500;
  transition: all .15s;
}
.page-btn:hover { background: var(--red); border-color: var(--red); color: #fff; }
.page-info { font-size: 0.82rem; color: var(--muted); }

/* ── Search page ─────────────────────────────────────────────── */
.search-bar-section { padding: 24px 0 0; }
.search-bar-section .wrap { max-width: 700px; }
.search-bar-form {
  display: flex; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.search-bar-form input {
  flex: 1; background: none; border: none; outline: none;
  padding: 12px 16px; color: #fff; font-size: 0.95rem;
}
.search-bar-form input::placeholder { color: var(--muted); }
.search-bar-form button {
  padding: 12px 20px; background: var(--red); color: #fff;
  font-weight: 600; font-size: 0.9rem; transition: background .15s;
}
.search-bar-form button:hover { background: var(--red-dark); }

.search-page-header { padding: 20px 0 16px; }
.search-page-header h1 { font-size: 1.1rem; color: #ccc; font-weight: 500; }
.query-hl { color: #fff; font-weight: 700; }
.results-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--muted);
  padding: 20px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 16px;
}

/* ── Related ─────────────────────────────────────────────────── */
.related-section { margin-top: 40px; }
.section-title {
  font-size: 0.9rem; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: #fff;
  border-left: 3px solid var(--red); padding-left: 10px;
  margin-bottom: 16px;
}

/* ── Misc ────────────────────────────────────────────────────── */
.err {
  padding: 16px; background: rgba(248,113,113,.08);
  border: 1px solid rgba(248,113,113,.2); border-radius: var(--radius);
  color: #f87171; font-size: 0.85rem;
}
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; padding: 80px 0; color: var(--muted); text-align: center;
}
.empty-state svg { width: 48px; height: 48px; opacity: .3; }
.no-embed-msg {
  padding: 20px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--muted); text-align: center;
  margin-bottom: 24px;
}

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  background: #0d0d0d; margin-top: 60px;
}
.site-footer .wrap {
  max-width: 1300px; margin: 0 auto; padding: 20px;
  text-align: center;
}
.site-footer p { font-size: 0.78rem; color: var(--muted); }
.site-footer a { color: #7ab3f0; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav { display: none; }
  .nav.open {
    display: flex; flex-direction: column; align-items: flex-start;
    position: fixed; top: 56px; left: 0; right: 0;
    background: #0d0d0d; padding: 12px 20px;
    border-bottom: 1px solid var(--border); z-index: 99;
    gap: 2px;
  }
  .burger { display: flex; }
  .header-search { display: none; }
  .watch-info { flex-direction: column; }
  .watch-poster { width: 120px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .watch-page .wrap { max-width: 100%; }
}

@media (max-width: 480px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .watch-title { font-size: 1.2rem; }
}

/* ─── Detail backdrop (movie/show pages) ──────────────────── */
.detail-backdrop {
  position: relative;
  width: 100%;
  height: 400px;
  background-size: cover;
  background-position: center 20%;
  margin-bottom: -120px;
}
.backdrop-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(17,19,24,0.2) 0%, rgba(17,19,24,1) 100%);
}

/* ─── Tagline ──────────────────────────────────────────────── */
.tagline {
  font-style: italic;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

/* ─── Hero ─────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 480px;
  background-size: cover;
  background-position: center 20%;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(13,13,13,0.92) 0%,
    rgba(13,13,13,0.65) 55%,
    rgba(13,13,13,0.1)  100%
  );
}
.hero-content {
  position: relative;
  z-index: 1;
  width: 1300px !important;
  margin: 0 auto;
  padding: 60px 20px;
}

.hero-content p {
  max-width: 400px;
}

.hero-content h1 {
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 12px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.hero-content p {
  font-size: 0.92rem;
  color: rgba(255,255,255,0.8);
  line-height: 1.6;
  margin-bottom: 24px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}
.hero-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--red);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: var(--radius);
  transition: background var(--transition), transform var(--transition);
  box-shadow: 0 4px 16px rgba(229,9,20,0.4);
}
.hero-cta-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.hero-cta-btn:hover {
  background: var(--red-dark);
  transform: translateY(-2px);
}

@media (max-width: 640px) {
  .hero { min-height: 320px; }
  .hero-content { padding: 32px 20px; }
  .hero-overlay {
    background: linear-gradient(to bottom,
      rgba(13,13,13,0.3) 0%,
      rgba(13,13,13,0.95) 100%
    );
  }
}

/* ─── Hero slides ──────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 480px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 20%;
  opacity: 0;
  transition: opacity 1s ease;
  z-index: 0;
}
.hero-slide.active {
  opacity: 1;
  z-index: 1;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(13,13,13,0.92) 0%,
    rgba(13,13,13,0.65) 55%,
    rgba(13,13,13,0.1)  100%
  );
  z-index: 2;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 3;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  padding: 60px 24px;
  box-sizing: border-box;
}

.hero-content h1,
.hero-content p,
.hero-content a {
  max-width: 500px;
}

/* Text fade on slide change */
.hero-text-fade {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* ─── Hero dots ────────────────────────────────────────────── */
.hero-dots {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 1300px;
  width: 100%;
  padding: 0 24px;
  display: flex;
  gap: 8px;
  z-index: 4;
  box-sizing: border-box;
}
.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.3s, transform 0.3s;
}
.hero-dot.active {
  background: #fff;
  transform: scale(1.3);
}
.hero-dot:hover {
  background: rgba(255,255,255,0.7);
}

@media (max-width: 640px) {
  .hero { min-height: 320px; }
  .hero-content { padding: 32px 20px 48px; }
  .hero-dots { padding: 0 20px; bottom: 14px; }
}
