/* __ATHAR_ADMIN_MOBILE_V1__
 * لوحة التحكم على الجوال — نسخة النشر الحي (overlay).
 * المصدر: client/src/index.css (نفس القواعد). هنا يُستهدف main.flex-1.overflow-auto.p-4
 * أيضاً، لأن حزمة JS الحية المثبّتة (index-Csy_iy8U.js) لا تحمل الصنف admin-main.
 */
/* ───────────── لوحة التحكم على الجوال (أقل من 768px) ─────────────
   شبكة أمان عامة لكل صفحات الإدارة ونوافذها، بدل تعديل 75 صفحة واحدة واحدة.
   خارج @layer عمداً: القواعد غير المصنّفة تغلب أدوات Tailwind (المصنّفة) دون !important. */
@media (max-width: 767px) {
  /* الجداول: سحب أفقي داخل الجدول بدل أن تتسع الصفحة كلها. */
  :is(.admin-main, main.flex-1.overflow-auto.p-4) table,
  [data-slot="dialog-content"] table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* صفوف «عنوان + أزرار»: تلتف إلى سطر ثانٍ بدل الخروج عن الشاشة. */
  :is(.admin-main, main.flex-1.overflow-auto.p-4) .justify-between,
  [data-slot="dialog-content"] .justify-between {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  /* صفوف فيها ثلاثة أزرار أو أكثر (شريط أدوات): تلتف. */
  :is(.admin-main, main.flex-1.overflow-auto.p-4) .flex:has(> [data-slot="button"] ~ [data-slot="button"] ~ [data-slot="button"]),
  [data-slot="dialog-content"] .flex:has(> [data-slot="button"] ~ [data-slot="button"] ~ [data-slot="button"]) {
    flex-wrap: wrap;
  }

  /* شبكات بعدد أعمدة ثابت (بلا sm:/md:): عمودان على الجوال. أعمدة الأيام السبعة تبقى. */
  :is(.admin-main, main.flex-1.overflow-auto.p-4) :is(.grid-cols-3, .grid-cols-4, .grid-cols-5, .grid-cols-6, .grid-cols-8, .grid-cols-9, .grid-cols-10, .grid-cols-12),
  [data-slot="dialog-content"] :is(.grid-cols-3, .grid-cols-4, .grid-cols-5, .grid-cols-6, .grid-cols-8, .grid-cols-9, .grid-cols-10, .grid-cols-12) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  /* عنصر يمتد على أعمدة أكثر من المتاح يأخذ السطر كاملاً. */
  :is(.admin-main, main.flex-1.overflow-auto.p-4) :is([class*="col-span-3"], [class*="col-span-4"], [class*="col-span-5"], [class*="col-span-6"]):not([class*=":col-span-"]),
  [data-slot="dialog-content"] :is([class*="col-span-3"], [class*="col-span-4"], [class*="col-span-5"], [class*="col-span-6"]):not([class*=":col-span-"]) {
    grid-column: 1 / -1;
  }

  /* عروض ثابتة بالبكسل (w-[600px] …): لا تتجاوز الشاشة، إلا داخل الجداول حيث السحب مقصود. */
  :is(.admin-main, main.flex-1.overflow-auto.p-4) :is([class*="w-["], [class*="min-w-["]):not(table, table *, :is(.admin-main, main.flex-1.overflow-auto.p-4) :is(.overflow-x-auto, .overflow-auto, .responsive-scroll) *, [data-slot="dialog-content"] :is(.overflow-x-auto, .overflow-auto, .responsive-scroll) *),
  [data-slot="dialog-content"] :is([class*="w-["], [class*="min-w-["]):not(table, table *, :is(.admin-main, main.flex-1.overflow-auto.p-4) :is(.overflow-x-auto, .overflow-auto, .responsive-scroll) *, [data-slot="dialog-content"] :is(.overflow-x-auto, .overflow-auto, .responsive-scroll) *) {
    max-width: 100%;
  }
  :is(.admin-main, main.flex-1.overflow-auto.p-4) [class*="min-w-["]:not(table, table *, :is(.admin-main, main.flex-1.overflow-auto.p-4) :is(.overflow-x-auto, .overflow-auto, .responsive-scroll) *, [data-slot="dialog-content"] :is(.overflow-x-auto, .overflow-auto, .responsive-scroll) *),
  [data-slot="dialog-content"] [class*="min-w-["]:not(table, table *, :is(.admin-main, main.flex-1.overflow-auto.p-4) :is(.overflow-x-auto, .overflow-auto, .responsive-scroll) *, [data-slot="dialog-content"] :is(.overflow-x-auto, .overflow-auto, .responsive-scroll) *) {
    min-width: 0;
  }

  /* شرائط التبويبات الطويلة: تلتف بدل أن تُقص. */
  :is(.admin-main, main.flex-1.overflow-auto.p-4) [data-slot="tabs-list"] {
    display: flex;
    height: auto;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.25rem;
  }

  /* الصور والوسائط والأكواد لا تتسع أكثر من الشاشة. */
  :is(.admin-main, main.flex-1.overflow-auto.p-4) :is(img, video, iframe, canvas, svg:not([class*="size-"]):not([width])) {
    max-width: 100%;
  }
  :is(.admin-main, main.flex-1.overflow-auto.p-4) pre {
    max-width: 100%;
    overflow-x: auto;
  }

  /* نوافذ الإدارة: هوامش أصغر لاستغلال عرض الجوال. */
  [data-slot="dialog-content"]:not([data-compact]) {
    padding: 1rem;
  }
}
