/* ══════════════════════════════════════════════════
   SilvaStream — Details Page (Movie & Series)
   Uses the same CSS variable system as main.css
   ══════════════════════════════════════════════════ */

/* Map old names → new, just in case */
:root {
  --primary:    var(--bg);
  --secondary:  var(--bg-2);
  --surface:    var(--bg-3);
  --card-bg:    var(--bg-card);
  --radius:     10px;
  --radius-sm:  6px;
  --glass:      rgba(255,255,255,0.04);
  --glass-border: rgba(255,255,255,0.08);
  --text-secondary: var(--text-2);
  --accent-glow: rgba(229,9,20,0.35);
}

body { background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── Search on inner pages ─────────────────────── */
.inner-search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 30px; padding: 0 16px; max-width: 340px; width: 100%;
  transition: border-color .25s;
}
.inner-search-bar:focus-within { border-color: var(--accent); }
.inner-search-bar input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: inherit; font-size: 14px;
  padding: 10px 0;
}
.inner-search-bar input::placeholder { color: var(--text-muted); }
.inner-search-bar button {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 14px; padding: 0;
  transition: color .2s;
}
.inner-search-bar button:hover { color: var(--accent); }

/* ── Backdrop Hero ─────────────────────────────── */
.details-backdrop-hero {
  position: relative; width: 100%; height: clamp(360px, 55vh, 600px);
  overflow: hidden; margin-top: var(--nav-h, 72px);
}

.details-backdrop-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: .45; transform: scale(1.05);
  filter: blur(2px);
}

.details-backdrop-grad {
  position: absolute; inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(4,7,20,.15) 0%,
    rgba(4,7,20,.5) 50%,
    rgba(4,7,20,1) 100%
  );
}

.details-back-btn {
  position: absolute; top: 24px; left: clamp(16px,4vw,60px);
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,.5); backdrop-filter: blur(12px);
  color: #fff; border: 1px solid rgba(255,255,255,.15);
  padding: 9px 20px; border-radius: 30px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; text-decoration: none;
  transition: background .25s, transform .25s; z-index: 5;
}
.details-back-btn:hover { background: var(--accent); border-color: var(--accent); transform: translateX(-4px); }

/* ── Main Info Block ───────────────────────────── */
.details-info-block {
  display: flex; gap: 36px; align-items: flex-start;
  padding: 0 clamp(16px,4vw,60px) 40px;
  margin-top: -120px; position: relative; z-index: 2;
}

.details-poster-wrap {
  flex-shrink: 0; width: clamp(140px, 18vw, 220px);
}

.details-poster {
  width: 100%; aspect-ratio: 2/3; object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.8), 0 0 0 1px rgba(255,255,255,.06);
  display: block;
}

.details-poster-ph {
  width: 100%; aspect-ratio: 2/3; border-radius: 12px;
  background: var(--bg-card); display: flex; align-items: center;
  justify-content: center; font-size: 48px; color: var(--text-muted);
}

.details-meta-wrap {
  flex: 1; padding-top: 120px;
  min-width: 0; overflow-wrap: break-word;
}

.details-badges {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
}

.details-badge {
  font-size: 11px; font-weight: 700; padding: 4px 12px;
  border-radius: 20px; letter-spacing: .5px; text-transform: uppercase;
}
.badge-movie { background: rgba(229,9,20,.15); color: var(--accent); border: 1px solid rgba(229,9,20,.3); }
.badge-series { background: rgba(67,97,238,.15); color: #6c8fff; border: 1px solid rgba(67,97,238,.3); }
.badge-hd { background: rgba(244,197,66,.12); color: var(--gold); border: 1px solid rgba(244,197,66,.25); }

.details-title {
  font-size: clamp(26px, 4vw, 48px); font-weight: 900;
  line-height: 1.1; margin: 0 0 14px; color: #fff;
  word-break: break-word;
}

.details-meta-row {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  margin-bottom: 16px;
}

.meta-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--text-2);
}
.meta-item i { color: var(--text-muted); font-size: 12px; }
.meta-rating { color: var(--gold); font-weight: 600; }
.meta-rating i { color: var(--gold) !important; }
.meta-sep { color: var(--text-muted); }

.details-genres {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px;
}
.genre-pill {
  font-size: 12px; padding: 5px 14px; border-radius: 20px;
  background: var(--bg-card); border: 1px solid rgba(255,255,255,.08);
  color: var(--text-2); font-weight: 500;
}

.details-description {
  font-size: 15px; line-height: 1.7; color: var(--text-2);
  max-width: min(680px, 100%); margin-bottom: 28px;
  overflow-wrap: break-word;
}

/* ── Action Buttons ────────────────────────────── */
.details-actions {
  display: flex; flex-wrap: wrap; gap: 12px;
}

.det-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: 8px; font-size: 15px;
  font-weight: 700; font-family: inherit; cursor: pointer;
  border: none; text-decoration: none; transition: all .2s;
}
.det-btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 24px rgba(229,9,20,.4);
}
.det-btn-primary:hover { background: #f40612; transform: translateY(-2px); box-shadow: 0 8px 32px rgba(229,9,20,.5); }

.det-btn-secondary {
  background: rgba(255,255,255,.1); color: #fff;
  border: 1px solid rgba(255,255,255,.15); backdrop-filter: blur(8px);
}
.det-btn-secondary:hover { background: rgba(255,255,255,.18); transform: translateY(-2px); }

.det-btn-ghost {
  background: transparent; color: var(--text-2);
  border: 1px solid rgba(255,255,255,.12);
}
.det-btn-ghost:hover { background: var(--bg-card); color: #fff; transform: translateY(-2px); }

/* ── Trailer Player (inline) ───────────────────── */
.trailer-embed {
  display: none; position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,.92); align-items: center; justify-content: center;
}
.trailer-embed.open { display: flex; }
.trailer-inner {
  position: relative; width: min(90vw, 960px);
  background: #000; border-radius: 12px; overflow: hidden;
}
.trailer-inner video {
  width: 100%; display: block; max-height: 80vh;
}
.trailer-close {
  position: absolute; top: 12px; right: 12px;
  background: rgba(0,0,0,.7); border: none; color: #fff;
  width: 36px; height: 36px; border-radius: 50%; font-size: 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .2s; z-index: 10;
}
.trailer-close:hover { background: var(--accent); }

/* ── Section Labels ────────────────────────────── */
.det-section {
  padding: 0 clamp(16px,4vw,60px); margin-bottom: 48px;
}

.det-section-title {
  font-size: 20px; font-weight: 800; margin: 0 0 20px;
  display: flex; align-items: center; gap: 10px;
}
.det-section-title::before {
  content: ''; display: block; width: 4px; height: 22px;
  background: var(--accent); border-radius: 2px;
}

/* ── Cast Row ──────────────────────────────────── */
.cast-scroll {
  display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent;
}
.cast-scroll::-webkit-scrollbar { height: 4px; }
.cast-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

.cast-card {
  flex: 0 0 110px; text-align: center;
}
.cast-photo-wrap {
  width: 80px; height: 80px; border-radius: 50%; overflow: hidden;
  margin: 0 auto 8px; background: var(--bg-card);
  border: 2px solid rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: var(--text-muted);
}
.cast-photo-wrap img {
  width: 100%; height: 100%; object-fit: cover;
}
.cast-name {
  font-size: 12px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cast-char {
  font-size: 11px; color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Similar Content Row ───────────────────────── */
.similar-scroll {
  display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent;
}
.similar-scroll::-webkit-scrollbar { height: 4px; }
.similar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

.similar-card {
  flex: 0 0 140px; cursor: pointer; border-radius: 8px; overflow: hidden;
  background: var(--bg-card); transition: transform .2s;
}
.similar-card:hover { transform: translateY(-4px) scale(1.02); }
.similar-card img {
  width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block;
}
.similar-card-info {
  padding: 8px 10px;
}
.similar-card-title {
  font-size: 12px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.similar-card-year { font-size: 11px; color: var(--text-muted); }

/* ── Seasons & Episodes ────────────────────────── */
.seasons-list { display: flex; flex-direction: column; gap: 12px; }

.season-block {
  background: var(--bg-card); border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px; overflow: hidden;
}

.season-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; cursor: pointer; user-select: none;
  transition: background .2s;
}
.season-header:hover { background: rgba(255,255,255,.04); }

.season-header h3 {
  font-size: 16px; font-weight: 700; margin: 0;
}
.season-header-right {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-muted);
}
.season-toggle-icon { transition: transform .3s; color: var(--text-muted); font-size: 13px; }
.season-block.open .season-toggle-icon { transform: rotate(180deg); }

.episodes-list {
  display: none; padding: 0 20px 16px; display: flex;
  flex-direction: column; gap: 8px;
}
.season-block:not(.open) .episodes-list { display: none; }
.season-block.open .episodes-list { display: flex; }

.episode-item {
  display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,.03); border-radius: 8px;
  padding: 12px 14px; transition: background .2s;
}
.episode-item:hover { background: rgba(255,255,255,.07); }

.episode-num {
  font-size: 20px; font-weight: 900; color: var(--text-muted);
  min-width: 36px; text-align: center;
}
.episode-info { flex: 1; }
.episode-title { font-size: 14px; font-weight: 600; }
.episode-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.episode-actions { display: flex; gap: 8px; }

.ep-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 6px; font-size: 12px;
  font-weight: 600; font-family: inherit; cursor: pointer;
  border: none; transition: all .2s;
}
.ep-btn-play { background: var(--accent); color: #fff; }
.ep-btn-play:hover { background: #f40612; }
.ep-btn-dl { background: var(--bg-3); color: var(--text-2); border: 1px solid rgba(255,255,255,.08); }
.ep-btn-dl:hover { background: var(--bg-card); }

/* ── Download Quality Modal ────────────────────── */
.det-modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 800;
  background: rgba(0,0,0,.8); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.det-modal-overlay.open { display: flex; }

.det-modal {
  background: var(--bg-2); border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px; width: min(90vw, 480px); max-height: 80vh;
  overflow: hidden; display: flex; flex-direction: column;
}
.det-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.det-modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.det-modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 20px; cursor: pointer; line-height: 1;
  transition: color .2s;
}
.det-modal-close:hover { color: var(--accent); }
.det-modal-body { padding: 16px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }

.quality-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card); border-radius: 10px; padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.05);
}
.quality-label { font-size: 15px; font-weight: 700; }
.quality-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.quality-dl-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; background: var(--accent); color: #fff;
  border-radius: 6px; font-size: 13px; font-weight: 600;
  text-decoration: none; transition: background .2s;
}
.quality-dl-btn:hover { background: #f40612; }
.quality-stream-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; background: var(--bg-3); color: var(--text);
  border-radius: 6px; font-size: 13px; font-weight: 600;
  border: none; cursor: pointer; font-family: inherit;
  border: 1px solid rgba(255,255,255,.08); margin-right: 8px;
  transition: background .2s;
}
.quality-stream-btn:hover { background: rgba(255,255,255,.1); }

/* ── Page Loader ───────────────────────────────── */
.details-spinner {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 60vh; gap: 20px;
  color: var(--text-muted);
}
.spin-ring {
  width: 48px; height: 48px; border: 3px solid rgba(255,255,255,.08);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error State ───────────────────────────────── */
.details-error {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 60vh; gap: 16px; text-align: center;
  padding: 40px;
}
.details-error i { font-size: 48px; color: var(--accent); }
.details-error h2 { font-size: 22px; font-weight: 700; margin: 0; }
.details-error p { color: var(--text-2); margin: 0; }
.details-error a {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff; padding: 10px 24px;
  border-radius: 8px; text-decoration: none; font-weight: 700;
  transition: background .2s;
}
.details-error a:hover { background: #f40612; }

/* ── Responsive ────────────────────────────────── */
@media (max-width: 700px) {
  .details-info-block { flex-direction: column; gap: 20px; margin-top: -60px; }
  .details-poster-wrap { width: 120px; }
  .details-meta-wrap { padding-top: 0; }
  .details-backdrop-hero { height: 220px; }
  .det-section { padding: 0 16px; }
  .details-actions { flex-wrap: wrap; }
  .det-btn { font-size: 13px; padding: 10px 18px; }
  .episode-item { flex-wrap: wrap; }
  .episode-actions { width: 100%; }
}

@media (max-width: 480px) {
  .cast-card { flex: 0 0 90px; }
  .cast-photo-wrap { width: 64px; height: 64px; }
}
