  :dir(rtl) input:required,
  :dir(rtl) select:required {
    border-right: 2px solid red !important;
  }

  /* للغة الإنجليزية (LTR) */
  :dir(ltr) input:required,
  :dir(ltr) select:required {
    border-left: 2px solid red !important;
  }

  /* للغات RTL - الحدود على اليمين */
  :dir(rtl) select[required] {
    border-right: 2px solid red !important;
    border-left: none !important;
    /* نتأكد ما يكون على اليسار */
  }

  /* للغات RTL - التعامل مع Select2 */
  :dir(rtl) select[required]+.select2-container {
    box-shadow: 2px 0 0 0 red !important;
    /* ظل على اليمين */
    border-radius: 2px !important;
    outline: none !important;
  }

  /* للغات LTR - الحدود على اليسار */
  :dir(ltr) select[required] {
    border-left: 2px solid red !important;
    border-right: none !important;
    /* نتأكد ما يكون على اليمين */
  }

  /* للغات LTR - التعامل مع Select2 */
  :dir(ltr) select[required]+.select2-container {
    box-shadow: -2px 0 0 0 red !important;
    /* ظل على اليسار */
    border-radius: 2px !important;
    outline: none !important;
  }

  /* تجاهل العناصر غير المطلوبة */
  select:not([required])+.select2-container {
    box-shadow: none !important;
    border: none !important;
  }


  .input-group {
    display: flex;
    /* force flex */
    /* align-items: center; */
    gap: 10px;
    width: 100%;
    /* تأكد من أن الحاوية تأخذ كامل العرض */
    flex-wrap: nowrap;
    /* اجعلهم في سطر واحد */
  }

  .input-group label {
    min-width: 100px;
    /* أو حسب الطول المناسب للغة */
    white-space: nowrap;
    text-align: center;
    margin-bottom: 20px;
  }

  .col-md-6 select {
    flex: 1;
    min-width: 0;
    /* مهم لمنع التمدد الزائد */
  }

  .langforms {
    gap: 10px;
    flex-wrap: nowrap;
    align-items: center;

  }

  .langforms label {
    min-width: 100px;
    /* أو حسب الطول المناسب للغة */
    white-space: nowrap;
    text-align: center;
  }

  .btn-reset-style {
    font-size: initial !important;
    padding: 5px !important;
    min-width: 30px !important;
    margin-top: initial !important;
  }

  /* لا تفعّل scroll بشكل افتراضي */
  .table-responsive {
    overflow-x: visible;
  }

  /* فقط في الشاشات الصغيرة (أقل من 768px) فعّل الـ scroll */
  @media (max-width: 767.98px) {
    .table-responsive {
      overflow-x: auto;
    }
  }

  .type-btn {
    border-radius: 50px !important;
    min-width: 80px !important;
    text-align: center !important;
    transition: 0.3s ease-in-out !important;
    margin: 0 5px !important;
    padding: 5px !important;
    font-size: 12px !important;
  }

  .type-btn.active {
    background-color: #ed1d26;
    color: white;
    border-color: #ed1d26;
  }

  .type-btn:hover {
    background-color: #ed1d26;
    color: white;
  }

  .btn-group.custom-pill-group {
    flex-wrap: wrap;
    gap: 10px;
  }

  .select2-container--default .select2-selection--single {
    height: 38px !important;
    padding: 6px 12px !important;
    border: 1px solid #ced4da !important;
    border-radius: 4px !important;
  }

  .select2-container .select2-selection--multiple {
    height: 38px !important;
    padding: 6px 12px !important;
    border: 1px solid #ced4da !important;
    border-radius: 4px !important;
  }

  .is-invalid {
    border-color: red !important;
  }

  :dir(rtl) .select2-results__options {
    text-align: right !important;
    direction: rtl !important;
  }

  :dir(ltr) .select2-results__options {
    text-align: left !important;
    direction: ltr !important;
  }

  .select2-container--default .select2-selection.is-invalid {
    border-radius: 0.25rem;
    background-color: #fff;
    box-shadow: inset 0 0 0 1px #ed1d26;
  }

  /* يجعل النص يلتف داخل الجدول */
  table.dataTable td,
  table td {
    white-space: normal !important;
    word-wrap: break-word !important;
    /* word-break: break-all !important; */
    overflow-wrap: break-word !important;
  }

  /* تحديد عرض افتراضي للخلية لتساعد على الالتفاف */
  table.dataTable td {
    max-width: 200px;
    /* عدلها حسب الحاجة */
  }


  /*for select2*/
  /*  حل تمدد select2 في حالة multiple */
  .select2-container--default .select2-selection--multiple {
    min-height: 38px;
    height: auto !important;
    overflow: visible !important;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    padding-bottom: 4px;
  }

  /*  حتى تتوسع داخل المودال بدون قص */
  .select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    max-height: none !important;
    overflow-y: visible !important;
  }

  /*  شكل التاغات مرتب */
  .select2-container--default .select2-selection--multiple .select2-selection__choice {
    margin-top: 4px;
    margin-right: 4px;
  }

  /*شكل جدول الصلاحيات*/
  /* الحاوية الأساسية للجدول لضمان الاستجابة الصحيحة */
  .table-responsive {
    position: relative; /* لضمان أن كل شيء بداخله يتحرك معه */
    width: 100%;
    display: block;
}
/* هذا الجزء يضمن أن الحاوية هي التي تملك خاصية التمرير */
#permissionsTable .table-responsive {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #dee2e6; /* إطار خفيف حول منطقة التمرير */
  margin-bottom: 1rem;
}

/* لجعل الجدول يحافظ على عرضه ولا ينضغط */
.permission-table {
  min-width: 1200px; /* القيمة المثالية لـ 9 أعمدة + الموديول */
  table-layout: auto !important;
}
.permission-table {
  overflow-x: auto !important;
    border-collapse: collapse !important;
    width: 100%;
}

.permission-table td {
    position: relative; /* لجعل الخلية هي المرجع للجيك بوكس */
    text-align: center !important;
    vertical-align: middle !important;
}

/* التنسيق الذهبي للجيك بوكس لجعله يتحرك مع الجدول */
.permission-table .form-check-input {
    position: static !important; 
    margin: 0 auto !important;
    display: inline-block !important;
    cursor: pointer;
    /* استبدال scale بـ width/height لتجنب مشاكل الإزاحة في التمرير */
    width: 18px !important;
    height: 18px !important;
    appearance: checkbox !important;
    -webkit-appearance: checkbox !important;
}

/* لضمان التمركز في RTL */
html[dir="rtl"] .permission-table .form-check-input {
    float: none !important;
}

/* منع تداخل النصوص في العناوين */
.permission-table th {
    white-space: nowrap !important;
    background-color: #f8f9fa;
}
   /* تخصيص الـ radio buttons */
  /* Wrapper */
.radio-wrapper {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding-inline-start: 30px; /* بديل ذكي عن padding-left */
}

/* Radio item */
.custom-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  width: 48%;
}

/* إخفاء radio الأصلي */
.custom-control-input {
  display: none;
}

/* Label */
.custom-control-label {
  font-size: 14px;
  color: #333;
  position: relative;
  cursor: pointer;
  font-weight: 500;

  padding-inline-start: 25px; /* بدل padding-left */
}

/* دائرة الـ radio */
.custom-control-label::before {
  content: '';
  position: absolute;
  inset-inline-start: 0; /* بدل left */
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid #666;
  border-radius: 50%;
  background: #fff;
}

/* النقطة الداخلية */
.custom-control-input:checked + .custom-control-label::after {
  content: '';
  position: absolute;
  inset-inline-start: 4px; /* بدل left */
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: #007bff;
  border-radius: 50%;
}

/* إضافة تأثير عند اختيار الـ radio button */
.custom-control-input:checked+.custom-control-label {
    color: #e53e3e;
    /* الأحمر عند الاختيار */
}

/* عندما يكون radio غير مفعل */
.custom-control-label:hover {
    color: #ed1d26;
}
/* الاتجاه العام LTR (الإنجليزية) */
[dir="ltr"] .timeline {
  list-style: none;
  padding: 0;
  position: relative;
}
/*عرض الحالات*/
[dir="ltr"] .timeline:before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #dee2e6;
}

[dir="ltr"] .timeline li {
  position: relative;
  margin-bottom: 20px;
  padding-left: 50px;
}

[dir="ltr"] .timeline li:before {
  content: '';
  position: absolute;
  left: 12px;
  top: 5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ed1d26;
}

/* الاتجاه RTL (العربية) */
[dir="rtl"] .timeline {
  list-style: none;
  padding: 0;
  position: relative;
}

[dir="rtl"] .timeline:before {
  content: '';
  position: absolute;
  right: 20px; /* بدل left */
  top: 0;
  bottom: 0;
  width: 2px;
  background: #dee2e6;
}

[dir="rtl"] .timeline li {
  position: relative;
  margin-bottom: 10px;
  padding-right: 50px; /* بدل padding-left */
}

[dir="rtl"] .timeline li:before {
  content: '';
  position: absolute;
  right: 12px; /* بدل left */
  top: 5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ed1d26;
}
/* الإنجليزية (LTR) */
[dir="ltr"] .modal-header .close {
  order: 2; /* يبقى على اليمين */
  margin-left: auto;
  margin-right: 0;
}

/* العربية (RTL) */
[dir="rtl"] .modal-header .close {
  order: 0; /* يصبح على اليسار */
  margin-right: auto;
  margin-left: 0;
}
/* الإنجليزية */
[dir="ltr"] .timeline li div {
  text-align: left;
  direction: ltr;
}

/* العربية */
[dir="rtl"] .timeline li div {
  text-align: right;
  direction: rtl;
}
/* timeline*/
.log-row {
  display: flex;
  gap: 12px;
  padding: 10px 0;
}

.log-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  flex-shrink: 0;
}

.log-success {
  background: #28a745;
}

.log-warning {
  background: #f0ad4e;
}

.log-danger {
  background: #dc3545;
}

.log-default {
  background: #6c757d;
}

.log-body {
  flex: 1;
}

.log-main {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
}

.log-title {
  font-weight: 600;
}



.log-diff ,.log-meta  strong {
  color: #0f1110;
  max-width: 450px;         
    white-space: normal;       
    overflow-wrap: break-word; 
    word-break: normal;       

}

.log-meta {
  font-size: 14px;
  color: #888;
  margin-top: 4px;
}

/* RTL support */
[dir="rtl"] .log-row {
  flex-direction: row-reverse;
}
#tab7 {
  /* يحدد الارتفاع الأقصى بـ 60% من طول شاشة المتصفح */
  max-height: 65vh; 
  overflow-y: auto;
  padding-right: 15px;
  
  /* إضافة لمسة جمالية لشريط التمرير (اختياري) */
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

/* تنسيق شكل السكرول بار للمتصفحات مثل Chrome */
#tab7::-webkit-scrollbar {
  width: 6px;
}
#tab7::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 10px;
}
.badge-notification
{
  border: 1.5px solid #dc3545; 
  border-radius: 50%; 
  color: #dc3545; 
  font-size: 10px; 
  font-weight: bold; 
}

.notification-header {
  font-size: 1rem;
  font-weight: 800;
  color: rgb(81, 111, 144) !important;
}

.module-group {
  transition: all .2s ease;
}

.module-group:hover {
  box-shadow: 0 0 0 1px #e9ecef;
}

.module-header {
  background: #f8f9fa;
}

.module-header h6 {
  font-size: 0.9rem;
}

.rule-name {
  font-size: 0.8rem;
  font-weight: 500;
}

.rule-desc {
  font-size: 0.75rem;
  color: #6c757d;
}

.form-switch .form-check-input {
  width: 2.4em;
  height: 1.3em;
  cursor: pointer;
}

.transition-icon {
  transition: transform .3s ease;
}

.module-header[aria-expanded="true"] .transition-icon {
  transform: rotate(180deg);
  color:rgb(237, 29, 38); 
}
.fa-20
{
  font-size: 20px;
}
.no-break {
  word-break: keep-all; /* تمنع كسر الكلمة الواحدة وتجعلها تنزل كاملة */
  overflow: hidden;
  text-overflow: ellipsis; /* تضع ثلاث نقاط (...) إذا كان النص طويلاً جداً */
}
.extra-permission-checkbox {
  display: inline-flex;
  align-items: center;
  background: #f0f0f0;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  gap: 10px
}
/* data mangement page style*/
    .stepper {
        gap: 10px;
    }

    .step {
        text-align: center;
        flex: 1;
    }

    .step p {
        margin-top: 8px;
        font-size: 14px;
        color: #777;
    }

    .circle {
        width: 42px;
        height: 42px;
        border: 2px solid #ccc;
        border-radius: 50%;
        line-height: 40px;
        margin: auto;
        font-weight: bold;
        background: #fff;
    }

    .step.active .circle {
        border-color: #ed1d26;
        color: #ed1d26;
    }

    .step.completed .circle {
        background: #ed1d26;
        color: #fff;
        border-color: #ed1d26;
    }

    .line {
        height: 2px;
        background: #ddd;
        flex: 1;
    }

    .upload-box {
        border: 2px dashed #ccc;
        background: #f8f9fa;
        cursor: pointer;
        transition: 0.3s;
    }

    .upload-box:hover {
        border-color: #0d6efd;
        background: #eef5ff;
    }
    @media print {
      /* إخفاء كل شيء غير ضروري */
      .ms-aside, .ms-header, .btn, .add-row-btn, .ms-panel-header, .ms-footer {
          display: none !important;
      }
  
      /* جعل النموذج يأخذ عرض الصفحة بالكامل */
      .ms-panel {
          border: none !important;
          box-shadow: none !important;
          width: 100% !important;
          margin: 0 !important;
          padding: 0 !important;
      }
  
      /* تحسين مظهر الجداول في الطباعة */
      table {
          width: 100% !important;
          border-collapse: collapse;
      }
      
      input, textarea, select {
          border: none !important;
          appearance: none !important;
          background: transparent !important;
      }
  }
  .print-only-header { display: none; }

  @media print {
      .print-only-header { display: block !important; }
      
      /* إخفاء القوائم، الأزرار، وأيقونات الحذف */
      .ms-aside, .ms-header, .btn, .add-row-btn, .ms-panel-header, th:last-child, td:last-child {
          display: none !important;
      }

      /* جعل الحقول تظهر بجانب بعضها في الطباعة (Column Layout) */
      .form-row {
          display: flex !important;
          flex-wrap: wrap !important;
          flex-direction: row !important;
      }
      .col-md-6 {
          width: 50% !important; /* تجعل حقلين في كل سطر */
          float: right !important; /* أو left حسب لغة النظام */
      }

      /* إخفاء سهم Select2 والمظهر الخاص به ليظهر كـ نص عادي */
      .select2-container--default .select2-selection--single .select2-selection__arrow,
      .select2-container {
          display: none !important;
      }
      
      /* إظهار القيمة المختارة فقط في السلكت */
      select {
          appearance: none !important;
          -webkit-appearance: none !important;
          border: none !important;
          font-weight: bold;
      }

      /* حل مشكلة الخط الأحمر الخاص بالـ required */
      input:invalid, select:invalid, textarea:invalid {
          box-shadow: none !important;
          border: 1px solid #ccc !important;
      }

      /* تحسين شكل الجدول في الطباعة */
      #products-table {
          width: 100% !important;
          table-layout: fixed;
          word-wrap: break-word;
      }
      
      /* إزالة المسافات الزائدة */
      .ms-panel { border: none !important; }
      body { padding: 0 !important; margin: 0 !important; }
  }
  /* opportunity*/ 
  .product-select-container {
    min-width: 250px; /* العرض الأدنى المناسب لأسماء المواد */
    width: 100%;
}
  .fixed-width-input {
    width: 120px;
} 

.add-row-btn {
    margin: 10px;
    color: rgb(237, 29, 38);
    /* لون الخط */
    padding: 10px 10px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.add-row-btn:hover {
    background-color: #918a8a70;
    /* لون أدكن عند التمرير */
}

.plus-icon {
    color: rgb(237, 29, 38);

    font-size: 14px;
    font-weight: bold;
}
/* تغيير لون الزر الأساسي وحالة التحويم */
.btn-primary {
  background-color: #ed1d26 !important;
  border-color: #ed1d26 !important;
  color: #fff !important;
}

.btn-primary:hover {
  background-color: #c4121a !important; 
  border-color: #c4121a !important;
}

.btn-primary:focus, 
.btn-primary.focus, 
.btn-primary:not(:disabled):not(.disabled):active:focus {
  box-shadow: 0 0 0 0.2rem rgba(237, 29, 38, 0.25) !important; 
}

.btn-primary:not(:disabled):not(.disabled).active, 
.btn-primary:not(:disabled):not(.disabled):active, 
.show > .btn-primary.dropdown-toggle {
  color: #fff !important;
  background-color: #ed1d26 !important;
  border-color: #ed1d26 !important;
}
[dir="rtl"] .dropdown-menu {
  text-align: right; 
}

[dir="rtl"] .dropdown-item {
  text-align: right;
}

[dir="rtl"] .dropdown-toggle::after {
  margin-right: 0.255em;
  margin-left: 0;
}