/* ═══════════════════════════════════════════════════════════════════════════
   PalVision TV — style.css
   Dark luxury design, optimized for 1080p TV + remote control navigation
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg:        #0a0a10;
  --bg2:       #111118;
  --bg3:       #1a1a24;
  --card-bg:   #16161e;
  --gold:      #e8b84b;
  --gold2:     #f5d070;
  --red:       #e83c3c;
  --text:      #ffffff;
  --text2:     #b0b0c0;
  --text3:     #707080;
  --border:    rgba(255,255,255,0.07);
  --shadow:    0 8px 32px rgba(0,0,0,0.6);
  --radius:    10px;
  --radius-sm: 6px;
  --tr:        0.2s ease;
  --navbar-h:  72px;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Tajawal', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}
button { background: none; border: none; cursor: pointer; color: inherit; font-family: inherit; }
img { display: block; }
::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; }

/* ── Splash ───────────────────────────────────────────────────────────────── */
#splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1a1a2e 0%, var(--bg) 70%);
}
.splash-inner { text-align: center; }
.splash-logo { font-size: 4rem; font-weight: 900; letter-spacing: -2px; margin-bottom: 40px; }
.logo-pal  { color: var(--gold); }
.logo-vis  { color: var(--text); }
.splash-bar-wrap {
  width: 300px; height: 4px; background: var(--bg3);
  border-radius: 2px; overflow: hidden; margin: 0 auto 20px;
}
.splash-bar {
  height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold2));
  border-radius: 2px; transition: width 0.4s ease;
}
.splash-msg { color: var(--text2); font-size: 1rem; font-weight: 300; }

/* ── Navbar ───────────────────────────────────────────────────────────────── */
#navbar {
  position: fixed; top: 0; right: 0; left: 0; z-index: 100;
  height: var(--navbar-h);
  display: flex; align-items: center; gap: 24px; padding: 0 40px;
  background: linear-gradient(to bottom, rgba(10,10,16,0.98) 60%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav-logo { font-size: 1.6rem; font-weight: 900; letter-spacing: -1px; flex-shrink: 0; }
.nav-items { display: flex; gap: 8px; flex: 1; justify-content: center; }
.nav-btn {
  padding: 10px 22px; border-radius: 24px;
  font-size: 1rem; font-weight: 500;
  color: var(--text2); transition: var(--tr);
  border: 2px solid transparent;
  outline: none;
}
.nav-btn:hover, .nav-btn.focused {
  color: var(--text);
  background: var(--bg3);
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(232,184,75,0.25);
}
.nav-btn.active-page {
  color: var(--gold); font-weight: 700;
}
.nav-right { flex-shrink: 0; }
.nav-hint { font-size: 0.72rem; color: var(--text3); }

/* ── Content area ─────────────────────────────────────────────────────────── */
#content {
  position: fixed; top: var(--navbar-h); right: 0; left: 0; bottom: 0;
  overflow-y: scroll; overflow-x: hidden;
  scroll-behavior: smooth;
}

/* ── Pages ────────────────────────────────────────────────────────────────── */
.page { min-height: 100%; }
.hidden { display: none !important; }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  position: relative; width: 100%; height: 56vh; min-height: 360px;
  overflow: hidden; flex-shrink: 0;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center top;
  filter: brightness(0.55);
  transition: background-image 0.6s ease;
}
.hero-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(to left, transparent 30%, rgba(10,10,16,0.85) 70%, var(--bg) 100%),
              linear-gradient(to top, var(--bg) 0%, transparent 40%);
}
.hero-content {
  position: absolute; bottom: 0; right: 0;
  padding: 40px 48px; max-width: 55%;
  direction: rtl; text-align: right;
}
.hero-badge {
  display: inline-block;
  background: var(--gold); color: #000;
  font-size: 0.72rem; font-weight: 700;
  padding: 3px 10px; border-radius: 4px; margin-bottom: 12px;
  text-transform: uppercase; letter-spacing: 1px;
}
.hero-title {
  font-size: 2.6rem; font-weight: 900; line-height: 1.15;
  margin-bottom: 12px; text-shadow: 0 2px 12px rgba(0,0,0,0.8);
}
.hero-meta {
  display: flex; gap: 16px; align-items: center;
  margin-bottom: 14px; font-size: 0.9rem; color: var(--text2);
  direction: rtl;
}
.hero-rating { color: var(--gold); font-weight: 700; }
.hero-plot {
  font-size: 0.95rem; color: var(--text2); line-height: 1.6;
  margin-bottom: 24px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--gold); color: #000;
  padding: 14px 32px; border-radius: 8px;
  font-size: 1.1rem; font-weight: 700;
  transition: var(--tr); border: 2px solid var(--gold);
  outline: none;
}
.hero-btn:hover, .hero-btn.focused {
  background: var(--gold2); box-shadow: 0 0 24px rgba(232,184,75,0.5);
  transform: scale(1.05);
}

/* ── Section rows ─────────────────────────────────────────────────────────── */
.section { padding: 32px 40px 0; }
.section-title {
  font-size: 1.25rem; font-weight: 700; margin-bottom: 16px;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.section-title::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(to left, transparent, var(--border));
}
.row-wrap {
  display: flex; gap: 14px; padding-bottom: 8px;
  overflow-x: auto; scroll-behavior: smooth;
}
.row-wrap:last-of-type { padding-bottom: 40px; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  flex-shrink: 0; position: relative;
  border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  border: 3px solid transparent;
  outline: none;
  transition: transform var(--tr), border-color var(--tr), box-shadow var(--tr);
  background: var(--card-bg);
}
.card:hover, .card.focused {
  border-color: var(--gold);
  transform: scale(1.06) translateY(-4px);
  box-shadow: 0 12px 40px rgba(232,184,75,0.3), 0 0 0 1px rgba(232,184,75,0.15);
  z-index: 10;
}
/* Landscape cards (movies/latest) */
.card-land { width: 240px; height: 145px; }
.card-land .card-img { width: 100%; height: 100%; object-fit: cover; }
/* Portrait cards (series) */
.card-port { width: 155px; height: 230px; }
.card-port .card-img { width: 100%; height: 172px; object-fit: cover; }
/* Channel cards (live) */
.card-chan { width: 170px; height: 110px; }
.card-chan .card-img { width: 100%; height: 70px; object-fit: contain; padding: 8px; background: var(--bg3); }

.card-info {
  padding: 8px 10px; background: var(--card-bg);
}
.card-name {
  font-size: 0.82rem; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-sub { font-size: 0.72rem; color: var(--text3); margin-top: 2px; }
.card-rating { color: var(--gold); font-size: 0.72rem; }

/* ── Category + Grid layout (movies / series / live) ─────────────────────── */
.cat-layout {
  display: flex; height: calc(100vh - var(--navbar-h));
}
.cat-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--bg2); border-left: 1px solid var(--border);
  overflow-y: auto; padding: 24px 0;
}
.cat-sidebar-title {
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
  color: var(--text3); letter-spacing: 1px;
  padding: 0 20px 12px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.cat-btn {
  display: block; width: 100%; text-align: right;
  padding: 12px 20px; font-size: 0.9rem;
  color: var(--text2); border-radius: 0;
  transition: var(--tr); border: 2px solid transparent;
  border-right: 3px solid transparent;
  outline: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cat-btn:hover, .cat-btn.focused {
  background: var(--bg3); color: var(--gold);
  border-right-color: var(--gold);
}
.cat-btn.selected { color: var(--gold); border-right-color: var(--gold); background: rgba(232,184,75,0.06); }

.cat-grid-wrap {
  flex: 1; overflow-y: auto; padding: 28px 32px;
}
.cat-grid-title {
  font-size: 1.2rem; font-weight: 700; margin-bottom: 20px; color: var(--text);
}
.cat-grid {
  display: flex; flex-wrap: wrap; gap: 14px;
}

/* ── Detail Modal ─────────────────────────────────────────────────────────── */
#detail-modal {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(8px);
}
.modal-box {
  position: relative; z-index: 1;
  width: 100%; max-width: 900px; max-height: 90vh;
  background: var(--bg2); border-radius: 14px;
  border: 1px solid var(--border); overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8);
  overflow-y: auto;
}
.modal-close-btn {
  position: absolute; top: 16px; left: 16px; z-index: 10;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: var(--text);
  font-size: 1rem; display: flex; align-items: center; justify-content: center;
  border: 2px solid transparent; transition: var(--tr); outline: none;
}
.modal-close-btn:hover, .modal-close-btn.focused {
  border-color: var(--gold); color: var(--gold);
}
/* Detail layout */
.detail-hero {
  position: relative; width: 100%; height: 280px; overflow: hidden;
}
.detail-backdrop {
  width: 100%; height: 100%; object-fit: cover; filter: brightness(0.45);
}
.detail-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg2) 0%, transparent 50%),
              linear-gradient(to left, transparent 40%, rgba(0,0,0,0.5) 100%);
}
.detail-poster-wrap {
  position: absolute; bottom: -50px; right: 40px;
  display: flex; gap: 28px; align-items: flex-end;
}
.detail-poster {
  width: 120px; height: 175px; border-radius: 10px;
  object-fit: cover; border: 3px solid var(--bg2);
  box-shadow: var(--shadow);
}
.detail-body { padding: 60px 40px 40px; }
.detail-title { font-size: 2rem; font-weight: 900; margin-bottom: 10px; }
.detail-meta {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  font-size: 0.88rem; color: var(--text2); margin-bottom: 16px;
}
.detail-meta .rating { color: var(--gold); font-weight: 700; }
.detail-genre {
  display: inline-block; background: var(--bg3);
  padding: 2px 10px; border-radius: 4px; font-size: 0.78rem;
}
.detail-plot {
  font-size: 0.95rem; color: var(--text2); line-height: 1.7;
  margin-bottom: 24px;
}
.detail-cast { font-size: 0.85rem; color: var(--text3); margin-bottom: 28px; }
.detail-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.btn-play-main {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--gold); color: #000;
  padding: 14px 36px; border-radius: 8px;
  font-size: 1.05rem; font-weight: 700;
  transition: var(--tr); border: 2px solid var(--gold); outline: none;
}
.btn-play-main:hover, .btn-play-main.focused {
  background: var(--gold2); box-shadow: 0 0 28px rgba(232,184,75,0.45);
  transform: scale(1.04);
}
/* Episodes */
.episodes-section { margin-top: 32px; }
.season-title {
  font-size: 1rem; font-weight: 700; color: var(--text2);
  margin: 20px 0 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px;
}
.episode-list { display: flex; flex-direction: column; gap: 6px; }
.ep-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--bg3); border: 2px solid transparent;
  transition: var(--tr); cursor: pointer; outline: none;
}
.ep-item:hover, .ep-item.focused {
  border-color: var(--gold); background: rgba(232,184,75,0.06);
}
.ep-num { font-size: 0.85rem; color: var(--gold); font-weight: 700; min-width: 28px; text-align: center; }
.ep-title { flex: 1; font-size: 0.9rem; }
.ep-dur { font-size: 0.78rem; color: var(--text3); }
.ep-play { font-size: 0.88rem; color: var(--gold); }

/* ── Player (Netflix-style custom) ───────────────────────────────────────── */
#player-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: #000;
  overflow: hidden;
  cursor: none;
  animation: pv-fade-in 0.35s ease;
}
@keyframes pv-fade-in { from { opacity: 0; } to { opacity: 1; } }

#player-overlay.pv-ui-show { cursor: default; }

#video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  background: #000;
  object-fit: contain;
}

/* Top + bottom gradient overlays */
.pv-top, .pv-bottom {
  position: absolute; left: 0; right: 0; z-index: 5;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.pv-top {
  top: 0; padding: 28px 48px 80px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.5) 60%, transparent 100%);
}
.pv-bottom {
  bottom: 0; padding: 60px 48px 28px;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.65) 50%, transparent 100%);
}
.pv-top > *, .pv-bottom > * { pointer-events: auto; }

#player-overlay.pv-ui-hide .pv-top    { opacity: 0; transform: translateY(-20px); }
#player-overlay.pv-ui-hide .pv-bottom { opacity: 0; transform: translateY(20px); }
#player-overlay.pv-ui-hide .pv-center-btn { opacity: 0; }

.pv-title-wrap { display: flex; align-items: center; gap: 16px; }
.pv-title {
  font-size: 1.8rem; font-weight: 700; color: #fff;
  text-shadow: 0 3px 14px rgba(0,0,0,0.95);
  max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pv-live-badge {
  background: #e50914; color: #fff;
  padding: 6px 14px; border-radius: 4px;
  font-size: 0.85rem; font-weight: 800; letter-spacing: 1px;
  box-shadow: 0 0 12px rgba(229,9,20,0.6);
  animation: pv-pulse 2s ease infinite;
}
@keyframes pv-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.65; } }

.pv-center-btn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 6;
  width: 110px; height: 110px; border-radius: 50%;
  background: rgba(20, 20, 28, 0.78);
  border: 3px solid rgba(255, 255, 255, 0.85);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.pv-center-btn:hover {
  transform: translate(-50%, -50%) scale(1.08);
  background: var(--gold); color: #000; border-color: var(--gold);
  box-shadow: 0 0 40px rgba(232,184,75,0.6);
}
.pv-center-btn svg { width: 56px; height: 56px; margin-right: -6px; }

.pv-poster {
  position: absolute; inset: 0; z-index: 1;
  background-size: cover; background-position: center;
  background-color: #000;
  filter: blur(28px) brightness(0.45);
  transform: scale(1.08);
  transition: opacity 0.45s ease;
  pointer-events: none;
}
.pv-poster.hidden { opacity: 0; }

.pv-spinner {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); z-index: 7;
  pointer-events: none;
}
.pv-spinner svg {
  width: 72px; height: 72px;
  animation: pv-spin 1.1s linear infinite;
}
.pv-spinner circle {
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-dasharray: 90 150;
  filter: drop-shadow(0 0 6px rgba(232,184,75,0.5));
}
@keyframes pv-spin { to { transform: rotate(360deg); } }

.pv-toast {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); z-index: 8;
  background: rgba(15, 15, 22, 0.92);
  color: #fff; padding: 18px 32px; border-radius: 12px;
  font-size: 1.4rem; font-weight: 700;
  border: 1.5px solid rgba(232,184,75,0.4);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  pointer-events: none;
  animation: pv-toast-in 0.2s ease;
}
@keyframes pv-toast-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.pv-progress {
  cursor: pointer;
  padding: 12px 0;
  margin-bottom: 8px;
}
.pv-progress:hover .pv-bar { height: 8px; }
.pv-progress:hover .pv-bar-thumb { transform: translate(-50%, -50%) scale(1.15); }
.pv-bar {
  position: relative; width: 100%; height: 5px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  transition: height 0.18s ease;
}
.pv-bar-buffer {
  position: absolute; top: 0; left: 0; height: 100%;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  transition: width 0.4s linear;
}
.pv-bar-fill {
  position: absolute; top: 0; left: 0; height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold2) 100%);
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(232,184,75,0.5);
  transition: width 0.18s linear;
}
.pv-bar-thumb {
  position: absolute; top: 50%; left: 0;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--gold);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(232,184,75,0.25), 0 2px 8px rgba(0,0,0,0.6);
  transition: left 0.18s linear, transform 0.18s ease;
}

.pv-controls {
  display: flex; justify-content: space-between; align-items: center;
  gap: 20px;
}
.pv-controls-left,
.pv-controls-right {
  display: flex; align-items: center; gap: 14px;
}

.pv-ic {
  position: relative;
  background: transparent; border: none;
  color: #fff; cursor: pointer;
  padding: 10px; border-radius: 50%;
  width: 52px; height: 52px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.pv-ic svg { width: 30px; height: 30px; }
.pv-ic:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--gold);
  transform: scale(1.08);
}
.pv-ic-num {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -42%);
  font-size: 0.62rem; font-weight: 800;
  pointer-events: none;
}

.pv-ic-play {
  width: 64px; height: 64px;
  background: rgba(255,255,255,0.1);
}
.pv-ic-play svg { width: 36px; height: 36px; }
.pv-ic-play:hover {
  background: var(--gold); color: #000;
}

.pv-vol-wrap {
  display: flex; align-items: center;
  gap: 0;
  border-radius: 30px;
  transition: background 0.2s ease;
}
.pv-vol-wrap:hover { background: rgba(255,255,255,0.08); }
.pv-vol-wrap:hover .pv-vol-bar { width: 90px; opacity: 1; margin-right: 14px; }
.pv-vol-bar {
  position: relative;
  width: 0; height: 4px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
  transition: width 0.25s ease, opacity 0.25s ease, margin 0.25s ease;
}
.pv-vol-fill {
  position: absolute; top: 0; left: 0; height: 100%;
  background: var(--gold);
  border-radius: 2px;
}

.pv-time {
  color: #fff;
  font-size: 1rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-right: 8px;
  min-width: 130px;
  direction: ltr; text-align: left;
}
.pv-sep { opacity: 0.55; margin: 0 4px; }
.pv-live-dot { color: #e50914; animation: pv-pulse 1.3s ease infinite; }

@media (min-width: 1600px) {
  .pv-top    { padding: 36px 64px 100px; }
  .pv-bottom { padding: 80px 64px 36px; }
  .pv-title  { font-size: 2.2rem; }
  .pv-live-badge { font-size: 1rem; padding: 8px 18px; }
  .pv-ic { width: 60px; height: 60px; }
  .pv-ic svg { width: 36px; height: 36px; }
  .pv-ic-play { width: 76px; height: 76px; }
  .pv-ic-play svg { width: 44px; height: 44px; }
  .pv-time { font-size: 1.2rem; min-width: 160px; }
  .pv-bar { height: 6px; }
  .pv-progress:hover .pv-bar { height: 10px; }
  .pv-bar-thumb { width: 22px; height: 22px; }
  .pv-center-btn { width: 140px; height: 140px; }
  .pv-center-btn svg { width: 70px; height: 70px; }
  .pv-toast { font-size: 1.7rem; padding: 22px 40px; }
}

/* ── Empty / Error / Loading states ─────────────────────────────────────── */
.state-msg {
  text-align: center; padding: 80px 20px; color: var(--text3);
  font-size: 1.1rem;
}
.state-msg .icon { font-size: 3rem; margin-bottom: 16px; }

/* ── Loading skeleton cards ──────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg2) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Scrollbar for modal ──────────────────────────────────────────────────── */
.modal-box::-webkit-scrollbar { width: 4px; }
.modal-box::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
