/*
 * ═══════════════════════════════════════════════════════════════
 * contracts_list.css  —  سما البنيان
 * ═══════════════════════════════════════════════════════════════
 *
 * 📁 مسار الرفع:  public/assets/css/contracts_list.css
 *
 * ✅ مستقل تماماً عن dashboard.css
 *    — كل المتغيرات بادئتها --cl-  (لا تتعارض مع أي ملف آخر)
 *
 * ✅ يُضاف سطر واحد فقط في header.php  (السطر 19):
 *    <link rel="stylesheet" href="<?= BASE_URL ?>/assets/css/contracts_list.css">
 *
 * Style Guide: #1F2B5B Navy | #78D1E1 Teal | Cairo | radius 4px
 * ═══════════════════════════════════════════════════════════════
 */


/* ══════════════════════════════════════════════════════════════
   1. CSS VARIABLES  (بادئة --cl- لتفادي أي تعارض)
══════════════════════════════════════════════════════════════ */
.cl-page {
  /* ── الألوان ── */
  --cl-navy:        #1F2B5B;
  --cl-navy-hover:  #2d3d7a;
  --cl-teal:        #78D1E1;
  --cl-teal-soft:   #e8f7fa;
  --cl-white:       #FFFFFF;
  --cl-bg:          #F2F5FA;
  --cl-border:      #E2E8F0;
  --cl-border-soft: #f1f5f9;
  --cl-text:        #1a2340;
  --cl-muted:       #64748b;
  --cl-muted-light: #94a3b8;

  /* ── شكل ── */
  --cl-r:      4px;
  --cl-sh-sm:  0 1px 4px rgba(31,43,91,.07);
  --cl-sh-md:  0 4px 20px rgba(31,43,91,.10);
  --cl-tr:     all .18s cubic-bezier(.4,0,.2,1);

  font-family: 'Cairo', sans-serif;
  direction:   rtl;
}


/* ══════════════════════════════════════════════════════════════
   2. PAGE WRAPPER
══════════════════════════════════════════════════════════════ */
.cl-page {
  padding: 0;
}


/* ══════════════════════════════════════════════════════════════
   3. HEADER ROW
══════════════════════════════════════════════════════════════ */
.cl-header {
  display:         flex;
  align-items:     flex-end;
  justify-content: space-between;
  gap:             12px;
  margin-bottom:   20px;
  flex-wrap:       wrap;
}

/* div يحتوي العنوان + الوصف */
.cl-header-right {
  display:        flex;
  flex-direction: column;
  gap:            2px;
}

/* div يحتوي زر "إنشاء عقد" */
.cl-header-actions {
  display:     flex;
  align-items: center;
  gap:         8px;
  flex-shrink: 0;
}

.cl-title {
  font-size:   20px;
  font-weight: 900;
  color:       var(--cl-navy);
  margin:      0;
  line-height: 1.2;
}

.cl-subtitle {
  font-size: 13px;
  color:     var(--cl-muted);
  margin:    0;
}


/* ══════════════════════════════════════════════════════════════
   4. ADD BUTTON  (زر "إنشاء عقد جديد")
══════════════════════════════════════════════════════════════ */
.cl-btn-add {
  display:         inline-flex;
  align-items:     center;
  gap:             7px;
  background:      var(--cl-navy);
  color:           #fff !important;
  font-family:     'Cairo', sans-serif;
  font-size:       13.5px;
  font-weight:     700;
  padding:         10px 18px;
  border-radius:   var(--cl-r);
  border:          none;
  cursor:          pointer;
  text-decoration: none !important;
  transition:      var(--cl-tr);
  white-space:     nowrap;
  line-height:     1;
}

.cl-btn-add:hover {
  background:  var(--cl-navy-hover);
  color:       #fff !important;
  transform:   translateY(-1px);
  box-shadow:  0 4px 12px rgba(31,43,91,.25);
}


/* ══════════════════════════════════════════════════════════════
   5. SUMMARY CARDS  (4 كروت في الأعلى)
══════════════════════════════════════════════════════════════ */
.cl-summary {
  display:               grid;
  grid-template-columns: repeat(4, 1fr);
  gap:                   14px;
  margin-bottom:         20px;
}

.cl-sum-card {
  background:    var(--cl-white);
  border:        1px solid var(--cl-border);
  border-radius: var(--cl-r);
  padding:       16px 18px;
  display:       flex;
  align-items:   center;
  gap:           14px;
  box-shadow:    var(--cl-sh-sm);
  transition:    transform .2s, box-shadow .2s;
}

.cl-sum-card:hover {
  transform:  translateY(-2px);
  box-shadow: var(--cl-sh-md);
}

/* أيقونة الكارت */
.cl-sum-icon {
  width:          42px;
  height:         42px;
  border-radius:  var(--cl-r);
  display:        flex;
  align-items:    center;
  justify-content:center;
  flex-shrink:    0;
}

/* لون الأيقونة حسب النوع */
.cl-sum-total    { background: rgba(31,43,91,.09);  color: #1F2B5B; }
.cl-sum-pending  { background: rgba(245,158,11,.12); color: #d97706; }
.cl-sum-approved { background: rgba(16,185,129,.12); color: #059669; }
.cl-sum-signed   { background: rgba(99,102,241,.12); color: #4f46e5; }

/* نص الكارت */
.cl-sum-info {
  display:        flex;
  flex-direction: column;
  gap:            2px;
  min-width:      0;
}

.cl-sum-num {
  display:     block;
  font-size:   24px;
  font-weight: 900;
  color:       var(--cl-navy);
  line-height: 1;
}

.cl-sum-lbl {
  display:     block;
  font-size:   12px;
  color:       var(--cl-muted);
  font-weight: 500;
  white-space: nowrap;
}


/* ══════════════════════════════════════════════════════════════
   6. TABLE PANEL  (الصندوق الرئيسي)
══════════════════════════════════════════════════════════════ */
.cl-panel {
  background:    var(--cl-white);
  border:        1px solid var(--cl-border);
  border-radius: var(--cl-r);
  box-shadow:    var(--cl-sh-sm);
  overflow:      hidden;
}


/* ══════════════════════════════════════════════════════════════
   7. TOOLBAR  (البحث + الفلتر)
══════════════════════════════════════════════════════════════ */
.cl-toolbar {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         14px 18px;
  border-bottom:   1px solid var(--cl-border);
  gap:             12px;
  flex-wrap:       wrap;
}

/* الجهة اليمنى — بحث + فلتر */
.cl-toolbar-right {
  display:     flex;
  align-items: center;
  gap:         10px;
  flex-wrap:   wrap;
}

/* الجهة اليسرى — عداد */
.cl-toolbar-left {
  display:     flex;
  align-items: center;
  gap:         10px;
  flex-shrink: 0;
}

/* ── حقل البحث ── */
.cl-search {
  position: relative;
  display:  flex;
  align-items: center;
}

/* أيقونة البحث — مُمركزة عمودياً */
.cl-search-icon {
  position:  absolute;
  right:     10px;
  top:       50%;
  transform: translateY(-50%);
  color:     var(--cl-muted-light);
  pointer-events: none;
  line-height:    1;
}

.cl-search-input {
  padding:       8px 34px 8px 12px;
  border:        1.5px solid var(--cl-border);
  border-radius: var(--cl-r);
  font-family:   'Cairo', sans-serif;
  font-size:     13px;
  color:         var(--cl-text);
  width:         240px;
  outline:       none;
  background:    #fafbff;
  transition:    border-color .18s, width .22s;
  direction:     rtl;
  line-height:   1.4;
}

.cl-search-input:focus {
  border-color: var(--cl-teal);
  width:        280px;
  background:   #fff;
}

.cl-search-input::placeholder { color: #b0bec5; }

/* ── زر الفلتر ── */
.cl-filter-wrap { position: relative; }

.cl-filter-btn {
  display:       inline-flex;
  align-items:   center;
  gap:           6px;
  padding:       8px 14px;
  border:        1.5px solid var(--cl-border);
  border-radius: var(--cl-r);
  font-family:   'Cairo', sans-serif;
  font-size:     13px;
  font-weight:   600;
  color:         var(--cl-navy);
  background:    var(--cl-white);
  cursor:        pointer;
  transition:    var(--cl-tr);
  line-height:   1;
}

.cl-filter-btn:hover {
  border-color: var(--cl-teal);
  background:   var(--cl-teal-soft);
}

.cl-filter-count {
  background:     var(--cl-navy);
  color:          #fff;
  font-size:      10px;
  font-weight:    800;
  padding:        1px 6px;
  border-radius:  20px;
  display:        inline-flex;
  align-items:    center;
  justify-content:center;
}

/* ── Dropdown الفلتر ── */
.cl-filter-dropdown {
  position:      absolute;
  top:           calc(100% + 6px);
  right:         0;
  background:    var(--cl-white);
  border:        1px solid var(--cl-border);
  border-radius: var(--cl-r);
  box-shadow:    var(--cl-sh-md);
  padding:       10px 0;
  min-width:     190px;
  z-index:       300;
  direction:     rtl;
}

.cl-fd-title {
  font-size:     11px;
  font-weight:   800;
  color:         var(--cl-muted);
  letter-spacing:.5px;
  text-transform:uppercase;
  padding:       4px 14px 8px;
  border-bottom: 1px solid var(--cl-border-soft);
  margin-bottom: 4px;
}

.cl-fd-opt {
  display:     flex;
  align-items: center;
  gap:         8px;
  padding:     7px 14px;
  cursor:      pointer;
  font-size:   13px;
  color:       var(--cl-text);
  font-family: 'Cairo', sans-serif;
  transition:  background .12s;
  user-select: none;
}

.cl-fd-opt:hover { background: #f8fafc; }

.cl-fd-opt input[type="radio"] {
  accent-color: var(--cl-navy);
  width:        14px;
  height:       14px;
  flex-shrink:  0;
  cursor:       pointer;
}

/* نقطة لون الحالة */
.st-dot {
  display:       inline-block;
  width:         8px;
  height:        8px;
  border-radius: 50%;
  flex-shrink:   0;
}

/* عداد "N عقد" */
.cl-showing {
  font-size:   13px;
  font-weight: 600;
  color:       var(--cl-muted);
  white-space: nowrap;
}


/* ══════════════════════════════════════════════════════════════
   8. TABLE
══════════════════════════════════════════════════════════════ */
.cl-table-wrap {
  overflow-x:                auto;
  -webkit-overflow-scrolling:touch;
}

.cl-table {
  width:           100%;
  border-collapse: collapse;
  font-family:     'Cairo', sans-serif;
  font-size:       13.5px;
}

/* header */
.cl-table thead tr {
  background: #f8fafc;
}

.cl-table th {
  padding:       11px 14px;
  text-align:    right;
  font-weight:   700;
  font-size:     12.5px;
  color:         var(--cl-navy);
  border-bottom: 1.5px solid var(--cl-border);
  white-space:   nowrap;
}

.cl-table th.cl-th-id      { width: 55px; text-align: center; }
.cl-table th.cl-th-actions { width: 240px; }

/* أيقونة + نص في رأس العمود */
.th-inner {
  display:     inline-flex;
  align-items: center;
  gap:         5px;
}

/* rows */
.cl-table tbody .cl-row {
  transition: background .12s;
}

.cl-table tbody .cl-row:not(:last-child) {
  border-bottom: 1px solid var(--cl-border-soft);
}

.cl-table tbody .cl-row:hover {
  background: rgba(120,209,225,.04);
}

/* cells */
.cl-table td {
  padding:        12px 14px;
  vertical-align: middle;
  color:          var(--cl-text);
}


/* ══════════════════════════════════════════════════════════════
   9. CELL STYLES
══════════════════════════════════════════════════════════════ */

/* رقم العقد */
.cl-id-badge {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  min-width:       30px;
  height:          24px;
  padding:         0 7px;
  background:      #f1f5f9;
  color:           var(--cl-muted);
  border-radius:   var(--cl-r);
  font-size:       12px;
  font-weight:     700;
  margin:          0 auto;
}

/* نوع العقد */
.cl-type {
  font-size:   13px;
  font-weight: 600;
  color:       var(--cl-navy);
}

/* العميل = avatar + اسم */
.cl-customer {
  display:     flex;
  align-items: center;
  gap:         9px;
}

.cl-avatar {
  width:           30px;
  height:          30px;
  border-radius:   50%;
  background:      linear-gradient(135deg, #78D1E1 0%, #1F2B5B 100%);
  color:           #fff;
  font-size:       13px;
  font-weight:     800;
  display:         flex;
  align-items:     center;
  justify-content: center;
  flex-shrink:     0;
}

.cl-cname {
  font-weight: 600;
  color:       var(--cl-text);
  font-size:   13.5px;
}

/* ── حالة العقد ── */
.cl-status {
  display:      inline-flex;
  align-items:  center;
  gap:          5px;
  padding:      4px 10px;
  border-radius:20px;
  font-size:    12px;
  font-weight:  700;
  white-space:  nowrap;
  line-height:  1;
}

.st-draft {
  background: #f1f5f9;
  color:      #64748b;
  border:     1px solid #e2e8f0;
}

.st-submitted {
  background: #fffbeb;
  color:      #b45309;
  border:     1px solid #fde68a;
}

.st-approved {
  background: #ecfdf5;
  color:      #047857;
  border:     1px solid #a7f3d0;
}

.st-signed {
  background: #eef2ff;
  color:      #4338ca;
  border:     1px solid #c7d2fe;
}

/* المبلغ */
.cl-amount {
  font-weight:  700;
  color:        var(--cl-navy);
  white-space:  nowrap;
  direction:    ltr;
  display:      inline-block;
}

.cl-amount small {
  font-size:   11px;
  font-weight: 500;
  color:       var(--cl-muted);
  margin-right:2px;
}

/* التاريخ */
.cl-date {
  font-size:  12.5px;
  color:      var(--cl-muted);
  direction:  ltr;
  display:    inline-block;
}

/* الموظف */
.cl-staff {
  font-size:   13px;
  color:       var(--cl-text);
  font-weight: 500;
}


/* ══════════════════════════════════════════════════════════════
   10. ACTION BUTTONS
══════════════════════════════════════════════════════════════ */
.cl-actions {
  display:     flex;
  align-items: center;
  gap:         5px;
  flex-wrap:   nowrap;
}

/* زر أساسي */
.ca {
  display:         inline-flex;
  align-items:     center;
  gap:             4px;
  padding:         5px 9px;
  border-radius:   var(--cl-r);
  font-family:     'Cairo', sans-serif;
  font-size:       12px;
  font-weight:     700;
  border:          none;
  cursor:          pointer;
  text-decoration: none !important;
  white-space:     nowrap;
  transition:      filter .15s, transform .12s;
  line-height:     1;
}

.ca:hover {
  filter:    brightness(.87);
  transform: translateY(-1px);
}

.ca svg { flex-shrink: 0; }

/* ألوان الأزرار */
.ca-view    { background: #e0f2fe; color: #0369a1; }
.ca-edit    { background: #fef3c7; color: #b45309; }
.ca-submit  { background: #dbeafe; color: #1d4ed8; }
.ca-approve { background: #dcfce7; color: #15803d; }
.ca-pdf     { background: #fee2e2; color: #b91c1c; }


/* ══════════════════════════════════════════════════════════════
   11. EMPTY STATE
══════════════════════════════════════════════════════════════ */
.cl-empty {
  text-align:       center;
  padding:          50px 24px;
  display:          flex;
  flex-direction:   column;
  align-items:      center;
  gap:              8px;
}

.cl-empty-svg   { opacity: .4; margin-bottom: 6px; }
.cl-empty-title { font-size: 15px; font-weight: 700; color: var(--cl-navy); margin: 0; }
.cl-empty-sub   { font-size: 13px; color: var(--cl-muted); margin: 0; }

/* "لا توجد نتائج" بعد البحث/الفلتر */
.cl-no-results {
  display:        none;   /* ← مخفي افتراضياً — JS يُظهره عند الحاجة */
  flex-direction: column;
  align-items:    center;
  gap:            8px;
  padding:        32px;
  color:          var(--cl-muted);
  font-size:      13px;
  font-family:    'Cairo', sans-serif;
}


/* ══════════════════════════════════════════════════════════════
   12. PANEL FOOTER
══════════════════════════════════════════════════════════════ */
.cl-footer {
  padding:       12px 18px;
  border-top:    1px solid var(--cl-border);
  background:    #fafbff;
}

.cl-total-lbl {
  font-size:   13px;
  color:       var(--cl-muted);
  font-family: 'Cairo', sans-serif;
}

.cl-total-lbl strong { color: var(--cl-navy); }


/* ══════════════════════════════════════════════════════════════
   13. RESPONSIVE — TABLET  769px – 1024px
══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) and (min-width: 769px) {

  .cl-summary {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .cl-search-input       { width: 200px; }
  .cl-search-input:focus { width: 220px; }
}


/* ══════════════════════════════════════════════════════════════
   14. RESPONSIVE — MOBILE  ≤ 768px
   (لا تأثير إطلاقاً على الشاشات الأكبر)
══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Header */
  .cl-header {
    flex-direction: column;
    align-items:    stretch;
    gap:            10px;
  }

  .cl-btn-add {
    width:            100%;
    justify-content:  center;
  }

  /* 4 كروت → 2 عمودين */
  .cl-summary {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .cl-sum-card { padding: 12px 14px; }
  .cl-sum-num  { font-size: 20px; }

  /* Toolbar */
  .cl-toolbar {
    flex-direction: column;
    align-items:    stretch;
    padding:        12px 14px;
    gap:            10px;
  }
  .cl-toolbar-right {
    flex-direction: column;
    gap:            8px;
  }
  .cl-search             { width: 100%; }
  .cl-search-input,
  .cl-search-input:focus { width: 100%; }
  .cl-filter-btn         { width: 100%; justify-content: center; }

  /* جدول يتمرر أفقياً */
  .cl-table-wrap { overflow-x: auto; }
  .cl-table {
    min-width:  680px;
    font-size:  12.5px;
  }
  .cl-table th,
  .cl-table td { padding: 10px; }

  /* إخفاء عمود الموظف في الجوال */
  .cl-table th:nth-child(7),
  .cl-table td:nth-child(7) { display: none; }

  /* أزرار الإجراءات */
  .ca { padding: 4px 7px; font-size: 11px; }

  .cl-footer { padding: 10px 14px; }
}