/* ===================== Design tokens (Plex-style) ===================== */
:root {
  --bg: #1a1d1e;
  --bg-surface: #202325;
  --bg-elevated: #2a2d2f;
  --border: #313436;
  --border-strong: #454a4d;
  --text: #ffffff;
  --text-secondary: #b8bcbe;
  --text-tertiary: #888d90;
  --accent: #e5a00d;
  --accent-hover: #cc8f0c;
  --accent-soft: rgba(229, 160, 13, .14);
  --nav-bg: #191b1c;
  --gold: #e5a00d;
  --success: #2f9e5b;
  --success-soft: #14301b;
  --danger: #e05252;
  --danger-soft: #34161a;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --shadow-card: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
  --shadow-pop: 0 12px 32px rgba(0,0,0,.5);
  --font: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --sidebar-w: 240px;
}

/*
 * Light theme. Toggled via [data-theme="light"] on <html> — see the
 * blocking inline script in header.php / admin/_layout_top.php that sets
 * this attribute before first paint (reading localStorage) to avoid a
 * flash of the wrong theme. Media surfaces (hero scrim, poster hover,
 * rating badges) stay dark-on-image in both themes on purpose — that's
 * standard for anything overlaid on a photo, not a light/dark bug.
 */
[data-theme="light"] {
  --bg: #f4f4f4;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --border: #e1e2e3;
  --border-strong: #cbccce;
  --text: #17181a;
  --text-secondary: #53565a;
  --text-tertiary: #7c7f83;
  --accent-soft: rgba(229, 160, 13, .12);
  --nav-bg: #ffffff;
  --gold: #b3830a;
  --success-soft: #dcf5e6;
  --danger-soft: #fbe3e3;
  --shadow-card: 0 1px 2px rgba(20,22,26,.05), 0 8px 24px rgba(20,22,26,.06);
  --shadow-pop: 0 12px 32px rgba(20,22,26,.14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; transition: background-color .15s ease, color .15s ease; }
a { color: inherit; text-decoration: none; }
img { display: block; }
h1, h2, h3 { font-weight: 700; letter-spacing: -.01em; margin: 0; }
p { margin: 0 0 .8rem; color: var(--text-secondary); }
::-webkit-scrollbar { height: 8px; width: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ===================== Navbar -> Plex-style sidebar ===================== */
/* Desktop: a fixed, full-height left rail (Plex's signature layout). Collapses
   to a slim top bar + slide-in drawer below 901px — see the responsive block. */
.navbar {
  display: flex; flex-direction: column; align-items: stretch; gap: 0;
  padding: 1.4rem 1rem 1.2rem; width: var(--sidebar-w); background: var(--nav-bg);
  position: fixed; top: 0; left: 0; height: 100vh; z-index: 100;
  border-right: 1px solid var(--border); border-bottom: none; overflow-y: auto;
}
.navbar .brand { display: flex; align-items: center; gap: .6rem; padding: 0 .5rem; margin-bottom: 1.6rem; flex-shrink: 0; }
.navbar .brand-mark { width: 28px; height: 28px; flex-shrink: 0; }
.navbar .brand-word { font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; }
.navbar .nav-links { display: flex; flex-direction: column; gap: .15rem; }
.navbar a.nav-link {
  display: flex; align-items: center; gap: .8rem; color: var(--text-secondary);
  font-size: .89rem; font-weight: 500; padding: .62rem .8rem; border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.navbar a.nav-link svg { flex-shrink: 0; opacity: .85; }
.navbar a.nav-link:hover { color: var(--text); background: var(--bg-elevated); }
.navbar a.nav-link.active { color: var(--text); background: var(--bg-elevated); }
.navbar a.nav-link.active svg { color: var(--accent); opacity: 1; }
.nav-search { margin: 1.1rem 0 .3rem; padding: 0 .1rem; }
.nav-search input {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .55rem .8rem; color: var(--text); width: 100%; font-size: .85rem; font-family: var(--font);
}
.nav-search input:focus { outline: none; border-color: var(--border-strong); background: var(--bg-surface); }
.nav-user { display: flex; flex-direction: column; align-items: stretch; gap: .35rem; margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); }
.nav-user .icon-btn { align-self: flex-start; }
.premium-pill { display: inline-flex; align-items: center; gap: .3rem; background: linear-gradient(135deg, var(--gold), #b8912b); color: #1a1400; font-weight: 700; font-size: .72rem; padding: .25rem .6rem; border-radius: 999px; letter-spacing: .02em; align-self: flex-start; }

/* ===================== Layout ===================== */
.page { padding: 0 2rem 3rem; max-width: 1600px; margin: 0 auto; margin-left: calc(var(--sidebar-w) + 2rem); }
.page > h1 { padding-top: 2.2rem; font-size: 1.7rem; }
.flash { padding: .8rem 1.1rem; border-radius: var(--radius-sm); margin: 1.2rem 0; font-size: .88rem; border: 1px solid transparent; }
.flash.success { background: var(--success-soft); color: #7ee08a; border-color: rgba(47,158,91,.3); }
.flash.error { background: var(--danger-soft); color: #ff9494; border-color: rgba(224,82,82,.3); }

/* ===================== Hero banner ===================== */
.hero {
  position: relative; height: 58vh; min-height: 380px; max-height: 600px;
  margin: 0 -2rem 2.75rem; display: flex; align-items: flex-end;
  background-size: cover; background-position: center top;
}
.hero::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,12,15,.1) 0%, rgba(11,12,15,.6) 58%, var(--bg) 100%),
              linear-gradient(90deg, rgba(11,12,15,.9) 0%, rgba(11,12,15,.1) 55%);
}
.hero-content { position: relative; z-index: 1; padding: 0 2rem 3rem; max-width: 620px; }
.hero-content .hero-meta { display: inline-flex; align-items: center; gap: .4rem; color: var(--gold); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .7rem; }
.hero-content h1 { font-size: 2.5rem; margin: 0 0 .7rem; line-height: 1.08; }
.hero-content p { color: var(--text-secondary); font-size: .98rem; line-height: 1.55; margin: 0 0 1.5rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { display: flex; gap: .75rem; }

/* Gradient scrim + badge/meta row used by the homepage's cinematic slider */
.hero-gradient-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(26,29,30,.05) 0%, rgba(26,29,30,.55) 55%, var(--bg) 100%),
              linear-gradient(90deg, rgba(26,29,30,.92) 0%, rgba(26,29,30,.15) 55%);
}
.hero-badge {
  display: inline-flex; align-items: center; gap: .4rem; color: var(--accent);
  font-weight: 700; font-size: .76rem; text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: .8rem;
}
.hero-meta-info { display: flex; align-items: center; gap: .7rem; color: var(--text-secondary); font-size: .87rem; margin-bottom: .9rem; flex-wrap: wrap; }
.hero-meta-info .rating-badge { position: static; background: none; backdrop-filter: none; border: none; padding: 0; color: var(--gold); font-weight: 700; }

/* Homepage cinematic hero slider (multiple backdrop slides + nav arrows +
   dots). The nav buttons and dots sit directly on top of a movie backdrop
   photo (background-image on .cinematic-hero), not the page background —
   same as the hero scrim above, that's intentionally dark-on-image in
   both themes, not a light/dark bug (see the note at the top of this
   file). */
.hero-slider-wrapper {
  position: relative; width: auto; margin: 0 -2rem; overflow: hidden;
  border: none !important; border-radius: 0 !important; box-shadow: none !important; outline: none !important;
}
@media (max-width: 900px) { .hero-slider-wrapper { margin: 0 -1rem; } }
.hero-slider { position: relative; width: 100%; border: none !important; border-radius: 0 !important; }
.hero-slider .slide {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0; visibility: hidden; transition: opacity .8s ease-in-out, visibility .8s ease-in-out;
  z-index: 1; border: none !important; border-radius: 0 !important; box-shadow: none !important;
}
.hero-slider .slide.active { position: relative; opacity: 1; visibility: visible; z-index: 2; }
.hero.cinematic-hero {
  border: none !important; border-radius: 0 !important; box-shadow: none !important; margin: 0 !important;
  background-size: cover; background-position: center;
}
.hero-nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 10;
  background: rgba(0, 0, 0, .4); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .15); color: #fff;
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all .25s ease;
}
.hero-nav-btn:hover { background: rgba(255, 255, 255, .25); border-color: rgba(255, 255, 255, .4); transform: translateY(-50%) scale(1.08); }
.hero-nav-btn.prev { left: 2rem; }
.hero-nav-btn.next { right: 2rem; }
.hero-dots { position: absolute; bottom: 2rem; right: 3rem; z-index: 10; display: flex; align-items: center; gap: .5rem; }
.hero-dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .35); border: none; cursor: pointer; transition: all .3s ease; padding: 0; }
.hero-dot.active { width: 28px; border-radius: 6px; background: var(--accent); }
@media (max-width: 768px) {
  .hero-nav-btn { width: 36px; height: 36px; }
  .hero-nav-btn.prev { left: .75rem; }
  .hero-nav-btn.next { right: .75rem; }
  .hero-dots { right: 50%; transform: translateX(50%); bottom: 1rem; }
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .7rem 1.4rem; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 600; font-size: .9rem; cursor: pointer; font-family: var(--font); transition: background .15s, border-color .15s, transform .1s; }
.btn-play { background: var(--accent); color: #fff; }
.btn-play:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--bg-elevated); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--text-tertiary); }

/* ===================== Rows of cards ===================== */
.row-section { margin-bottom: 2.6rem; }
.row-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1rem; }
.row-heading h2 { font-size: 1.15rem; }
.row-heading .see-all { font-size: .82rem; color: var(--text-tertiary); font-weight: 500; }
.row-heading .see-all:hover { color: var(--accent); }
.row-scroll { display: flex; gap: 1.1rem; overflow-x: auto; padding-bottom: .5rem; scroll-snap-type: x proximity; }
.row-scroll .title-card { flex: 0 0 165px; scroll-snap-align: start; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 1.3rem 1.1rem; margin-bottom: 2rem; }

/* ===================== Poster card ===================== */
.title-card { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.poster-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
  flex-shrink: 0;
}

.poster-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  transition: transform .3s ease;
}

.title-card:hover .poster-wrap img {
  transform: scale(1.04);
}

.no-poster {
  width: 100%;
  height: 100%;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: .6rem;
  overflow: hidden;
  font-size: .85rem;
  color: var(--text-tertiary);
}
.poster-hover { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,.75) 0%, transparent 55%); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; }
.title-card:hover .poster-hover { opacity: 1; }
.play-icon { width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.95); color: var(--bg); display: flex; align-items: center; justify-content: center; font-size: .78rem; box-shadow: var(--shadow-pop); }
.rating-badge { position: absolute; top: 8px; right: 8px; background: rgba(11,12,15,.8); backdrop-filter: blur(4px); color: var(--gold); font-size: .7rem; font-weight: 700; padding: .18rem .45rem; border-radius: 5px; border: 1px solid rgba(255,255,255,.08); }
.premium-badge-mini { position: absolute; top: 8px; left: 8px; background: linear-gradient(135deg, var(--gold), #b8912b); color: #1a1400; font-size: .65rem; font-weight: 800; padding: .18rem .4rem; border-radius: 5px; letter-spacing: .02em; }
.title-card-name { font-size: .87rem; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-card-meta { font-size: .76rem; color: var(--text-tertiary); }

.progress-bar { height: 3px; background: var(--border); border-radius: 2px; margin-top: -8px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

/* ===================== Player ===================== */
.player-wrapper, .vast-ad-container { position: relative; margin: 1.3rem 0; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-card); }
.vast-ad-label { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.7); padding: .2rem .55rem; font-size: .72rem; border-radius: 4px; }
.vast-skip-button { position: absolute; bottom: 14px; right: 14px; background: rgba(0,0,0,.85); color: #fff; border: 1px solid rgba(255,255,255,.3); padding: .45rem .9rem; cursor: pointer; border-radius: var(--radius-sm); font-family: var(--font); }
.player-empty { padding: 3.5rem 2rem; text-align: center; background: var(--bg-surface); border-radius: var(--radius-md); color: var(--text-tertiary); border: 1px solid var(--border); }
.vast-ad-loading { padding: 3.5rem 2rem; text-align: center; background: var(--bg-surface); border-radius: var(--radius-md); color: var(--text-tertiary); border: 1px solid var(--border); margin: 1.2rem 0; }

/* Premium lock screen shown instead of the player for gated content */
.premium-lock { padding: 3rem 2rem; text-align: center; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); margin: 1.3rem 0; }
.premium-lock .lock-icon { font-size: 2.2rem; margin-bottom: .8rem; }
.premium-lock h3 { margin-bottom: .5rem; }
.premium-lock p { max-width: 420px; margin-inline: auto; }

/* ===================== Detail page ===================== */
.detail-header { display: flex; gap: 2.2rem; padding-top: 2.2rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.detail-poster { width: 220px; border-radius: var(--radius-md); flex-shrink: 0; box-shadow: var(--shadow-card); }
.detail-info h1 { font-size: 2rem; margin-bottom: .5rem; }
.detail-meta { color: var(--text-tertiary); font-size: .9rem; margin-bottom: 1.1rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.detail-meta .rating { color: var(--gold); font-weight: 700; }
.genre-pills { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.genre-pill { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 999px; padding: .3rem .85rem; font-size: .78rem; color: var(--text-secondary); }
.action-row { display: flex; gap: .6rem; margin-top: 1.1rem; flex-wrap: wrap; }

.watchlist-btn, .mark-watched-btn { background: var(--bg-elevated); border: 1px solid var(--border-strong); color: var(--text); padding: .6rem 1.1rem; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; font-size: .87rem; font-family: var(--font); transition: border-color .15s; }
.watchlist-btn.active { border-color: var(--accent); color: var(--accent); }
.watchlist-btn:hover, .mark-watched-btn:hover { border-color: var(--text-tertiary); }

/* ===================== Auth pages ===================== */
.login-page, .register-page, .premium-page { max-width: 420px; padding-top: 3rem; }
.oauth-buttons { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.6rem; }
.oauth-buttons button { width: 100%; padding: .7rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text); font-weight: 600; cursor: pointer; font-family: var(--font); }
.oauth-buttons button:hover { border-color: var(--text-tertiary); }
.login-page form, .register-page form { display: flex; flex-direction: column; gap: .75rem; }
input, select, textarea { padding: .68rem .85rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text); font-family: var(--font); font-size: .9rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
button { cursor: pointer; font-family: var(--font); }
.login-page button[type="submit"], .register-page button[type="submit"] { background: var(--accent); color: #fff; border: none; padding: .75rem; border-radius: var(--radius-sm); font-weight: 700; }
.login-page button[type="submit"]:hover, .register-page button[type="submit"]:hover { background: var(--accent-hover); }

/* ===================== Premium page ===================== */
.premium-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2.2rem; text-align: center; box-shadow: var(--shadow-card); }
.premium-card--active { border-color: rgba(212,175,55,.4); }
.premium-badge { display: inline-block; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .78rem; padding: .3rem .8rem; border-radius: 999px; margin-bottom: 1rem; }
.premium-price { font-size: 2.4rem; font-weight: 800; margin-bottom: 1.2rem; }
.premium-features { list-style: none; padding: 0; margin: 0 0 1.6rem; text-align: left; display: inline-block; }
.premium-features li { padding: .4rem 0; color: var(--text-secondary); }
.premium-features li::before { content: '✓ '; color: var(--success); font-weight: 700; }
.premium-page form { margin-bottom: .8rem; }
.premium-page .btn { width: 100%; padding: .85rem; }

/* ===================== Season accordion (watch-series.php) ===================== */
details.season-section {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  transition: background-color .2s ease, border-color .2s ease;
}
details.season-section summary.season-header {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; list-style: none; user-select: none;
}
details.season-section summary.season-header::-webkit-details-marker { display: none; }
.season-title-wrap { display: flex; align-items: baseline; gap: 1rem; }
.season-title-wrap h2 { font-size: 1.25rem; font-weight: 700; margin: 0; }
.episode-count { font-size: .85rem; color: var(--text-tertiary); font-weight: 500; }
.chevron-icon { color: var(--text-secondary); transition: transform .25s cubic-bezier(.4, 0, .2, 1); }
details.season-section[open] .chevron-icon { transform: rotate(180deg); color: var(--accent); }
details.season-section[open] .episode-list { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* ===================== Episodes ===================== */
.episode-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.episode-list li a { display: flex; justify-content: space-between; align-items: center; background: var(--bg-surface); border: 1px solid var(--border); color: var(--text); padding: .75rem 1.1rem; border-radius: var(--radius-sm); font-size: .9rem; }
.episode-list li a:hover { border-color: var(--border-strong); }
.episode-list li a.active { border-color: var(--accent); background: var(--accent-soft); }

/* ===================== Comments ===================== */
.comments-section { margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.comment-form { display: flex; gap: .7rem; margin-bottom: 1.6rem; align-items: flex-start; }
.comment-form textarea { flex: 1; resize: vertical; min-height: 44px; }
.comment-list { display: flex; flex-direction: column; gap: 1.1rem; }
.comment { display: flex; gap: .8rem; }
.comment-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-elevated); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; color: var(--text-secondary); flex-shrink: 0; }
.comment-body { flex: 1; }
.comment-meta { display: flex; align-items: center; gap: .6rem; margin-bottom: .25rem; }
.comment-author { font-weight: 600; font-size: .87rem; }
.comment-time { font-size: .76rem; color: var(--text-tertiary); }
.comment-text { font-size: .89rem; color: var(--text-secondary); white-space: pre-wrap; }
.comment-delete { font-size: .76rem; color: var(--text-tertiary); background: none; border: none; padding: 0; margin-top: .3rem; cursor: pointer; }
.comment-delete:hover { color: var(--danger); }

/* ===================== Chat widget ===================== */
.chat-widget { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 200; font-family: var(--font); }
.chat-toggle { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; border: none; font-size: 1.3rem; box-shadow: var(--shadow-pop); cursor: pointer; }
.chat-toggle:hover { background: var(--accent-hover); }
.chat-panel { position: absolute; bottom: 64px; right: 0; width: 320px; max-height: 440px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); display: none; flex-direction: column; overflow: hidden; }
.chat-panel.open { display: flex; }
.chat-header { padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); font-weight: 700; font-size: .9rem; }
.chat-messages { flex: 1; overflow-y: auto; padding: .9rem 1.1rem; display: flex; flex-direction: column; gap: .7rem; min-height: 200px; }
.chat-message { font-size: .84rem; }
.chat-message .chat-author { font-weight: 700; color: var(--accent); margin-right: .3rem; }
.chat-message .chat-time { font-size: .68rem; color: var(--text-tertiary); margin-left: .3rem; }
.chat-input-row { display: flex; gap: .5rem; padding: .8rem; border-top: 1px solid var(--border); }
.chat-input-row input { flex: 1; padding: .55rem .7rem; font-size: .85rem; }
.chat-input-row button { background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); padding: 0 .9rem; font-weight: 600; font-size: .85rem; }
.chat-login-prompt { padding: 1.5rem 1.1rem; text-align: center; font-size: .85rem; color: var(--text-tertiary); }

/* ===================== Footer ===================== */
.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; padding: 2.5rem 2rem 2rem; margin-left: var(--sidebar-w); }
.site-footer .footer-inner { max-width: 1600px; margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1.5rem; }
.site-footer .footer-brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; margin-bottom: .6rem; }
.site-footer .footer-brand svg { width: 22px; height: 22px; }
.site-footer p { font-size: .82rem; color: var(--text-tertiary); max-width: 380px; }
.footer-links { display: flex; gap: 2.5rem; flex-wrap: wrap; }
.footer-links div { display: flex; flex-direction: column; gap: .55rem; }
.footer-links a { font-size: .84rem; color: var(--text-secondary); }
.footer-links a:hover { color: var(--text); }
.footer-links .footer-col-title { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-tertiary); font-weight: 700; margin-bottom: .2rem; }
.footer-bottom { max-width: 1600px; margin: 1.8rem auto 0; padding-top: 1.4rem; border-top: 1px solid var(--border); font-size: .78rem; color: var(--text-tertiary); }

/* ===================== Admin ===================== */
.admin-layout { display: flex; }
.admin-sidebar { width: 210px; background: var(--bg-surface); min-height: 100vh; padding: 1.6rem 1rem; display: flex; flex-direction: column; gap: .3rem; border-right: 1px solid var(--border); }
.admin-sidebar-brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.05rem; padding: 0 .7rem 1.3rem; margin-bottom: .5rem; border-bottom: 1px solid var(--border); }
.admin-nav-links { display: flex; flex-direction: column; gap: .35rem; width: 100%; }
.admin-sidebar a { padding: .55rem .7rem; border-radius: var(--radius-sm); font-size: .88rem; color: var(--text-secondary); font-weight: 500; }
.admin-sidebar a:hover { background: var(--bg-elevated); color: var(--text); }
.admin-sidebar a.active { background: var(--accent); color: #fff; font-weight: 700; }
.admin-content { flex: 1; padding: 2.2rem; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.6rem; }
.admin-topbar-actions { display: flex; align-items: center; gap: .9rem; }
.admin-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .9rem; flex-shrink: 0; }
.admin-form { display: flex; gap: .6rem; margin-bottom: 1.2rem; flex-wrap: wrap; align-items: center; }
.admin-form.vertical { flex-direction: column; align-items: stretch; max-width: 480px; }
.admin-form.vertical label { display: flex; flex-direction: column; gap: .35rem; font-size: .87rem; color: var(--text-secondary); }
.stat-grid { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat { background: var(--bg-surface); border: 1px solid var(--border); padding: 1.1rem 1.6rem; border-radius: var(--radius-md); }
.stat b { display: block; font-size: 1.7rem; color: var(--accent); font-weight: 800; }
.stat span { font-size: .82rem; color: var(--text-tertiary); }
table { width: 100%; border-collapse: collapse; margin-top: 1.2rem; font-size: .89rem; }
th, td { text-align: left; padding: .7rem; border-bottom: 1px solid var(--border); }
th { color: var(--text-tertiary); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.hint { color: var(--text-tertiary); font-size: .85rem; }
.pagination { display: flex; gap: .5rem; margin-top: 1.2rem; }
.pagination a { padding: .45rem .9rem; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .85rem; }

/* --- Admin: page/card/form building blocks (used across admin/*.php) ---
   These replace what used to be inline style="" on every element, which
   mostly referenced --card-bg/--text-color/--border-color/--input-bg —
   none of which are real tokens (see the header.php note below), so
   those elements never actually adapted to the light theme; only the
   dark, hardcoded fallback value ever applied. Everything here uses the
   project's real tokens instead, so the whole admin panel now follows
   the light/dark toggle automatically. */
.admin-page { display: flex; flex-direction: column; gap: 1.5rem; }
.admin-page.max-1200 { max-width: 1200px; }
.admin-page.max-900 { max-width: 900px; }
.admin-page-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.admin-page-header.align-start { align-items: flex-start; }
.admin-page-header h1, .admin-page-title { margin: 0; font-size: 1.5rem; font-weight: 700; }
.admin-page-subtitle { margin: .25rem 0 0; opacity: .7; font-size: .9rem; }

.admin-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; }
.admin-card.stack { display: flex; flex-direction: column; gap: 1rem; }
.admin-card-title { margin: 0; font-size: 1.05rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.admin-card-title.plain { color: var(--text); }
.admin-card-desc { margin: 0; font-size: .88rem; opacity: .75; line-height: 1.4; }
.admin-card-desc.sm { font-size: .85rem; opacity: .6; }
.admin-table-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.admin-table-card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); background: var(--bg-elevated); display: flex; justify-content: space-between; align-items: center; }
.admin-table-scroll { overflow-x: auto; }

.admin-alert { padding: .85rem 1.25rem; border-radius: 8px; font-size: .95rem; }
.admin-alert-danger { background: var(--danger-soft); border: 1px solid rgba(224, 82, 82, .35); color: var(--danger); }

.admin-field { display: flex; flex-direction: column; gap: .4rem; font-size: .9rem; font-weight: 500; }
.admin-field.max-320 { max-width: 320px; }
.admin-field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.admin-checkbox-row { display: flex; align-items: center; gap: .75rem; padding-top: .25rem; }
.admin-checkbox-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.admin-checkbox-row label { font-size: .9rem; font-weight: 500; cursor: pointer; }

.admin-input {
  padding: .65rem .9rem; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 8px; color: inherit; font-size: .95rem; outline: none; font-family: var(--font);
}
.admin-input.sm { padding: .5rem .75rem; font-size: .85rem; border-radius: 6px; }
.admin-input.xs { padding: .4rem .6rem; font-size: .85rem; border-radius: 6px; }

.admin-btn {
  padding: .65rem 1.25rem; background: var(--accent); color: #fff; border: none; border-radius: 8px;
  font-weight: 600; cursor: pointer; font-size: .9rem; white-space: nowrap; transition: opacity .2s; font-family: var(--font);
}
.admin-btn:hover { opacity: .88; }
.admin-btn.sm { padding: .4rem .75rem; font-size: .85rem; border-radius: 6px; font-weight: 500; }
.admin-btn-ghost {
  padding: .65rem 1.25rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px;
  color: inherit; font-size: .9rem; font-weight: 500; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; transition: background .15s; font-family: var(--font);
}
.admin-btn-ghost:hover { background: var(--border); }
.admin-btn-ghost.sm { padding: .4rem .75rem; font-size: .85rem; border-radius: 6px; }
.admin-btn-ghost.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.admin-btn-danger {
  padding: .65rem 1.25rem; background: var(--danger-soft); border: 1px solid rgba(224, 82, 82, .3); border-radius: 8px;
  color: var(--danger); font-weight: 600; cursor: pointer; font-size: .9rem; transition: background .2s; font-family: var(--font);
}
.admin-btn-danger.sm { padding: .4rem .75rem; font-size: .82rem; border-radius: 6px; font-weight: 600; }
.admin-btn-warning {
  padding: .4rem .75rem; background: rgba(234, 179, 8, .1); border: 1px solid rgba(234, 179, 8, .2); border-radius: 6px;
  color: #eab308; font-size: .85rem; font-weight: 500; cursor: pointer; font-family: var(--font);
}

.admin-table { width: 100%; border-collapse: collapse; text-align: left; font-size: .9rem; }
.admin-table thead tr { background: var(--bg-elevated); border-bottom: 1px solid var(--border); }
.admin-table th, .admin-table td { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.admin-table th { font-weight: 600; color: var(--text-tertiary); text-transform: none; letter-spacing: normal; font-size: .9rem; }
.admin-table tbody tr { transition: background .15s; }
.admin-table tbody tr:hover { background: var(--bg-elevated); }
.admin-table .cell-primary { font-weight: 500; color: var(--text); }
.admin-table .cell-sub { display: block; font-size: .8rem; opacity: .6; margin-top: .1rem; }
.admin-table .cell-empty { padding: 2.5rem; text-align: center; opacity: .6; }
.admin-table .cell-muted { opacity: .7; font-size: .85rem; }
.admin-table .cell-mono { font-family: monospace; font-size: .85rem; opacity: .85; }

.admin-pill { display: inline-block; padding: .2rem .6rem; border-radius: 6px; font-size: .76rem; font-weight: 600; text-transform: uppercase; }
.admin-pill-success { background: rgba(16, 185, 129, .15); color: #10B981; }
.admin-pill-warning { background: rgba(234, 179, 8, .15); color: #eab308; }
.admin-pill-danger { background: rgba(239, 68, 68, .15); color: #ef4444; }
.admin-pill-accent { background: var(--accent-soft); color: var(--accent); }
.admin-pill-neutral { background: var(--bg-elevated); color: var(--text-secondary); opacity: .85; text-transform: none; }

.admin-tag { font-size: .75rem; padding: .25rem .6rem; border-radius: 4px; font-weight: 600; }
.admin-tag-red { background: rgba(229, 9, 20, .15); color: #e50914; }
.admin-tag-blue { background: rgba(54, 162, 235, .15); color: #36a2eb; }

.admin-pagination { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-top: 1px solid var(--border); flex-wrap: wrap; gap: 1rem; }
.admin-pagination-links { display: flex; gap: .35rem; }
.admin-page-link {
  padding: .4rem .8rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 6px;
  color: inherit; text-decoration: none; font-size: .85rem; font-weight: 500;
}
.admin-page-link.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.admin-page-link.disabled { opacity: .4; cursor: not-allowed; }

.admin-analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.admin-analytics-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.admin-progress-row { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: .35rem; }
.admin-progress-label { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.admin-progress-track { width: 100%; background: var(--bg-elevated); height: 8px; border-radius: 4px; overflow: hidden; }
.admin-progress-fill { height: 100%; border-radius: 4px; transition: width .4s ease; }
.admin-progress-fill.red { background: #e50914; }
.admin-progress-fill.blue { background: #36a2eb; }
.admin-stat-sub { display: block; font-weight: normal; opacity: .7; font-size: .8rem; }

.admin-code-box { background: var(--bg-elevated); padding: .6rem .8rem; border-radius: 6px; font-family: monospace; font-size: .85rem; word-break: break-all; border: 1px solid var(--border); }
.admin-code-box.xs { padding: .4rem .6rem; border-radius: 4px; font-size: .82rem; }
.admin-code-stack { display: flex; flex-direction: column; gap: .35rem; font-family: monospace; font-size: .82rem; }

.admin-sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: .35rem; width: 100%; padding-top: 1rem; border-top: 1px solid var(--border); }
.admin-sidebar-footer a { display: flex; align-items: center; gap: .75rem; padding: .65rem .85rem; border-radius: 8px; color: inherit; text-decoration: none; font-size: .9rem; font-weight: 500; opacity: .8; transition: all .2s; }
.admin-sidebar-footer a:hover { opacity: 1; background: var(--bg-elevated); }
.admin-sidebar-footer a.danger { color: var(--danger); opacity: 1; }
.admin-back-link { display: inline-flex; align-items: center; gap: .4rem; font-size: .88rem; font-weight: 500; color: inherit; text-decoration: none; opacity: .75; margin-bottom: .5rem; transition: opacity .15s; }
.admin-back-link:hover { opacity: 1; }

/* ===================== Responsive ===================== */
/* Below 901px the fixed sidebar collapses into a slim top bar (hamburger
   opens the slide-in drawer — see the Mobile drawer section below);
   content stops reserving space for the rail. */
@media (max-width: 900px) {
  .navbar {
    position: sticky; top: 0; left: auto; width: auto; height: auto;
    flex-direction: row; align-items: center; padding: .7rem 1rem;
    border-right: none; border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px); background: color-mix(in srgb, var(--nav-bg) 92%, transparent);
  }
  .navbar .brand { margin-bottom: 0; padding: 0; }
  .page, .site-footer { margin-left: 0; }
  .page { padding: 0 1rem 2rem; }
  .hero { margin: 0 -1rem 2rem; }
  .hero-content { padding: 0 1.2rem 2rem; }
  .hero-content h1 { font-size: 1.7rem; }
  .detail-header { padding-top: 1.3rem; }
  .detail-poster { width: 130px; }
  .chat-panel { width: calc(100vw - 2.5rem); }
  .site-footer { padding: 2rem 1rem 1.5rem; }
}

/* ===================== Theme toggle + notification bell ===================== */
.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: border-color .15s, color .15s;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); }

/* Sun/moon swap: dark theme shows the sun (click to go light), light theme shows the moon. */
.theme-icon-moon { display: none; }
[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: block; }

/* ===================== Mobile drawer (hamburger nav) ===================== */
/* Below 901px the sidebar's nav-links/search/user block hide (see the
   Responsive block above) and this slide-in drawer + hamburger button
   take over — triggered by the inline script at the bottom of
   header.php. Colors use the same design tokens as the rest of the
   site so this switches with the light/dark toggle automatically. */
.mobile-menu-toggle {
  display: none; position: absolute; top: 50%; right: 1rem; transform: translateY(-50%);
  width: 42px; height: 42px; background: none; border: none; color: inherit;
  cursor: pointer; padding: .5rem; align-items: center; justify-content: center; z-index: 10;
}
.mobile-menu-toggle:focus-visible, .drawer-close:focus-visible, #mobileThemeToggle:focus-visible {
  outline: 2px solid currentColor; outline-offset: 3px; border-radius: 6px;
}
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transition: all .3s ease; z-index: 1500;
}
.drawer-overlay.open { opacity: 1; visibility: visible; }
.navbar-drawer {
  position: fixed; top: 0; right: -100%; width: 280px; height: 100vh;
  background: var(--bg-surface); color: var(--text); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 1.5rem; gap: 1.25rem;
  transition: right .3s cubic-bezier(.4, 0, .2, 1), background-color .3s ease, color .3s ease;
  z-index: 2000; box-shadow: -10px 0 30px rgba(0, 0, 0, .5); overflow-x: visible;
}
.navbar-drawer.open { right: 0; }
.drawer-header { display: flex; align-items: center; justify-content: space-between; }
.drawer-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 1.75rem; line-height: 1; padding: .2rem; }
.drawer-search input {
  width: 100%; padding: .6rem 1rem; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 8px; color: inherit; font-size: .95rem; outline: none;
}
.drawer-links { display: flex; flex-direction: column; gap: .75rem; }
.drawer-links a, .drawer-links button.drawer-action-btn {
  color: inherit; text-decoration: none; font-weight: 500; font-size: 1.05rem; padding: .5rem 0;
  background: none; border: none; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: left; cursor: pointer;
}
.drawer-footer-actions {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: .5rem; border-top: 1px solid var(--border); margin-top: auto;
}
.desktop-notif-slot, .mobile-notif-slot { position: relative; display: inline-flex; align-items: center; }
.mobile-notif-slot { display: none; min-width: 42px; justify-content: center; }
.mobile-notif-slot, .mobile-notif-slot .notif-wrapper, .mobile-notif-slot #notifToggle { z-index: 3001; }
.navbar-drawer .notif-wrapper, .navbar-drawer .notification-dropdown,
.navbar-drawer .notifications-dropdown, .navbar-drawer .notif-dropdown { z-index: 3002 !important; }
.mobile-notif-slot .notif-wrapper { display: flex !important; position: relative; }

@media (max-width: 900px) {
  .nav-links, .nav-search, .nav-user { display: none !important; }
  .navbar { min-height: 64px; padding-right: 4.25rem; padding-left: 1rem; }
  .mobile-menu-toggle { display: inline-flex; }
  .navbar-drawer .drawer-footer-actions { display: flex; }
  .mobile-notif-slot { display: inline-flex !important; }
  .nav-user > .notif-wrapper { display: none !important; }
  .navbar-drawer .notif-wrapper { display: flex !important; }
  .navbar-drawer #mobileThemeToggle { display: flex !important; }
}

.notif-widget { position: relative; }
.notif-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: .68rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; line-height: 1; border: 2px solid var(--bg);
}
.notif-panel {
  position: absolute; top: calc(100% + 10px); left: 0; width: 340px; max-width: 90vw;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity .15s, transform .15s, visibility .15s; z-index: 200; overflow: hidden;
}
.notif-panel.open { opacity: 1; visibility: visible; transform: translateY(0); }
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.1rem;
  font-weight: 700; border-bottom: 1px solid var(--border);
}
.notif-new-pill { background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; padding: .15rem .6rem; border-radius: 999px; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item {
  display: block; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent; transition: background .15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-surface); }
.notif-item.unread { border-left-color: var(--accent); background: var(--accent-soft); }
.notif-item-title { font-weight: 700; font-size: .9rem; margin-bottom: .2rem; }
.notif-item-body { font-size: .84rem; color: var(--text-secondary); line-height: 1.4; margin-bottom: .3rem; }
.notif-item-time { font-size: .74rem; color: var(--text-tertiary); }
.notif-view-all {
  display: block; text-align: center; padding: .9rem; font-size: .86rem; font-weight: 600;
  color: var(--accent); border-top: 1px solid var(--border);
}
.notif-view-all:hover { background: var(--bg-surface); }

.page-narrow { max-width: 640px; margin: 0 auto; padding-top: 2rem; }
.notif-list--page { max-height: none; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-elevated); }
/* --- Social share buttons (movie/series detail pages, referrals page) --- */
.share-row { display: flex; align-items: center; gap: .5rem; margin-top: 1.1rem; flex-wrap: wrap; }
.share-label { font-size: .82rem; color: var(--text-tertiary); margin-right: .2rem; }
.share-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  width: 34px; height: 34px; border-radius: 50%; background: var(--bg-elevated);
  border: 1px solid var(--border-strong); color: var(--text-secondary);
  cursor: pointer; text-decoration: none; transition: border-color .15s, color .15s;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); }
.share-btn.share-copy { width: auto; padding: 0 .9rem; border-radius: 999px; font-size: .82rem; font-weight: 600; font-family: var(--font); }

/* --- GDPR cookie consent banner --- */
.cookie-consent {
  position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 2000;
  max-width: 640px; margin: 0 auto; background: var(--bg-elevated);
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); padding: 1.1rem 1.3rem;
  display: flex; flex-direction: column; gap: .9rem;
}
.cookie-consent p { margin: 0; font-size: .86rem; color: var(--text-secondary); line-height: 1.5; }
.cookie-consent p a { color: var(--accent); }
.cookie-consent-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
.cookie-consent--hidden { display: none; }
@media (min-width: 901px) {
  /* Above the sidebar breakpoint, the fixed Plex-style left rail (240px,
     see .navbar) is on screen — start the banner after it rather than
     centering across the full viewport, or it can overlap the sidebar. */
  .cookie-consent { left: calc(var(--sidebar-w) + 1rem); margin: 0; }
}
@media (max-width: 520px) {
  .cookie-consent { left: .6rem; right: .6rem; bottom: .6rem; padding: 1rem; }
  .cookie-consent-actions { justify-content: stretch; }
  .cookie-consent-actions .btn { flex: 1; }
}

/* --- Account / referrals pages --- */
/* Named .info-panel, not .glass-panel — the latter is already used
   (unstyled) on movie.php/watch-series.php's hero and comments blocks;
   reusing it here would leak a new border/background onto those
   pre-existing pages as a side effect. */
.info-panel { background: var(--bg-surface); border: 1px solid var(--border); }
