/* ==========================================================================
   NetStream Web — Styles
   Brand: Yellow (#FFC107) / Purple (#9C27B0) / Black
   ========================================================================== */

:root {
  --black: #0a0a0b;
  --surface: #121214;
  --card: #1a1a1d;
  --card-2: #202024;
  --elevated: #26262b;
  --line: rgba(255, 255, 255, 0.08);

  --yellow: #ffc107;
  --yellow-dark: #ffa000;
  --yellow-soft: rgba(255, 193, 7, 0.14);
  --purple: #9c27b0;
  --purple-light: #ce93d8;
  --purple-soft: rgba(156, 39, 176, 0.16);

  --text: #ffffff;
  --text-2: #b6b6bd;
  --text-3: #78787f;
  --on-yellow: #1a1200;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;

  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-yellow: 0 8px 24px rgba(255, 193, 7, 0.28);

  --header-h: 64px;
  --bottomnav-h: 62px;
  --max: 1360px;

  --font-display: "Poppins", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--black);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* radial glows in the backdrop for depth */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1100px 520px at 82% -8%, var(--purple-soft), transparent 60%),
    radial-gradient(900px 500px at 8% 4%, rgba(255, 193, 7, 0.07), transparent 55%);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }
img { display: block; }
button { font-family: inherit; border: none; background: none; color: inherit; }

/* pointer cursor on everything interactive */
button,
a,
.card,
.btn,
[data-nav],
[data-retry],
[data-server],
[data-dot],
[data-hero],
.hero-nav,
.hero-dots button,
.icon-btn,
.see-all,
input[type="submit"],
label { cursor: pointer; }

::-webkit-scrollbar { height: 8px; width: 8px; }
::-webkit-scrollbar-thumb { background: #303036; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ===================== Header ============================================= */
.header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 clamp(14px, 4vw, 34px);
  background: linear-gradient(180deg, rgba(10, 10, 11, 0.96), rgba(10, 10, 11, 0.72));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(19px, 2.4vw, 24px);
  letter-spacing: 0.5px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 2px;
}
.brand .b-net { color: var(--text); }
.brand .b-stream { color: var(--yellow); }
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--purple); margin-left: 5px;
  box-shadow: 0 0 12px var(--purple);
}

.nav-desktop { display: flex; gap: 4px; margin-left: 8px; }
.nav-desktop a {
  padding: 9px 15px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text-2);
  transition: color 0.18s, background 0.18s;
}
.nav-desktop a:hover { color: var(--text); }
.nav-desktop a.active {
  color: var(--on-yellow);
  background: var(--yellow);
}

.header-search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  width: min(320px, 40vw);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.header-search:focus-within { border-color: var(--yellow); box-shadow: 0 0 0 3px var(--yellow-soft); }
.header-search svg { flex: none; color: var(--text-3); }
.header-search input {
  border: none; background: none; outline: none; color: var(--text);
  font-size: 14.5px; width: 100%;
}
.header-search input::placeholder { color: var(--text-3); }

.search-btn-mobile { display: none; margin-left: auto; color: var(--text); }

/* ===================== Bottom nav (mobile) =============================== */
.bottom-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 70;
  height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: linear-gradient(180deg, rgba(13, 13, 15, 0.86), rgba(6, 6, 7, 0.98));
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  grid-template-columns: repeat(4, 1fr);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-3); font-size: 11px; font-weight: 600;
  transition: color 0.18s;
}
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.active { color: var(--yellow); }

/* ===================== Layout shell ===================================== */
.main { padding-bottom: 60px; min-height: 60vh; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 clamp(14px, 4vw, 34px); }

/* ===================== Promo box (home top) ============================ */
.promo {
  margin: 16px auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.promo-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
}
.promo-item.app { background: linear-gradient(135deg, rgba(255,193,7,0.12), rgba(255,193,7,0.03)); border-color: rgba(255,193,7,0.35); }
.promo-item.tg  { background: linear-gradient(135deg, rgba(156,39,176,0.16), rgba(156,39,176,0.03)); border-color: rgba(156,39,176,0.4); }
.promo-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.promo-item.app .promo-ico { background: var(--yellow-soft); color: var(--yellow); }
.promo-item.tg  .promo-ico { background: var(--purple-soft); color: var(--purple-light); }
.promo-text { flex: 1; min-width: 0; }
.promo-text b { display: block; font-family: var(--font-display); font-weight: 700; font-size: 14.5px; }
.promo-text span { font-size: 12.5px; color: var(--text-2); }
.promo-text span .imp { color: var(--yellow); font-weight: 700; }
.promo-cta {
  flex: none; font-weight: 700; font-size: 13px; white-space: nowrap;
  padding: 9px 16px; border-radius: 999px;
}
.promo-item.app .promo-cta { background: var(--yellow); color: var(--on-yellow); }
.promo-item.tg  .promo-cta { background: var(--purple); color: #fff; }
.promo-cta:hover { filter: brightness(1.08); }

@media (max-width: 720px) {
  .promo { grid-template-columns: 1fr; }
  .promo-text span { display: none; }
}

.section { margin-top: clamp(26px, 4vw, 40px); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px; gap: 12px;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(17px, 2.4vw, 22px);
  display: flex; align-items: center; gap: 10px;
}
.section-title::before {
  content: ""; width: 4px; height: 20px; border-radius: 4px;
  background: linear-gradient(var(--yellow), var(--purple));
}
.see-all {
  font-size: 13.5px; font-weight: 600; color: var(--yellow);
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
.see-all:hover { color: var(--yellow-dark); }

/* ===================== Hero banner carousel ============================= */
.hero {
  position: relative;
  width: 100%;
  height: clamp(360px, 56vw, 560px);
  overflow: hidden;
  background: var(--surface);
}
.hero-track { position: absolute; inset: 0; }
.hero-slide {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden;
  transition: opacity 0.7s ease;
}
.hero-slide.active { opacity: 1; visibility: visible; }

.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center 22%;
  transform: scale(1.08);
  filter: saturate(1.05);
}
.hero-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, var(--black) 0%, rgba(10, 10, 11, 0.72) 42%, rgba(10, 10, 11, 0.15) 78%),
    linear-gradient(0deg, var(--black) 2%, transparent 55%);
}
.hero-inner {
  position: relative; z-index: 2;
  max-width: var(--max); margin: 0 auto; height: 100%;
  display: flex; align-items: flex-end; gap: 30px;
  padding: 0 clamp(14px, 4vw, 34px) clamp(28px, 5vw, 54px);
}
.hero-poster {
  flex: none; width: 168px; aspect-ratio: 2/3;
  border-radius: var(--radius); object-fit: cover;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.hero-text { max-width: 620px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.badge {
  font-size: 12px; font-weight: 700; letter-spacing: 0.3px;
  padding: 4px 10px; border-radius: 999px;
}
.badge-type { background: var(--purple); color: #fff; }
.badge-rating {
  background: var(--yellow-soft); color: var(--yellow);
  display: inline-flex; align-items: center; gap: 4px;
}
.badge-muted { background: rgba(255, 255, 255, 0.08); color: var(--text-2); }

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(26px, 5.2vw, 52px);
  line-height: 1.04;
  margin-bottom: 12px;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}
.hero-meta { color: var(--text-2); font-size: 14px; font-weight: 500; margin-bottom: 12px; }
.hero-desc {
  color: var(--text-2); font-size: 15px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 20px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 15px; padding: 12px 22px;
  border-radius: 999px; transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary { background: var(--yellow); color: var(--on-yellow); box-shadow: var(--shadow-yellow); }
.btn-primary:hover { background: var(--yellow-dark); }
.btn-ghost { background: rgba(255, 255, 255, 0.1); color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.16); }

.hero-nav {
  position: absolute; z-index: 3; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--line);
  display: grid; place-items: center; backdrop-filter: blur(6px);
  transition: background 0.18s;
}
.hero-nav:hover { background: var(--yellow); color: var(--on-yellow); }
.hero-prev { left: 16px; }
.hero-next { right: 16px; }

.hero-dots {
  position: absolute; z-index: 3; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px;
}
.hero-dots button {
  width: 9px; height: 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.35);
  transition: width 0.25s, background 0.25s;
}
.hero-dots button.active { width: 26px; background: var(--yellow); }

/* ===================== Rows (horizontal scroll) ========================= */
.row-scroll {
  display: flex; gap: 14px; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; padding: 4px 2px 12px;
  scrollbar-width: none;          /* Firefox — hide bar, keep scroll */
  -ms-overflow-style: none;       /* old Edge/IE */
}
.row-scroll::-webkit-scrollbar { display: none; height: 0; width: 0; } /* Chrome/Safari */
.row-scroll .card { scroll-snap-align: start; flex: 0 0 auto; width: 158px; }

/* ===================== Grid ============================================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: clamp(12px, 2vw, 20px);
}

/* ===================== Movie card ====================================== */
.card {
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: rgba(255, 193, 7, 0.4); }
.card-poster-wrap { position: relative; aspect-ratio: 2/3; background: var(--card-2); }
.card-poster { width: 100%; height: 100%; object-fit: cover; }
.card-poster-wrap::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.75), transparent 42%);
}
.card-rating {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: rgba(0, 0, 0, 0.66); color: var(--yellow);
  font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 3px; backdrop-filter: blur(3px);
}
.card-type {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: var(--purple); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: 0.4px;
  padding: 3px 8px; border-radius: 999px; text-transform: uppercase;
}
.card-body { padding: 9px 10px 11px; }
.card-title {
  font-size: 13.5px; font-weight: 600; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-sub { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

/* ===================== Detail ========================================== */
.detail-hero { position: relative; }
.detail-backdrop {
  position: absolute; inset: 0; height: 460px;
  background-size: cover; background-position: center 20%;
  filter: blur(2px) saturate(1.05); transform: scale(1.05);
}
.detail-backdrop::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(0deg, var(--black) 8%, rgba(10, 10, 11, 0.55) 55%, rgba(10, 10, 11, 0.7));
}
.detail-body {
  position: relative; z-index: 2;
  display: flex; gap: clamp(18px, 4vw, 40px);
  padding-top: clamp(90px, 14vw, 150px);
  flex-wrap: wrap;
}
.detail-poster {
  flex: none; width: clamp(150px, 34vw, 260px); aspect-ratio: 2/3;
  border-radius: var(--radius); object-fit: cover;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.detail-info { flex: 1 1 360px; min-width: 0; }
.detail-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(24px, 4.4vw, 42px); line-height: 1.08; margin-bottom: 12px;
}
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 16px; }
.chip {
  font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); color: var(--text-2);
}
.chip-genre { background: var(--purple-soft); color: var(--purple-light); border-color: transparent; }
.chip-rating { background: var(--yellow-soft); color: var(--yellow); border-color: transparent; display: inline-flex; gap: 4px; align-items: center; }

.detail-section-label {
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  margin: 22px 0 10px; color: var(--text);
}
.detail-desc { color: var(--text-2); line-height: 1.65; font-size: 15px; max-width: 720px; }
.detail-facts { margin-top: 16px; color: var(--text-3); font-size: 13.5px; line-height: 1.9; }
.detail-facts b { color: var(--text-2); font-weight: 600; }

.server-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.server-btn {
  padding: 10px 15px; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
  transition: all 0.18s; display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
}
.server-btn:hover { border-color: var(--purple); color: var(--text); }
.server-btn.active { background: var(--purple); border-color: var(--purple); color: #fff; }
.server-btn small { font-size: 10.5px; opacity: 0.8; font-weight: 500; }

.detail-actions { margin-top: 22px; display: flex; gap: 12px; flex-wrap: wrap; }

/* ===================== Player ========================================== */
.player-page { max-width: 1100px; margin: 0 auto; padding: 18px clamp(14px, 4vw, 34px) 40px; }
.player-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--text); transition: background 0.18s;
}
.icon-btn:hover { background: var(--elevated); }
.player-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(17px, 2.6vw, 24px); }
.player-frame {
  position: relative; width: 100%; aspect-ratio: 16/9;
  background: #000; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.player-frame iframe, .player-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
.player-servers { margin-top: 18px; }

/* ===================== States ========================================== */
.state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 70px 20px; gap: 14px; color: var(--text-2);
}
.state svg { color: var(--text-3); }
.state h3 { font-family: var(--font-display); font-size: 19px; color: var(--text); }
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12); border-top-color: var(--yellow);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* skeleton shimmer */
.skel { position: relative; overflow: hidden; background: var(--card); border-radius: var(--radius); }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skel-card { aspect-ratio: 2/3; }

.loadmore-sentinel { height: 40px; display: grid; place-items: center; margin-top: 20px; }

/* fade-in for views */
.view { animation: fade 0.35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===================== Responsive ====================================== */
@media (max-width: 860px) {
  .nav-desktop { display: none; }
  .header-search { display: none; }
  .search-btn-mobile { display: inline-flex; }
  .bottom-nav { display: grid; }
  .main { padding-bottom: calc(var(--bottomnav-h) + 24px); }
  .hero-poster { display: none; }
  .hero-inner { padding-bottom: 30px; }
  .row-scroll .card { width: 132px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); }
}

@media (max-width: 460px) {
  .hero { height: clamp(340px, 82vw, 440px); }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .hero-nav { width: 38px; height: 38px; }
  .btn { padding: 11px 18px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .hero-slide { transition: none; }
}

/* search overlay for mobile */
.mobile-search {
  position: fixed; inset: 0; z-index: 90; background: rgba(6, 6, 7, 0.98);
  backdrop-filter: blur(8px); display: none; flex-direction: column; padding: 16px;
}
.mobile-search.open { display: flex; }
.mobile-search .ms-bar {
  display: flex; align-items: center; gap: 10px; background: var(--card);
  border: 1px solid var(--yellow); border-radius: 999px; padding: 12px 16px;
}
.mobile-search .ms-bar input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 16px; }
.mobile-search .ms-close { color: var(--text-2); font-weight: 600; padding: 4px 8px; }
