/* ============ CineWave — Netflix-style dark theme ============ */
:root {
  --bg: #0d0d0f;
  --bg-soft: #16161a;
  --card: #1c1c21;
  --text: #f2f2f2;
  --muted: #a3a3ab;
  --accent: #e50914;
  --accent-hover: #f6121d;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}
.hidden { display: none !important; }
a { color: inherit; text-decoration: none; }

/* ---------- setup banner ---------- */
.setup-banner {
  background: #3a2b00;
  color: #ffd97a;
  padding: 12px 16px;
  font-size: 14px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 200;
}
.setup-banner code { background: rgba(0,0,0,.35); padding: 1px 6px; border-radius: 4px; }

/* ---------- navbar ---------- */
#navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(to bottom, rgba(0,0,0,.92), rgba(0,0,0,.75));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.logo { font-size: 24px; font-weight: 800; color: var(--accent); letter-spacing: .5px; }
.nav-links { display: flex; gap: 20px; }
.nav-links a { color: var(--muted); font-size: 15px; font-weight: 500; }
.nav-links a.active, .nav-links a:hover { color: #fff; }
.nav-links a.active { color: #fff; border-bottom: 2px solid var(--accent); padding-bottom: 2px; }
.search-box { margin-left: auto; }
.search-box input {
  background: var(--bg-soft);
  border: 1px solid rgba(255,255,255,.12);
  color: #fff;
  border-radius: 20px;
  padding: 8px 16px;
  width: 220px;
  font-size: 14px;
  outline: none;
}
.search-box input:focus { border-color: var(--accent); width: 260px; }
.genre-bar {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px 12px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.genre-bar::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  background: var(--bg-soft);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--muted);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 16px;
  cursor: pointer;
}
.chip:hover, .chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- hero ---------- */
#hero {
  position: relative;
  height: 62vh;
  min-height: 420px;
  overflow: hidden;
}
#hero-backdrop {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center 20%;
  transition: opacity .6s;
}
.hero-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg) 4%, transparent 55%),
              linear-gradient(to right, rgba(0,0,0,.75), transparent 60%);
}
.hero-content {
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 70px;
  max-width: 1400px;
}
.hero-content h1 { font-size: clamp(28px, 5vw, 54px); font-weight: 800; margin-bottom: 10px; max-width: 700px; }
.meta-line { color: var(--muted); font-size: 15px; margin-bottom: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.meta-line .rating { color: #ffd97a; font-weight: 700; }
#hero-overview { max-width: 620px; color: #d7d7db; font-size: 15px; line-height: 1.55; margin-bottom: 20px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { display: flex; gap: 12px; }
.btn {
  border: none; border-radius: 6px;
  padding: 11px 26px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: rgba(255,255,255,.16); color: #fff; }
.btn-secondary:hover { background: rgba(255,255,255,.26); }
.hero-dots { position: absolute; bottom: 22px; right: 30px; display: flex; gap: 8px; }
.hero-dots span { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.3); cursor: pointer; }
.hero-dots span.on { background: #fff; }

/* ---------- rows ---------- */
#rows { max-width: 1400px; margin: -30px auto 0; padding: 0 20px 40px; position: relative; z-index: 2; }
.row { margin-bottom: 34px; }
.row h2 { font-size: 20px; margin-bottom: 14px; font-weight: 700; }
.row-scroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.card {
  flex: 0 0 158px;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s;
  position: relative;
}
.card:hover { transform: scale(1.05); z-index: 3; }
.card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; background: #26262c; }
.card .card-body { padding: 8px 10px 10px; }
.card .card-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .card-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.card .badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,.72); color: #ffd97a;
  font-size: 12px; font-weight: 700;
  padding: 3px 8px; border-radius: 6px;
}

/* ---------- grid view ---------- */
#grid-view { max-width: 1400px; margin: 0 auto; padding: 26px 20px 60px; }
#grid-title { font-size: 22px; margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 16px; }
.grid .card { flex: none; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.78); }
.modal-box {
  position: relative; background: var(--bg-soft);
  border-radius: 14px; max-width: 860px; width: 100%;
  max-height: 90vh; overflow-y: auto;
}
.modal-close {
  position: absolute; top: 10px; right: 14px; z-index: 2;
  background: rgba(0,0,0,.6); color: #fff; border: none;
  font-size: 26px; width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
}
.detail-hero { position: relative; height: 340px; background-size: cover; background-position: center 20%; }
.detail-hero::after { content:""; position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg-soft) 2%, transparent 60%); }
.detail-body { padding: 6px 28px 30px; margin-top: -60px; position: relative; }
.detail-main { display: flex; gap: 22px; }
.detail-poster { width: 170px; flex: 0 0 170px; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.detail-info h2 { font-size: 28px; margin-bottom: 8px; }
.detail-info .tagline { color: var(--muted); font-style: italic; margin-bottom: 10px; font-size: 14px; }
.genres { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.genres span { background: rgba(255,255,255,.09); font-size: 12px; padding: 4px 12px; border-radius: 12px; }
.overview { color: #d7d7db; line-height: 1.6; font-size: 14.5px; margin: 12px 0 18px; }
.detail-actions { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.cast-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.cast { flex: 0 0 84px; text-align: center; }
.cast img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; background: #26262c; }
.cast .c-name { font-size: 11.5px; margin-top: 6px; font-weight: 600; }
.cast .c-char { font-size: 11px; color: var(--muted); }
.section-title { font-size: 17px; margin: 20px 0 12px; font-weight: 700; }
.providers { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.providers img { width: 44px; height: 44px; border-radius: 8px; }
.provider-region { font-size: 12px; color: var(--muted); width: 100%; }

/* ---------- trailer ---------- */
.trailer-box { position: relative; width: min(900px, 100%); }
.video-wrap { position: relative; padding-bottom: 56.25%; height: 0; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 10px; }

footer { text-align: center; padding: 34px 20px; color: var(--muted); font-size: 13px; border-top: 1px solid rgba(255,255,255,.06); }
footer .tmdb-note { margin-top: 6px; font-size: 12px; opacity: .7; }
#footer-brand { color: var(--accent); font-weight: 800; font-size: 16px; }

.loading { text-align: center; padding: 60px; color: var(--muted); }

@media (max-width: 640px) {
  .nav-links { display: none; }
  .search-box input { width: 150px; }
  .search-box input:focus { width: 170px; }
  .detail-main { flex-direction: column; }
  .detail-poster { width: 130px; flex-basis: 130px; }
  #hero { height: 52vh; min-height: 360px; }
}

/* ---------- ad slots (Adsterra etc.) ---------- */
.ad-slot { display: none; justify-content: center; padding: 12px 16px; }
.ad-slot iframe, .ad-slot img { max-width: 100%; }

/* ---------- player ---------- */
.player-controls { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; align-items: center; }
.player-controls select {
  background: var(--bg-soft); color: #fff; border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px; padding: 8px 10px; font-size: 14px; max-width: 100%;
}
.server-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.server-row .server-label { color: var(--muted); font-size: 13px; margin-right: 2px; }
