/* ============================================================
   HEDUR+ | نظام التصميم السينمائي  (RTL / Mobile First)
   ============================================================ */

/* ---------- الخطوط ---------- */
@import url('https://fonts.googleapis.com/css2?family=Readex+Pro:wght@300;400;500;600;700&family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&display=swap');

/* ---------- المتغيرات (الوضع الداكن افتراضياً) ---------- */
:root {
  --font-display: 'Readex Pro', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans Arabic', system-ui, sans-serif;

  --bg-0: #0a0c12;
  --bg-1: #11131c;
  --bg-2: #171a26;
  --bg-glass: rgba(23, 26, 38, 0.62);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text-1: #f4f5f8;
  --text-2: #b6bac6;
  --text-3: #7a7f8e;

  --accent: #e0a64b;          /* ذهبي سينمائي */
  --accent-soft: rgba(224, 166, 75, 0.14);
  --accent-2: #2fc8a0;        /* تركوازي */
  --danger: #e0556b;

  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 0 1px var(--border), 0 18px 50px rgba(0, 0, 0, 0.55);

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-pill: 999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-h: 64px;
}

/* الوضع النهاري */
[data-theme="light"] {
  --bg-0: #f4f1ea;
  --bg-1: #ffffff;
  --bg-2: #f7f4ee;
  --bg-glass: rgba(255, 255, 255, 0.72);
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --text-1: #15171e;
  --text-2: #474b57;
  --text-3: #8a8f9c;
  --accent-soft: rgba(196, 138, 47, 0.16);
  --accent: #b9802a;
  --shadow-md: 0 12px 40px rgba(60, 50, 30, 0.16);
  --shadow-glow: 0 0 0 1px var(--border), 0 18px 50px rgba(60, 50, 30, 0.18);
}

/* ---------- أساسيات ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg-0);
  color: var(--text-1);
  direction: rtl;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .4s var(--ease), color .4s var(--ease);
}

/* خلفية أجواء سينمائية */
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(1200px 600px at 85% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(900px 500px at 0% 100%, rgba(47,200,160,.08), transparent 60%);
  pointer-events: none; z-index: 0;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul { list-style: none; }

h1, h2, h3, .display { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; }

.container { width: min(1280px, 92%); margin-inline: auto; position: relative; z-index: 1; }

/* ---------- شريط التنقل ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border);
  transition: background .4s var(--ease);
}
.nav .container { display: flex; align-items: center; gap: 18px; }

.logo { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; }
.logo b { color: var(--accent); }
.logo .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 14px var(--accent);
}

.nav-links { display: none; gap: 4px; margin-inline-start: 10px; }
.nav-links a {
  padding: 8px 14px; border-radius: var(--r-pill);
  color: var(--text-2); font-size: .92rem; font-weight: 500;
  transition: all .25s var(--ease);
}
.nav-links a:hover { color: var(--text-1); background: var(--bg-2); }
.nav-links a.active { color: var(--accent); background: var(--accent-soft); }

.nav-spacer { flex: 1; }

.icon-btn {
  width: 42px; height: 42px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text-1); transition: all .25s var(--ease);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.icon-btn svg { width: 20px; height: 20px; }

/* بحث الشريط */
.nav-search { position: relative; }
.nav-search input {
  width: 0; opacity: 0; padding: 0; border: none;
  background: var(--bg-2); border-radius: var(--r-pill);
  color: var(--text-1); font-family: inherit; font-size: .92rem;
  transition: width .35s var(--ease), opacity .25s var(--ease), padding .35s var(--ease);
}
.nav-search.open input { width: min(260px, 60vw); opacity: 1; padding: 11px 44px 11px 16px; border: 1px solid var(--border-strong); }
.nav-search .search-toggle { position: absolute; inset-inline-end: 0; top: 0; }
.nav-search.open .search-toggle { background: transparent; border-color: transparent; }

.search-suggest {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0;
  width: min(360px, 86vw); max-height: 60vh; overflow-y: auto;
  background: var(--bg-1); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-md);
  padding: 6px; display: none; z-index: 120;
}
.search-suggest.show { display: block; animation: pop .25s var(--ease); }
.suggest-item { display: flex; gap: 12px; padding: 8px; border-radius: var(--r-sm); transition: background .2s; }
.suggest-item:hover { background: var(--bg-2); }
.suggest-item .thumb { width: 46px; height: 64px; border-radius: 8px; flex-shrink: 0; object-fit: cover; }
.suggest-item .meta { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.suggest-item .meta b { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-item .meta span { font-size: .76rem; color: var(--text-3); }
.suggest-empty { padding: 18px; text-align: center; color: var(--text-3); font-size: .88rem; }

/* ---------- السلايدر (Hero) ---------- */
.hero { position: relative; height: clamp(420px, 64vh, 640px); overflow: hidden; }
.hero-track { position: absolute; inset: 0; }
.hero-slide {
  position: absolute; inset: 0; opacity: 0;
  transition: opacity 1s var(--ease);
  display: flex; align-items: flex-end;
}
.hero-slide.active { opacity: 1; }
.hero-slide .bg { position: absolute; inset: 0; }
.hero-slide .bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg-0) 4%, rgba(10,12,18,.4) 45%, transparent),
              linear-gradient(to left, var(--bg-0) 0%, transparent 55%);
}
.hero-content {
  position: relative; z-index: 2; padding: 0 0 46px;
  width: min(1280px, 92%); margin-inline: auto;
}
.hero-content .badge { margin-bottom: 14px; }
.hero-content h1 { font-size: clamp(2rem, 7vw, 4rem); line-height: 1.05; max-width: 14ch; }
.hero-content .sub { color: var(--text-2); margin: 14px 0 22px; max-width: 52ch; font-size: clamp(.95rem, 2.5vw, 1.08rem); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; color: var(--text-2); font-size: .9rem; margin-bottom: 22px; }
.hero-meta .star { color: var(--accent); font-weight: 700; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 26px; border-radius: var(--r-pill);
  font-weight: 600; font-size: .96rem;
  transition: all .25s var(--ease);
}
.btn svg { width: 19px; height: 19px; }
.btn-primary { background: var(--accent); color: #0a0c12; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px var(--accent-soft); filter: brightness(1.06); }
.btn-ghost { background: var(--bg-glass); border: 1px solid var(--border-strong); color: var(--text-1); backdrop-filter: blur(10px); }
.btn-ghost:hover { transform: translateY(-2px); border-color: var(--accent); }

.hero-dots { position: absolute; bottom: 18px; inset-inline-start: 50%; transform: translateX(50%); display: flex; gap: 8px; z-index: 3; }
.hero-dots button { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); transition: all .3s var(--ease); }
.hero-dots button.active { width: 26px; border-radius: var(--r-pill); background: var(--accent); }

/* ---------- الأقسام والصفوف ---------- */
.section { padding: 34px 0 6px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-head h2 { font-size: clamp(1.25rem, 4vw, 1.6rem); display: flex; align-items: center; gap: 10px; }
.section-head h2::before { content: ""; width: 4px; height: 22px; border-radius: 4px; background: var(--accent); }
.section-head a { color: var(--text-3); font-size: .86rem; display: flex; align-items: center; gap: 4px; transition: color .2s; }
.section-head a:hover { color: var(--accent); }

.row {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: 46%;
  gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 14px; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.row::-webkit-scrollbar { display: none; }
.row > * { scroll-snap-align: start; }

/* شبكة (صفحة التصفّح) */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(2, 1fr);
}

/* ---------- بطاقة العمل ---------- */
.card {
  position: relative; border-radius: var(--r-md); overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--border);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
  cursor: pointer; will-change: transform;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card .poster { aspect-ratio: 2/3; width: 100%; object-fit: cover; background: var(--bg-1); }
.card .top { position: absolute; top: 8px; inset-inline: 8px; display: flex; justify-content: space-between; gap: 6px; }
.card .rate {
  background: rgba(0,0,0,.6); backdrop-filter: blur(6px);
  color: var(--accent); font-weight: 700; font-size: .78rem;
  padding: 4px 9px; border-radius: var(--r-pill); display: flex; align-items: center; gap: 4px;
}
.card .rate svg { width: 13px; height: 13px; }
.card .fav-btn {
  width: 32px; height: 32px; border-radius: 50%; background: rgba(0,0,0,.5);
  backdrop-filter: blur(6px); display: grid; place-items: center; color: #fff;
  opacity: 0; transform: scale(.8); transition: all .25s var(--ease);
}
.card:hover .fav-btn { opacity: 1; transform: scale(1); }
.card .fav-btn.active { color: var(--accent); background: rgba(0,0,0,.7); }
.card .fav-btn svg { width: 16px; height: 16px; }
.card .body { padding: 11px 12px 13px; }
.card .body h3 { font-size: .96rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .body .info { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 5px; color: var(--text-3); font-size: .78rem; }
.card .body .info .pill { background: var(--bg-1); padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--border); }
.exclusive-tag {
  position: absolute; bottom: 0; inset-inline-start: 0;
  background: var(--accent); color: #0a0c12; font-size: .68rem; font-weight: 700;
  padding: 3px 12px; border-start-end-radius: 10px;
}

/* شريط تقدم المتابعة على البطاقة */
.card .progress { position: absolute; bottom: 0; inset-inline: 0; height: 4px; background: rgba(0,0,0,.4); }
.card .progress span { display: block; height: 100%; background: var(--accent); }

/* ---------- شارات ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-soft); color: var(--accent);
  padding: 6px 14px; border-radius: var(--r-pill);
  font-size: .8rem; font-weight: 600;
}

/* ---------- Skeleton Loading ---------- */
.skeleton { position: relative; overflow: hidden; background: var(--bg-2); }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
  animation: shimmer 1.4s infinite;
}
.sk-card { border-radius: var(--r-md); overflow: hidden; }
.sk-card .sk-poster { aspect-ratio: 2/3; }
.sk-card .sk-line { height: 12px; border-radius: 6px; margin: 12px 12px 0; }
.sk-card .sk-line.sm { width: 55%; margin-bottom: 13px; }

/* ---------- التذييل ---------- */
.footer { margin-top: 56px; padding: 36px 0; border-top: 1px solid var(--border); color: var(--text-3); }
.footer .container { display: flex; flex-direction: column; gap: 16px; }
.footer .top { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center; }
.footer nav { display: flex; gap: 18px; flex-wrap: wrap; font-size: .88rem; }
.footer nav a:hover { color: var(--accent); }
.footer small { font-size: .8rem; }

/* ---------- التوست ---------- */
.toast-wrap { position: fixed; bottom: 20px; inset-inline-start: 50%; transform: translateX(50%); z-index: 300; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  background: var(--bg-1); border: 1px solid var(--border-strong);
  color: var(--text-1); padding: 12px 20px; border-radius: var(--r-pill);
  box-shadow: var(--shadow-md); font-size: .9rem; font-weight: 500;
  display: flex; align-items: center; gap: 9px;
  animation: toastIn .35s var(--ease);
}
.toast svg { width: 18px; height: 18px; color: var(--accent); }

/* ---------- التبويبات (المكتبة) ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 22px; }
.tab {
  padding: 9px 18px; border-radius: var(--r-pill); background: var(--bg-2);
  border: 1px solid var(--border); color: var(--text-2); font-weight: 500; font-size: .9rem;
  transition: all .25s var(--ease);
}
.tab.active, .tab:hover { color: var(--accent); border-color: var(--accent); }

.empty-state { text-align: center; padding: 64px 20px; color: var(--text-3); }
.empty-state svg { width: 56px; height: 56px; margin-bottom: 14px; opacity: .5; }

/* ---------- أنيميشن الظهور ---------- */
.reveal { opacity: 0; transform: translateY(22px); }
.reveal.in { animation: revealUp .7s var(--ease) forwards; }

@keyframes revealUp { to { opacity: 1; transform: none; } }
@keyframes shimmer { to { transform: translateX(-100%); } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* انتقال الصفحات */
.page-enter { animation: fadeIn .5s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { animation: none !important; transition: none !important; }
}

/* ============================================================
   نقاط التجاوب  (Tablet ثم Desktop)
   ============================================================ */
@media (min-width: 600px) {
  .row { grid-auto-columns: 30%; }
  .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
  .nav-links { display: flex; }
  .row { grid-auto-columns: 21%; gap: 16px; }
  .grid { grid-template-columns: repeat(4, 1fr); gap: 18px; }
  .hero-content { padding-bottom: 60px; }
}
@media (min-width: 1200px) {
  .row { grid-auto-columns: 16.2%; }
  .grid { grid-template-columns: repeat(6, 1fr); }
}
