/* ══════════════════════════════════════════════════════════════════════
   (2026-12-04) شاشات تعريفات الأصناف — المجموعات ، التعريفات (5 تبويبات) ، الباركود الإضافى ،
   موقع الأصناف ، أنواع الطلبات ، الطاولات
   ▸ ملف عام (مش .razor.css) عشان الكلاسات متشاركة بين 6 شاشات ومكوّن البحث IdfItemFind
   ▸ الألوان من متغيرات الثيم بس (--fs-primary تركوازى ، --fs-action كهرمانى) — مفيش برتقالى ثابت
   ══════════════════════════════════════════════════════════════════════ */

/* ── الصفحة ── */
.idf-page { display: flex; flex-direction: column; gap: 12px; }                 /* مسافة ثابتة بين الأجزاء */
.idf-narrow { max-width: 860px; margin-inline: auto; width: 100%; }               /* الشاشات الصغيرة (الباركود/الموقع) فى النص */
.idf-head-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } /* زراير الهيدر جنب بعض */
.idf-branch { min-width: 200px; }                                                 /* عرض اختيار الفرع فى الهيدر */
.idf-card {                                                                       /* الكارت الأبيض للمحتوى */
    background: #fff; border: 1px solid #e3eaec; border-radius: 12px;
    padding: 14px; display: flex; flex-direction: column; gap: 12px;
}
.idf-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }              /* خانتين فى سطر (أقل سطور) */
.idf-acts { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }/* زراير آخر الكارت */
.idf-center { text-align: center; }
.idf-mono { font-family: ui-monospace, Consolas, monospace; direction: ltr; unicode-bidi: plaintext; } /* الباركود والأكواد */
.idf-muted { color: #8a9aa0; }
.idf-note { color: #6b7c82; font-size: 12px; margin: 0; line-height: 1.6; overflow-wrap: anywhere; }   /* فقرة عادية (مش flex) عشان السطر الطويل يلف على الجوال */
.idf-note > i, .idf-note > .idf-dot { vertical-align: middle; margin-inline-end: 4px; }
.idf-err {                                                                        /* رسالة خطأ جوه الصفحة */
    display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px;
    background: #fdecec; color: #b42318; font-size: 13px;
}
.idf-m-only { display: none; }                                                    /* نافذة تعديل الجوال بس */
@media (max-width: 768px) { .idf-m-only { display: block; } }

/* ── الأزرار ── */
.idf-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 38px; padding: 0 14px; border-radius: 9px; cursor: pointer; white-space: nowrap;
    border: 1px solid var(--fs-primary); background: var(--fs-primary); color: #fff; font-weight: 600; font-size: 13px;
}
.idf-btn:hover:not(:disabled) { background: var(--fs-primary-deep); }
.idf-btn:disabled { opacity: .55; cursor: not-allowed; }
.idf-btn--amb { background: var(--fs-action); border-color: var(--fs-action); }   /* زرار الإضافة/الحفظ الكهرمانى */
.idf-btn--amb:hover:not(:disabled) { background: var(--fs-action-hover); }
.idf-btn--ghost { background: #fff; color: var(--fs-primary); }
.idf-btn--ghost:hover:not(:disabled) { background: var(--fs-tint-1, #eef6f8); }
.idf-ic {                                                                         /* زرار أيقونة صغير */
    width: 34px; height: 34px; border-radius: 8px; border: 1px solid #dbe4e7; background: #fff;
    color: #5b6b70; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: 0 0 auto;
}
.idf-ic:hover:not(:disabled) { border-color: var(--fs-primary); color: var(--fs-primary); }
.idf-ic:disabled { opacity: .45; cursor: not-allowed; }
.idf-ic--ok { color: #fff; background: var(--fs-primary); border-color: var(--fs-primary); }
.idf-ic--ok:hover:not(:disabled) { color: #fff; background: var(--fs-primary-deep); }
.idf-ic--cam { height: 38px; width: 38px; }
.idf-file { display: none; }                                                      /* اختيار الملف مخفى ، الزرار هو الـ label */
.idf-spin { animation: idf-spin 1s linear infinite; }
@keyframes idf-spin { to { transform: rotate(360deg); } }

/* ── شارات ── */
.idf-pill {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 600; background: rgba(var(--fs-primary-rgb), .1); color: var(--fs-primary-deep);
}
.idf-pill--off { background: #eef1f2; color: #7a8a90; }
.idf-pill--vio { background: #efeafd; color: #5b3fc4; }                          /* المحفظة */
.idf-pill--amb { background: rgba(var(--fs-action-rgb), .14); color: var(--fs-action-deep); }

/* ── مفتاح تشغيل/إيقاف (فى الكاشير ، افتراضى ، محفظة ...) ── */
.idf-sw { position: relative; display: inline-block; width: 40px; height: 22px; flex: 0 0 auto; cursor: pointer; }
.idf-sw input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.idf-sw > span { position: absolute; inset: 0; border-radius: 999px; background: #cfd8db; transition: background .15s; }
.idf-sw > span::after {
    content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px;
    border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s;
}
.idf-sw input:checked + span { background: var(--fs-primary); }
.idf-sw input:checked + span::after { transform: translateX(18px); }
[dir="rtl"] .idf-sw input:checked + span::after, .rtl .idf-sw input:checked + span::after { transform: translateX(-18px); }
.idf-sw input:disabled + span { opacity: .5; }
.idf-sw input:focus-visible + span { outline: 2px solid var(--fs-primary); outline-offset: 2px; }
.idf-sw-row {                                                                     /* سطر: نص ← مفتاح */
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 10px; border: 1px solid #e3eaec; border-radius: 9px; cursor: pointer; margin: 0;
}
.idf-sw-row > span:first-child { color: #374151; font-size: 12.5px; }              /* (2026-12-04) النص كان أحمر بسبب قاعدة «label span» العامة */

/* ── صور المجموعات ── */
.idf-thumb { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; background: #f1f5f6; border: 1px solid #e3eaec; flex: 0 0 auto; }
.idf-thumb--sm { width: 30px; height: 30px; border-radius: 7px; }
.idf-thumb--lg { width: 96px; height: 96px; border-radius: 12px; }
.idf-name-cell { display: flex; align-items: center; gap: 8px; }
.idf-cat-card { display: flex; align-items: center; gap: 10px; }                 /* كارت المجموعة على الجوال */
.idf-cat-mid { flex: 1 1 auto; min-width: 0; }
.idf-img-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.idf-img-acts { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }

/* ── التبويبات (فوق .fs-ctabs) ── */
.idf-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.idf-tab { display: inline-flex; align-items: center; gap: 6px; }
.idf-tab small { font-size: 11px; padding: 0 6px; border-radius: 999px; background: rgba(0,0,0,.06); }
.idf-tab.on small { background: rgba(255,255,255,.25); }
@media (max-width: 768px) {                                                       /* الجوال: مربعات (أشكال الجوال المعتمدة) */
    .idf-tabs { display: grid; grid-template-columns: repeat(3, 1fr); }
    .idf-tab { flex-direction: column; justify-content: center; padding: 8px 4px; font-size: 12px; text-align: center; }
}

/* ── سطر الإضافة السريعة + التعديل فى السطر ── */
.idf-quick { display: flex; gap: 8px; align-items: center; }
.idf-quick .fm-input { flex: 1 1 auto; min-width: 0; height: 38px; }
.idf-inline { display: flex; gap: 6px; align-items: center; }
.idf-inline .fm-input { flex: 1 1 auto; min-width: 0; height: 32px; }

/* ── عدّاد النسخ ── */
.idf-step { display: inline-flex; align-items: stretch; border: 1px solid #dbe4e7; border-radius: 9px; overflow: hidden; height: 38px; }
.idf-step button { width: 38px; border: 0; background: #f3f7f8; font-size: 18px; cursor: pointer; color: var(--fs-primary-deep); }
.idf-step button:disabled { opacity: .45; cursor: not-allowed; }
.idf-step input { width: 52px; border: 0; text-align: center; font-weight: 700; -moz-appearance: textfield; }
.idf-step input::-webkit-inner-spin-button, .idf-step input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ── اختيار الوحدة (صغرى/وسطى/كبرى) ── */
.idf-seg { display: inline-flex; border: 1px solid #dbe4e7; border-radius: 9px; overflow: hidden; flex-wrap: wrap; }
.idf-seg button { border: 0; background: #fff; padding: 0 14px; height: 36px; cursor: pointer; font-weight: 600; color: #5b6b70; }
.idf-seg button + button { border-inline-start: 1px solid #dbe4e7; }
.idf-seg button.on { background: var(--fs-primary); color: #fff; }

/* ── بحث الصنف (IdfItemFind) ── */
.idf-find { position: relative; }
.idf-find-box {
    display: flex; align-items: center; gap: 8px; height: 42px; padding-inline: 12px 4px;
    border: 1px solid #dbe4e7; border-radius: 10px; background: #fff;
}
.idf-find-box:focus-within { border-color: var(--fs-primary); box-shadow: 0 0 0 3px rgba(var(--fs-primary-rgb), .12); }
.idf-find-box > i { color: #8a9aa0; }
.idf-find-box input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14px; }
.idf-find-cam { width: 34px; height: 34px; border: 0; border-radius: 8px; background: rgba(var(--fs-primary-rgb), .1); color: var(--fs-primary); cursor: pointer; }
.idf-find-list {
    position: absolute; z-index: 20; inset-inline: 0; top: calc(100% + 4px); max-height: 300px; overflow: auto;
    background: #fff; border: 1px solid #dbe4e7; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.1);
}
.idf-find-opt {
    display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%;
    padding: 9px 12px; border: 0; background: #fff; text-align: start; cursor: pointer;
}
.idf-find-opt + .idf-find-opt { border-top: 1px solid #f0f3f4; }
.idf-find-opt:hover, .idf-find-opt:focus { background: var(--fs-tint-1, #eef6f8); }
.idf-find-opt small { color: #8a9aa0; direction: ltr; }
.idf-find-none { padding: 8px 4px; color: #8a9aa0; font-size: 13px; }

/* ── شارة الصنف المختار ── */
.idf-subject { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.idf-subject--sm { font-size: 13px; }

/* ── الباركود الإضافى ── */
.idf-bar-new { display: flex; flex-direction: column; gap: 8px; }
.idf-bar-new > .idf-seg { align-self: flex-start; }                               /* اختيار الوحدة بعرض زراره بس مش السطر كله */
.idf-table-wrap { overflow-x: auto; border: 1px solid #e3eaec; border-radius: 10px; }
.idf-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.idf-table th { background: #f3f7f8; color: #5b6b70; font-weight: 600; text-align: start; padding: 8px 10px; }
.idf-table td { padding: 7px 10px; border-top: 1px solid #f0f3f4; }
.idf-row-main td { background: #fafcfc; color: #6b7c82; }                         /* الباركود الأساسى: للقراءة بس */

/* ── موقع الأصناف ── */
.idf-loc-head, .idf-loc-row { display: grid; grid-template-columns: 110px 1fr 22px 1fr; gap: 8px; align-items: center; }
.idf-loc-head { font-size: 12px; color: #6b7c82; font-weight: 600; }
.idf-loc-old { background: #f3f7f8 !important; color: #6b7c82; }
.idf-loc-arrow { color: var(--fs-action); text-align: center; }
[dir="ltr"] .idf-loc-arrow { transform: scaleX(-1); }
@media (max-width: 768px) {                                                       /* الجوال: الوحدة فوق والخانتين جنب بعض */
    .idf-loc-head { display: none; }
    .idf-loc-row { grid-template-columns: 1fr 22px 1fr; }
    .idf-loc-row > b { grid-column: 1 / -1; }
}

/* ── الطاولات ── */
.idf-tgroup { display: flex; flex-direction: column; gap: 8px; }
.idf-tgroup-hd { display: flex; align-items: center; gap: 8px; color: var(--fs-primary-deep); }
.idf-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.idf-tile {
    position: relative; height: 64px; border-radius: 12px; border: 1px solid #dbe4e7; background: #fff;
    font-weight: 700; font-size: 16px; color: var(--fs-primary-deep); cursor: pointer;
}
.idf-tile:hover { border-color: var(--fs-primary); box-shadow: 0 2px 8px rgba(var(--fs-primary-rgb), .15); }
.idf-tile.used::after, .idf-dot {                                                 /* نقطة: الطاولة عليها فواتير */
    content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--fs-action);
}
.idf-tile.used::after { position: absolute; top: 7px; inset-inline-end: 7px; }
.idf-tile--add { border-style: dashed; color: #8a9aa0; font-size: 20px; }
.idf-del { margin-inline-end: auto; }                                             /* زرار الحذف فى ناحية لوحده */
.idf-box { border: 1px solid #e3eaec; border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 768px) {
    /* رأس القايمة على الجوال: «إضافة» فى مكانها الثابت جنب «تصدير» (fs-list.css) ، والفرع ينزل سطر لوحده تحت العنوان */
    .idf-page .rpt-header:has(.idf-head-acts) { flex-wrap: wrap; row-gap: 8px; }
    .idf-page .idf-head-acts { display: contents; }
    .idf-page .idf-head-acts > .idf-branch { order: 5; flex: 1 1 100%; min-width: 0; }
    .idf-2 { grid-template-columns: 1fr 1fr; }                                    /* الخانات القصيرة اتنين فى سطر حتى على الجوال */
    .idf-quick .idf-btn { padding: 0 10px; }
    .idf-page.rpt-page--list > .idf-tabs, .idf-page.rpt-page--list > .idf-quick { margin-inline: 12px; } /* (2026-12-04) التبويبات وسطر الإضافة كانوا لازقين فى حافة الشاشة — نفس هامش البحث والكروت */
    .idf-acts .idf-btn { flex: 1 1 auto; }
}

/* ══ نوافذ التعريفات (إضافة/تعديل) — 2026-12-04: الشكل كان ناقص فالنافذة كانت بتظهر آخر الصفحة من غير تنسيق ══ */
.idf-overlay {                                                                      /* الخلفية الغامقة ورا النافذة */
    position: fixed; inset: 0; z-index: 1040;                                       /* بتغطى الشاشة كلها فوق الصفحة */
    background: rgba(15, 23, 42, .55);                                              /* غامقة شفافة */
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);                 /* تمويه بسيط للصفحة اللى وراها */
    animation: idf-fade .18s ease;                                                  /* بتظهر بهدوء */
}
@keyframes idf-fade { from { opacity: 0; } to { opacity: 1; } }                     /* ظهور تدريجى */
.idf-modal {                                                                        /* النافذة نفسها فى نص الشاشة */
    position: fixed; inset: 0; margin: auto; z-index: 1050;                         /* فوق الخلفية الغامقة */
    display: flex; flex-direction: column;                                          /* هيدر ثم محتوى ثم فوتر */
    width: min(480px, 96vw); height: fit-content; max-height: min(92vh, 750px);     /* عرض مناسب ، والطول على قد المحتوى */
    background: #fff; border-radius: 16px; overflow: hidden;                        /* كارت أبيض بحواف دايرية */
    box-shadow: 0 20px 60px rgba(0,0,0,.22), 0 4px 16px rgba(0,0,0,.12);            /* ظل يفصلها عن الصفحة */
    animation: idf-up .2s ease;                                                     /* بتطلع لفوق بهدوء */
}
@keyframes idf-up { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } } /* حركة الظهور */
.idf-modal .fm-header {                                                             /* هيدر النافذة التركوازى */
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 20px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--fs-primary) 0%, var(--fs-primary-deep) 100%); /* لون الهوية */
}
.idf-modal .fm-header-left { display: flex; align-items: center; gap: 12px; min-width: 0; } /* الأيقونة جنب العنوان */
.idf-modal .fm-header-icon {                                                        /* مربع الأيقونة */
    width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.2); color: #fff; font-size: 18px;
}
.idf-modal .fm-header-title { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; } /* العنوان */
.idf-modal .fm-header-sub { font-size: 11.5px; color: rgba(255,255,255,.8); margin-top: 2px; }   /* السطر الصغير تحت العنوان */
.idf-modal .fm-close-btn {                                                          /* زرار × */
    width: 34px; height: 34px; border-radius: 8px; border: none; flex-shrink: 0; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.18); color: #fff; font-size: 14px;
}
.idf-modal .fm-close-btn:hover { background: rgba(255,255,255,.32); }              /* يفتح لما الماوس عليه */
.idf-modal .fm-body {                                                               /* المحتوى ، وبيعمل سكرول لو طويل */
    flex: 1; overflow-y: auto; padding: 16px 20px;
    display: flex; flex-direction: column; gap: 12px;
}
.idf-modal .fm-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; } /* الليبل فوق الخانة */
.idf-modal .fm-field--full { grid-column: 1 / -1; }                                 /* خانة بعرض السطر كله */
.idf-modal .fm-label { font-size: 11.5px; font-weight: 600; color: #374151; }       /* اسم الخانة */
.idf-modal .fm-required { color: #ef4444; margin-inline-start: 2px; }               /* النجمة الحمرا للإلزامى */
.idf-modal .fm-input {                                                              /* الخانة */
    width: 100%; height: 36px; padding: 0 10px; box-sizing: border-box;
    font-size: 12.5px; color: #1f2937; background: #fff;
    border: 1.5px solid #e5e7eb; border-radius: 8px; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.idf-modal .fm-input:focus { border-color: var(--fs-primary); box-shadow: 0 0 0 3px rgba(var(--fs-primary-rgb),.14); } /* إطار تركوازى وقت الكتابة */
.idf-modal .fm-input::placeholder { color: #c4c9d0; }                               /* النص الإرشادى باهت */
.idf-modal .fm-footer {                                                             /* سطر الزراير تحت */
    display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
    padding: 10px 20px; border-top: 1px solid #f3f4f6; background: #fafafa; flex-shrink: 0;
}
.idf-modal .fm-footer-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; } /* إلغاء وحفظ جنب بعض */
.idf-modal .fm-btn {                                                                /* شكل الزراير */
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 18px;
    font-size: 12.5px; font-weight: 600; border-radius: 9px; white-space: nowrap; cursor: pointer;
    border: 1.5px solid transparent; transition: background .15s, border-color .15s, color .15s;
}
.idf-modal .fm-btn--cancel { background: #fff; color: #6b7280; border-color: #e5e7eb; }          /* إلغاء أبيض */
.idf-modal .fm-btn--cancel:hover { background: #f9fafb; border-color: #d1d5db; color: #374151; }
.idf-modal .fm-btn--cancel.idf-del { color: #dc2626; border-color: #fecaca; }                     /* حذف بالأحمر */
.idf-modal .fm-btn--cancel.idf-del:hover { background: #fef2f2; border-color: #fca5a5; }
.idf-modal .fm-btn--save { background: var(--fs-action); color: #fff; }                           /* حفظ كهرمانى زى باقى الشاشات */
.idf-modal .fm-btn--save:hover { background: var(--fs-action-hover); }
.idf-modal .fm-btn:disabled { opacity: .55; cursor: not-allowed; }                                 /* وقت الحفظ */
@media (max-width: 640px) {                                                         /* الجوال: النافذة تطلع من تحت */
    .idf-modal {
        inset: auto 0 0 0; margin: 0; width: 100vw; max-height: 92dvh;              /* لازقة فى تحت بعرض الشاشة */
        border-radius: 16px 16px 0 0;                                               /* حواف من فوق بس */
        animation: idf-sheet .22s ease;                                             /* بتطلع من تحت */
    }
    .idf-modal .fm-header { padding: 12px 14px; }                                   /* هيدر أصغر */
    .idf-modal .fm-header-icon { width: 36px; height: 36px; font-size: 15px; }
    .idf-modal .fm-header-sub { display: none; }                                    /* نشيل السطر الصغير توفيرًا للمساحة */
    .idf-modal .fm-body { padding: 12px 14px; }
    .idf-modal .fm-footer { padding: 10px 14px; }
    .idf-modal .fm-footer-actions { flex: 1 1 auto; }                               /* الزراير بعرض الشاشة */
    .idf-modal .fm-footer-actions .fm-btn { flex: 1 1 0; justify-content: center; }
}
@keyframes idf-sheet { from { transform: translateY(100%); opacity: 0; } to { transform: none; opacity: 1; } } /* حركة الطلوع من تحت */

/* (2026-12-04) كروت العدّادات فى الطاولات: 3 كروت كانت فى شبكة 4 أعمدة ← على الجوال الأسماء والأرقام كانت مقصوصة */
.idf-page .fs-kpis:has(> :nth-child(3):last-child) { grid-template-columns: 1.25fr 1fr 1fr; }   /* 3 كروت = 3 أعمدة بس */
.idf-page .fs-kpis > .fs-kpi { min-width: 0; }                                                     /* الكارت يصغر مع الشاشة من غير ما يطلع بره */
@media (max-width: 640px) {
    .idf-page .fs-kpis:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } /* 3 كروت متساوية على الجوال */
    .idf-page .fs-kpis:has(> :nth-child(3):last-child) .fs-kpi { min-height: 0; padding: 9px 10px; }                /* كارت أصغر */
    .idf-page .fs-kpis:has(> :nth-child(3):last-child) .fs-kpi-ic { display: none; }                               /* الأيقونة بتتشال عشان الاسم يبان كامل */
    .idf-page .fs-kpis:has(> :nth-child(3):last-child) .fs-kpi-v { font-size: 20px; }                              /* الرقم أصغر شوية ويبان كامل */
}
