﻿/* ==========================================================================
   قسم المسلسلات — Series shelf, details, server player
   Loaded after style.css; only adds, never overrides the film pipeline.
   ========================================================================== */

/* ---------- separate view ----------
   Films and series never share the page: body.series-mode hides the whole
   film pipeline and shows #seriesView alone. app.js keeps toggling its own
   [hidden] flags, so the switch is done in CSS and cannot fight it. */

#seriesView { display: none; }

body.series-mode #seriesView {
  display: block;
  padding-top: calc(var(--header-h) + 1.4rem);
}

body.series-mode #hero,
body.series-mode #homeSections,
body.series-mode #searchSection,
body.series-mode #loadError {
  display: none !important;
}

body.series-mode .site-footer { margin-top: 2.5rem; }

.nav-pill {
  display: none;
  align-items: center;
  gap: .4rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .07);
  color: var(--text);
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  padding: .48rem .9rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s ease, border-color .18s ease;
}

.nav-pill:hover { background: rgba(255, 255, 255, .14); }

.nav-pill.active {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

/* below 980px .main-nav is hidden, so the pill is the only way in */
@media (max-width: 980px) {
  .nav-pill { display: inline-flex; }
}

.series-section .section-head { margin-bottom: .35rem; }

.series-sub {
  color: var(--muted);
  font-size: .88rem;
  margin-bottom: 1.05rem;
}

.series-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: center;
  margin-bottom: 1.15rem;
}

.series-search {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1 1 260px;
  min-width: 200px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .55rem .8rem;
}

.series-search svg {
  width: 1.05rem;
  height: 1.05rem;
  color: var(--muted);
  flex: 0 0 auto;
}

.series-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font: inherit;
  font-size: .9rem;
}

.series-search:focus-within { border-color: rgba(var(--accent-rgb), .65); }

.series-sort {
  display: inline-flex;
  gap: .3rem;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .25rem;
}

.series-sort button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  padding: .42rem .8rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}

.series-sort button:hover { color: var(--text); }

.series-sort button.active {
  background: var(--accent);
  color: #fff;
}

.series-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 1.1rem;
}

.series-more-wrap .btn { min-width: 160px; }

/* series cards reuse .movie-card; only the meta line needs room */
.series-section .card-meta { opacity: .85; font-size: .72rem; }
.series-section .card-meta .dot { margin-inline: .3rem; }

/* ---------- details ---------- */

.series-box { max-width: 940px; }

.series-seasons {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .85rem;
}

.season-tab {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  padding: .42rem .85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}

.season-tab:hover { background: rgba(255, 255, 255, .13); }

.season-tab.active {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: .5rem;
  margin-top: 1.15rem;
}

.episode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .18rem;
  padding: .6rem .4rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease, border-color .18s ease;
}

.episode-btn:hover {
  background: rgba(var(--accent-rgb), .18);
  border-color: rgba(var(--accent-rgb), .55);
  transform: translateY(-1px);
}

.ep-num { font-size: 1rem; font-weight: 900; }
.ep-label { font-size: .72rem; color: var(--muted); }

.ep-srv {
  font-size: .64rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 .4rem;
}

/* ---------- player ---------- */

.series-server-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .7rem 1rem .2rem;
}

.server-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  padding: .42rem .8rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}

.server-chip:hover { background: rgba(255, 255, 255, .14); }

.server-chip.active {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.server-dot {
  width: .42rem;
  height: .42rem;
  border-radius: 50%;
  background: #35d07f;
  box-shadow: 0 0 6px rgba(53, 208, 127, .8);
  flex: 0 0 auto;
}

.server-live {
  display: inline-block;
  width: .4rem;
  height: .4rem;
  border-radius: 50%;
  background: #35d07f;
  margin-inline-end: .4rem;
}

#seriesPlayer .player-stage { padding: 0 1rem 1rem; }

body.series-lock { overflow: hidden; }

@media (max-width: 640px) {
  .series-toolbar { flex-direction: column; align-items: stretch; }
  .series-sort { justify-content: space-between; }
  .episode-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
}
