/* ============================================================
   Samflix Design System v2 — Cinematic Streaming UI
   Inspired by premium IPTV / streaming platforms (Zentara-style)
   ============================================================ */

:root {
  --bg: #05060a;
  --bg-soft: #0a0c12;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-strong: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f5f4;
  --text-dim: #9ca3af;
  --text-faint: #6b7280;
  --brand-1: #f59e0b;
  --brand-2: #facc15;
  --brand-grad: linear-gradient(135deg, #f59e0b 0%, #facc15 55%, #fde68a 100%);
  --green: #10b981;
  --blue: #3b82f6;
  --violet: #8b5cf6;
  --red: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  --glow-brand: 0 0 44px rgba(250, 204, 21, 0.22);
}

* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* ---------- Ambient background ---------- */
.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 560px at 85% -12%, rgba(245, 158, 11, 0.08), transparent 62%),
    radial-gradient(900px 640px at -12% 108%, rgba(59, 130, 246, 0.06), transparent 62%),
    radial-gradient(760px 520px at 55% 118%, rgba(139, 92, 246, 0.05), transparent 62%),
    var(--bg);
}
.app-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at 50% 0%, black 0%, transparent 78%);
}

/* ---------- Surfaces ---------- */
.glass {
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
}
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.014));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-hover { transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease; }
.card-hover:hover { transform: translateY(-3px); border-color: rgba(250, 204, 21, .35); box-shadow: var(--shadow), var(--glow-brand); }

/* ---------- Brand ---------- */
.brand-text {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-btn {
  background: var(--brand-grad);
  color: #1c1200;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  transition: filter .2s ease, transform .15s ease, box-shadow .2s ease;
  box-shadow: 0 8px 24px rgba(245, 158, 11, .28);
}
.brand-btn:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 10px 30px rgba(245, 158, 11, .4); }
.brand-btn:active { transform: translateY(0); }
.brand-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-ghost { background: rgba(255,255,255,.05); border: 1px solid var(--border); color: var(--text-dim); border-radius: 12px; font-weight: 600; transition: all .2s ease; }
.btn-ghost:hover { background: rgba(255,255,255,.09); color: var(--text); border-color: var(--border-strong); }
.btn-danger { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; border-radius: 12px; font-weight: 600; transition: all .2s ease; }
.btn-danger:hover { background: rgba(239,68,68,.22); }
.btn-success { background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.3); color: #6ee7b7; border-radius: 12px; font-weight: 600; transition: all .2s ease; }
.btn-success:hover { background: rgba(16,185,129,.22); }
.btn-blue { background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.3); color: #93c5fd; border-radius: 12px; font-weight: 600; transition: all .2s ease; }
.btn-blue:hover { background: rgba(59,130,246,.22); }

.field {
  width: 100%;
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .65rem .9rem;
  font-size: .875rem;
  color: var(--text);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field:focus { border-color: rgba(250, 204, 21, .55); box-shadow: 0 0 0 3px rgba(250, 204, 21, .12); }
.field::placeholder { color: var(--text-faint); }
select.field option { background: #111318; color: var(--text); }

/* ============================================================
   STREAMING LAYOUT
   ============================================================ */

.section-title {
  font-family: 'Manrope', 'Inter', sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.section-title .bar { width: 4px; height: 20px; border-radius: 4px; background: var(--brand-grad); box-shadow: var(--glow-brand); }

/* ---------- Category chips ---------- */
.chips {
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: .25rem 0 .9rem;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: .45rem 1.1rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); background: rgba(255,255,255,.09); }
.chip.active {
  background: var(--brand-grad);
  color: #1c1200;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(245, 158, 11, .3);
}

/* ---------- Horizontal rows ---------- */
.row-section { margin-bottom: 2rem; }
.row-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: .9rem; padding: 0 .25rem; }
.row-scroll {
  display: flex;
  gap: .9rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: .25rem .25rem 1rem;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.row-scroll::-webkit-scrollbar { display: none; }
.row-scroll > * { scroll-snap-align: start; flex: none; }

/* ---------- Poster cards (VOD) ---------- */
.poster {
  position: relative;
  width: 150px;
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(160deg, #15171f, #0b0d13);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform .28s cubic-bezier(.16,1,.3,1), box-shadow .28s ease, border-color .28s ease;
  box-shadow: 0 8px 26px rgba(0,0,0,.45);
}
.poster:hover { transform: translateY(-6px) scale(1.03); box-shadow: 0 18px 50px rgba(0,0,0,.65), var(--glow-brand); border-color: rgba(250,204,21,.4); z-index: 2; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.poster:hover img { transform: scale(1.06); }
.poster .poster-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.88) 0%, rgba(0,0,0,.18) 45%, transparent 70%);
  opacity: 0;
  transition: opacity .25s ease;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: .8rem;
}
.poster:hover .poster-overlay { opacity: 1; }
.poster .poster-title { font-weight: 700; font-size: .82rem; line-height: 1.2; text-shadow: 0 2px 8px rgba(0,0,0,.8); }
.poster .poster-group { font-size: .66rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin-top: .2rem; }
.poster .play-badge {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.6);
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--brand-grad); color: #1c1200;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 8px 26px rgba(245,158,11,.45);
  opacity: 0;
  transition: all .25s cubic-bezier(.16,1,.3,1);
}
.poster:hover .play-badge { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.poster .series-badge {
  position: absolute; top: .6rem; right: .6rem;
  background: rgba(0,0,0,.65); backdrop-filter: blur(6px);
  color: #fde68a; border: 1px solid rgba(250,204,21,.35);
  font-size: .58rem; font-weight: 800; letter-spacing: .08em;
  padding: .22rem .5rem; border-radius: 999px; text-transform: uppercase;
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}
.poster-grid .poster { width: 100%; }

/* ---------- Channel tiles (Live) ---------- */
.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}
.channel-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 16px;
  background: linear-gradient(160deg, #14161f, #0a0c13);
  border: 1px solid var(--border);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: .55rem;
  padding: 1rem;
  cursor: pointer;
  transition: transform .25s cubic-bezier(.16,1,.3,1), border-color .25s ease, box-shadow .25s ease;
}
.channel-tile:hover { transform: translateY(-5px); border-color: rgba(250,204,21,.45); box-shadow: 0 16px 44px rgba(0,0,0,.6), var(--glow-brand); }
.channel-tile .logo-wrap {
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  overflow: hidden;
  transition: transform .25s ease;
}
.channel-tile:hover .logo-wrap { transform: scale(1.06); }
.channel-tile img { max-width: 78%; max-height: 78%; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.channel-tile .tile-name { font-size: .72rem; font-weight: 600; text-align: center; line-height: 1.25; color: var(--text-dim); max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.channel-tile:hover .tile-name { color: var(--text); }
.channel-tile .live-dot-pos { position: absolute; top: .6rem; right: .6rem; }
.channel-tile .play-badge { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(.5); width: 40px; height: 40px; border-radius: 50%; background: var(--brand-grad); color: #1c1200; display: flex; align-items: center; justify-content: center; font-size: 1rem; opacity: 0; transition: all .22s cubic-bezier(.16,1,.3,1); box-shadow: 0 8px 24px rgba(245,158,11,.45); }
.channel-tile:hover .play-badge { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.channel-tile.playing { border-color: rgba(250,204,21,.6); box-shadow: 0 0 0 3px rgba(250,204,21,.15), var(--glow-brand); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  aspect-ratio: 16/7;
  min-height: 240px;
  max-height: 420px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 2.2rem;
  background: linear-gradient(160deg, #12141c, #08090f);
}
.hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center 30%; animation: heroZoom 12s ease-in-out infinite alternate; }
@keyframes heroZoom { from { transform: scale(1); } to { transform: scale(1.07); } }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to top, rgba(5,6,10,.96) 0%, rgba(5,6,10,.55) 40%, rgba(5,6,10,.15) 100%),
    linear-gradient(to right, rgba(5,6,10,.85) 0%, transparent 60%);
}
.hero-content { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; justify-content: flex-end; padding: 2rem 1.6rem 1.8rem; max-width: 60%; }
.hero-badge { display: inline-flex; align-items: center; gap: .4rem; align-self: flex-start; font-size: .66rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #fde68a; background: rgba(245,158,11,.14); border: 1px solid rgba(250,204,21,.3); padding: .3rem .7rem; border-radius: 999px; margin-bottom: .8rem; }
.hero-title { font-family: 'Manrope', 'Inter', sans-serif; font-weight: 800; font-size: clamp(1.4rem, 3.2vw, 2.6rem); letter-spacing: -0.025em; line-height: 1.08; text-shadow: 0 4px 24px rgba(0,0,0,.7); }
.hero-desc { margin-top: .6rem; color: #cbd5e1; font-size: .92rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 560px; }
.hero-actions { display: flex; gap: .7rem; margin-top: 1.1rem; }
.btn-play-lg {
  display: inline-flex; align-items: center; gap: .55rem;
  background: var(--brand-grad); color: #1c1200;
  font-weight: 800; font-size: .9rem;
  padding: .7rem 1.5rem; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(245,158,11,.4);
  transition: transform .18s ease, box-shadow .2s ease, filter .2s ease;
  border: none; cursor: pointer;
}
.btn-play-lg:hover { transform: translateY(-2px); filter: brightness(1.07); box-shadow: 0 14px 40px rgba(245,158,11,.5); }
.btn-hero-ghost {
  display: inline-flex; align-items: center; gap: .5rem;
  background: rgba(15,17,24,.55); backdrop-filter: blur(8px);
  color: #fff; font-weight: 700; font-size: .85rem;
  padding: .7rem 1.3rem; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.2);
  transition: all .2s ease; cursor: pointer;
}
.btn-hero-ghost:hover { background: rgba(255,255,255,.12); }
.hero-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 40px; height: 40px; border-radius: 50%; background: rgba(0,0,0,.5); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.18); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .2s ease; }
.hero-nav:hover { background: rgba(245,158,11,.8); color: #1c1200; }
.hero-nav.prev { left: .9rem; }
.hero-nav.next { right: .9rem; }
.hero-dots { position: absolute; bottom: .9rem; right: 1.4rem; z-index: 3; display: flex; gap: .4rem; }
.hero-dots button { width: 8px; height: 8px; border-radius: 999px; border: none; background: rgba(255,255,255,.3); cursor: pointer; transition: all .25s ease; padding: 0; }
.hero-dots button.active { width: 22px; background: var(--brand-grad); }

/* ---------- Search overlay ---------- */
.search-overlay {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(4,5,8,.86);
  backdrop-filter: blur(14px);
  overflow-y: auto;
  padding: 5rem 1rem 2rem;
}
.search-box {
  max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; gap: .7rem;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: .4rem .6rem .4rem 1.2rem;
}
.search-box input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-size: 1rem; padding: .55rem 0; }
.search-box input::placeholder { color: var(--text-faint); }

/* ---------- Full-screen players ---------- */
.player-modal { position: fixed; inset: 0; z-index: 100; background: #000; }
.player-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.2rem;
  background: linear-gradient(to bottom, rgba(0,0,0,.85), transparent);
}
.player-back {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .2s ease; font-size: 1.1rem; flex: none;
}
.player-back:hover { background: rgba(245,158,11,.85); color: #1c1200; }
.player-title { color: #fff; font-weight: 700; font-size: 1rem; line-height: 1.2; }
.player-sub { color: #9ca3af; font-size: .72rem; margin-top: .15rem; display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.player-drawer-toggle { margin-left: auto; display: flex; align-items: center; gap: .4rem; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); color: #e5e7eb; border-radius: 999px; padding: .45rem .9rem; font-size: .75rem; font-weight: 700; cursor: pointer; transition: background .2s ease; }
.player-drawer-toggle:hover { background: rgba(255,255,255,.14); }
.player-drawer {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 15;
  width: min(360px, 86vw);
  background: rgba(8,9,13,.92);
  backdrop-filter: blur(16px);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.16,1,.3,1);
  display: flex; flex-direction: column;
}
.player-drawer.open { transform: translateX(0); }
.player-drawer .drawer-head { padding: 1.1rem 1rem .6rem; display: flex; align-items: center; justify-content: space-between; }
.player-drawer .drawer-close { background: none; border: none; color: var(--text-dim); font-size: 1.3rem; cursor: pointer; }
.player-drawer .drawer-list { flex: 1; overflow-y: auto; padding: .4rem .6rem 1rem; }

/* ---------- Mobile bottom nav ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  display: flex;
  background: rgba(8,9,13,.92);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: .22rem;
  padding: .55rem 0 .5rem;
  color: var(--text-faint);
  font-size: .6rem; font-weight: 700; letter-spacing: .03em;
  cursor: pointer;
  transition: color .2s ease;
  text-decoration: none;
}
.bottom-nav a i { font-size: 1.3rem; line-height: 1; }
.bottom-nav a.active { color: var(--brand-2); }
.bottom-nav a.active i { text-shadow: 0 0 18px rgba(250,204,21,.6); }

/* ---------- Guide (EPG) ---------- */
.guide-scroll::-webkit-scrollbar { height: 8px; }
.guide-scroll::-webkit-scrollbar-thumb { background: #272a33; border-radius: 10px; }

/* ---------- Tables / badges / stat cards (management) ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
.tbl thead th { text-align: left; padding: .75rem 1rem; color: var(--text-faint); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl tbody td { padding: .8rem 1rem; border-bottom: 1px solid rgba(255,255,255,.045); vertical-align: middle; }
.tbl tbody tr { transition: background .15s ease; }
.tbl tbody tr:hover { background: rgba(255,255,255,.03); }

.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.badge-green { background: rgba(16,185,129,.14); color: #6ee7b7; border: 1px solid rgba(16,185,129,.3); }
.badge-red { background: rgba(239,68,68,.14); color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.badge-amber { background: rgba(245,158,11,.14); color: #fcd34d; border: 1px solid rgba(245,158,11,.3); }
.badge-blue { background: rgba(59,130,246,.14); color: #93c5fd; border: 1px solid rgba(59,130,246,.3); }
.badge-violet { background: rgba(139,92,246,.14); color: #c4b5fd; border: 1px solid rgba(139,92,246,.3); }
.badge-gray { background: rgba(255,255,255,.06); color: var(--text-dim); border: 1px solid var(--border); }

.stat-card { position: relative; overflow: hidden; padding: 1.25rem 1.5rem; }
.stat-card .icon-wrap { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.stat-card .stat-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat-card .stat-label { color: var(--text-dim); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }

.nav-item { display: flex; align-items: center; gap: .8rem; width: 100%; padding: .65rem .9rem; border-radius: 12px; color: var(--text-dim); font-size: .85rem; font-weight: 600; transition: all .18s ease; border: 1px solid transparent; }
.nav-item:hover { background: rgba(255,255,255,.055); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(250,204,21,.14), rgba(250,204,21,.03)); border-color: rgba(250,204,21,.25); color: #fde68a; box-shadow: inset 3px 0 0 var(--brand-2); }
.nav-item .nav-icon { width: 20px; text-align: center; font-size: 1.1rem; }
.nav-group-label { padding: .9rem .9rem .35rem; font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; color: var(--text-faint); }

.modal-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(4,5,8,.78); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-card { width: 100%; max-width: 34rem; max-height: 90vh; overflow-y: auto; background: linear-gradient(180deg, #14161d, #0d0f15); border: 1px solid var(--border-strong); border-radius: 20px; box-shadow: 0 40px 120px rgba(0,0,0,.7); animation: modalIn .28s cubic-bezier(.16,1,.3,1); }
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

.row-actions { display: flex; gap: .4rem; justify-content: flex-end; }
.row-actions button { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; border: 1px solid var(--border); background: rgba(255,255,255,.04); color: var(--text-dim); transition: all .18s ease; }
.row-actions button:hover { color: var(--text); border-color: var(--border-strong); background: rgba(255,255,255,.09); }
.row-actions button.danger:hover { color: #fca5a5; border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.12); }
.row-actions button.primary:hover { color: #fde68a; border-color: rgba(250,204,21,.4); background: rgba(250,204,21,.1); }

.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); }

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.25); background-clip: content-box; border: 2px solid transparent; }
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

/* ---------- Animations ---------- */
.fade-up { animation: fadeUp .4s cubic-bezier(.16,1,.3,1) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.stagger > * { animation: fadeUp .45s cubic-bezier(.16,1,.3,1) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .07s; }
.stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .17s; }
.stagger > *:nth-child(5) { animation-delay: .22s; }
.stagger > *:nth-child(6) { animation-delay: .27s; }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; display: inline-block; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.8); } }

#toast { transition: all .3s cubic-bezier(.16,1,.3,1); }

/* ---------- Responsive tuning ---------- */
@media (max-width: 1023px) {
  .hero { aspect-ratio: 16/8; min-height: 220px; }
  .hero-content { max-width: 78%; }
}
@media (max-width: 767px) {
  .hero { aspect-ratio: 4/3; min-height: 210px; border-radius: 16px; }
  .hero-content { max-width: 100%; padding: 1.2rem 1rem 1.1rem; }
  .hero-desc { display: none; }
  .hero-title { font-size: 1.25rem; }
  .hero-actions { margin-top: .7rem; }
  .btn-play-lg { padding: .55rem 1.1rem; font-size: .8rem; }
  .section-title { font-size: 1.1rem; }
  .poster-grid, .live-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: .8rem; }
  .row-scroll { gap: .7rem; }
  .search-overlay { padding-top: 4.2rem; }
}

/* ============================================================
   SUBTITLE IMAGE OVERLAY (base64 bitmap subtitles)
   ============================================================ */
.sub-overlay {
    position: absolute;
    left: 0;
    right: 0;
    /* Sit ABOVE the custom control bar so the bar's gradient never hides
       the subtitles; drop back down when the bar is auto-hidden. */
    bottom: calc(4.75rem + env(safe-area-inset-bottom));
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    pointer-events: none;
    padding: 0 3%;
    transition: bottom .25s ease;
}
.player-modal.pc-hidden .sub-overlay {
    bottom: 1.5rem;
}
/* Subtitle images are capped to ~10% of the video height (--sub-cap-h is set
   from JS per video size) so oversized broadcast strips stay consistent. */
.sub-overlay img {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: var(--sub-cap-h, 90px);
    object-fit: contain;
    display: block;
    margin: 2px 0;
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}
.sub-overlay-text {
    color: #fff;
    font-size: clamp(14px, 1.9vw, 24px);
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0,0,0,.95), 0 0 3px #000;
    background: rgba(0,0,0,.4);
    border-radius: 6px;
    padding: .12em .55em;
    margin: 1px 0;
}

/* ---- fullscreen: modal hosts the video + subtitle overlay ---- */
.player-modal:fullscreen,
.player-modal:-webkit-full-screen {
    background: #000;
}
.player-modal:fullscreen .player-topbar,
.player-modal:-webkit-full-screen .player-topbar {
    display: none;
}

/* ---- custom fullscreen button ---- */
.player-fs-btn {
    margin-left: .6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.14);
    color: #e5e7eb;
    cursor: pointer;
    transition: background .2s ease;
}
.player-fs-btn:hover { background: rgba(255,255,255,.14); }

/* simulated fullscreen (iOS Safari: no element Fullscreen API) */
.player-modal.fs-sim { background: #000; }
.player-modal.fs-sim .player-topbar { display: none; }

/* ---- custom player controls (no native controls) ---- */
.player-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    padding: 1.2rem 1rem calc(.8rem + env(safe-area-inset-bottom));
    background: linear-gradient(transparent, rgba(0,0,0,.72));
    /* Visible by default so the buttons always exist; JS opts into
       auto-hide after a few seconds of playback. */
    opacity: 1;
    pointer-events: auto;
    transition: opacity .25s ease, transform .25s ease;
}
.player-controls.auto-hide {
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
}
.pc-row {
    display: flex;
    align-items: center;
    gap: .7rem;
    flex-wrap: wrap;
}
.pc-btn {
    width: 2.5rem;
    height: 2.5rem;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(0,0,0,.45);
    border: 1px solid rgba(255,255,255,.16);
    color: #fff;
    font-size: 1.15rem;
    cursor: pointer;
    transition: background .2s ease;
}
.pc-btn:hover { background: rgba(255,255,255,.2); }
.pc-seek {
    /* Seek bar always on its own full-width row so the buttons below it
       (including fullscreen) never overflow on narrow screens. */
    order: -1;
    flex: 0 0 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,.28);
    border-radius: 999px;
    cursor: pointer;
}
.pc-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #facc15;
    border: none;
}
.pc-seek:disabled { cursor: default; opacity: .85; }
.pc-seek:disabled::-webkit-slider-thumb { background: rgba(255,255,255,.5); }
.pc-seek::-moz-range-thumb {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #facc15;
    border: none;
}
.pc-volume {
    width: 5rem;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,.28);
    border-radius: 999px;
    cursor: pointer;
}
.pc-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #fff;
    border: none;
}
.pc-volume::-moz-range-thumb {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #fff;
    border: none;
}
.pc-time {
    font-size: .78rem;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0,0,0,.8);
    min-width: 3.2rem;
    text-align: right;
    margin-left: auto;
}

/* tighter spacing on small screens */
@media (max-width: 480px) {
    .pc-row { gap: .5rem; }
    .pc-volume { width: 3.5rem; }
    .pc-btn { width: 2.3rem; height: 2.3rem; font-size: 1.05rem; }
    .player-controls { padding: .9rem .7rem calc(.6rem + env(safe-area-inset-bottom)); }
}

/* ---- loading indicator ---- */
.player-loading {
    position: absolute;
    inset: 0;
    z-index: 65;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    background: rgba(0,0,0,.45);
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: .02em;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease;
}
.player-loading.active {
    opacity: 1;
    visibility: visible;
}
.player-loading i {
    font-size: 2.1rem;
    color: #facc15;
    animation: pc-spin 1s linear infinite;
}
@keyframes pc-spin {
    to { transform: rotate(360deg); }
}

