/* ============================================================
   STREAMFLIX - Stylesheet
   ============================================================ */
:root {
  --bg: #0b0f1a;
  --bg-card: #131a2b;
  --bg-soft: #1a2236;
  --accent: #e50914;
  --accent-hover: #ff2b36;
  --text: #eef1f7;
  --text-muted: #9aa4bd;
  --border: #232c44;
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ---------- HEADER ---------- */
header {
  background: linear-gradient(180deg, rgba(0,0,0,.7), rgba(11,15,26,.9));
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  flex-wrap: wrap;
}
.logo {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.5px;
}
.logo span { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a {
  color: var(--text-muted);
  font-weight: 600;
  transition: color .2s;
}
.nav-links a:hover { color: var(--text); }

/* ---------- HERO / BANNER ---------- */
.hero {
  background: radial-gradient(ellipse at 20% 0%, #1c2946, var(--bg) 70%);
  padding: 40px 0 10px;
  text-align: center;
}
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: 6px; }
.hero p { color: var(--text-muted); }

/* ---------- SEARCH ---------- */
.search-form {
  display: flex;
  gap: 8px;
  max-width: 520px;
  margin: 22px auto 6px;
}
.search-form input[type="search"] {
  flex: 1;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: .98rem;
}
.search-form input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
}
.search-form button {
  padding: 13px 22px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s;
}
.search-form button:hover { background: var(--accent-hover); }

/* Inline search di navbar (halaman watch) */
.search-inline { display: flex; align-items: center; gap: 4px; }
.search-inline input {
  width: 150px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: .85rem;
}
.search-inline input:focus { outline: none; border-color: var(--accent); }
.search-inline button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}
.search-inline button:hover { color: var(--accent); }
@media (max-width: 600px) {
  .search-inline { width: 100%; }
  .search-inline input { flex: 1; width: auto; }
}

/* ---------- ADS ---------- */
.ad-container {
  margin: 18px auto;
  text-align: center;
  position: relative;
}
.ad-label {
  display: inline-block;
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}

/* ---------- GENRE FILTER ---------- */
.genre-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 8px;
}
.genre-pill {
  padding: 7px 16px;
  border-radius: 20px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 600;
  transition: all .2s;
  white-space: nowrap;
}
.genre-pill:hover {
  border-color: var(--accent);
  color: var(--text);
}
.genre-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- FILM GRID ---------- */
.section-title {
  font-size: 1.3rem;
  margin: 26px 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::before {
  content: '';
  width: 5px; height: 22px;
  background: var(--accent);
  border-radius: 3px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 20px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 28px rgba(0,0,0,.5);
  border-color: var(--accent);
}
.badge-new {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  background: #00c853;
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}

.card-thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #000;
}
.card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s;
}
.card:hover .card-thumb img { transform: scale(1.06); }
.play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.35);
  opacity: 0; transition: opacity .25s;
}
.card:hover .play-overlay { opacity: 1; }
.play-btn {
  width: 58px; height: 58px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 16px rgba(229,9,20,.5);
}
.card-duration {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(0,0,0,.8);
  padding: 2px 8px; border-radius: 6px;
  font-size: .75rem;
}
.card-body { padding: 12px 14px 14px; }
.card-title { font-weight: 700; font-size: .98rem; line-height: 1.35; }
.card-meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: .8rem; color: var(--text-muted); }
.badge {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: .72rem;
}

/* ---------- PAGINATION ---------- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 36px 0;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-weight: 600;
  transition: background .2s;
}
.pagination a:hover { background: var(--accent); border-color: var(--accent); }
.pagination .current { background: var(--accent); border-color: var(--accent); }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ---------- WATCH PAGE ---------- */
.watch-wrap { padding: 28px 0; }
.player-frame {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-info { margin-top: 20px; }
.video-info h1 { font-size: 1.5rem; margin-bottom: 8px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 12px; color: var(--text-muted); margin-bottom: 14px; font-size: .9rem; }
.desc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  color: #c7cede;
}

/* ---------- PRE-ROLL OVERLAY ---------- */
.preroll-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.88);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.preroll-box {
  width: min(90%, 700px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.preroll-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  font-size: .8rem;
  color: var(--text-muted);
}
.preroll-header span:first-child { font-weight: 800; letter-spacing: 1px; color: var(--accent); }
.preroll-countdown { font-weight: 700; }
.preroll-body { padding: 16px; min-height: 180px; display: flex; align-items: center; justify-content: center; }
.preroll-skip {
  display: block;
  margin: 0 auto 14px;
  padding: 10px 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
}
.preroll-skip:hover { background: var(--accent-hover); }

/* ---------- PAGES (About / Privacy) ---------- */
.page-content {
  padding: 30px 0;
  max-width: 900px;
}
.card-article {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
}
.card-article h2 {
  color: var(--accent);
  font-size: 1.3rem;
  margin: 22px 0 10px;
}
.card-article h2:first-child { margin-top: 0; }
.card-article h3 {
  color: var(--text);
  font-size: 1.05rem;
  margin: 20px 0 8px;
}
.card-article p { color: #c7cede; margin-bottom: 12px; }
.card-article ul { color: #c7cede; margin: 0 0 12px 22px; }
.card-article li { margin-bottom: 6px; }
.card-article a { color: var(--accent); text-decoration: underline; }
.card-article strong { color: var(--text); }

/* ---------- AD GATE (GERBANG IKLAN) ---------- */
body.gate-locked { overflow: hidden; }

.ad-gate {
  position: fixed;
  inset: 0;
  background: rgba(4,7,14,.97);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.ad-gate-box {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 16px;
  width: min(94%, 720px);
  padding: 26px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.ad-gate-box h2 {
  color: var(--accent);
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.ad-gate-info {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-size: .95rem;
}
.ad-gate-progress {
  text-align: center;
  font-weight: 700;
  color: #fff;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px;
  margin-bottom: 20px;
}
.ad-gate-slot {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
  transition: border-color .2s;
}
.ad-gate-slot.done { border-color: #00c853; }
.ad-gate-slot-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.ad-gate-ad {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0f16;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 10px;
  text-align: center;
  overflow: hidden;
}
.ad-gate-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  transition: background .2s;
}
.ad-gate-btn:hover { background: var(--accent-hover); }
.ad-gate-btn:disabled { background: #1f5a32; cursor: default; }

/* ---------- FOOTER ---------- */
footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
}

/* ---------- EMPTY STATE ---------- */
.empty { text-align: center; padding: 60px 0; color: var(--text-muted); }
.empty h2 { color: var(--text); margin-bottom: 8px; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .navbar { justify-content: center; }
}
