/* ريليات - تصميم فاتح فاخر، أخضر زمردي، RTL، موبايل أولًا */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --border: #e4e8ef;
  --text: #151a26;
  --muted: #68707f;
  --navy: #171c2b;
  --green: #0db87f;
  --cyan: #0a9fd8;
  --grad: linear-gradient(120deg, #12c48b, #0a9fd8);
  --radius: 14px;
  --shadow: 0 2px 14px #1b2540 12;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Cairo", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  line-height: 1.75;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.container {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: 16px;
}

/* ===== الهيدر ===== */
.site-header {
  background: #fffffff2;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-block: 12px;
  flex-wrap: wrap;
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1.5rem;
  font-weight: 900;
}
.logo .logo-icon { width: 34px; height: 34px; filter: drop-shadow(0 4px 12px #0db87f55); }
.logo-word { letter-spacing: -.5px; }
.iconbtn {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.iconbtn:hover { color: var(--green); border-color: var(--green); }
.header-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.tg-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: #229ed9; color: #fff; font-weight: 800; font-size: .88rem;
  padding: 9px 16px; border-radius: 999px; line-height: 1;
}
.tg-btn:hover { background: #1b87b8; color: #fff; }
.tg-footer { justify-self: start; }
@media (max-width: 560px) { .tg-btn.tg-header-only .tg-text, .header-actions .tg-text { display: none; } .header-actions .tg-btn { padding: 0; width: 40px; height: 40px; justify-content: center; } }
.header-search {
  border-top: 1px solid var(--border);
  background: #fffffff2;
  padding-block: 10px;
}
.main-nav { display: flex; gap: 18px; flex-wrap: wrap; font-size: .95rem; }
.main-nav a { color: var(--muted); padding-block: 4px; border-bottom: 2px solid transparent; white-space: nowrap; flex-shrink: 0; }
.main-nav a:hover { color: var(--text); border-bottom-color: var(--green); }
.search-form { display: flex; gap: 10px; }
.search-form input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  padding: 10px 22px;
  font-family: inherit;
  font-size: .95rem;
}
.search-form input::placeholder { color: var(--muted); }
.search-form input:focus { outline: 2px solid #0db87f55; border-color: var(--green); }
.search-form button {
  background: var(--grad);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 10px 26px;
  font-family: inherit;
  font-weight: 800;
  font-size: .92rem;
  cursor: pointer;
}

/* ===== عناوين الأقسام ===== */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 40px 0 18px;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
}
.section-title::before {
  content: "";
  width: 18px; height: 18px;
  border-radius: 6px;
  background: var(--grad);
  display: inline-block;
}
.section-more { color: var(--muted); font-size: .9rem; }
.section-more:hover { color: var(--green); }
.shelf-tools { display: flex; align-items: center; gap: 14px; }
.shelf-arrows { display: flex; gap: 7px; }
.shelf-arrows button {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.shelf-arrows button:hover { color: var(--green); border-color: var(--green); }
.page-title {
  font-size: 1.65rem;
  font-weight: 800;
  margin: 26px 0 20px;
}
.breadcrumb { color: var(--muted); font-size: .87rem; margin-block: 16px; }
.breadcrumb a:hover { color: var(--green); }

/* ===== الهيرو (ملصق كامل + محتوى فوق تدرج) ===== */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--border);
  box-shadow: 0 22px 55px #1b254033;
  background: var(--navy);
  min-height: 500px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin-top: 20px;
  isolation: isolate;
}
.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  z-index: 0;
}
.hero-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(13,18,30,.97) 8%, rgba(13,18,30,.72) 38%, rgba(13,18,30,.18) 66%, rgba(13,18,30,.28) 100%);
}
.hero-inner {
  position: relative;
  z-index: 2;
  padding: 24px 18px 18px;
  color: #fff;
}
.hero-kicker {
  display: inline-block;
  background: rgba(13,184,127,.22);
  color: #7de9c2;
  border: 1px solid rgba(125,233,194,.4);
  font-size: .78rem;
  font-weight: 700;
  padding: 4px 16px;
  border-radius: 999px;
  margin-bottom: 10px;
  backdrop-filter: blur(6px);
}
.hero-title {
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1.45;
  margin: 0 0 10px;
  color: #fff;
  text-shadow: 0 2px 16px rgba(0,0,0,.55);
}
.hero-chips { margin-bottom: 10px; }
.hero-chips .chip {
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.25);
  color: #fff;
  backdrop-filter: blur(6px);
}
.hero-chips .chip:hover { background: rgba(255,255,255,.26); color: #fff; }
.hero-desc {
  color: #dde4ee;
  font-size: .95rem;
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 60ch;
  text-shadow: 0 1px 10px rgba(0,0,0,.4);
}
.hero-stats {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: .92rem;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.hero-stats b { color: var(--text); }
.hero .hero-stats { color: #c6cfdd; }
.hero .hero-stats b { color: #fff; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.hero .btn-ghost {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.35);
  color: #fff;
  backdrop-filter: blur(6px);
}
.hero .btn-ghost:hover { background: rgba(255,255,255,.22); border-color: #fff; color: #fff; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 30px;
  border-radius: 12px;
  font-weight: 800;
  font-size: .98rem;
  border: 1px solid transparent;
}
.btn-grad {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 24px #0db87f44;
}
.btn-grad:hover { filter: brightness(1.07); }
.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--green); color: var(--green); }
.btn-dark {
  background: var(--navy);
  color: #fff;
}
.btn-dark:hover { background: #232a3f; }

.hero-thumbs {
  position: absolute;
  z-index: 3;
  inset-inline-end: 20px;
  bottom: 20px;
  display: none;
  gap: 8px;
}
.hero-thumbs button {
  flex: 0 0 56px;
  border-radius: 9px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.35);
  aspect-ratio: 2 / 3;
  background: rgba(255,255,255,.08);
  padding: 0;
  cursor: pointer;
}
.hero-thumbs button.active { border-color: #7de9c2; }
.hero-thumbs img { width: 100%; height: 100%; object-fit: cover; }

.hero-nav { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.hero-arrow {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.28);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
}
.hero-arrow:hover { background: rgba(255,255,255,.24); }
.hero-dots { display: flex; gap: 7px; }
.hero-dots button {
  width: 9px; height: 9px;
  border-radius: 99px;
  border: 0;
  background: rgba(255,255,255,.4);
  cursor: pointer;
  padding: 0;
  transition: width .2s ease, background .2s ease;
}
.hero-dots button.on { width: 26px; background: #fff; }

/* قائمة اللغات */
.langwrap { position: relative; }
.langmenu[hidden] { display: none; }
.langmenu {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  display: grid;
  gap: 2px;
  min-width: 168px;
  box-shadow: 0 18px 44px #1b254026;
  z-index: 80;
}
.langmenu a {
  padding: 7px 12px;
  border-radius: 9px;
  font-size: .9rem;
  color: var(--text);
  white-space: nowrap;
}
.langmenu a:hover { background: var(--surface-2); }
.langmenu a.on { color: var(--green); font-weight: 800; }

.genres-strip {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 30px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.genres-strip strong { margin-inline-end: 6px; }

@media (min-width: 860px) {
  .hero { min-height: 430px; }
  .hero-inner { padding: 34px 38px 30px; max-width: 76%; }
  .hero-thumbs { display: flex; }
  .hero-title { font-size: 2.15rem; }
}

/* ===== رقائق التصنيفات ===== */
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 7px 18px;
  border-radius: 999px;
  font-size: .9rem;
  color: var(--muted);
}
.chip:hover { color: var(--green); border-color: var(--green); }
.chip-count { font-size: .76rem; opacity: .65; }

/* رقائق ملونة في صفحة المسلسل */
.chips.colored .chip { font-weight: 700; font-size: .84rem; padding: 5px 16px; }
.chips.colored .chip:nth-child(4n+1) { background: #8b5cf61a; color: #7c4dff; border-color: #8b5cf633; }
.chips.colored .chip:nth-child(4n+2) { background: #ef44441a; color: #e5484d; border-color: #ef444433; }
.chips.colored .chip:nth-child(4n+3) { background: #f973161a; color: #ea7a1f; border-color: #f9731633; }
.chips.colored .chip:nth-child(4n+4) { background: #0db87f1a; color: #0a9c6c; border-color: #0db87f33; }

/* ===== صفوف البوسترات ===== */
.row-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 6px 2px 14px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: #c9d0dc transparent;
}
.row-scroll .series-card { flex: 0 0 168px; scroll-snap-align: start; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px;
}

/* ===== بطاقة المسلسل ===== */
.series-card { display: block; }
.poster-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: 0 3px 12px #1b25400f;
  transition: transform .18s ease, box-shadow .18s ease;
}
.series-card:hover .poster-wrap {
  transform: translateY(-5px);
  box-shadow: 0 16px 36px #1b254026;
}
.poster-wrap img { width: 100%; height: 100%; object-fit: cover; }
.poster-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 12px;
  color: var(--muted); font-weight: 700;
}
.poster-badge {
  position: absolute;
  top: 8px; inset-inline-start: 8px;
  font-size: .7rem;
  font-weight: 800;
  padding: 3px 11px;
  border-radius: 7px;
  background: #171c2bdd;
  color: #fff;
}
.poster-badge.ongoing { background: #0db87fdd; }
.poster-badge.upcoming { background: #7c4dffdd; }
.new-badge {
  position: absolute;
  top: 8px; inset-inline-end: 8px;
  font-size: .68rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 7px;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 3px 10px #0db87f55;
}
.poster-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .18s ease;
  background: #171c2b55;
}
.series-card:hover .poster-play { opacity: 1; }
.poster-play span {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  padding-inline-start: 3px;
  box-shadow: 0 8px 22px #0db87f66;
}
.card-title {
  font-size: .97rem;
  font-weight: 700;
  margin: 10px 4px 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.card-meta {
  margin: 0 4px;
  font-size: .78rem;
  color: var(--muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.card-meta .ep-count { color: var(--green); font-weight: 700; }

/* بطاقة مرقّمة (الرائج) */
.rank-card { position: relative; }
.rank-num {
  position: absolute;
  bottom: -12px;
  inset-inline-start: 2px;
  font-size: 4.4rem;
  font-weight: 900;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 2.5px #0db87f;
  text-stroke: 2.5px #0db87f;
  opacity: .9;
  z-index: 2;
  pointer-events: none;
}

/* ===== صفحة المسلسل ===== */
.series-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 4px 22px #1b25400f;
}
.series-head .poster-col .poster-wrap { max-width: 250px; margin-inline: auto; }
.series-head h1 {
  font-size: 1.8rem;
  font-weight: 900;
  margin: 0 0 10px;
  line-height: 1.45;
}
.title-en { font-size: .9rem; color: var(--muted); font-weight: 400; }
.series-head .chips { margin-bottom: 14px; }
.series-head .hero-stats { margin-bottom: 14px; }
.series-desc {
  color: var(--muted);
  font-size: .98rem;
  max-width: 68ch;
  margin: 0 0 18px;
}
.share-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.share-label { color: var(--muted); font-size: .88rem; }
.share-btn {
  min-width: 38px; height: 38px;
  padding-inline: 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
}
.share-btn:hover { color: var(--green); border-color: var(--green); }

@media (min-width: 860px) {
  .series-head { grid-template-columns: 250px 1fr; padding: 30px; }
  .series-head .poster-col .poster-wrap { max-width: none; }
}

/* ===== قائمة الحلقات ===== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: 0 2px 12px #1b25400a;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1.12rem;
  margin: 0;
}
.panel h2::before {
  content: "";
  width: 15px; height: 15px;
  border-radius: 5px;
  background: var(--grad);
  display: inline-block;
}
.panel-count { color: var(--muted); font-size: .86rem; }

.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 10px;
}
.ep-btn {
  position: relative;
  background: var(--navy);
  color: #fff;
  border-radius: 10px;
  padding: 12px 0;
  text-align: center;
  font-weight: 800;
  font-size: .95rem;
  border: 1px solid transparent;
  transition: transform .12s ease, background .12s ease;
}
.ep-btn:hover { transform: translateY(-2px); background: #232a3f; }
.ep-btn .lock { font-size: .8em; opacity: .85; }
.ep-btn.free-active {
  background: var(--grad);
  box-shadow: 0 6px 18px #0db87f55;
}
.ep-btn.ep-free { background: #10243f; border-color: #0db87f44; }
.ep-btn.ep-free:hover { background: #16304f; border-color: var(--green); }
.ep-btn .ep-mini {
  position: absolute;
  top: 4px; inset-inline-start: 6px;
  font-size: .62rem;
  font-weight: 700;
  opacity: .75;
}
.ep-btn.ep-free .ep-mini { color: var(--green); opacity: 1; }

/* ===== المصدر الرسمي ===== */
.source-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.source-name { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.05rem; }
.source-logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--grad);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
}
.source-sub { display: block; color: var(--muted); font-size: .8rem; font-weight: 400; }

/* ===== الأسئلة الشائعة ===== */
.faq-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  background: var(--surface);
  overflow: hidden;
}
.faq-item summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 700;
  font-size: .95rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::after {
  content: "⌄";
  color: var(--green);
  font-size: 1.1rem;
  transition: transform .15s ease;
}
.faq-item[open] summary::after { transform: rotate(180deg); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p { margin: 0; padding: 0 18px 16px; color: var(--muted); font-size: .92rem; }

/* ===== بلوك SEO ===== */
.seo-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px;
  margin-block: 30px;
  text-align: center;
}
.seo-block h2 { font-size: 1.2rem; margin: 0 0 12px; }
.seo-block p { color: var(--muted); font-size: .92rem; max-width: 75ch; margin: 0 auto 12px; }
.seo-block a { color: var(--green); font-weight: 700; }

/* ===== متفرقات ===== */
.ad-slot { margin-block: 20px; text-align: center; }
.pagination {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-block: 28px;
  color: var(--muted);
}
.pagination a { color: var(--green); font-weight: 700; }
.empty {
  grid-column: 1 / -1;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
}
.empty code { direction: ltr; display: inline-block; }

/* ===== الفوتر ===== */
.site-footer {
  background: var(--navy);
  margin-top: 60px;
  padding-block: 34px;
  color: #aab2c5;
  font-size: .9rem;
}
.footer-inner { display: grid; gap: 18px; }
.footer-logo { color: #fff; }
.footer-genres { display: flex; flex-wrap: wrap; gap: 14px; }
.footer-block h3 { margin: 0 0 10px; font-size: 1rem; color: #fff; }
.footer-genres a:hover { color: #fff; }
.footer-note { border-top: 1px solid #ffffff1a; padding-top: 16px; font-size: .82rem; }
.footer-links a:hover { color: #fff; }

/* ===== شريط التنقل السفلي (موبايل) ===== */
.dock {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 60;
  display: none;
  justify-content: space-around;
  background: #fffffff5;
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 6px 4px max(6px, env(safe-area-inset-bottom));
}
.dock a, .dock button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: 0;
  color: var(--muted);
  font-family: inherit;
  font-size: .68rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 10px;
}
.dock a:hover, .dock button:hover { color: var(--green); }

.totop {
  position: fixed;
  bottom: 18px;
  inset-inline-start: 18px;
  z-index: 55;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  border: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px #171c2b55;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.totop.show { opacity: 1; pointer-events: auto; }

@media (max-width: 859px) {
  .dock { display: flex; }
  body { padding-bottom: 64px; }
  .totop { bottom: 78px; }
  .main-nav {
    order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 6px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 10px;
  }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav a {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
    padding: 6px 14px; font-weight: 700; color: var(--text); font-size: .88rem;
  }
  .header-inner { gap: 10px; padding-block: 10px; }
  .footer-inner { padding-bottom: 24px; }
}
