/* B4UMoviez — dark cinematic UI (reference-inspired theme, B4UMoviez branding)
 * Locked theme: black background, red accent #EF4444, teal/green section
 * headings, full-bleed hero with Play / See More, wide backdrop rows. */
:root {
  --bg: #000000;
  --bg2: #14141c;
  --card: #1a1a24;
  --text: #f5f5f7;
  --muted: #a1a1b3;
  --accent: #EF4444;
  --accent2: #F87171;
  --teal: #2DD4BF;
  --green: #22C55E;
  --gold: #f5c518;
  --border: #2a2a38;
  --radius: 12px;
  --topbar-bg: rgba(11, 11, 15, 0.92);
  --hover: #23232f;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.14);
}
/* Light theme: only the variables flip — the red accent, red chips,
 * hero and section heading hues stay. Dark is the default (no
 * [data-theme] attribute, or data-theme="dark"). */
[data-theme="light"] {
  --bg: #f2f2f5;
  --bg2: #ffffff;
  --card: #ffffff;
  --text: #17171f;
  --muted: #5c5c6e;
  --accent: #EF4444;
  --accent2: #DC2626;
  --teal: #0D9488;
  --green: #16A34A;
  --gold: #B45309;
  --border: #dddde6;
  --topbar-bg: rgba(255, 255, 255, 0.92);
  --hover: #ececf1;
  --glass-bg: rgba(0, 0, 0, 0.06);
  --glass-border: rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .h-sky { color: #0284C7; }
[data-theme="light"] .h-blue { color: #2563EB; }
[data-theme="light"] .h-purple { color: #9333EA; }
* { box-sizing: border-box; margin: 0; padding: 0; }
/* Universal text spacing (Zain 06:55 PKT): the reset above zeroes EVERY
 * paragraph margin, so any bare paragraph sat flush on the next element —
 * the Blog subtitle colliding with the first card is the same bug as
 * FIX E and the .page-sub fix, just on another page. A base bottom
 * margin on all paragraphs kills the whole class of bug at once.
 * Specific rules (.hero-desc, .page-count, .page-sub,
 * .legal-page p, .tv-season-overview) keep overriding it, and inline
 * styles win. */
p { margin: 0 0 16px; }
html { scroll-behavior: smooth; overflow-x: clip; /* full-bleed hero uses calc(50% - 50vw) negative margins; 50vw counts the scrollbar width, so the hero is ~15px wider than the visible viewport — clip stops the sideways scroll without breaking the sticky header (clip creates no scroll container, unlike hidden) */ }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent2); }
img { display: block; max-width: 100%; }

/* ---------- Top bar ---------- */
/* Glass header (FIX C): translucent + blurred over the hero in BOTH
 * themes so the hero wallpaper shows through (reference pattern). Once
 * the user scrolls past the hero it turns solid (.scrolled). Over the
 * hero the text is forced light-on-dark (.over-hero) — the hero is
 * always dark, so light-mode dark text would be unreadable on it. */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 24px;
  background: rgba(10, 10, 14, 0.28);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  transition: background 0.25s ease, border-color 0.25s ease;
}
[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.18); border-bottom-color: rgba(0, 0, 0, 0.08); }
.topbar.scrolled { background: var(--topbar-bg); border-bottom-color: var(--border); }
.topbar.over-hero .logo { color: #fff; }
.topbar.over-hero .mainnav a { color: rgba(255, 255, 255, 0.78); }
.topbar.over-hero .mainnav a.active { color: #fff; background: var(--accent); }
.topbar.over-hero .mainnav a:hover { color: #FCA5A5; background: rgba(239, 68, 68, 0.22); }
.topbar.over-hero .search-wrap input { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.3); color: #fff; }
.topbar.over-hero .search-wrap input::placeholder { color: rgba(255, 255, 255, 0.65); }
.topbar.over-hero .icon-btn { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.25); color: #fff; }
.logo { display: inline-flex; align-items: center; font-size: 22px; font-weight: 900; letter-spacing: 1px; white-space: nowrap; }
.logo-b4u { color: var(--accent); }
/* Popcorn-bucket logo (Zain, 2026-12-04): the bucket SVG stands in
 * place of the letter U in B4UMOVIEZ. Height in em so it scales with
 * the wordmark (22px desktop / 18px mobile); the whole logo stays
 * well inside the topbar — nothing may stick out top or bottom. */
.logo-bucket { height: 1.3em; width: auto; flex: none; margin: 0 1px; }
.mainnav { display: flex; gap: 18px; margin-left: 8px; }
/* Nav hover (Zain, 02:01 PKT — must read REDDISH, never white/grey):
 * hovered nav links get the theme accent red text on a red-tinted pill
 * in BOTH themes. The old rule set hover colour to #fff, which is
 * invisible on the light header — that is the bug.
 * FIX B2: hover and active MUST NOT look identical — a resting cursor
 * used to mimic the active item, so two nav pills looked red at once.
 * Active is now the solid red pill (white text); hover stays the
 * reddish tint (red text). Same split over the hero. */
.mainnav a { color: var(--muted); font-weight: 600; font-size: 15px; padding: 6px 10px; border-radius: 999px; transition: color 0.15s ease, background 0.15s ease; }
.mainnav a.active { color: #fff; background: var(--accent); }
.mainnav a:hover { color: var(--accent); background: rgba(239, 68, 68, 0.14); }
.search-wrap { margin-left: auto; position: relative; width: min(340px, 40vw); }
.search-wrap input {
  width: 100%; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg2); color: var(--text);
  font-size: 14px; outline: none;
}
.search-wrap input:focus { border-color: var(--accent); }
.suggest-box {
  position: absolute; top: 110%; left: 0; right: 0;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,0.6); z-index: 60;
}
.suggest-item {
  display: flex; gap: 10px; align-items: center; padding: 8px 10px; cursor: pointer;
}
.suggest-item:hover { background: var(--hover); }
.suggest-item img { width: 34px; height: 50px; object-fit: cover; border-radius: 4px; }
.suggest-item .s-title { font-weight: 700; font-size: 14px; }
.suggest-item .s-meta { color: var(--muted); font-size: 12px; }
.suggest-item .s-meta .star { color: var(--gold); }
.suggest-item .s-type { font-weight: 700; color: var(--text); }
.suggest-item.s-more { border-top: 1px solid var(--border); justify-content: center; text-align: center; }
.suggest-item.s-more .s-title { color: var(--accent2); }
/* Glass header buttons (reference pattern): translucent + blurred so they
 * blend with the hero backdrop behind them. No account button — user
 * accounts were declined. */
.header-actions { position: relative; display: flex; gap: 10px; align-items: center; margin-left: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  color: var(--text); font-size: 18px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.icon-btn:hover { border-color: var(--accent); transform: scale(1.08); }
.icon-btn svg { display: block; }
.menu-btn { font-size: 20px; }
/* Hamburger dropdown panel (reference pattern): dark panel, one row per
 * section, small glyph icon + label. Only sections that exist here. */
.menu-panel {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 80;
  min-width: 240px; max-width: calc(100vw - 32px);
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); padding: 6px;
}
.menu-panel[hidden] { display: none; }
.menu-panel a {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 8px;
  font-weight: 600; font-size: 14px; color: var(--text);
}
.menu-panel a:hover { background: rgba(239, 68, 68, 0.14); color: var(--accent); }
/* FIX B2: menu active is the solid red pill, like the top nav — the old
 * red-text-only active was too close to the tinted hover. */
.menu-panel a.active { color: #fff; background: var(--accent); }
.menu-panel .m-ico { width: 20px; text-align: center; color: var(--muted); font-size: 15px; }
.wl-badge {
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 11px; padding: 1px 7px; vertical-align: middle;
}
.wl-badge:empty { display: none; }

/* Account button + dropdown (login/signup for viewers; the old Admin
 * nav pill is gone — staff reach the panel from this menu only). */
.avatar-initial { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 14px; font-weight: 800; }
#accountBtnIcon { display: inline-flex; align-items: center; justify-content: center; }
.account-panel { min-width: 260px; }
.account-meta { padding: 10px 12px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.account-meta strong { display: block; font-size: 15px; }
.account-meta span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.account-meta .status-pill { display: inline-block; margin-top: 6px; }
.menu-panel button.linklike { display: flex; gap: 10px; align-items: center; width: 100%; padding: 10px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--text); background: none; border: 0; cursor: pointer; text-align: left; font-family: inherit; }
.menu-panel button.linklike:hover { background: rgba(239, 68, 68, 0.14); color: var(--accent); }
.menu-panel button.linklike .m-ico { width: 20px; text-align: center; color: var(--muted); font-size: 15px; }
/* Log in / Sign up modal */
.auth-modal { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.65); display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-modal[hidden] { display: none; }
.auth-card { position: relative; width: min(420px, 100%); background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 24px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); }
.auth-card h3 { font-size: 22px; margin-bottom: 14px; }
.auth-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg2); color: var(--text); font-size: 14px; cursor: pointer; }
.auth-close:hover { border-color: var(--accent); color: var(--accent); }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.auth-tabs button { flex: 1; padding: 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg2); color: var(--text); font-weight: 700; cursor: pointer; font-size: 14px; }
.auth-tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.auth-error { color: #fca5a5; background: #7f1d1d; border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.auth-error:empty { display: none; }
.auth-note { color: var(--muted); font-size: 13px; margin-top: 14px; }

/* ---------- Layout ---------- */
main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px 40px; }
.section { margin-top: 34px; }
/* Count line above browse grids (FIX E, Phase 2.4): needs real spacing
 * below it — the global margin reset left it flush on the first poster
 * row, so it looked collided with the posters (Netflix page). */
.page-count { color: var(--muted); margin: 6px 0 20px; }
/* Subtitle line under a page heading (Platforms, Blog, actor pages):
 * same root cause as FIX E — the global margin reset left it flush on
 * the grid below, so the text looked collided with the cards. */
.page-sub { color: var(--muted); margin: 6px 0 20px; }
.section h2 { font-size: 22px; margin-bottom: 14px; }
/* Reference pattern: "Heading | View All" — the link sits right after the
 * heading text (NOT floated right); the row arrows own the right edge. */
.section h2 .more { font-size: 14px; color: var(--teal); font-weight: 600; }
.h-sep { color: var(--muted); font-weight: 400; margin: 0 2px; }
/* "| View All" must never split across lines (mobile wrapped it as
 * "Trending Movies |" + "View All" on its own line). */
.h-more { white-space: nowrap; }
.more { color: var(--teal); font-weight: 600; }
.more:hover { text-decoration: underline; }
.h-teal { color: var(--teal); }
.h-green { color: var(--green); }
.h-blue { color: #3B82F6; }
.h-purple { color: #A855F7; }
.h-gold { color: var(--gold); }
.h-pink { color: #EC4899; }
.h-red { color: var(--accent); }
.h-orange { color: #F97316; }
.h-sky { color: #38BDF8; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin-bottom: 0; }
.row-arrows { display: flex; gap: 8px; flex-shrink: 0; }
.row-arrow {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 20px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.row-arrow:hover { border-color: var(--accent); color: var(--accent2); transform: scale(1.1); box-shadow: 0 4px 14px rgba(239,68,68,0.35); }
.loading-page, .empty-state { text-align: center; color: var(--muted); padding: 80px 20px; font-size: 17px; }

/* ---------- Hero ---------- */
/* Full-bleed hero: breaks out of the 1280px container, edge to edge. */
.hero {
  position: relative; overflow: hidden;
  min-height: 520px; display: flex; align-items: flex-end;
  background-size: cover; background-position: center 20%;
  margin-top: -64px; /* pulled under the glass header (JS sets the exact height) */
  margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(90deg, rgba(5,5,10,0.92) 0%, rgba(5,5,10,0.55) 55%, rgba(5,5,10,0.15) 100%),
              linear-gradient(0deg, rgba(5,5,10,0.9) 0%, rgba(5,5,10,0) 55%);
}
/* Hero background trailer (Netflix-style): muted autoplay YouTube embed
 * covering the hero, backdrop image underneath as poster/fallback.
 * Fades in only once the embed loads (see app.js); pointer-events none
 * so Play / See More stay clickable. */
.hero-video { position: absolute; inset: 0; z-index: 0; overflow: hidden; opacity: 0; transition: opacity 1s ease; pointer-events: none; }
.hero-video.loaded { opacity: 1; }
.hero-video iframe {
  position: absolute; top: 50%; left: 50%; width: 100%; height: 56.25vw;
  min-height: 100%; min-width: 177.78vh; transform: translate(-50%, -50%); border: 0;
}
/* YouTube IFrame API player (FIX B): same cover behaviour as the old
 * iframe embed, but created by the API with NO playlist param — so no
 * dead ⏮ ⏸ ⏯ transport overlay ever appears over the video. */
.bg-yt {
  position: absolute; top: 50%; left: 50%; width: 100%; height: 56.25vw;
  min-height: 100%; min-width: 177.78vh; transform: translate(-50%, -50%);
}
.bg-yt iframe { width: 100%; height: 100%; border: 0; }
/* ---------- Hero carousel (top 5 trending) ---------- */
/* Hero arrows (FIX A): hidden until the cursor is over the hero (or
 * the hero has keyboard focus) — the always-visible arrows blocked
 * the wallpaper/trailer. Touch devices have no hover, so the arrows
 * stay visible there. */
.hero-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.35);
  color: #fff; font-size: 26px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, opacity 0.25s ease;
}
@media (hover: hover) {
  .hero-arrow { opacity: 0; pointer-events: none; }
  .hero:hover .hero-arrow, .hero:focus-within .hero-arrow { opacity: 1; pointer-events: auto; }
}
.hero-arrow:hover { background: var(--accent); transform: translateY(-50%) scale(1.08); box-shadow: 0 6px 20px rgba(239,68,68,0.45); }
.hero-prev { left: 18px; }
.hero-next { right: 18px; }
.hero-dots {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 3; display: flex; gap: 8px;
}
.hero-dot {
  width: 10px; height: 10px; border-radius: 50%; padding: 0;
  background: rgba(255,255,255,0.45); border: none; cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}
.hero-dot:hover { transform: scale(1.3); }
.hero-dot.active { background: var(--accent); transform: scale(1.25); }
/* Thumbnail strip below the hero (reference pattern): small backdrops of
 * the 5 slides; the active one has a red ring. */
.hero-thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-top: 14px; }
.hero-thumb {
  cursor: pointer; border-radius: 10px; overflow: hidden; padding: 0;
  border: 2px solid transparent; background: var(--card); text-align: left;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.hero-thumb img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.hero-thumb span {
  display: block; padding: 6px 8px; font-size: 12px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text);
}
.hero-thumb:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.5); }
.hero-thumb.active { border-color: var(--accent); box-shadow: 0 6px 20px rgba(239,68,68,0.35); }
.hero-content { position: relative; z-index: 2; padding: 36px; max-width: 640px; }
.hero-tag {
  display: inline-block; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 800; letter-spacing: 2px;
  padding: 4px 10px; border-radius: 4px; margin-bottom: 12px;
}
/* Hero title (FIX D): always solid white over the theme-independent
 * dark scrim — in light mode it inherited the dark page text colour
 * and washed out against the dark hero. */
.hero-content h1 { font-size: 44px; line-height: 1.05; margin-bottom: 10px; color: #fff; text-shadow: 0 2px 14px rgba(0,0,0,0.6); }
.hero-meta { color: #d6d6e0; font-size: 14px; margin-bottom: 12px; }
.hero-meta .star { color: var(--gold); }
.hero-desc { color: #c9c9d6; line-height: 1.55; margin-bottom: 20px; }
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 8px; border: none;
  font-size: 15px; font-weight: 700; cursor: pointer; margin-right: 10px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(239,68,68,0.35); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); color: #fff; }
/* FIX A (Phase 2.4): theme-variable ghost button — the old rule was
 * hard-coded white text on translucent white, which is INVISIBLE in
 * light mode (white-on-white: "+ My Watchlist", "Movie details"). Dark
 * keeps the same look; light gets dark text on a light pill. */
.btn-ghost { background: var(--glass-bg); color: var(--text); border: 1px solid var(--glass-border); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
/* Hero buttons, reference style: solid white Play, outlined See More. */
.btn-play { background: #fff; color: #000; }
.btn-play:hover { background: #e5e5e5; color: #000; }
.btn-see-more { background: rgba(255,255,255,0.08); color: #fff; border: 1px solid rgba(255,255,255,0.65); }
.btn-see-more:hover { background: rgba(255,255,255,0.2); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* ---------- Movie rows / cards ---------- */
/* FIX I (Phase 2.4): overflow-x: auto forces overflow-y to compute to
 * auto, so a hover-lifted card's top (translateY(-4px)) was clipped by
 * the row's top edge — the rounded top corners looked cut off. The
 * padding-top gives the lifted card room inside the row; the negative
 * margin-top keeps the cards exactly where they were (no layout shift).
 * padding-bottom is larger too so the hover shadow is not cut below. */
.row {
  display: grid; grid-auto-flow: column; grid-auto-columns: 168px;
  gap: 14px; overflow-x: auto; padding: 8px 0 14px; margin-top: -8px;
  scroll-snap-type: x mandatory;
}
.row::-webkit-scrollbar { height: 8px; }
.row::-webkit-scrollbar-thumb { background: #33334a; border-radius: 4px; }
.card { scroll-snap-align: start; cursor: pointer; transition: transform 0.2s ease; }
.card:hover { transform: translateY(-4px); }
.card-poster-wrap { position: relative; overflow: hidden; border-radius: var(--radius); }
.card .poster {
  width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: var(--radius);
  background: var(--card); transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover .poster { transform: scale(1.04); box-shadow: 0 14px 30px rgba(0,0,0,0.6), 0 0 0 1px rgba(239,68,68,0.45); }
/* ★ rating badge top-right + bookmark toggle top-left (reference pattern). */
.card-rating {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: rgba(0,0,0,0.78); color: #fff; font-size: 12px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; pointer-events: none;
}
.card-rating .star { color: var(--gold); }
.card-bookmark {
  position: absolute; top: 8px; left: 8px; z-index: 6;
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: rgba(0,0,0,0.65); color: #fff; font-size: 15px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.card-bookmark:hover { transform: scale(1.15); background: rgba(0,0,0,0.85); }
.card-bookmark.active { color: var(--accent2); }
/* Hover preview (reference pattern): an overlay over the poster with the
 * backdrop, Movie ★ rating · year · language, title, 2-line overview
 * and Watch Now / + buttons. It lives INSIDE the poster wrap (rows
 * clip vertically), so it never gets cut off by the row scroll area.
 * The bookmark stays clickable above it (z-index 6). */
.card-preview {
  position: absolute; inset: 0; z-index: 4;
  display: flex; flex-direction: column; justify-content: flex-end;
  opacity: 0; transition: opacity 0.18s ease; pointer-events: none;
}
.card:hover .card-preview { opacity: 1; pointer-events: auto; }
.card-preview-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-preview-body {
  position: relative; z-index: 1; padding: 10px;
  background: linear-gradient(0deg, rgba(0,0,0,0.94) 25%, rgba(0,0,0,0.55) 60%, rgba(0,0,0,0.08));
}
.card-preview-meta { font-size: 11px; font-weight: 700; color: #fff; }
.card-preview-meta .star { color: var(--gold); }
.card-preview-title { font-size: 14px; font-weight: 800; color: #fff; margin: 3px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-preview-desc {
  font-size: 11px; line-height: 1.45; color: #d6d6e0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-preview-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.card-preview-watch { background: #fff; color: #000; font-size: 12px; font-weight: 800; padding: 6px 12px; border-radius: 6px; }
.card-preview-plus {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.6); background: rgba(0,0,0,0.5);
  color: #fff; font-size: 16px; line-height: 1; cursor: pointer;
}
.card-tv-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 800;
  letter-spacing: 1px; padding: 3px 8px; border-radius: 4px;
}
.card .c-title { font-weight: 700; font-size: 14px; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .c-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card .c-meta .star { color: var(--gold); }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.chip {
  padding: 9px 16px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--border); font-weight: 600; font-size: 14px; cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.chip:hover, .chip.active { background: var(--accent); border-color: var(--accent); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(239,68,68,0.35); }

/* ---------- Genre cards (live cover images) ---------- */
.genre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.genre-card {
  position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden;
  cursor: pointer; display: block; background: var(--card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.genre-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease; }
.genre-card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(0,0,0,0.6), 0 0 0 1px rgba(239,68,68,0.45); }
.genre-card:hover img { transform: scale(1.06); }
.genre-card.no-cover { background: linear-gradient(135deg, var(--accent) 0%, #7f1d1d 100%); }
.genre-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 14px; background: linear-gradient(0deg, rgba(0,0,0,0.88), rgba(0,0,0,0) 62%);
}
.genre-name { font-size: 19px; font-weight: 800; color: #fff; }
.genre-count { color: #d6d6e0; font-size: 13px; margin-top: 2px; }

/* ---------- Details ---------- */
.details { display: grid; grid-template-columns: 280px 1fr; gap: 28px; margin-top: 24px; }
.details .poster { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 16px; }
.details h1 { font-size: 34px; margin-bottom: 8px; }
.details .d-meta { color: var(--muted); margin-bottom: 14px; font-size: 15px; }
.details .d-meta .star { color: var(--gold); }
.details .d-meta .quality {
  border: 1px solid var(--muted); border-radius: 4px; padding: 1px 6px; font-size: 12px; font-weight: 700;
}
.details p.desc { line-height: 1.65; color: var(--text); margin-bottom: 16px; max-width: 720px; }
.kv { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.kv b { color: var(--text); }
.license-note {
  margin-top: 18px; padding: 12px 14px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--muted); font-size: 13px; line-height: 1.5;
}

/* Fallback details note (FIX H): shown when the full details fetch
 * failed and the page is serving the discover-data shell. */
.fallback-note {
  margin: 16px 24px 0; padding: 12px 14px;
  background: rgba(245, 197, 24, 0.12); border: 1px solid rgba(245, 197, 24, 0.45);
  border-radius: 8px; color: var(--text); font-size: 14px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}

/* ---------- Details: genre chips, cast grid, trailer ---------- */
/* Details genre chips are RED by default (the Movies-page sort chips and
 * admin chips keep the dark default + red on hover — this rule is scoped
 * to .d-chips only). Hover still lifts + glows via .chip:hover. */
.d-chips { margin: 0 0 14px; }
.d-chips .chip { padding: 6px 13px; font-size: 13px; background: var(--accent); border-color: var(--accent); color: #fff; }
/* Details hero: the movie's trailer plays muted over its backdrop
 * (same .hero-video pattern as the homepage carousel). The overlay is a
 * bottom-only fade so the trailer stays visible. */
/* Details hero (FIX D): the scrim is a dark gradient in BOTH themes —
 * the old rule faded into var(--bg), which is near-white in light mode
 * and left ugly white feathered edges around the backdrop. */
/* Details hero redesign (approved 2026-12-05, mockup
 * design-mockups/details-hero-mockup.html): tall full-bleed hero,
 * poster + title + meta + genres + Play/Watchlist all inside it.
 * The scrim is a dark gradient in BOTH themes — the old rule faded
 * into var(--bg), which is near-white in light mode and left ugly
 * white feathered edges around the backdrop. */
.details-hero { min-height: 560px; }
.details-hero::after { background: linear-gradient(180deg, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.05) 35%, rgba(0,0,0,0.55) 62%, rgba(0,0,0,0.92) 100%); }
/* Blurred full-bleed fill: shown on mobile under the fitted 16/9
 * band, and on all sizes when there is no backdrop (poster blur). */
.details-hero-blur { display: none; position: absolute; inset: -30px; z-index: 0; background-size: cover; background-position: center; filter: blur(28px) brightness(0.5) saturate(1.2); }
/* Fitted 16/9 backdrop band: mobile only, never an over-zoomed crop. */
.details-hero-band { display: none; }
/* No backdrop: the poster itself, blurred and darkened, is the hero
 * background. No poster either: red gradient placeholder. Never a
 * black empty hero. */
.details-hero--poster-fallback { background-image: none; }
.details-hero--poster-fallback .details-hero-blur { display: block; }
.details-hero--no-art { background-image: none; background: linear-gradient(135deg, #7f1d1d 0%, #EF4444 55%, #991b1b 100%); }
.details-hero--no-art .details-hero-blur { display: none; }
/* Hero content: poster card bottom-left, text beside it, all above
 * the video layer and the scrim. */
.details-hero-inner { position: relative; z-index: 2; display: flex; gap: 26px; align-items: flex-end; width: 100%; padding: 30px; }
.details-hero-poster { flex: 0 0 auto; width: 200px; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,0.65); border: 1px solid rgba(255,255,255,0.14); }
.details-hero-text { flex: 1; min-width: 0; padding-bottom: 6px; }
.details-hero-text h1 { font-size: 46px; line-height: 1.08; font-weight: 800; color: #fff; text-shadow: 0 2px 18px rgba(0,0,0,0.6); margin-bottom: 10px; }
.details-hero .d-meta { color: #e5e5e5; font-size: 16px; margin-bottom: 14px; }
.details-hero .d-meta .star { color: var(--gold); }
.details-hero .d-meta .quality { border: 1px solid rgba(255,255,255,0.7); border-radius: 4px; padding: 1px 6px; font-size: 12px; font-weight: 700; }
.details-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.details-hero-actions .btn { margin: 0; }
/* The synopsis and facts now sit below the hero as plain text. */
.details--below { display: block; margin-top: 24px; }
.details-section h2 { font-size: 20px; }
/* Cast (reference pattern): large round photos, bold white name, grey
 * character below; the whole card is a link to the actor's page. Hover
 * highlights the card and tints the name red. */
.cast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 14px; }
.cast-card {
  display: block; text-align: center; padding: 12px 6px; border-radius: 12px;
  transition: transform 0.18s ease, background 0.18s ease;
}
.cast-card:hover { transform: translateY(-3px); background: var(--hover); }
.cast-card:hover .cast-name { color: var(--accent2); }
.cast-avatar {
  width: 92px; height: 92px; margin: 0 auto 8px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 26px;
  display: flex; align-items: center; justify-content: center;
}
.cast-photo {
  width: 92px; height: 92px; margin: 0 auto 8px; border-radius: 50%;
  object-fit: cover; display: block;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}
.cast-name { font-size: 14px; font-weight: 700; line-height: 1.35; }
.cast-char { font-size: 12px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
/* Trailer player: centred, wide (the reference puts it centre-stage, not in
 * the left corner). */
.trailer-player { position: relative; width: 100%; max-width: 1080px; margin: 0 auto; aspect-ratio: 16/9; background: #000; border-radius: var(--radius); overflow: hidden; }
.trailer-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* Actor-page filter bar: Type / Genre / Year / Sort selects + the red
 * Clear Cast Filter button. */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 14px 0 6px; }
.filter-bar select { width: auto; min-width: 130px; }
/* Actor-page header: the person's photo (from /api/cast cast_info)
 * beside the "Movies and TV Shows featuring ..." heading. */
.cast-head { display: flex; gap: 16px; align-items: center; }
.cast-head h2 { margin-bottom: 4px; }
.cast-head-photo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex-shrink: 0; box-shadow: 0 4px 14px rgba(0,0,0,0.5); }

/* ---------- Player ---------- */
.player-wrap { margin-top: 20px; }
.player-wrap h1 { font-size: 24px; margin-bottom: 4px; }
.player-wrap .p-sub { color: var(--muted); margin-bottom: 14px; }
.player {
  position: relative; width: 100%; aspect-ratio: 16/9; background: #000;
  border-radius: 16px; overflow: hidden;
}
/* Watch player (FIX F, Phase 2.4): the whole 16:9 player — Play, seek
 * bar, fullscreen — must fit the viewport without scrolling. The width
 * shrinks so the height fits under the sticky header, title, server bar
 * and action buttons (a 320px vertical reserve), and stays centred. */
.player-wrap .player {
  width: min(100%, max(320px, calc((100vh - 320px) * 16 / 9)));
  margin-left: auto; margin-right: auto;
}
/* Fullscreen (Phase 2.5, mobile landscape): the width cap that fits
 * the player under the header must NOT apply in fullscreen — on a
 * landscape phone 100vh is ~360px, so the cap would shrink the player
 * to 320px wide with black bars around it. In fullscreen the player
 * fills the whole screen; controls keep safe-area padding for notched
 * phones. The landscape rule below does the same for non-fullscreen
 * landscape viewing, where the same cap would also collapse the player. */
.player:fullscreen, .player:-webkit-full-screen {
  width: 100% !important; height: 100% !important; max-width: none;
  margin: 0; border-radius: 0; background: #000;
}
.player:fullscreen video, .player:fullscreen iframe,
.player:-webkit-full-screen video, .player:-webkit-full-screen iframe {
  width: 100%; height: 100%; object-fit: contain;
}
.player:fullscreen .controls, .player:-webkit-full-screen .controls {
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
@media (max-width: 900px) and (orientation: landscape) {
  .player-wrap .player { width: 100%; }
}
.player video { width: 100%; height: 100%; display: block; background: #000; }
.player .spinner {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.spinner::after {
  content: ""; width: 54px; height: 54px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.25); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.player-error {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px;
  align-items: center; justify-content: center; background: rgba(0,0,0,0.85);
  text-align: center; padding: 20px;
}
.controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px 14px 12px;
  background: linear-gradient(0deg, rgba(0,0,0,0.85), rgba(0,0,0,0));
  opacity: 0; transition: opacity 0.2s;
}
.player:hover .controls, .player.paused .controls { opacity: 1; }
.seek { width: 100%; accent-color: var(--accent); cursor: pointer; }
.controls-row { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.ctrl-btn {
  background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; padding: 2px 4px;
}
.ctrl-btn:hover { color: var(--accent2); }
.time-label { font-size: 13px; color: #ddd; white-space: nowrap; }
.vol { width: 90px; accent-color: var(--accent); }
.spacer { flex: 1; }
.player-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- Admin ---------- */
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0; }
.admin-tabs button {
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-weight: 600; cursor: pointer;
}
.admin-tabs button.active { background: var(--accent); border-color: var(--accent); }
.panel { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; }
.panel h3 { margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
td img.thumb { width: 40px; height: 60px; object-fit: cover; border-radius: 4px; }
.status-pill { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status-active { background: #14532d; color: #86efac; }
.status-not-integrated { background: #7f1d1d; color: #fca5a5; }
.status-not-configured { background: #713f12; color: #fcd34d; }
.status-suspended { background: #7f1d1d; color: #fca5a5; }
/* Admin tables: the Integration Status table squeezed its first two
 * columns so narrow that headers and status pills wrapped mid-word
 * (INTEGRAT ION, STAT US, activ e, not-config ured). Fixed column
 * widths + nowrap on headers and pills, and normal word-breaking so
 * long words never split — the detail column takes the rest. */
.admin-table th { white-space: nowrap; }
.admin-table th, .admin-table td { overflow-wrap: normal; word-break: normal; }
.admin-table .status-pill { white-space: nowrap; display: inline-block; }
.table-status { table-layout: fixed; }
.table-status th:nth-child(1) { width: 200px; }
.table-status th:nth-child(2) { width: 140px; }
.table-status td:nth-child(3) { overflow-wrap: break-word; }
/* Featured search (Admin > Featured): input + button on one row. */
.feat-search { display: flex; gap: 10px; }
.feat-search input { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 14px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
.log-list { font-family: monospace; font-size: 13px; line-height: 1.7; color: var(--text); }
.log-list .log-time { color: var(--muted); }

/* ---------- Footer / toast ---------- */
/* Professional OTT footer (Phase 2.5): brand + tagline, link columns,
 * copyright line. The old footer was a single catalog line. */
.site-footer { border-top: 1px solid var(--border); padding: 28px 24px 24px; color: var(--muted); font-size: 13px; }
.footer-inner { max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.footer-top { display: flex; gap: 32px; flex-wrap: wrap; }
.footer-brand { flex: 1 1 260px; min-width: 220px; }
.footer-brand strong { color: var(--text); font-size: 15px; }
.footer-tag { margin-top: 8px; line-height: 1.6; max-width: 320px; }
.footer-col { display: flex; flex-direction: column; gap: 8px; min-width: 120px; }
.footer-col h4 { color: var(--text); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 2px; }
.footer-col a { color: var(--muted); }
.footer-col a:hover { color: var(--accent2); }
.footer-bottom {
  display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap;
  border-top: 1px solid var(--border); padding-top: 16px; line-height: 1.5;
}
.footer-note { line-height: 1.5; }

/* ---------- Legal pages (Terms / Privacy / DMCA) ---------- */
.legal-page { max-width: 760px; }
.legal-page h1 { font-size: 30px; margin-bottom: 6px; }
.legal-updated { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.legal-page h2 { font-size: 18px; margin: 22px 0 8px; }
.legal-page p { line-height: 1.7; margin-bottom: 10px; }
.legal-nav { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 12px 20px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  z-index: 100; font-weight: 600;
}

/* ---------- Wide backdrop rows (reference home rows) ---------- */
.row-wide { grid-auto-columns: 300px; }
.card-wide { position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; cursor: pointer; scroll-snap-align: start; background: var(--card); transition: transform 0.2s ease, box-shadow 0.2s ease; }
.card-wide:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(0,0,0,0.6), 0 0 0 1px rgba(239,68,68,0.45); }
.card-wide .backdrop { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s ease; }
.card-wide:hover .backdrop { transform: scale(1.04); }
.wide-overlay {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 12px 10px;
  background: linear-gradient(0deg, rgba(0,0,0,0.88), rgba(0,0,0,0));
}
.wide-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wide-genres { color: #c9c9d6; font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Providers ---------- */
.row-providers { grid-auto-columns: 132px; }
.provider-tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 8px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; scroll-snap-align: start;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.provider-tile:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: 0 12px 26px rgba(0,0,0,0.55), 0 0 0 1px rgba(239,68,68,0.35); }
.provider-tile img { width: 56px; height: 56px; object-fit: contain; border-radius: 10px; background: #fff; padding: 4px; }
.provider-tile span { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.3; min-height: 2.6em; /* two lines of room, so 1-line and 2-line names sit on the same baseline and every tile is the same height */ }
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 14px; }

/* ---------- Continue Watching ---------- */
.row-cw { grid-auto-columns: 200px; }
.cw-card { position: relative; cursor: pointer; scroll-snap-align: start; }
.cw-card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: var(--radius); background: var(--card); }
.cw-card .cw-title { font-weight: 700; font-size: 13px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-remove {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,0.7); color: #fff; border: none; cursor: pointer; font-size: 12px; z-index: 2;
}
.cw-progress { position: absolute; left: 8px; right: 8px; bottom: 34px; height: 4px; background: rgba(255,255,255,0.35); border-radius: 2px; overflow: hidden; }
.cw-progress span { display: block; height: 100%; background: var(--accent); }
.cw-card-grid { position: relative; }
.cw-card-grid .cw-progress { bottom: 48px; }

/* ---------- Embedded player / source badge ---------- */
.embed-player iframe { width: 100%; height: 100%; border: 0; display: block; background: #000; }
.embed-player iframe[hidden], .server-bar[hidden], .embed-poster[hidden], .embed-spinner[hidden] { display: none; }
/* Red loading ring over the embed player (our own overlay only — nothing
 * inside the cross-origin iframe is styled). Shown while an embed loads,
 * hidden on its load event (see app.js). */
.embed-spinner { position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.55); pointer-events: none; }
.embed-ring { width: 54px; height: 54px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.25); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
.embed-poster { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; cursor: pointer; }
.embed-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.embed-play-btn { position: relative; z-index: 1; width: 76px; height: 76px; border-radius: 50%; border: none; background: var(--accent); color: #fff; font-size: 28px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding-left: 6px; }
.embed-play-btn:hover { background: var(--accent2); }
.server-bar { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }
.server-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.server-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.server-btn { background: var(--bg2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; font-size: 13px; cursor: pointer; transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease; }
.server-btn:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(239,68,68,0.3); }
.server-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.server-btn.offline { opacity: .45; }
.server-hint { color: var(--muted); font-size: 12px; }

/* ---------- Blog ---------- */
/* List: movie-style poster cards — 2:3 poster on top with a dark scrim
 * over its bottom, soft whitish title below (red on hover, like the
 * site theme), grey date + read-time meta. 4 per row on desktop,
 * 2 per row on mobile (see the mobile media query below). */
.blog-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.blog-card {
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.blog-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 12px 26px rgba(0,0,0,0.55); }
.blog-poster-wrap { position: relative; overflow: hidden; aspect-ratio: 2/3; background: var(--bg2); }
.blog-poster { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s ease; }
.blog-card:hover .blog-poster { transform: scale(1.04); }
.blog-poster-wrap::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(0deg, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 45%);
}
.blog-poster-empty {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #14141c, #3a0d0d);
  color: rgba(255,255,255,0.45); font-size: 34px; font-weight: 800; letter-spacing: 1px;
}
.blog-card-body { padding: 12px 14px 14px; }
.blog-card-body h3 {
  font-size: 16px; font-weight: 700; line-height: 1.35; margin-bottom: 6px;
  color: rgba(255,255,255,0.85); transition: color 0.15s ease;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.blog-card:hover .blog-card-body h3 { color: var(--accent); }
[data-theme="light"] .blog-card-body h3 { color: rgba(23,23,31,0.8); }
[data-theme="light"] .blog-card:hover .blog-card-body h3 { color: var(--accent); }
.blog-meta { color: var(--muted); font-size: 13px; }
.blog-date { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.blog-post h1 { font-size: 32px; margin-bottom: 8px; line-height: 1.2; }
/* Article hero: full cover image, never cropped. The poster/backdrop is
 * shown uncropped (contain) in the centre, with the same image blurred
 * as a full-bleed backdrop behind it for a cinematic look. */
.blog-hero { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; min-height: 280px; max-height: 70vh; overflow: hidden; border-radius: var(--radius); margin-bottom: 18px; background: var(--bg2); }
.blog-hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(28px) brightness(0.5); transform: scale(1.15); }
.blog-hero-img { position: relative; z-index: 1; display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; object-fit: contain; border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,0.6); }
.blog-body p { line-height: 1.7; color: var(--text); margin-bottom: 14px; }
/* Article body headings: bold red, so they read as headings. */
.blog-body h2 { font-size: 24px; font-weight: 800; color: var(--accent); line-height: 1.3; margin: 28px 0 12px; scroll-margin-top: 90px; }
.blog-body h3 { font-size: 19px; font-weight: 800; color: var(--accent); line-height: 1.35; margin: 22px 0 10px; scroll-margin-top: 90px; }
/* Jump-to outline: sticky right rail on desktop, collapsed dropdown on mobile. */
.blog-post-layout { display: block; }
.blog-post-layout.has-toc { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 32px; align-items: start; }
.blog-toc { position: sticky; top: 90px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); padding: 16px 18px; max-height: calc(100vh - 120px); overflow-y: auto; }
.blog-toc h2 { font-size: 14px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
.blog-toc ul { list-style: none; margin: 0; padding: 0; }
.blog-toc li { margin-bottom: 8px; }
.blog-toc .toc-link { display: block; width: 100%; background: none; border: 0; padding: 0; margin: 0; text-align: left; font: inherit; color: var(--text); font-size: 14px; line-height: 1.4; cursor: pointer; }
.blog-toc .toc-link:hover { color: var(--accent); }
.blog-toc-mobile { display: none; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); padding: 12px 14px; margin-bottom: 16px; }
.blog-toc-mobile summary { cursor: pointer; font-weight: 800; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); }
.blog-toc-mobile ul { list-style: none; margin: 10px 0 0; padding: 0; }
.blog-toc-mobile li { margin-bottom: 8px; }
.blog-toc-mobile .toc-link { display: block; width: 100%; background: none; border: 0; padding: 0; margin: 0; text-align: left; font: inherit; color: var(--text); font-size: 14px; line-height: 1.4; cursor: pointer; }
.blog-toc-mobile .toc-link:hover { color: var(--accent); }
/* Related blogs at the bottom of an article: same cards as the blog list. */
.related-blogs { border-top: 1px solid var(--border); margin-top: 36px; padding-top: 8px; }
.related-blogs h2 { font-size: 22px; font-weight: 800; margin: 24px 0 16px; }

/* ---------- Custom dropdowns (FIX L — reference-style filters) ----------
 * Dark rounded panels, smooth fade/slide open, red hover + checkmark
 * on the selected option. Light theme: white panel, dark text. The
 * native select menus they replace are gone from the cast filter bar. */
.cdrop { position: relative; }
.cdrop-btn {
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  min-width: 150px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-size: 14px; font-weight: 600; cursor: pointer; outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cdrop-btn:hover, .cdrop.open .cdrop-btn { border-color: var(--accent); box-shadow: 0 4px 14px rgba(239,68,68,0.25); }
.cdrop-chev { color: var(--muted); font-size: 12px; transition: transform 0.2s ease; }
.cdrop.open .cdrop-chev { transform: rotate(180deg); color: var(--accent); }
.cdrop-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 70;
  min-width: 220px; max-width: 280px; max-height: 320px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.55); padding: 6px;
  animation: cdrop-in 0.16s ease;
}
@keyframes cdrop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.cdrop-panel[hidden] { display: none; }
.cdrop-search {
  width: 100%; padding: 9px 10px; margin-bottom: 4px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 13px; outline: none;
}
.cdrop-search:focus { border-color: var(--accent); }
.cdrop-opt {
  display: flex; gap: 8px; align-items: center; width: 100%;
  padding: 9px 10px; border: none; border-radius: 8px;
  background: transparent; color: var(--text);
  font-size: 14px; font-weight: 600; text-align: left; cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.cdrop-opt:hover { background: rgba(239, 68, 68, 0.14); color: var(--accent); }
.cdrop-opt.selected { color: var(--accent); }
.cdrop-check { width: 16px; color: var(--accent); font-weight: 800; visibility: hidden; flex-shrink: 0; }
.cdrop-opt.selected .cdrop-check { visibility: visible; }

/* ---------- TV seasons + episodes (FIX K, Phase 3) ---------- */
.tv-season-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.tv-season-bar label { font-weight: 700; font-size: 14px; }
.tv-season-bar select {
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 14px; font-weight: 600; outline: none; cursor: pointer;
}
.tv-season-bar select:focus { border-color: var(--accent); }
.tv-season-overview { color: var(--muted); font-size: 14px; line-height: 1.55; flex-basis: 100%; margin: 0; }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.ep-card {
  display: flex; gap: 12px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.ep-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 10px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(239,68,68,0.35); }
.ep-card img { width: 110px; min-height: 78px; object-fit: cover; flex-shrink: 0; background: var(--bg2); }
.ep-body { padding: 10px 10px 10px 0; min-width: 0; }
.ep-num { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--accent); text-transform: uppercase; }
.ep-name { font-size: 14px; font-weight: 700; line-height: 1.35; margin: 2px 0 4px; }
.ep-desc {
  font-size: 12px; line-height: 1.45; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* ---------- TV episode playlist (FIX G, Phase 2.4) ----------
 * Reference-style list BELOW the player: one row per episode with a
 * thumbnail still, "Episode N — real title" and overview; click a row
 * to play it. The playing episode is highlighted. Season tabs sit above
 * the list. Replaces the old top season/episode dropdowns, whose labels
 * wrapped ("Seas on" / "Episo de"). */
.tv-playlist-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.tv-playlist-head h2 { margin-bottom: 0; }
.season-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.season-tab {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 13px; font-weight: 700;
  cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.season-tab:hover { border-color: var(--accent); color: var(--accent); }
.season-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.ep-list { display: flex; flex-direction: column; gap: 10px; }
.ep-list .ep-card:hover { transform: none; }
.ep-card.current { border-color: var(--accent); background: rgba(239, 68, 68, 0.08); box-shadow: 0 0 0 1px rgba(239,68,68,0.45); }
.ep-now {
  display: inline-block; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  padding: 2px 7px; border-radius: 4px; margin-left: 8px; vertical-align: middle;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .details { grid-template-columns: 1fr; }
  .details .poster { max-width: 300px; }
  .hero-content h1 { font-size: 30px; }
  .hero { min-height: 340px; }
  /* Details hero keeps its tall redesign height here too. */
  .details-hero { min-height: 560px; }
}
@media (max-width: 760px) {
  /* Header: two clean rows — logo + icons on top, full-width search
   * below. The old layout squeezed logo, search and icons onto one
   * wrapping row so the icons crowded the logo. */
  .topbar { flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .logo { font-size: 18px; }
  .mainnav {
    display: none; order: 3; width: 100%; flex-direction: column; gap: 10px;
    padding-top: 6px; border-top: 1px solid var(--border);
  }
  .header-actions { order: 2; margin-left: auto; gap: 8px; }
  .search-wrap { order: 3; flex: 1 1 100%; width: 100%; }
  .icon-btn { width: 34px; height: 34px; font-size: 16px; }
  main { padding: 0 14px 32px; }
  /* Hero: arrows move to the TOP corners — at 50% height they sat on
   * top of the description text. Content gets bottom room for the dots. */
  .hero-content { padding: 22px 18px 44px; }
  .hero-content h1 { font-size: 26px; }
  /* CineHD-style tall mobile hero (Zain 06:53 PKT, his cinehd.vc
   * screenshots): the 420px hero was shorter than its own content, so
   * the text covered the whole backdrop and the FEATURED badge slid
   * under the sticky header on any scroll. 640px leaves the top of the
   * backdrop clean and the text in the lower third over a stronger
   * bottom scrim. PC untouched — this whole block is mobile-only. */
  .hero { min-height: 640px; }
  .hero::after {
    background: linear-gradient(90deg, rgba(5,5,10,0.85) 0%, rgba(5,5,10,0.45) 55%, rgba(5,5,10,0.1) 100%),
                linear-gradient(0deg, rgba(5,5,10,0.96) 0%, rgba(5,5,10,0.78) 32%, rgba(5,5,10,0) 58%);
  }
  /* Details hero redesign, mobile (approved 2026-12-05): 550px hero,
   * backdrop fitted as a 16/9 band over the blurred fill, never
   * over-zoomed; poster smaller and content lower so the backdrop
   * stays clearly visible above it. */
  .details-hero { min-height: 550px; }
  .details-hero::after { background: linear-gradient(180deg, rgba(0,0,0,0.02) 0%, rgba(0,0,0,0.02) 32%, rgba(0,0,0,0.35) 55%, rgba(0,0,0,0.78) 76%, rgba(0,0,0,0.95) 100%); }
  .details-hero-blur { display: block; }
  .details-hero-band { display: block; position: absolute; top: 0; left: 0; width: 100%; aspect-ratio: 16/9; object-fit: contain; z-index: 0; }
  .details-hero-inner { flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 10px; padding: 12px 16px 16px; }
  .details-hero-poster { width: 80px; border-radius: 9px; }
  .details-hero-text { padding-bottom: 0; }
  .details-hero-text h1 { font-size: 24px; margin-bottom: 6px; }
  .details-hero .d-meta { font-size: 13.5px; margin-bottom: 10px; }
  .details-hero .d-chips { margin-bottom: 13px; }
  .details-hero .d-chips .chip { font-size: 11.5px; padding: 5px 11px; }
  .details-hero-actions { width: 100%; }
  .details-hero-actions .btn-play { flex: 1; }
  .hero-arrow { top: 12px; bottom: auto; transform: none; width: 34px; height: 34px; font-size: 20px; }
  .hero-arrow:hover { transform: scale(1.08); }
  .hero-desc {
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  }
  /* Denser posters (Phase 2.5): 3 posters per row on a phone instead
   * of 2 large ones — smaller cards + tighter gaps on rows and grids. */
  .row { grid-auto-columns: 104px; gap: 10px; }
  .row-wide { grid-auto-columns: 200px; }
  .row-cw { grid-auto-columns: 120px; }
  .row-providers { grid-auto-columns: 96px; }
  .card .c-title { font-size: 13px; }
  .card .c-meta { font-size: 11px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .genre-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .hero-thumbs { display: flex; overflow-x: auto; padding: 6px 0 10px; margin-top: 8px; }
  .hero-thumb { flex: 0 0 110px; }
  /* Compact buttons on mobile: no oversized controls crowding the screen. */
  .btn { padding: 10px 16px; font-size: 14px; margin-right: 8px; margin-bottom: 8px; }
  .btn-sm { padding: 7px 12px; font-size: 12px; }
  .server-btn { padding: 5px 10px; font-size: 12px; }
  .chip { padding: 7px 13px; font-size: 13px; }
  .season-tab { padding: 7px 12px; font-size: 12px; }
  .row-arrow { width: 30px; height: 30px; font-size: 18px; }
  /* Section headings wrap cleanly with the arrows ("View All" stays
   * glued to its separator via .h-more, so it never dangles alone). */
  .section-head { flex-wrap: wrap; }
  .section h2 { font-size: 19px; }
  .section-head h2 { font-size: 19px; }
  /* Details + watch page. */
  .details h1 { font-size: 26px; }
  .details .poster { max-width: 260px; }
  .player-wrap h1 { font-size: 20px; }
  .ep-card img { width: 88px; min-height: 62px; }
  .legal-page h1 { font-size: 24px; }
  /* Footer stacks on mobile. */
  .footer-top { flex-direction: column; gap: 18px; }
  .footer-bottom { flex-direction: column; gap: 4px; }
  .blog-list { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .blog-card-body { padding: 10px 10px 12px; }
  .blog-card-body h3 { font-size: 14px; }
  .blog-hero { min-height: 200px; }
  .blog-post-layout.has-toc { display: block; }
  .blog-toc { display: none; }
  .blog-toc-mobile { display: block; }
  .form-grid { grid-template-columns: 1fr; }
  .controls-row { gap: 8px; }
  .vol { width: 64px; }
}
