/* ======================================================
   GLOBAL CSS — text.css
   Header · Sidebar · Filter Panel · Card · Layout · Utils
   ====================================================== */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700&display=swap');

/* ── Variables ─────────────────────────────────────────── */
:root {
  --primary-color: #ffffff;
  --primary-dark: #f8f9fa;
  --primary-light: #e9ecef;
  --accent-color: #27ae60;
  --text-color: #000000;
  --bg-light: #fafafa;
  --card-border: #e0e0e0;
  --region-bg: #f0f0f0;
  --glass-bg-light: rgba(255,255,255,0.72);
  --glass-bg-dark: rgba(18,18,18,0.72);
  --glass-border-light: rgba(255,255,255,0.55);
  --glass-border-dark: rgba(255,255,255,0.08);
  --glass-blur: 18px;
  --float-radius: 22px;
  --float-shadow: 0 8px 32px rgba(0,0,0,0.18);
  --header-h: 64px;
  --sidebar-w: 280px;
}

body.dark-mode {
  --primary-color: #000000;
  --primary-dark: #111111;
  --primary-light: #1a1a1a;
  --accent-color: #2ecc71;
  --text-color: #ffffff;
  --bg-light: #000000;
  --card-border: #444444;
  --region-bg: #1a1a1a;
  background-color: var(--bg-light);
  color: var(--text-color);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; overflow-x: hidden; height: 100%; font-size: 14px; }

body {
  font-family: 'Tajawal', sans-serif;
  background-color: var(--bg-light);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* content-visibility مخصص فقط لبطاقات الألعاب وليس لجميع الصور */
.hm-card-img img,
.game-card img { content-visibility: auto; contain-intrinsic-size: 300px 400px; }

/* يُخفى فقط إذا كانت الصورة تعتمد data-src (lazy load عبر JS) */
img[loading="lazy"][data-src] { opacity: 0; transition: opacity 0.3s ease; }
img[loading="lazy"][data-src].loaded { opacity: 1; }

/* صور بـ src مباشر: تظهر فوراً بلا تأخير */
img[loading="lazy"]:not([data-src]) { opacity: 1; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 12px; }

/* ── Site Header (موحّد: الشعار + البحث + الفلتر + الإجراءات في صف واحد) ──
   الأزرار العائمة القديمة (#floatingControls) صارت داخل الهيدر نفسه، فلا
   يوجد شريط ثانٍ يتراكب مع الأشرطة العلوية، و--header-h يعكس الارتفاع الحقيقي.
   ─────────────────────────────────────────────────────────────────────── */
.site-header {
  --hdr-line: rgba(0,0,0,0.07);
  --hdr-ctl-bg: rgba(0,0,0,0.05);
  --hdr-ctl-hover: rgba(0,0,0,0.09);
  position: sticky; top: 0; width: 100%; z-index: 900;
  overflow: visible; isolation: isolate;
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  background: var(--glass-bg-light);
  border-bottom: 1px solid var(--hdr-line);
  box-shadow: 0 2px 18px rgba(0,0,0,0.05);
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
body.dark-mode .site-header {
  --hdr-line: rgba(255,255,255,0.09);
  --hdr-ctl-bg: rgba(255,255,255,0.07);
  --hdr-ctl-hover: rgba(255,255,255,0.13);
  background: var(--glass-bg-dark);
  box-shadow: 0 2px 18px rgba(0,0,0,0.45);
}
.site-header.scrolled { box-shadow: 0 6px 26px rgba(0,0,0,0.12); }

.header-inner {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  min-height: 64px; padding: 8px 18px;
  max-width: 1400px; margin: 0 auto;
}

/* الأزرار (قائمة/رجوع/بحث/فلتر) تُرسم كعناصر مباشرة داخل الصف، والترتيب بـ order */
.site-header .floating-controls { display: contents; }
.floating-controls-spacer { height: 0; display: none; }
.float-sidebar   { order: 1; }
.float-back      { order: 2; }
.header-branding { order: 3; }
.float-search    { order: 4; }
.float-actions   { order: 5; }
.header-right    { order: 6; }

/* الشعار */
.header-branding { display: flex; align-items: center; flex: 0 0 auto; min-width: 0; }
.logo-container, .logo-link { display: flex; align-items: center; }
.site-logo { display: block; height: 36px; width: auto; max-width: 150px; object-fit: contain; }

/* أزرار الأيقونات */
.float-btn,
.theme-toggle {
  width: 40px; height: 40px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 12px; border: 1px solid transparent;
  background: var(--hdr-ctl-bg); color: var(--text-color);
  font-family: inherit; font-size: 16px; line-height: 1; cursor: pointer; padding: 0;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.float-btn:hover,
.theme-toggle:hover { background: var(--hdr-ctl-hover); color: var(--accent-color); }
.float-btn:active,
.theme-toggle:active { transform: scale(0.94); }
.float-filter { width: auto; padding: 0 14px; font-size: 13px; font-weight: 600; }
.float-btn-label { white-space: nowrap; }

/* البحث */
.float-search {
  display: flex; align-items: center; gap: 4px;
  flex: 1 1 260px; max-width: 440px; min-width: 0; height: 40px;
  padding: 0 4px 0 14px; border-radius: 12px;
  background: var(--hdr-ctl-bg); border: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.float-search:focus-within {
  background: var(--primary-color); border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(39,174,96,0.15);
}
.float-search-input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0;
  font-family: inherit; font-size: 14px; color: var(--text-color); padding: 0 4px;
}
.float-search-input::placeholder { color: #999; }
.float-search-btn {
  width: 32px; height: 32px; flex: 0 0 auto; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-color); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
  transition: background 0.2s, color 0.2s;
}
.float-search-btn:hover { background: var(--accent-color); color: #fff; }

.float-actions { display: flex; align-items: center; gap: 6px; }

/* الجانب الآخر: روابط + ثيم + لغة */
.header-right { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; margin-inline-start: auto; }
.header-top-links { display: flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 500; }
.header-top-links a {
  color: var(--text-color); opacity: 0.65; text-decoration: none;
  padding: 6px 10px; border-radius: 8px; transition: opacity 0.2s, color 0.2s, background 0.2s;
}
.header-top-links a:hover { opacity: 1; color: var(--accent-color); background: var(--hdr-ctl-bg); }
.header-actions { display: flex; align-items: center; gap: 6px; }
.theme-toggle:hover { transform: rotate(18deg); }

/* Language Switcher */
.language-switcher { position: relative; display: inline-block; }
.language-switcher-btn {
  height: 40px; min-width: 0; padding: 0 12px; border-radius: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--hdr-ctl-bg); border: 1px solid transparent; color: var(--text-color);
  font-family: inherit; font-size: 13px; font-weight: 700;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.language-switcher-btn:hover { background: var(--hdr-ctl-hover); }
.language-switcher-btn:active { transform: scale(0.96); }
.language-switcher-btn i { font-size: 10px; transition: transform 0.25s ease; }
.language-switcher-btn[aria-expanded="true"] i { transform: rotate(180deg); }

.language-dropdown {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0;
  min-width: 140px; padding: 6px; border-radius: 14px; z-index: 1001;
  background: var(--primary-color); border: 1px solid var(--card-border);
  box-shadow: 0 12px 32px rgba(0,0,0,0.16);
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.language-dropdown.show { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }
.language-option {
  display: block; padding: 9px 14px; border-radius: 9px; color: var(--text-color);
  text-decoration: none; font-size: 13px; font-weight: 600;
  transition: background 0.2s, color 0.2s;
}
.language-option:hover { background: var(--hdr-ctl-bg); color: var(--accent-color); }
.language-option.active { color: var(--accent-color); font-weight: 800; background: rgba(39,174,96,0.12); }

.float-btn:focus-visible,
.theme-toggle:focus-visible,
.language-switcher-btn:focus-visible,
.header-top-links a:focus-visible,
.logo-link:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }

/* Breadcrumb (عام — يستخدمه شريط البريدكرمب أسفل الهيدر) */
.breadcrumb {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: #888; flex-wrap: wrap; min-width: 0;
}
.breadcrumb a { color: var(--accent-color); text-decoration: none; transition: opacity 0.2s; }
.breadcrumb a:hover { opacity: 0.75; }
.breadcrumb .current-page {
  color: var(--text-color); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}
.breadcrumb .fa-chevron-right,
.breadcrumb .fa-chevron-left { font-size: 9px; opacity: 0.5; }

/* ── Header: Desktop ───────────────────────────────────── */
@media (min-width: 769px) {
  .float-search-toggle { display: none; }
  /* القائمة الجانبية ثابتة على الصفحات ذات sidebar-page، فلا حاجة لزر القائمة */
  body.sidebar-page .float-sidebar { display: none; }
}
@media (max-width: 1199px) {
  .header-top-links { display: none; }   /* الروابط تظهر داخل القائمة الجانبية */
}
@media (max-width: 900px) {
  .float-btn-label { display: none; }
  .float-filter { width: 40px; padding: 0; }
}

/* ── Header: Mobile ────────────────────────────────────── */
@media (max-width: 768px) {
  .header-inner { min-height: 56px; padding: 6px 12px; gap: 6px; }
  .site-logo { height: 30px; max-width: 120px; }
  .float-btn, .theme-toggle, .float-search-toggle { width: 38px; height: 38px; font-size: 15px; }
  .language-switcher-btn { height: 38px; padding: 0 10px; }
  .header-right { gap: 6px; }

  /* البحث مطوي بشكل افتراضي، ويفتح بملء الصف */
  .float-search { display: none; height: 38px; }
  .floating-controls.search-open .float-search { display: flex; }
  .site-header.search-open .float-search { order: 1; flex: 1 1 auto; max-width: none; }
  .site-header.search-open .float-actions { order: 2; }
  .site-header.search-open .header-branding,
  .site-header.search-open .header-right,
  .site-header.search-open .float-sidebar,
  .site-header.search-open .float-back,
  .site-header.search-open .float-filter { display: none; }
  .float-search-input { font-size: 16px; }   /* يمنع تكبير iOS عند التركيز */
}
@media (max-width: 380px) {
  .header-inner { gap: 4px; padding-inline: 8px; }
  .site-logo { max-width: 96px; }
  .float-btn, .theme-toggle, .float-search-toggle { width: 36px; height: 36px; }
  .language-switcher-btn { padding: 0 8px; }
}

/* ── Sidebar ───────────────────────────────────────────────
   - الجوال: درج منزلق (من اليسار، ومن اليمين في RTL)
   - الديسكتوب (body.sidebar-page ≥769px): ثابت بعرض 280px — قاعدته في قسم Page Layout
   - الألوان كلها عبر متغيرات --sb-* فلا حاجة لقواعد منفصلة للوضع الفاتح/الداكن
   ─────────────────────────────────────────────────────────── */
.sidebar {
  --sb-bg: #ffffff;
  --sb-fg: #111111;
  --sb-link: rgba(0,0,0,0.76);
  --sb-muted: rgba(0,0,0,0.55);
  --sb-line: rgba(0,0,0,0.08);
  --sb-hover: rgba(0,0,0,0.05);
  --sb-card: rgba(0,0,0,0.03);
  --sb-accent-bg: rgba(39,174,96,0.12);
  --sb-danger: #ef4444;

  position: fixed; top: 0; left: 0; right: auto;
  width: min(86vw, 300px); height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--sb-bg); color: var(--sb-fg);
  z-index: 1001;
  overflow-x: hidden; overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: var(--sb-line) transparent;
  padding-bottom: env(safe-area-inset-bottom);
  border-right: 1px solid var(--sb-line);
  box-shadow: 6px 0 28px rgba(0,0,0,0.14);
  transform: translateX(-105%); visibility: hidden; will-change: transform;
  transition: transform 0.32s cubic-bezier(0.22,1,0.36,1), visibility 0s linear 0.32s;
}
.sidebar.open { transform: none; visibility: visible; transition-delay: 0s; }
body.dark-mode .sidebar {
  --sb-bg: #101011;
  --sb-fg: #f4f4f5;
  --sb-link: rgba(255,255,255,0.74);
  --sb-muted: rgba(255,255,255,0.58);
  --sb-line: rgba(255,255,255,0.09);
  --sb-hover: rgba(255,255,255,0.07);
  --sb-card: rgba(255,255,255,0.04);
  box-shadow: 6px 0 28px rgba(0,0,0,0.55);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--sb-line); border-radius: 6px; }

/* RTL: الدرج من اليمين */
[dir="rtl"] .sidebar {
  left: auto; right: 0;
  border-right: 0; border-left: 1px solid var(--sb-line);
  box-shadow: -6px 0 28px rgba(0,0,0,0.14);
  transform: translateX(105%);
}
[dir="rtl"] .sidebar.open { transform: none; }
[dir="rtl"] body.dark-mode .sidebar,
body.dark-mode[dir="rtl"] .sidebar { box-shadow: -6px 0 28px rgba(0,0,0,0.55); }

.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 1000;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.sidebar-overlay.visible { opacity: 1; visibility: visible; pointer-events: auto; }
body.sidebar-open { overflow: hidden; }

.sidebar a:focus-visible,
.sidebar button:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }

/* Brand (بنفس ارتفاع الهيدر ليصطف معه على الديسكتوب) */
.sidebar-header {
  position: sticky; top: 0; z-index: 3; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 64px; padding: 0 16px;
  background: var(--sb-bg); border-bottom: 1px solid var(--sb-line);
}
.sidebar-brand { display: flex; align-items: center; min-width: 0; }
.sidebar-logo { display: block; height: 36px; width: auto; max-width: 170px; object-fit: contain; filter: none; }
.sidebar-close {
  width: 38px; height: 38px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px; cursor: pointer;
  background: var(--sb-card); color: var(--sb-fg); font-size: 18px; padding: 0;
  transition: background 0.2s;
}
.sidebar-close:hover { background: var(--sb-hover); }

/* CTA: اشترك + انضم للفريق */
.sidebar-subscribe-cta { display: flex; flex-direction: column; gap: 8px; padding: 14px 14px 0; }
.subscribe-cta-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 14px; border-radius: 12px; text-decoration: none;
  font-size: 14px; font-weight: 700; letter-spacing: 0.2px; color: #fff;
  background: linear-gradient(135deg, #b32424, #8a1616);
  border: 1px solid rgba(155,28,28,0.65);
  box-shadow: 0 6px 18px rgba(155,28,28,0.26);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s, border-color 0.2s, color 0.2s;
}
.subscribe-cta-btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.subscribe-cta-btn.is-secondary {
  padding: 9px 14px; font-size: 13.5px; font-weight: 600;
  color: var(--sb-fg); background: var(--sb-card);
  border-color: var(--sb-line); box-shadow: none;
}
.subscribe-cta-btn.is-secondary:hover { filter: none; border-color: var(--accent-color); color: var(--accent-color); }
.subscribe-cta-btn.active { border-color: var(--accent-color); color: var(--accent-color); }
.subscribe-cta-text { font-weight: inherit; }
.subscribe-cta-btn i { font-size: 13px; }

/* لا تسمح لعناصر القائمة الجانبية بالانكماش — السايدبار عمود flex بارتفاع الشاشة
   (overflow-y:auto)، وبدون هذا السطر تنكمش بطاقة المستخدم (overflow:hidden) وتُقصّ
   عناصر القائمة المنسدلة (My List / Notifications / Logout) بدل أن يتمرّر السايدبار. */
.sidebar > * { flex-shrink: 0; }

/* بطاقة المستخدم */
.sidebar-user-section {
  position: relative; margin: 14px 14px 0;
  border: 1px solid var(--sb-line); border-radius: 14px;
  background: var(--sb-card); overflow: hidden;
}
.sidebar .user-profile {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  position: relative; border-radius: 0; cursor: default; transition: background 0.2s;
}
.sidebar .user-profile.logged-in { cursor: pointer; }
.sidebar .user-profile.logged-in:hover { background: var(--sb-hover); }
.sidebar .user-avatar {
  width: 44px; height: 44px; flex: 0 0 44px; margin: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden;
  background: var(--accent-color); color: #fff; font-size: 22px;
}
.sidebar .user-info { flex: 1; min-width: 0; }
.sidebar .user-name {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  font-size: 15px; font-weight: 700; line-height: 1.25; color: var(--sb-fg);
}
.sidebar .user-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .user-username,
.sidebar .user-status {
  margin-top: 2px; font-size: 12.5px; color: var(--sb-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar .user-dropdown-indicator { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; margin: 0; }
.sidebar .user-dropdown-badge {
  width: 18px; height: 18px; object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(155,28,28,0.5)) drop-shadow(0 0 2px rgba(0,0,0,0.25));
}
.sidebar .user-dropdown-arrow { font-size: 12px; color: var(--sb-muted); transition: transform 0.25s; }
.sidebar .user-profile.active .user-dropdown-arrow { transform: rotate(180deg); }

/* قائمة المستخدم: تتمدد داخل البطاقة (لا تطفو فوق باقي القائمة) */
.sidebar .user-dropdown-menu { display: none; padding: 6px; border-top: 1px solid var(--sb-line); }
.sidebar .user-dropdown-menu.show { display: block; }
.sidebar .dropdown-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 10px; text-decoration: none;
  font-size: 13.5px; font-weight: 500; color: var(--sb-fg);
  transition: background 0.2s, color 0.2s;
}
.sidebar .dropdown-item:hover { background: var(--sb-hover); color: var(--accent-color); }
.sidebar .dropdown-item i,
.sidebar .dropdown-item .dropdown-icon {
  position: relative; width: 20px; flex: 0 0 20px; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar .dropdown-item .dropdown-icon svg { width: 19px; height: 19px; }
.sidebar .dropdown-item.logout { color: var(--sb-danger); }
.sidebar .dropdown-item.logout:hover { background: rgba(239,68,68,0.10); color: var(--sb-danger); }
.sidebar .dropdown-divider { height: 1px; margin: 6px 4px; background: var(--sb-line); }

/* شارات الإشعارات */
.sidebar-notif-dot {
  position: absolute; top: -6px; inset-inline-end: -7px;
  min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px;
  align-items: center; justify-content: center;
  background: #ef4444; color: #fff; font-size: 0.58rem; font-weight: 800; line-height: 1;
  box-shadow: 0 0 6px rgba(239,68,68,0.7);
  animation: notif-dot-pulse 1.8s ease-in-out infinite;
}
.sidebar-notif-count {
  align-items: center; padding: 2px 8px; border-radius: 8px;
  background: rgba(239,68,68,0.16); color: #f87171; font-size: 0.7rem; font-weight: 700;
}
.notif-sidebar-bell-anim { display: inline-block; transform-origin: top center; animation: notif-bell-ring 3s ease-in-out infinite; }
@keyframes notif-dot-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.6); }
  50%     { box-shadow: 0 0 0 5px rgba(239,68,68,0); }
}
@keyframes notif-bell-ring {
  0%,100% { transform: rotate(0deg); }
  8% { transform: rotate(10deg); } 16% { transform: rotate(-8deg); }
  24% { transform: rotate(6deg); } 32% { transform: rotate(-4deg); }
  40% { transform: rotate(2deg); } 48% { transform: rotate(0deg); }
}

/* زوار غير مسجلين */
.sidebar .user-actions { display: flex; gap: 8px; padding: 0 12px 12px; }
.sidebar .login-btn,
.sidebar .signup-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 8px; border-radius: 10px; text-decoration: none;
  font-size: 13.5px; font-weight: 600; transition: background 0.2s, border-color 0.2s, color 0.2s, filter 0.2s;
}
.sidebar .login-btn { background: transparent; color: var(--sb-fg); border: 1px solid var(--sb-line); }
.sidebar .login-btn:hover { border-color: var(--accent-color); color: var(--accent-color); }
.sidebar .signup-btn { background: var(--accent-color); color: #fff; border: 1px solid var(--accent-color); }
.sidebar .signup-btn:hover { filter: brightness(1.08); }

/* التنقل */
.sidebar-nav { flex: 0 0 auto; display: flex; flex-direction: column; gap: 4px; padding: 14px 12px 12px; }
.sidebar-nav .separator { display: none; }
.sidebar .nav-section-label {
  padding: 8px 12px 4px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.8px; text-transform: uppercase; color: var(--sb-muted);
}
.sidebar .nav-link-item,
.sidebar .accordion-header {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 12px;
  background: transparent; color: var(--sb-fg);
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; text-align: start;
  text-decoration: none; cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, color 0.2s;
}
.sidebar .nav-link-item:hover,
.sidebar .accordion-header:hover { background: var(--sb-hover); }
.sidebar .nav-link-item.active,
.sidebar .accordion-header.active { color: var(--accent-color); background: var(--sb-accent-bg); }
.sidebar .nav-ico {
  width: 32px; height: 32px; flex: 0 0 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; background: var(--sb-card); font-size: 15px;
  transition: background 0.2s;
}
.sidebar .nav-link-item.active .nav-ico,
.sidebar .accordion-header.active .nav-ico { background: rgba(39,174,96,0.18); }
.sidebar .nav-text { flex: 1; min-width: 0; }
.sidebar .accordion-header .arrow { font-size: 11px; opacity: 0.55; transition: transform 0.25s ease; }
.sidebar .accordion-header .arrow.rotated { transform: rotate(180deg); }

/* أقسام قابلة للطي — انزلاق ناعم دون قياس الارتفاع بالـJS */
.sidebar-accordion { width: 100%; }
.accordion-content {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s ease;
}
.accordion-content.open { grid-template-rows: 1fr; }
.accordion-inner {
  min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; gap: 2px;
  margin-inline-start: 26px; padding-inline-start: 10px;
  border-inline-start: 1px solid var(--sb-line);
  visibility: hidden; transition: visibility 0s linear 0.28s;
}
.accordion-content.open > .accordion-inner { visibility: visible; transition-delay: 0s; }
.accordion-inner > :first-child { margin-top: 4px; }
.accordion-inner > :last-child  { margin-bottom: 6px; }

.sidebar .accordion-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px; text-decoration: none;
  font-size: 13px; font-weight: 500; color: var(--sb-link);
  transition: background 0.2s, color 0.2s;
}
.sidebar .accordion-link::before {
  content: ''; flex: none; box-sizing: border-box;
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.4;
  transition: transform 0.2s, opacity 0.2s, background 0.2s;
}
.sidebar .accordion-link:hover { color: var(--accent-color); background: var(--sb-hover); }
.sidebar .accordion-link:hover::before { transform: scale(1.3); opacity: 1; }
.sidebar .accordion-link.active { color: var(--accent-color); background: var(--sb-accent-bg); font-weight: 700; }
.sidebar .accordion-link.active::before { opacity: 1; }
/* روابط فرعية (قائمة الألعاب / PS2 to PS4 ...) */
.sidebar .accordion-link.sub-link { margin-inline-start: 12px; padding-block: 6px; font-size: 12.5px; }
.sidebar .accordion-link.sub-link::before { width: 7px; height: 7px; background: transparent; border: 1.5px solid currentColor; }
/* قريباً */
.sidebar .accordion-link.soon-link { opacity: 0.6; cursor: default; }
.sidebar .accordion-link.soon-link:hover { color: var(--sb-link); background: transparent; }
.soon-badge {
  display: inline-flex; align-items: center; white-space: nowrap; margin-inline-start: auto;
  padding: 2px 8px; border-radius: 20px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.3px;
  background: rgba(243,156,18,0.16); color: #e67e22;
}

/* تذييل القائمة */
.sidebar-social-bottom {
  margin-top: auto; padding: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  border-top: 1px solid var(--sb-line);
}
.social-title { font-size: 11px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--sb-muted); }
.social-icons { display: flex; justify-content: center; gap: 12px; }
.social-icons a {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--sb-card); font-size: 17px; text-decoration: none;
  transition: transform 0.2s, background 0.2s;
}
.social-icons a:hover { background: var(--sb-hover); transform: translateY(-2px); }
.social-icons a[aria-label="Telegram"] { color: #0088cc; }
.social-icons a[aria-label="YouTube"]  { color: #ff0000; }
.social-icons a[aria-label="Facebook"] { color: #1877f2; }
/* روابط DMCA/Contact/Privacy: تظهر هنا فقط حين تُخفى من الهيدر */
.sidebar-legal { display: none; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 12px; }
.sidebar-legal a { color: var(--sb-muted); text-decoration: none; transition: color 0.2s; }
.sidebar-legal a:hover { color: var(--accent-color); }
@media (max-width: 1199px) { .sidebar-legal { display: flex; } }
@media (max-width: 768px)  { .sidebar-header { min-height: 56px; } }

/* خط فاصل عام (احتياط لأي صفحة تستخدمه) */
.separator { height: 1px; background-color: rgba(127,127,127,0.18); margin: 0 20px; }

@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar-overlay, .accordion-content, .accordion-inner { transition: none; }
}

/* Category Nav (mobile) */
.category-nav {
  display: flex; gap: 7px; overflow-x: auto; padding: 10px 20px;
  border-top: 1px solid var(--card-border); background: var(--primary-color);
  white-space: nowrap; justify-content: center;
  max-width: 1200px; margin: 0 auto;
}
.category-nav::-webkit-scrollbar { height: 3px; }
.category-nav .nav-link {
  display: inline-block; padding: 8px 16px; text-decoration: none;
  color: #666; font-weight: 600; border-radius: 5px;
  transition: all 0.3s ease; font-size: 0.85rem; border: 1px solid transparent;
}
.category-nav .nav-link:hover,
.category-nav .nav-link.active {
  background: var(--primary-dark); color: var(--accent-color);
  border-color: var(--card-border);
}
.category-nav .nav-link.active { border-color: var(--accent-color); }

/* ── Filter Panel (Side Drawer) ────────────────────────── */
.filter-modal {
  display: flex; flex-direction: column;
  position: fixed; top: 0; right: 0; bottom: 0; left: auto;
  width: min(340px,100vw); height: 100%;
  background: var(--primary-color);
  border-left: 1px solid var(--card-border);
  box-shadow: -6px 0 32px rgba(0,0,0,0.18);
  z-index: 3000; overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(.4,0,.2,1), visibility 0s linear 0.3s;
  visibility: hidden; pointer-events: none;
}
.filter-modal.show {
  transform: translateX(0); visibility: visible; pointer-events: auto;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1), visibility 0s linear 0s;
}
[dir="rtl"] .filter-modal {
  right: auto; left: 0;
  border-left: none; border-right: 1px solid var(--card-border);
  box-shadow: 6px 0 32px rgba(0,0,0,0.18);
  transform: translateX(-100%);
}
[dir="rtl"] .filter-modal.show { transform: translateX(0); }
body.dark-mode .filter-modal { box-shadow: -6px 0 32px rgba(0,0,0,0.70); }

.filter-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.50); z-index: 2900; backdrop-filter: blur(2px);
}
.filter-backdrop.show { display: block; }
body.dark-mode .filter-backdrop { background: rgba(0,0,0,0.65); }

.filter-modal-content {
  display: flex; flex-direction: column;
  height: 100%; width: 100%; overflow: hidden;
  background: var(--primary-color);
}

/* Filter header */
.filter-header {
  flex-shrink: 0; display: flex; align-items: center;
  justify-content: space-between; padding: 15px 18px;
  border-bottom: 1px solid var(--card-border);
}
.filter-header-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; color: var(--text-color);
}
.filter-header-title i { color: var(--accent-color); }
.fh-count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent-color); color: #fff;
  font-size: 11px; font-weight: 700;
}
.filter-close {
  background: none; border: none; color: #999; cursor: pointer;
  font-size: 16px; padding: 6px 8px; border-radius: 6px;
  transition: all 0.2s; line-height: 1;
}
.filter-close:hover { background: var(--primary-light); color: var(--text-color); }

/* Scrollable sections */
.filter-sections { flex: 1; overflow-y: auto; padding: 0; }
.filter-sections::-webkit-scrollbar { width: 3px; }
.filter-sections::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 2px; }

/* Filter blocks */
.fp-block { padding: 16px 18px; border-bottom: 1px solid var(--card-border); }
.fp-block:last-child { border-bottom: none; }
.fp-block-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.7px; color: #999; margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}
.fp-block-title i { color: var(--accent-color); font-size: 12px; }

/* Pills */
.fp-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.fp-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border: 1.5px solid var(--card-border);
  border-radius: 20px; font-size: 12px; font-weight: 600;
  color: var(--text-color); background: var(--primary-color);
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.fp-pill:hover { border-color: var(--accent-color); color: var(--accent-color); }
.fp-pill-active {
  border-color: var(--accent-color) !important;
  background: var(--accent-color) !important;
  color: #fff !important;
}
.fp-pill i { font-size: 11px; }

/* Stars */
.fp-stars-row { display: flex; flex-direction: column; gap: 6px; }
.fp-star-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px; border: 1.5px solid var(--card-border);
  border-radius: 8px; cursor: pointer; user-select: none;
  background: var(--primary-color);
  transition: border-color 0.15s, background 0.15s;
}
.fp-star-btn:hover { border-color: var(--accent-color); background: rgba(39,174,96,0.05); }
.fp-star-active  { border-color: var(--accent-color) !important; background: rgba(39,174,96,0.1) !important; }
.fp-stars-icons  { display: flex; gap: 2px; }
.fp-stars-icons .fa-star     { font-size: 14px; color: var(--card-border); }
.fp-stars-icons .fa-star.lit { color: #f39c12; }
.fp-star-label   { font-size: 12px; font-weight: 700; color: var(--text-color); }

/* Filter footer actions */
.filter-actions {
  flex-shrink: 0; padding: 14px 18px;
  border-top: 1px solid var(--card-border);
  display: flex; gap: 10px; background: var(--primary-color);
}
.filter-reset {
  flex: 1; padding: 11px; border: 1.5px solid var(--card-border);
  border-radius: 8px; font-weight: 600; font-size: 13px;
  cursor: pointer; background: var(--primary-light); color: var(--text-color);
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: background 0.2s;
}
.filter-reset:hover { background: var(--card-border); }
.filter-apply {
  flex: 2; padding: 11px; border: none; border-radius: 8px;
  font-weight: 700; font-size: 13px; cursor: pointer;
  background: var(--accent-color); color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: background 0.2s, transform 0.15s;
}
.filter-apply:hover { background: #219a52; transform: translateY(-1px); }

/* ── Page Layout — Desktop Sidebar Offset ──────────────── */
/* ── Page Layout — sidebar-page class handles all platforms ── */
body.sidebar-page { display: flex; flex-direction: column; min-height: 100vh; }

body.sidebar-page .main-wrap { flex: 1 0 auto; }

body.sidebar-page .footer,
body.sidebar-page .footer.footer-pro { margin-top: auto; }

@media (min-width: 769px) {
  .category-nav { display: none !important; }

  body.sidebar-page .sidebar {
    left: 0 !important; right: auto !important;
    width: 280px !important; display: flex !important;
    position: fixed !important; top: 0; bottom: 0;
    z-index: 2000; transform: none !important;
    visibility: visible !important; box-shadow: none;
  }
  body.sidebar-page .sidebar-overlay,
  body.sidebar-page .sidebar-close { display: none !important; }
  body.sidebar-page { padding: 0 !important; }

  body.sidebar-page .site-header {
    width: calc(100% - 280px) !important;
    margin-left: 280px !important; margin-right: 0 !important;
    z-index: 900 !important;
  }
  body.sidebar-page .main-wrap {
    margin-left: 280px; width: calc(100% - 280px);
  }
  body.sidebar-page .container {
    margin-left: 280px !important; width: calc(100% - 280px) !important;
    max-width: calc(100% - 280px) !important;
  }
  body.sidebar-page .footer,
  body.sidebar-page .footer.footer-pro {
    margin-left: 280px !important; width: calc(100% - 280px) !important;
  }

  body.sidebar-page .main-wrap .footer,
  body.sidebar-page .main-wrap .footer.footer-pro {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
  }

  /* RTL */
  [dir="rtl"] body.sidebar-page .sidebar { right: 0 !important; left: auto !important; }
  [dir="rtl"] body.sidebar-page .site-header { margin-left: 0 !important; margin-right: 280px !important; }
  [dir="rtl"] body.sidebar-page .main-wrap { margin-left: 0; margin-right: 280px; }
  [dir="rtl"] body.sidebar-page .container {
    margin-left: 0 !important; margin-right: 280px !important;
    width: calc(100% - 280px) !important; max-width: calc(100% - 280px) !important;
  }
  [dir="rtl"] body.sidebar-page .footer,
  [dir="rtl"] body.sidebar-page .footer.footer-pro { margin-left: 0 !important; margin-right: 280px !important; }

  [dir="rtl"] body.sidebar-page .main-wrap .footer,
  [dir="rtl"] body.sidebar-page .main-wrap .footer.footer-pro {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
  }
}

@media (max-width: 768px) {
  body.sidebar-page .main-wrap,
  body.sidebar-page .container,
  body.sidebar-page .footer,
  body.sidebar-page .footer.footer-pro {
    margin-left: 0 !important; margin-right: 0 !important; width: 100% !important; max-width: 100% !important;
  }
}

@media (min-width: 769px) {
  body.with-sidebar-offset .footer,
  body.with-sidebar-offset .footer.footer-pro {
    margin-left: 280px !important;
    width: calc(100% - 280px) !important;
  }

  body:not(.sidebar-page):has(.sidebar) .footer,
  body:not(.sidebar-page):has(.sidebar) .footer.footer-pro {
    margin-left: 280px !important;
    width: calc(100% - 280px) !important;
  }

  [dir="rtl"] body.with-sidebar-offset .footer,
  [dir="rtl"] body.with-sidebar-offset .footer.footer-pro,
  [dir="rtl"] body:not(.sidebar-page):has(.sidebar) .footer,
  [dir="rtl"] body:not(.sidebar-page):has(.sidebar) .footer.footer-pro {
    margin-left: 0 !important;
    margin-right: 280px !important;
    width: calc(100% - 280px) !important;
  }
}

@media (max-width: 768px) {
  body.with-sidebar-offset .footer,
  body.with-sidebar-offset .footer.footer-pro,
  body:not(.sidebar-page):has(.sidebar) .footer,
  body:not(.sidebar-page):has(.sidebar) .footer.footer-pro {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
  }
}

/* ── Wrappers ───────────────────────────────────────────── */
.main-wrap {
  display: block; min-height: 60vh;
  overflow: visible; position: relative; z-index: 1;
  padding-bottom: 20px;
}

/* ── Shared Game Card (hm-card) ────────────────────────── */
.hm-card {
  flex: 0 0 175px; min-width: 175px;
  background: var(--primary-color); border: 1px solid var(--card-border);
  border-radius: 10px; overflow: hidden; scroll-snap-align: start;
  box-shadow: 0 1px 5px rgba(0,0,0,0.05);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  text-decoration: none; color: inherit; display: block;
}
.hm-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,0.1); border-color: var(--accent-color); }

.hm-card-img {
  position: relative; width: 100%; height: 0; padding-bottom: 133%;
  overflow: hidden; background: var(--primary-dark);
}
.hm-card-img img {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover; display: block; transition: transform 0.3s;
}
.hm-card:hover .hm-card-img img { transform: scale(1.03); }

.hm-card-badge {
  position: absolute; top: 6px; right: 6px;
  font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 6px; z-index: 2;
}
[dir="rtl"] .hm-card-badge { right: auto; left: 6px; }
.hm-card-badge-new { background: linear-gradient(135deg,#ff4757,#ff3838); color: #fff; box-shadow: 0 2px 5px rgba(255,71,87,0.3); }
.hm-card-badge-updated { background: linear-gradient(135deg,#3b82f6,#2563eb); color: #fff; box-shadow: 0 2px 5px rgba(59,130,246,0.3); }
.hm-card-badge-pop { background: linear-gradient(135deg,#f39c12,#e67e22); color: #fff; box-shadow: 0 2px 5px rgba(243,156,18,0.3); }
.hm-card-badge-tr  { background: linear-gradient(135deg,#8e44ad,#6c3483); color: #fff; box-shadow: 0 2px 5px rgba(142,68,173,0.3); top: auto !important; bottom: 32px; right: 6px; }
[dir="rtl"] .hm-card-badge-tr { right: auto; left: 6px; }

/* منع تراكب شارتين متجاورتين (مثال: جديدة/محدّث + شائعة معًا) */
.hm-card-badge + .hm-card-badge:not(.hm-card-badge-tr) { top: 26px; }

.hm-card-plat {
  position: absolute; bottom: 6px; left: 6px;
  background: rgba(0,0,0,0.70); color: var(--accent-color);
  font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
}
[dir="rtl"] .hm-card-plat { left: auto; right: 6px; }

.hm-card-body  { padding: 8px 10px; }
.hm-card-title {
  font-weight: 700; font-size: 11px; line-height: 1.35; height: 30px;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  color: var(--text-color);
}
.hm-card-meta {
  margin-top: 5px; display: flex; justify-content: space-between;
  font-size: 10px; color: #888;
}
body.dark-mode .hm-card-meta { color: rgba(255,255,255,0.55); }
.hm-card-meta span { display: inline-flex; align-items: center; gap: 2px; }
.hm-card-meta .fa-star { color: #ffc107; font-size: 9px; }

/* ── Games Grid ────────────────────────────────────────── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px,1fr));
  gap: 12px; padding: 4px 16px 20px;
}
.games-grid .hm-card { flex: none; min-width: 0; width: 100%; }

/* ── Platform Controls Bar (shared: ps4/ps3/ps5/arabic) ────── */
.platform-controls {
  display: flex; flex-direction: column;
  padding: 10px 16px 6px; gap: 8px;
}
.platform-game-count {
  font-size: 13px; color: #888; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.platform-game-count strong { color: var(--accent-color); }

.platform-active-filters-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.platform-active-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px 4px 12px;
  background: rgba(39,174,96,0.12);
  border: 1px solid rgba(39,174,96,0.35);
  color: var(--accent-color); border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.platform-active-tag .remove-filter {
  background: none; border: none; color: var(--accent-color); cursor: pointer;
  font-size: 11px; padding: 0; margin: 0; line-height: 1; opacity: 0.7; transition: opacity 0.2s;
}
.platform-active-tag .remove-filter:hover { opacity: 1; }

.platform-clear-all-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; background: none; border: 1px solid var(--card-border);
  border-radius: 20px; font-size: 12px; color: #888; cursor: pointer; transition: all 0.2s;
}
.platform-clear-all-btn:hover { border-color: #e74c3c; color: #e74c3c; }

.hm-viewall-bottom { display: flex; justify-content: flex-end; padding: 6px 16px 4px; }
[dir="rtl"] .hm-viewall-bottom { justify-content: flex-start; }

.platform-lastvisited { padding: 4px 0 10px; border-top: 1px solid var(--card-border); margin-top: 4px; display: none; }

/* ── Search Results ────────────────────────────────────── */
.search-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  margin-bottom: 10px;
}
.search-results-header h2 {
  font-size: .8rem;
  font-weight: 500;
  color: #888;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.search-results-header h2 span {
  color: var(--text-color);
  font-weight: 700;
}
.search-results-meta { display: none; }
.clear-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  color: #888;
  border: 1px solid var(--card-border);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: .7rem;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.clear-search-btn:hover {
  color: var(--accent-color);
  border-color: var(--accent-color);
}
.search-results-meta .clear-search-btn {
  margin-top: 0;
  padding: 4px 10px;
  border-radius: 6px;
}

/* ── No Results ────────────────────────────────────────── */
.no-results { text-align: center; padding: 50px 20px; color: #888; }
.no-results i { font-size: 40px; margin-bottom: 12px; color: var(--card-border); display: block; }
.no-results h3 { font-size: 1.1rem; margin-bottom: 6px; color: var(--text-color); }
.no-results .clear-search-btn {
  margin-top: 10px; padding: 7px 18px;
  border: 1px solid var(--accent-color); background: transparent;
  color: var(--accent-color); border-radius: 6px; cursor: pointer;
  font-weight: 600; transition: all 0.2s;
}
.no-results .clear-search-btn:hover { background: var(--accent-color); color: #fff; }

/* ── Pagination ────────────────────────────────────────── */
.pagination-container {
  padding: 14px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.pagination-info { font-size: 12px; color: #888; }
.pagination { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.pagination button,
.pagination .page-btn {
  min-width: 34px; height: 34px; padding: 0 8px;
  border: 1px solid var(--card-border);
  background: var(--primary-color); color: var(--text-color);
  border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600;
  transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit;
  text-decoration: none; /* لأن .page-btn الحين ممكن تكون <a> */
}
.pagination button:hover:not([disabled]),
.pagination .page-btn:hover { border-color: var(--accent-color); color: var(--accent-color); }
.pagination button.active,
.pagination .page-btn.active { background: var(--accent-color); color: #fff; border-color: var(--accent-color); }
.pagination button[disabled] { opacity: 0.35; cursor: not-allowed; }
.page-ellipsis { display: inline-flex; align-items: center; padding: 0 4px; color: #888; font-size: 13px; }

/* ── Loading Spinner ───────────────────────────────────── */
.loading-spinner { text-align: center; padding: 40px 20px; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--card-border);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 10px;
}
.loading-text { font-size: 13px; color: #888; }

/* ── Footer (base) ─────────────────────────────────────── */
.footer {
  margin-top: 35px; padding: 25px 0;
  color: #666; font-size: 0.8rem;
  border-top: 1px solid var(--card-border);
  background: var(--primary-color);
  width: 100%; text-align: center;
}
.footer.footer-pro { padding: 0; }

/* ── Footer Pro (full layout from footer.php) ──────────── */
.footer.footer-pro {
  margin-top: 35px; width: 100%;
  background: var(--primary-color);
  border-top: 1px solid var(--card-border);
  text-align: initial;
}
.footer-pro .footer-wrap { max-width: 1200px; margin: 0 auto; padding: 28px 16px 18px; }
.footer-pro .footer-brand {
  display: flex; flex-direction: column; gap: 12px;
  align-items: flex-start; margin-bottom: 18px;
}
.footer-pro .footer-logo-link {
  display: inline-flex; align-items: center; justify-content: flex-start;
  padding: 0; border-radius: 0; border: 0; background: transparent; overflow: visible;
}
body.dark-mode .footer-pro .footer-logo-link { background: transparent; border-color: transparent; }
.footer-pro .footer-logo { width: 170px; height: auto; max-height: 70px; object-fit: contain; display: block; }
.footer-pro .footer-brand-text { width: 100%; max-width: 760px; }
.footer-pro .footer-about    { margin: 2px 0 8px; line-height: 1.7; font-size: 13px; color: #666; }
.footer-pro .footer-disclaimer { margin: 0; line-height: 1.7; font-size: 12px; color: #777; }
body.dark-mode .footer-pro .footer-about      { color: rgba(255,255,255,.78); }
body.dark-mode .footer-pro .footer-disclaimer { color: rgba(255,255,255,.68); }

.footer-pro .footer-grid {
  display: grid; grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 22px; padding-top: 16px; border-top: 1px solid var(--card-border);
}
.footer-pro .footer-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.footer-pro .footer-block-title {
  margin: 0 0 10px; font-size: 14px; font-weight: 800;
  letter-spacing: .6px; color: var(--text-color); text-transform: uppercase;
}
.footer-pro.is-ar .footer-block-title { text-transform: none; letter-spacing: 0; }

.footer-pro .footer-list,
.footer-pro .footer-social-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-pro .footer-list a { text-decoration: none; font-size: 13px; color: #666; transition: color .2s ease; }
.footer-pro .footer-list a:hover { color: var(--accent-color); }
body.dark-mode .footer-pro .footer-list a { color: rgba(255,255,255,.72); }

.footer-pro .footer-social-link {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; font-size: 13px; color: #666;
  transition: color .2s ease, transform .2s ease;
}
.footer-pro .footer-social-link i { width: 18px; text-align: center; color: var(--accent-color); font-size: 14px; flex: 0 0 auto; }
.footer-pro .footer-social-link:hover { color: var(--accent-color); transform: translateY(-1px); }
body.dark-mode .footer-pro .footer-social-link { color: rgba(255,255,255,.72); }

.footer-pro.is-ar .footer-social-link { flex-direction: row-reverse; justify-content: flex-end; }

.footer-pro .footer-bottom {
  border-top: 1px solid var(--card-border);
  padding: 14px 16px; text-align: center; font-size: 12px; color: #666;
}
body.dark-mode .footer-pro .footer-bottom { color: rgba(255,255,255,.72); }
.footer-pro .footer-bottom a { color: inherit; text-decoration: none; }
.footer-pro .footer-bottom a:hover { color: var(--accent-color); }

/* ── Year Filter (PS4 / PS3 pages) ────────────────────── */
.year-filter { padding: 15px 0; }
.year-inputs { display: flex; gap: 15px; align-items: center; }
.year-input { flex: 1; }
.year-input label { display: block; margin-bottom: 5px; font-size: 13px; color: var(--text-color); font-weight: 500; }
.year-input input {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--card-border); border-radius: 6px;
  background: var(--primary-color); color: var(--text-color);
  font-size: 14px; font-family: inherit; transition: all 0.3s;
}
.year-input input:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 2px rgba(39,174,96,0.1); }
.year-input input::placeholder { color: #999; }
body.dark-mode .year-input input { background: var(--primary-light); border-color: #444; }

/* ── RTL Adjustments ───────────────────────────────────── */
[dir="rtl"] .breadcrumb   { flex-direction: row-reverse; }

/* ── Responsive ────────────────────────────────────────── */
/* ملاحظة: قاعدة كانت هنا تفرض ظهور .sidebar بشكل دائم من عرض 600px
   على كل الصفحات (بدون شرط body.sidebar-page) وبدون تزحزح المحتوى،
   وكانت أيضاً تعطّل زر الإغلاق (.sidebar-close) وطبقة الإغلاق
   (.sidebar-overlay) — فيصبح السايد بار عالقاً مفتوحاً فوق المحتوى
   على الشاشات المتوسطة (آيباد) بلا طريقة لإغلاقه. تم حذفها؛ السلوك
   الثابت (Pinned) للسايد بار على الديسكتوب الحقيقي يبقى يعمل فقط عبر
   القاعدة المخصّصة body.sidebar-page في @media (min-width: 769px)
   أعلاه، والتي تُزحزح المحتوى بشكل صحيح (margin-left/right: 280px). */

@media (max-width: 768px) {
  .games-grid { grid-template-columns: repeat(2,1fr) !important; gap: 8px; padding: 4px 10px 16px; }
  .platform-controls { padding: 8px 12px; }
  .category-nav { display: none !important; }
  .year-inputs { flex-direction: column; gap: 10px; }
  .footer-pro .footer-wrap { padding: 22px 14px 16px; }
  .footer-pro .footer-grid { gap: 18px; }
  .footer-pro .footer-block-title { font-size: 13px; }
  .footer-pro .footer-list a, .footer-pro .footer-social-link { font-size: 12.5px; }
  .footer-pro .footer-logo { width: 128px; max-height: 64px; }
}

@media (max-width: 480px) {
  .games-grid { grid-template-columns: repeat(2,1fr) !important; gap: 8px; padding: 4px 10px 16px; }
  .footer-pro .footer-grid { gap: 14px; }
  .footer-pro .footer-social-list { gap: 9px; }
  .footer-pro .footer-logo { width: 120px; max-height: 60px; }
}

@media (min-width: 1100px) {
  .games-grid { grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 14px; }
  .hm-card    { flex: 0 0 190px; min-width: 190px; }
}

/* ── Animations ────────────────────────────────────────── */
@keyframes floatIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
