/* ════════════════════════════════════════════════════════════════════════════
   ⚡ وضع الأداء القصوى — 99-performance-mode.css (2026-06-10)
   ────────────────────────────────────────────────────────────────────────────
   طبقة override نهائية تُحمَّل آخر سطر في كتلة الـ CSS داخل index.html.
   الفلسفة: لوحة الأدمن «غرفة عمليات» لا «صالة عرض» — تُلغى الحركة والتأثيرات
   المكلفة فقط (أنيميشن دخول، نبضات لانهائية، blur، توهجات، ظلال ثقيلة)
   مع بقاء الهوية البصرية (الثيم الداكن/الفاتح، الألوان، التخطيط، RTL) كما هي.

   ⚠️ للإلغاء الكامل: احذف سطر <link> الخاص بهذا الملف من index.html فقط.
   ملاحظة: لا يوجد أي حذف من الملفات الأصلية — كل شيء هنا override قابل للعكس.
   ملاحظة: prefers-reduced-motion يبقى محترماً ضمنياً — هذا الوضع أشد صرامة منه
   وصار هو الافتراضي للجميع.
   ════════════════════════════════════════════════════════════════════════════ */

/* ────────────────────────────────────────────────────────────────────────────
   §1 — إعدام أنيميشن الدخول والتدرّج
   (hmTileEnter / cardStagger / fadeIn على الصفحات / wapIn / مودالات الدخول)
   المحتوى يظهر فوراً. ملاحظة: السبينر .spinner::after و .tt-spinner خارج
   النطاق عمداً (مؤشرا تحميل وظيفيان يبقيان يدوران).
   ──────────────────────────────────────────────────────────────────────────── */
.app-page,
.grid-tile.tile-enter,
.grid-tile.stagger,
.a-card.stagger,
.vid-item.stagger {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}
/* بطاقة «جديد» في الفاينل — تظهر فوراً (الإطار المميّز يبقى عبر §5) */
.final-admin-card.is-new { animation: none !important; opacity: 1 !important; }
/* بطاقات باقة التحليلات */
.wap-card { animation: none !important; opacity: 1 !important; }
/* مودالات الدخول المتدرّج (الفوترة/الدورات/المدفوع/تيليجرام/دروس الانتظار)
   — animation:none فقط: حالتها الطبيعية مرئية، ولا نفرض transform حتى لا
   نكسر أي توسيط يعتمد على translate */
.bil-modal-overlay, .bil-modal-box, .bil-pl-created-box,
.dc-modal-backdrop, .dc-modal,
.pc-modal-backdrop, .pc-modal,
.tqa-modal-sheet, .tqa-modal-overlay,
.wlx-form-area.open {
  animation: none !important;
}
/* تموّج النقر الزخرفي (ripple) — يُرسم مع كل نقرة بلا فائدة وظيفية */
.ripple-circle { display: none !important; }

/* ────────────────────────────────────────────────────────────────────────────
   §2 — إيقاف النبضات اللانهائية (استنزاف بطارية + GPU)
   القاعدة: الشارة/النقطة/المعلومة تبقى ظاهرة وثابتة — الحركة فقط تُزال.
   ──────────────────────────────────────────────────────────────────────────── */
/* main.css */
.topbar-badge { animation: none !important; opacity: 1 !important; }
.grid-tile.final-tile-active::before {
  animation: none !important;
  /* بدل نبضة tilePulse: هالة ثابتة خفيفة تبقي النقطة الحمراء مرئية */
  box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.25) !important;
}
.final-admin-new-badge {
  animation: none !important;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.45) !important;
}
/* main-enhancements.css — طفو شعار صفحة الدخول */
#pg-login .a-card img { animation: none !important; }
/* billing.css — كل نبضات bil-* */
.bil-rt-connected i,
.bil-env-live,
.bil-pl-status-active i,
.bil-pl-badge-soon,
.bil-unsaved-dot {
  animation: none !important;
  opacity: 1 !important;
}
.bil-invoice-row.bil-invoice-hidden,
tr.bil-invoice-row.bil-invoice-hidden {
  animation: none !important;
  /* علامة «مخفية» تبقى مرئية بهالة كهرمانية ثابتة بدل النبض */
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.45) !important;
}
/* جرس «جديد» في بطاقات مجموعات الفاينل — نبضته inline في قالب main.js،
   والـ !important هنا يغلب الـ style المضمّن (الجرس الأحمر يبقى ظاهراً ثابتاً) */
.fsg-student-name .fa-bell { animation: none !important; }
/* telegram-automation.css / telegram-insights.css */
.ta-stat-card.live::before { animation: none !important; opacity: 1 !important; }
.ti-crisis-row[data-severity="critical"] {
  animation: none !important;
  box-shadow: 0 0 0 1px rgba(255, 107, 107, 0.4) !important;
}
/* الهياكل العظمية (skeleton/shimmer) → كتل ثابتة بنفس الشكل */
.bil-skeleton-block, .dc-skel, .pc-skel { animation: none !important; }
.ta-skeleton::after, .ti-skeleton::after, .tt-skeleton-card::after { animation: none !important; }

/* ────────────────────────────────────────────────────────────────────────────
   §3 — إلغاء الـ blur نهائياً (أغلى تأثير paint على الجوال)
   التعويض: خلفيات صلبة أعلى عتامة تحافظ على القراءة بنفس الإحساس البصري.
   ──────────────────────────────────────────────────────────────────────────── */
.topbar {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(13, 20, 32, 0.97) !important;
}
[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.98) !important; }
.modal-bg, .cmd-palette {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(0, 0, 0, 0.72) !important;
}
/* شريط التحديد الجماعي — الـ blur عنده inline style في index.html فالـ
   !important هنا يغلبه بلا تعديل HTML */
#bulkBar {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: var(--card) !important;
}
#finalReqBulkBar {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.bunlib-thumb .bunlib-duration {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(0, 0, 0, 0.85) !important;
}
/* بطاقات إحصائيات الفوترة (النسختان) + رأس الجدول اللاصق */
.bil-stat-card {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.bil-table thead th {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  /* لاصق فوق صفوف متحركة — يجب أن يكون معتماً تماماً للقراءة */
  background: #0f172a !important;
}
/* كل overlays المودالات عبر الموديولات → خلفية صلبة داكنة موحدة */
.bil-modal-overlay,
.dc-modal-backdrop,
.pc-modal-backdrop,
.tqa-modal-overlay,
.ta-modal-overlay,
.ttr-modal-overlay,
.tt-modal-overlay {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(0, 0, 0, 0.72) !important;
}
/* بطاقات زجاجية متفرقة — إزالة الـ blur فقط (خلفياتها المتدرجة الخفيفة تبقى) */
.dc-idx-card, .dc-crs-card,
.pc-grp-card, .pc-item-card,
.fp-alert-card {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.wap-drawer-overlay {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(4, 8, 14, 0.72) !important;
}
/* مودال أحداث نشاط الأجهزة (fp-activity-grouped) — ستايله يُحقن بـ JS بعد
   هذه الطبقة في ترتيب المستند، فالـ !important وحده يضمن الغلبة */
.fp-evt-backdrop {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(0, 0, 0, 0.78) !important;
}

/* ────────────────────────────────────────────────────────────────────────────
   §4 — خلفية الجسم والسكرول بار
   تدرّجات body مع background-attachment:fixed تُعاد رسمها مع كل سكرول.
   ──────────────────────────────────────────────────────────────────────────── */
body,
[data-theme="light"] body {
  background: var(--bg) !important;
  background-attachment: initial !important;
}
/* السكرول بار المتدرج → لون صلب واحد هادئ */
::-webkit-scrollbar-thumb {
  background: rgba(90, 101, 119, 0.55) !important;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(90, 101, 119, 0.8) !important; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: #cbd5e1 !important; }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #94a3b8 !important; }
* { scrollbar-color: rgba(90, 101, 119, 0.55) transparent !important; }
[data-theme="light"] * { scrollbar-color: #cbd5e1 transparent !important; }

/* ────────────────────────────────────────────────────────────────────────────
   §5 — ترويض الـ hover والانتقالات
   ──────────────────────────────────────────────────────────────────────────── */
/* مربعات الرئيسية: بلا رفع، بلا توهج — تغيّر لون الإطار فقط */
.grid-tile:hover,
[data-theme="light"] .grid-tile:hover {
  transform: none !important;
  box-shadow: none !important;
  border-color: rgba(0, 180, 216, 0.45);
}
.grid-tile:active { transform: none !important; }
.grid-tile::after { display: none !important; } /* التوهج الشعاعي */
/* رفعات hover المتفرقة — تصير ثابتة (transform منزوع من قائمة الانتقالات
   أدناه، فبقاؤها كان سيجعلها قفزة لحظية مزعجة) */
.a-btn:hover, .a-btn:hover i,
.back-btn:hover, .back-btn:hover i,
.a-card:hover,
.vid-item:hover .vid-thumb img { transform: none !important; }

/* حصر transition:all (78 موضعاً عبر الملفات) في الألوان فقط وبمدة 0.1s.
   ملاحظة أمان: لا يوجد أي مستمع transitionend/animationend في كامل الكود
   (مُتحقق منه بـ grep) — التضييق آمن. */
.grid-tile, .a-card, .a-btn, .a-input, .stu-sort-btn, .stu-filter-btn,
.vid-item, .back-btn, .theme-toggle, .topbar .btn-logout, .drop-zone,
.req-search-clear, .cs-type-card, .bunlib-search input, .bunlib-filter,
.bunlib-card, .bunlib-dl, .bunlib-preview, .bunlib-pagination button,
.toast-item, .copy-btn-mini, .wap-radar-row,
[class^="bil-"], [class*=" bil-"],
[class^="tt-"], [class*=" tt-"],
[class^="ttr-"], [class*=" ttr-"],
[class^="tqa-"], [class*=" tqa-"],
[class^="ta-"], [class*=" ta-"],
[class^="ti-"], [class*=" ti-"],
[class^="dc-"], [class*=" dc-"],
[class^="pc-"], [class*=" pc-"],
[class^="ls-"], [class*=" ls-"],
[class^="wap-"], [class*=" wap-"] {
  transition-property: background-color, color, border-color !important;
  transition-duration: 0.1s !important;
  transition-timing-function: ease !important;
}

/* ظلال متعددة الطبقات على البطاقات → ظل واحد خفيف أو لا شيء */
[data-theme="light"] .a-card { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important; }
[data-theme="light"] .grid-tile { box-shadow: none !important; }
.modal-box, .cmd-box { box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45) !important; }
[data-theme="light"] .modal-box,
[data-theme="light"] .cmd-box { box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18) !important; }
#pg-login .a-card { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4) !important; }
.bil-modal-box { box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important; }
/* حالتا «جديد» و«محدد» وظيفيتان — حلقة واحدة خفيفة تبقي التمييز */
.final-admin-card.is-new { box-shadow: 0 0 0 1px rgba(255, 107, 107, 0.4) !important; }
.is-selected { box-shadow: 0 0 0 1px rgba(0, 180, 216, 0.45) !important; }
.toast-item { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35) !important; }

/* ────────────────────────────────────────────────────────────────────────────
   §6 — الانسجام عبر الأجهزة (جوال + آيباد + أندرويد + ديسكتوب/لابتوب)
   نقاط الاختبار: 360 / 390 / 768 / 1024 / 1280px+ — بلا تكسّر RTL.
   ──────────────────────────────────────────────────────────────────────────── */
/* 6.1 الجداول: حاوية تمرير أفقي سلسة (تُحقن تلقائياً من main.js — كتلة PERF
   تغلّف أي جدول بلا حاوية overflow أفقية أصلاً) */
.perf-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
@media (max-width: 768px) {
  /* على الشاشات الضيقة فقط: الجدول يأخذ عرضه الطبيعي وينسكرل بدل أن تنسحق
     أعمدته — الديسكتوب يبقى كما هو تماماً */
  .perf-table-scroll > table { min-width: max-content; }
}

/* 6.2 أهداف اللمس ≥ 44px على أجهزة اللمس فقط */
@media (pointer: coarse) {
  .a-btn.sm { min-height: 44px; }
  .stu-sort-btn, .stu-filter-btn { min-height: 44px; }
  .bunlib-pagination button { min-height: 44px; min-width: 44px; }
  .theme-toggle, .topbar .btn-logout { min-height: 44px; min-width: 44px; }
  /* زر النسخ المصغّر: منطقة لمس ممتدة غير مرئية بدل تكبير الزر (لا يكسر الصفوف) */
  .copy-btn-mini { position: relative; }
  .copy-btn-mini::after { content: ''; position: absolute; inset: -12px; }
}

/* 6.3 مدخلات iOS: 16px تمنع الزوم القسري في Safari عند التركيز */
@media (max-width: 768px), (pointer: coarse) {
  input, select, textarea, .a-input, .cmd-input { font-size: 16px !important; }
}

/* 6.4 مناطق الأمان (النوتش/الحواف المنحنية) — أصفار على الديسكتوب فلا تغيير */
.topbar {
  padding-left: max(20px, env(safe-area-inset-left)) !important;
  padding-right: max(20px, env(safe-area-inset-right)) !important;
  padding-top: max(12px, env(safe-area-inset-top)) !important;
}
#bulkBar { padding-bottom: max(12px, calc(12px + env(safe-area-inset-bottom))) !important; }
.toast-wrap { bottom: max(20px, calc(20px + env(safe-area-inset-bottom))) !important; }

/* 6.5 مقاسات سائلة clamp() — الديسكتوب هو السقف (قيمه الأصلية بلا تغيير)
   والنزول للجوال انسيابي بدل القفزات الحادة بين الـ breakpoints */
.page-header h2 { font-size: clamp(1.05rem, 0.95rem + 1vw, 1.3rem); }
.app-page { padding: clamp(12px, 2vw, 20px); }
.grid-tile { padding: clamp(14px, 1.2vw + 8px, 24px) clamp(10px, 1vw + 4px, 16px); }
.grid-tile .tile-count { font-size: clamp(1.35rem, 1rem + 1.4vw, 1.8rem); }
.grid-tile .tile-title { font-size: clamp(0.85rem, 0.78rem + 0.5vw, 1rem); }

/* ────────────────────────────────────────────────────────────────────────────
   §7 — قوائم التحليلات الكاملة بسكرول داخلي (المرحلة 3)
   content-visibility: المتصفح يرسم الظاهر فقط — آلاف الصفوف بسلاسة 60fps.
   ──────────────────────────────────────────────────────────────────────────── */
/* رادار المتعثرين — كل الطلاب بقائمة واحدة */
.wap-radar-list {
  max-height: min(62vh, 560px) !important;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.wap-radar-row {
  content-visibility: auto;
  contain-intrinsic-size: auto 44px;
}
/* أكثر الطلاب مشاهدة — قائمة موسعة بنفس شكل الصف */
#topWatchersList {
  max-height: min(60vh, 520px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
#topWatchersList > div {
  content-visibility: auto;
  contain-intrinsic-size: auto 44px;
}
/* النشاط الأخير — 50 سجلاً بسكرول */
#recentWatchActivity {
  max-height: min(50vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
#recentWatchActivity > div {
  content-visibility: auto;
  contain-intrinsic-size: auto 40px;
}
