/* Modern font stack import for filters UI */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&family=Tajawal:wght@400;500;700&family=Inter:wght@400;600;700&display=swap');

:root {
  --filters-font-arabic: 'Cairo', 'Tajawal', 'Noto Kufi Arabic', 'Segoe UI', Tahoma, sans-serif;
  --filters-font-latin: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
}

.btn {
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.btn:hover svg {
    transform: scale(1.1);
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* تبويب الإحصائيات: تم نقل الأنماط إلى assets/css/stats.css لتوحيد أنماط الإحصائيات وتجنب التكرار */
/* الإبقاء على التعريف فقط لمنع كسر البنية في حال تم الاعتماد على هذه الفئة في HTML */
.statistics-container { max-width: 100%; }

/* ===== تخطيط الفلاتر الجديد - أربعة صفوف منظمة ===== */
.filters {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    max-width: 100%;
    overflow: visible;
    box-sizing: border-box;
    width: 100%;
  font-family: var(--filters-font-arabic);
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    align-items: end;
    width: 100%;
    position: relative;
    z-index: 50; /* فوق الجدول */
}

/* الصف الأول: رقم الملف - اسم العميل */
.filter-row.row-one {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.filter-group.file-number-field {
    min-width: 180px;
}

.filter-group.client-name-field {
    min-width: 250px;
}

/* الصف الثاني: سنة بدء النشاط - النشاط */
.filter-row.row-two {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.filter-group.activity-start-field {
    min-width: 180px;
}

.filter-group.activity-field {
    min-width: 250px;
}

/* الصف الثالث: مأمورية الضرائب والكيان القانوني */
.filter-row.row-three {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.filter-group.tax-office-field {
    min-width: 300px;
}

.filter-group.legal-entity-field {
    min-width: 300px;
}

.filter-row.row-four {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    align-items: center;
}

.filter-group.checkbox-field {
    min-width: 200px;
    margin-top: 0;
    justify-content: flex-start;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
}

/* ===== واجهة الفلترة الموحدة ===== */
.filters .unified-row {
  display: grid;
  gap: var(--filter-gap);
  grid-template-columns: minmax(180px, 220px) 1fr;
  align-items: center;
  grid-column: 1 / -1; /* اجعل صف الفلترة الموحد يمتد بكامل العرض */
}
.filters .unified-row .unified-select-value-field { grid-column: 2 / 3; }

/* إخفاء/إظهار تبادلي وفق الحالة */
.unified-row.mode-text #unified-select-wrapper { display: none !important; }
.unified-row.mode-text #unified-text-wrapper { display: block !important; }
.unified-row.mode-select #unified-select-wrapper { display: block !important; }
.unified-row.mode-select #unified-text-wrapper { display: none !important; }
.unified-row.mode-none #unified-select-wrapper,
.unified-row.mode-none #unified-text-wrapper { display: none !important; }

/* توزيع صف القوائم (قوائم العملاء + التصنيفات + الترتيب) */
.filters .row-four {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr; /* املأ المساحة المتاحة بالتساوي */
  align-items: end;
  gap: 12px;
}
.filters .row-four .filter-group > select,
.filters .row-four .filter-group > input { width: 100%; }
/* Give the merged classification select a bit more minimum width on large screens */
.filters .row-four .classifications-field select { min-width: 220px; }
/* تحسين الاستجابة على الشاشات الصغيرة */
@media (max-width: 1024px) {
  .filters .row-four { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .filters .row-four { grid-template-columns: 1fr; }
}

/* ===== تصنيفات العملاء (بطاقات) ===== */
.classification-cards { margin: 16px 0 8px; }
.classification-cards .cards-toolbar { display:flex; justify-content:flex-start; align-items:center; gap:8px; margin-bottom:10px; }
.classification-cards .clear-classification-btn { padding:6px 10px; font-size:13px; border-radius:8px; border:1px solid #d1d5db; background:#f9fafb; color:#374151; cursor:pointer; }
.classification-cards .clear-classification-btn:hover { background:#f3f4f6; }
.classification-cards .cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.classification-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  border: var(--filter-border);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--filter-shadow-light);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  min-height: 84px;
  overflow: hidden;
}
.classification-card:hover { transform: translateY(-2px); box-shadow: var(--filter-shadow-medium); }
.classification-card .card-title { font-weight: 700; color: #111827; margin-bottom: 6px; text-align:center; max-width:100%; overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-line-clamp:2; line-clamp:2; -webkit-box-orient:vertical; line-height:1.2; }
.classification-card .card-count { font-size: 22px; font-weight: 800; color: #0ea5e9; }
.classification-card.selected { background:#111827; box-shadow:none; }
.classification-card.selected .card-title { color:#ffffff; }
.classification-card.selected .card-count { color:#93c5fd; }
.classification-cards .cards-note { margin-top: 6px; font-size: 12px; color: #6b7280; }

@media (max-width: 640px){
  .filters .unified-row { grid-template-columns: 1fr; }
}


.filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
    white-space: nowrap;
  font-family: var(--filters-font-arabic);
}

.filter-group input,
.filter-group select {
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-md);
    font-size: 14px;
    background: #ffffff;
    color: #111827;
    transition: var(--transition-fast);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  font-family: var(--filters-font-arabic);
}
.filter-group input::placeholder { font-family: inherit; color: #9aa4b2; }
.filter-group select:invalid { color: #9aa4b2; }
.filter-group select option { color: #111827; background: #ffffff; }

/* Ensure buttons inside filters use the same modern Arabic stack */
.filters .btn,
.filters .btn-primary,
.filters .btn-secondary { font-family: var(--filters-font-arabic); }

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-group input:hover,
.filter-group select:hover {
    border-color: #9ca3af;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    user-select: none;
  font-family: var(--filters-font-arabic);
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

/* ===== تصنيفات العملاء - تصميم شريط الشرائح الجديد ===== */
.category-hub {
  margin-bottom: 24px;
  padding: 24px 26px;
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(132deg, #4338ca 0%, #7c3aed 45%, #0ea5e9 100%);
  box-shadow: 0 25px 50px -12px rgba(59, 130, 246, 0.45);
  direction: rtl;
  text-align: right;
}

.category-hub::before {
  content: '';
  position: absolute;
  inset-inline-start: -40%;
  top: -60%;
  width: 70%;
  height: 140%;
  background: radial-gradient(circle at center, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 60%);
  transform: rotate(-8deg);
  pointer-events: none;
}

.category-hub__header {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
}

.category-hub__control-cluster {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  min-width: 260px;
}

.category-hub__view-toggle-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}

.category-hub__view-toggle-slot .view-toggle-btn {
  margin: 0;
  border-radius: 12px;
}

.category-hub__title {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #fff;
}

.category-hub__caption {
  text-align: right;
}

.category-hub__icon {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(6px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.category-hub__icon i {
  font-size: 22px;
}

.category-hub__caption h3 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.category-hub__caption p {
  margin: 4px 0 0;
  font-size: 14px;
  opacity: 0.85;
}

/* ═══════════════════════════════════════════════════════════
   🎯 CATEGORY HUB - MODERN PROFESSIONAL CONTAINER
   ══════════════════════════════════════════════════════════ */

.category-hub__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: flex-start;
  align-items: center;
  margin-top: 24px;
  
  /* خلفية شفافة مع حدود */
  padding: 20px;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.03) 0%, 
    rgba(255, 255, 255, 0.01) 100%);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  
  /* ظل خفيف */
  box-shadow: 
    0 4px 16px rgba(15, 23, 42, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.category-hub__types {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-start;
  flex: 1;
  min-width: 0;
}

/* ═══════════════════════════════════════════════════════════
   🔄 DISPLAY TOGGLE & UTILITIES - ENHANCED DESIGN
   ══════════════════════════════════════════════════════════ */

.category-hub__utilities {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.category-hub__display-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 16px;
  
  /* تدرج لوني راقي */
  background: linear-gradient(135deg, 
    rgba(15, 23, 42, 0.4) 0%, 
    rgba(30, 41, 59, 0.3) 100%);
  
  border: 2px solid rgba(248, 250, 252, 0.15);
  color: #f8fafc;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px) saturate(120%);
  
  box-shadow: 
    0 4px 12px rgba(15, 23, 42, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.category-hub__display-toggle::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.1) 0%, 
    transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.category-hub__display-toggle:hover {
  transform: translateY(-3px) scale(1.02);
  background: linear-gradient(135deg, 
    rgba(30, 41, 59, 0.5) 0%, 
    rgba(51, 65, 85, 0.4) 100%);
  border-color: rgba(248, 250, 252, 0.25);
  
  box-shadow: 
    0 8px 20px rgba(15, 23, 42, 0.35),
    0 4px 8px rgba(15, 23, 42, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.category-hub__display-toggle:hover::before {
  opacity: 1;
}

.category-hub__display-toggle[aria-pressed="true"],
.category-hub--list-mode .category-hub__display-toggle {
  background: linear-gradient(135deg, 
    #10b981 0%, 
    #059669 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px) scale(1.05);
  
  box-shadow: 
    0 12px 32px rgba(16, 185, 129, 0.4),
    0 6px 12px rgba(5, 150, 105, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.category-hub__display-toggle .display-toggle-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.category-hub__display-toggle:hover .display-toggle-icon {
  background: rgba(248, 250, 252, 0.3);
  transform: scale(1.1) rotate(-5deg);
}

.category-hub__display-toggle[aria-pressed="true"] .display-toggle-icon {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.15);
}

.category-hub__display-toggle .display-toggle-icon i {
  font-size: 16px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.category-hub__display-toggle .display-toggle-text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════════════
   👁️ SHOW ALL BUTTON - PREMIUM DESIGN
   ══════════════════════════════════════════════════════════ */

.category-hub__show-all {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 16px;
  
  /* تدرج لوني أنيق */
  background: linear-gradient(135deg, 
    rgba(59, 130, 246, 0.15) 0%, 
    rgba(99, 102, 241, 0.1) 100%);
  
  border: 2px solid rgba(59, 130, 246, 0.3);
  color: #3b82f6;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px) saturate(130%);
  
  box-shadow: 
    0 4px 12px rgba(59, 130, 246, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.category-hub__show-all::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.2) 0%, 
    transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.category-hub__show-all:hover {
  transform: translateY(-3px) scale(1.02);
  background: linear-gradient(135deg, 
    rgba(59, 130, 246, 0.25) 0%, 
    rgba(99, 102, 241, 0.2) 100%);
  border-color: rgba(59, 130, 246, 0.5);
  color: #2563eb;
  
  box-shadow: 
    0 8px 24px rgba(59, 130, 246, 0.3),
    0 4px 12px rgba(99, 102, 241, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.category-hub__show-all:hover::before {
  opacity: 1;
}

.category-hub__show-all[aria-pressed="true"],
.category-hub--show-all .category-hub__show-all {
  background: linear-gradient(135deg, 
    #3b82f6 0%, 
    #6366f1 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px) scale(1.05);
  
  box-shadow: 
    0 12px 32px rgba(59, 130, 246, 0.45),
    0 6px 16px rgba(99, 102, 241, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.category-hub__show-all .show-all-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.category-hub__show-all:hover .show-all-icon {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.15) rotate(5deg);
}

.category-hub__show-all[aria-pressed="true"] .show-all-icon {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.2);
}

.category-hub__show-all .show-all-icon i {
  font-size: 16px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.category-hub__show-all .show-all-text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════════════
   🎨 MODERN CATEGORY BUTTONS - PROFESSIONAL DESIGN v2.0
   ══════════════════════════════════════════════════════════ */

.category-type-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  
  /* تدرج لوني عصري */
  background: linear-gradient(135deg, 
    rgba(15, 23, 42, 0.95) 0%, 
    rgba(30, 41, 59, 0.9) 100%);
  
  /* حدود مع تدرج */
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 16px;
  
  /* نص أبيض مع ظل خفيف */
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px) saturate(150%);
  
  /* ظل متعدد الطبقات */
  box-shadow: 
    0 4px 12px rgba(15, 23, 42, 0.4),
    0 2px 4px rgba(15, 23, 42, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* طبقة تأثير الضوء الداخلي */
.category-type-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.1) 0%, 
    rgba(255, 255, 255, 0) 50%,
    rgba(255, 255, 255, 0.05) 100%);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
}

/* تأثير التوهج الخارجي */
.category-type-btn::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(135deg, 
    #3b82f6 0%, 
    #8b5cf6 50%, 
    #ec4899 100%);
  border-radius: inherit;
  opacity: 0;
  z-index: -2;
  transition: opacity 0.4s ease;
}

.category-type-btn i {
  font-size: 16px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.category-type-btn span {
  position: relative;
  z-index: 1;
  font-weight: 700;
}

/* حالة Hover - تأثير رفع مع توهج */
.category-type-btn:hover {
  transform: translateY(-4px) scale(1.02);
  
  /* تدرج أفتح عند الـ hover */
  background: linear-gradient(135deg, 
    rgba(30, 41, 59, 1) 0%, 
    rgba(51, 65, 85, 0.95) 100%);
  
  /* ظل أقوى */
  box-shadow: 
    0 12px 28px rgba(15, 23, 42, 0.5),
    0 6px 12px rgba(15, 23, 42, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  
  color: #ffffff;
}

.category-type-btn:hover::before {
  opacity: 1;
}

.category-type-btn:hover i {
  transform: scale(1.15) rotate(-5deg);
}

/* حالة Active - تصميم بارز بألوان زاهية */
.category-type-btn.is-active {
  /* تدرج ملون جذاب */
  background: linear-gradient(135deg, 
    #6366f1 0%, 
    #8b5cf6 50%,
    #a855f7 100%);
  
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
  
  /* ظل قوي مع توهج ملون */
  box-shadow: 
    0 16px 48px rgba(99, 102, 241, 0.45),
    0 8px 20px rgba(139, 92, 246, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.2);
  
  transform: translateY(-2px) scale(1.05);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.category-type-btn.is-active::after {
  opacity: 1;
}

.category-type-btn.is-active::before {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.2) 0%, 
    rgba(255, 255, 255, 0) 50%,
    rgba(255, 255, 255, 0.1) 100%);
  opacity: 1;
}

.category-type-btn.is-active i {
  transform: scale(1.2);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* حالة Active + Hover */
.category-type-btn.is-active:hover {
  transform: translateY(-5px) scale(1.08);
  
  background: linear-gradient(135deg, 
    #7c3aed 0%, 
    #a855f7 50%,
    #c026d3 100%);
  
  box-shadow: 
    0 20px 56px rgba(124, 58, 237, 0.5),
    0 10px 24px rgba(168, 85, 247, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15),
    0 0 0 2px rgba(255, 255, 255, 0.3);
}

/* حالة Focus للـ accessibility */
.category-type-btn:focus {
  outline: none;
  box-shadow: 
    0 0 0 3px rgba(99, 102, 241, 0.4),
    0 4px 12px rgba(15, 23, 42, 0.4);
}

/* حالة Disabled */
.category-type-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  filter: grayscale(0.6);
}

.category-type-btn:disabled:hover {
  transform: none !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.4);
}

/* ═══════════════════════════════════════════════════════════
   🎛️ DASHT TOGGLE - MODERN SWITCH DESIGN
   ══════════════════════════════════════════════════════════ */

.category-hub__toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-radius: 18px;
  
  /* تدرج رمادي أنيق */
  background: linear-gradient(135deg, 
    rgba(71, 85, 105, 0.3) 0%, 
    rgba(51, 65, 85, 0.25) 100%);
  
  border: 2px solid rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  min-width: 240px;
  
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px) saturate(120%);
  
  box-shadow: 
    0 4px 14px rgba(15, 23, 42, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.category-hub__toggle::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.08) 0%, 
    transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.category-hub__toggle .toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.2);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.category-hub__toggle .toggle-icon i {
  font-size: 18px;
  color: #cbd5e1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  transition: all 0.3s ease;
}

.category-hub__toggle .toggle-label {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.2px;
  display: block;
  color: #f1f5f9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.category-hub__toggle .toggle-hint {
  font-size: 12px;
  display: block;
  color: rgba(203, 213, 225, 0.85);
  font-weight: 600;
}

.category-hub__toggle .toggle-indicator {
  content: '';
  position: absolute;
  inset-inline-end: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 
    0 0 0 5px rgba(148, 163, 184, 0.15),
    0 2px 8px rgba(15, 23, 42, 0.3);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* حالة Active - تصميم أخضر مشرق */
.category-hub__toggle[data-show-dasht="true"] {
  background: linear-gradient(135deg, 
    #10b981 0%, 
    #059669 100%);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
  transform: translateY(-2px) scale(1.02);
  
  box-shadow: 
    0 12px 36px rgba(16, 185, 129, 0.45),
    0 6px 16px rgba(5, 150, 105, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.category-hub__toggle[data-show-dasht="true"]::before {
  opacity: 1;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.2) 0%, 
    transparent 100%);
}

.category-hub__toggle[data-show-dasht="true"] .toggle-icon {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1) rotate(15deg);
}

.category-hub__toggle[data-show-dasht="true"] .toggle-icon i {
  color: #ffffff;
  transform: scale(1.1);
}

.category-hub__toggle[data-show-dasht="true"] .toggle-label {
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.category-hub__toggle[data-show-dasht="true"] .toggle-hint {
  color: rgba(255, 255, 255, 0.9);
}

.category-hub__toggle[data-show-dasht="false"] .toggle-label {
  color: #f1f5f9;
}

.category-hub__toggle[data-show-dasht="false"] .toggle-hint {
  color: rgba(203, 213, 225, 0.85);
}

.category-hub__toggle[data-show-dasht="true"] .toggle-indicator {
  background: #ffffff;
  box-shadow: 
    0 0 0 6px rgba(255, 255, 255, 0.25),
    0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateY(-50%) scale(1.2);
}

.category-hub__toggle:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: rgba(148, 163, 184, 0.4);
  
  box-shadow: 
    0 8px 24px rgba(15, 23, 42, 0.3),
    0 4px 12px rgba(15, 23, 42, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.category-hub__toggle:hover::before {
  opacity: 1;
}

.category-hub__toggle:hover .toggle-icon {
  background: rgba(148, 163, 184, 0.3);
  transform: scale(1.1);
}

.category-hub__toggle[data-show-dasht="true"]:hover {
  transform: translateY(-4px) scale(1.04);
  
  box-shadow: 
    0 16px 44px rgba(16, 185, 129, 0.5),
    0 8px 20px rgba(5, 150, 105, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

.category-hub__toggle[data-show-dasht="true"]:hover .toggle-icon {
  transform: scale(1.15) rotate(20deg);
}

.category-slider {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  --category-card-gap: clamp(12px, 1.4vw, 16px);
  direction: rtl;
}

.category-slider__viewport {
  flex: 1;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.12);
  padding: 24px 24px 28px;
  position: relative;
}

.category-slider__track {
  position: relative;
  display: block;
  min-height: 240px;
  direction: rtl;
}

.category-slider__nav {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(248, 250, 252, 0.9);
  color: #312e81;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(30, 64, 175, 0.35);
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.category-slider__nav:hover {
  transform: translateY(-2px);
  background: #4338ca;
  color: #f8fafc;
  box-shadow: 0 18px 35px rgba(30, 64, 175, 0.45);
}

.category-slider__nav.is-disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
  transform: none;
  box-shadow: none;
  background: rgba(248, 250, 252, 0.55);
}

.category-slider__nav i {
  font-size: 16px;
}

.category-slider__dots {
  display: none !important;
  margin: 0;
  padding: 0;
}

.category-hub--list-mode .category-slider,
.category-hub--list-mode .category-slider__dots {
  display: none !important;
}

.category-list {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
  padding: 20px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(6px);
}

.category-hub--list-mode .category-list {
  display: flex;
}

.category-list__empty {
  color: rgba(248, 250, 252, 0.85);
  font-size: 14px;
  text-align: center;
}

.category-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(248, 250, 252, 0.18);
  background: rgba(248, 250, 252, 0.96);
  color: #0f172a;
  font-weight: 600;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.category-list-item:hover {
  transform: translateX(-4px);
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.24);
}

.category-list-item.is-active {
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 22px 42px rgba(59, 130, 246, 0.35);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(96, 165, 250, 0.2));
}

.category-list-item__label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.category-list-item__label span:first-child {
  font-size: 15px;
}

.category-list-item__label span:last-child {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.58);
  font-weight: 500;
}

.category-list-item__metrics {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.category-list-item__count {
  font-size: 18px;
  font-weight: 700;
  color: #1d4ed8;
}

.category-list-item__percentage {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
}

.category-hub--list-mode .category-hub__show-all,
.category-hub--list-mode .category-slider__nav {
  display: none !important;
}

.category-card {
  position: relative;
  direction: rtl;
  width: 100%;
  padding: 18px 16px 16px;
  border-radius: 18px;
  background: #f8fafc;
  color: #1e293b;
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.16);
  transition: transform .25s ease, box-shadow .25s ease;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.category-card::after {
  content: '';
  position: absolute;
  inset-inline-end: 16px;
  inset-block-start: 16px;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(59, 130, 246, 0.12);
  filter: blur(0);
  z-index: 0;
}

.category-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 25px 45px rgba(15, 23, 42, 0.28);
}

.category-card.active,
.category-card.selected {
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 28px 55px rgba(59, 130, 246, 0.38), inset 0 0 0 2px rgba(59, 130, 246, 0.09);
}

.category-card-header,
.category-card-body,
.category-card-footer {
  position: relative;
  z-index: 2;
}

.category-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.category-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.16), rgba(129, 140, 248, 0.32));
  color: #312e81;
}

.category-card-icon.icon-activity { background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(96, 165, 250, 0.4)); color: #1d4ed8; }
.category-card-icon.icon-legal-entity { background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(45, 212, 191, 0.45)); color: #0f766e; }
.category-card-icon.icon-tax-office { background: linear-gradient(135deg, rgba(14, 165, 233, 0.22), rgba(59, 130, 246, 0.38)); color: #0369a1; }
.category-card-icon.icon-activity-year { background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(251, 146, 60, 0.4)); color: #c2410c; }
.category-card-icon.icon-registration-status { background: linear-gradient(135deg, rgba(37, 99, 235, 0.22), rgba(129, 140, 248, 0.38)); color: #1d4ed8; }
.category-card-icon.icon-missing-data { background: linear-gradient(135deg, rgba(234, 179, 8, 0.25), rgba(248, 113, 113, 0.35)); color: #b45309; }
.category-card-icon.icon-age-group { background: linear-gradient(135deg, rgba(220, 38, 38, 0.22), rgba(248, 113, 113, 0.38)); color: #b91c1c; }
.category-card-icon.icon-gender { background: linear-gradient(135deg, rgba(236, 72, 153, 0.22), rgba(244, 114, 182, 0.35)); color: #be185d; }
.category-card-icon.icon-birthplace { background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(30, 64, 175, 0.28)); color: #1e40af; }
.category-card-icon.icon-file-category { background: linear-gradient(135deg, rgba(67, 56, 202, 0.22), rgba(129, 140, 248, 0.35)); color: #3730a3; }

.category-card-icon i {
  font-size: 20px;
}

.category-card-count {
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 800;
  color: #0f172a;
}

.category-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.category-card-title {
  margin: 0;
  font-size: clamp(14px, 1.8vw, 16px);
  font-weight: 700;
}

.category-card-subtitle {
  margin: 0;
  font-size: clamp(12px, 1.6vw, 13px);
  color: #475569;
}

.category-card-progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
  margin-bottom: 16px;
}

.category-card-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8 0%, #3b82f6 50%, #6366f1 100%);
  transition: width 0.7s ease;
}

.category-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: clamp(11.5px, 1.5vw, 13px);
}

.category-card-percentage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #2563eb;
  font-weight: 600;
}

.category-card-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #1e293b;
  font-weight: 600;
  transition: color .2s ease;
}

.category-card-action i {
  font-size: 14px;
}

.category-card:hover .category-card-action,
.category-card.selected .category-card-action {
  color: #4338ca;
}

.category-card-group {
  display: none;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--category-card-gap);
  opacity: 0;
  direction: rtl;
}

.category-card-group.is-active {
  display: grid;
  opacity: 1;
  animation: categoryGroupFadeIn .45s ease forwards;
}

.category-card-group.is-exiting {
  animation: categoryGroupFadeOut .35s ease forwards;
}

@keyframes categoryGroupFadeIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes categoryGroupFadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-18px); }
}

@media (max-width: 1399px) {
  .category-card-group {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  [dir="rtl"] .last-update-card__contributors .contributors-bar {
    direction: rtl;
  }
}

@media (max-width: 1199px) {
  .category-card-group {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 991px) {
  .category-card-group {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .category-card-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 479px) {
  .category-card-group {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
}

.category-hub--show-all .category-slider {
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
}

.category-hub--show-all .category-slider__viewport {
  overflow: visible;
  padding: 0;
  background: transparent;
}

.category-hub--show-all .category-slider__track {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--category-card-gap);
  padding-inline: 0;
}

.category-hub--show-all .category-card {
  min-width: 0;
  max-width: none;
  width: 100%;
}

.category-hub--show-all .category-card-group {
  display: contents !important;
  opacity: 1 !important;
  animation: none !important;
}

@media (min-width: 640px) {
  .category-hub--show-all .category-slider__track {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .category-hub--show-all .category-slider__track {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .category-hub--show-all .category-slider__track {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 1400px) {
  .category-hub--show-all .category-slider__track {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.category-hub--show-all .category-slider__nav,
.category-hub--show-all .category-slider__dots {
  display: none !important;
}

.category-hub--show-all .category-hub__show-all .show-all-icon i {
  transform: rotate(180deg);
}

.category-loading,
.category-empty {
  position: relative;
  z-index: 2;
  margin-top: 24px;
  padding: 32px 24px;
  border-radius: 16px;
  text-align: center;
  color: #f8fafc;
}

.state-loading {
  background: rgba(15, 23, 42, 0.18);
  border: 1px dashed rgba(248, 250, 252, 0.25);
}

.state-empty {
  background: rgba(15, 23, 42, 0.14);
  border: 1px dashed rgba(248, 250, 252, 0.2);
}

.state-empty i {
  font-size: 42px;
  margin-bottom: 14px;
  opacity: 0.8;
}

.loading-spinner {
  display: inline-block;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(248, 250, 252, 0.35);
  border-top-color: #f8fafc;
  animation: spin 1s linear infinite;
}

.category-hub__header + .state-loading,
.category-hub__header + .state-empty {
  margin-top: 16px;
}

@media (max-width: 1024px) {
  .category-hub {
    padding: 22px 20px;
  }

  .category-hub__control-cluster {
    width: 100%;
    justify-content: space-between;
    gap: 14px;
  }

  .category-hub__view-toggle-slot {
    flex: 1 1 auto;
    justify-content: flex-start;
  }

  .category-hub__toggle {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }

  .category-hub__utilities {
    flex: 1 1 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .category-slider {
    gap: 10px;
  }

  .category-slider__nav {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 768px) {
  .category-hub {
    padding: 20px 18px;
  }

  .category-hub__header {
    flex-direction: column;
    align-items: stretch;
  }

  .category-hub__control-cluster {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .category-hub__actions {
    align-items: stretch;
    justify-content: stretch;
  }

  .category-hub__types {
    justify-content: flex-start;
  }

  .category-hub__utilities {
    flex-direction: column;
    align-items: stretch;
  }

  .category-slider__viewport {
    padding-block: 14px 20px;
  }
}

@media (max-width: 540px) {
  .category-type-btn {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
  }

  .category-hub__toggle {
    min-width: 0;
  }

  .category-card {
    min-width: 220px;
  }

  .category-hub--show-all .category-slider__track {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .filters {
        padding: 16px;
        gap: 16px;
    }
    
    .filter-row {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .filter-group.file-number-field,
    .filter-group.client-name-field,
    .filter-group.activity-start-field,
    .filter-group.activity-field,
    .filter-group.tax-office-field,
    .filter-group.legal-entity-field,
  .filter-group.client-lists-field {
        flex: 1 1 100%;
        min-width: 100%;
        max-width: 100%;
    }
    
    .checkbox-label {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .filters {
        padding: 12px;
        gap: 12px;
    }
    
    .filter-group input,
    .filter-group select {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .filter-group label {
        font-size: 13px;
    }
}

/* ===== عناوين تبويبات الوظائف (الفلترة - البحث المتقدم - الإحصائيات) - نمط مقسّم احترافي مشابه للصورة ===== */
.multi-function-container .function-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  background: #f3f4f6; /* خلفية الحاوية */
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.multi-function-container .function-tab {
  flex: 1 1 33.333%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center; /* توسيط النص داخل التبويب */
  gap: 8px; /* مسافة بين الأيقونة والنص */
  background: transparent;
  color: #374151;
  border: 0;
  padding: 14px 18px;
  min-width: 0;
  cursor: pointer;
  position: relative;
  transition: background-color .2s ease, color .2s ease;
}

/* فاصل بين العناصر داخل نفس الحاوية */
.multi-function-container .function-tab + .function-tab {
  border-inline-start: 1px solid #e5e7eb; /* منطقي ليدعم RTL/LTR */
}

.multi-function-container .function-tab .tab-icon {
  width: 18px;
  height: 18px;
  margin-inline-start: 0; /* إزالة الحافة السابقة */
  margin-inline-end: 4px; /* وضع الأيقونة بجانب النص */
  color: currentColor;
}

.multi-function-container .function-tab span {
  font-size: 14px;
  font-weight: 700;
  color: inherit;
}

.multi-function-container .function-tab:hover {
  background: rgba(255,255,255,0.6);
}

.multi-function-container .function-tab.active {
  background: #ffffff;
  color: #2563eb; /* لون أزرق للتبويب النشط */
}

.multi-function-container .function-tab.active::after {
  content: '';
  position: absolute;
  inset-inline: 0; /* يمتد على عرض التبويب بالكامل */
  bottom: 0;
  height: 3px;
  background: #2563eb; /* خط سفلي أزرق للتبويب النشط */
}

/* ضمان نفس السلوك عند التعريفات العامة للتبويبات إن وُجدت */
.function-tabs .function-tab {
  justify-content: center !important;
  gap: 8px !important;
}

/* ===== أنماط الإشعارات ===== */

.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    z-index: 10000;
    transform: translateX(100%);
    opacity: 0;
    transition: var(--transition-smooth);
    max-width: 400px;
    border-left: 4px solid #007cba;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-success {
    border-left-color: #28a745;
}

.notification-error {
    border-left-color: #dc3545;
}

.notification-warning {
    border-left-color: #ffc107;
}

.notification-info {
    border-left-color: #17a2b8;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-icon {
    flex-shrink: 0;
    color: #007cba;
}

.notification-success .notification-icon {
    color: #28a745;
}

.notification-error .notification-icon {
    color: #dc3545;
}

.notification-warning .notification-icon {
    color: #ffc107;
}

.notification-info .notification-icon {
    color: #17a2b8;
}

.notification-message {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

/* ===== تمييز الصف الأول بعد البحث ===== */
#posts-table tbody tr.highlight-row {
    background: linear-gradient(90deg, 
        rgba(59, 130, 246, 0.15) 0%, 
        rgba(147, 197, 253, 0.25) 50%, 
        rgba(59, 130, 246, 0.15) 100%) !important;
    animation: pulse-highlight 2s ease-in-out;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4) inset;
    transition: all 0.4s ease;
}

@keyframes pulse-highlight {
    0%, 100% {
        background: linear-gradient(90deg, 
            rgba(59, 130, 246, 0.15) 0%, 
            rgba(147, 197, 253, 0.25) 50%, 
            rgba(59, 130, 246, 0.15) 100%);
    }
    50% {
        background: linear-gradient(90deg, 
            rgba(59, 130, 246, 0.25) 0%, 
            rgba(147, 197, 253, 0.35) 50%, 
            rgba(59, 130, 246, 0.25) 100%);
    }
}

#posts-table tbody tr.highlight-row td {
  border-color: rgba(59, 130, 246, 0.3) !important;
  background: linear-gradient(90deg,
    rgba(59, 130, 246, 0.18) 0%,
    rgba(147, 197, 253, 0.32) 50%,
    rgba(59, 130, 246, 0.2) 100%) !important;
  color: #0f172a;
}

/* ===== تصميم حديث لجدول العملاء ===== */
#posts-table_wrapper {
  margin-top: 28px;
  padding: 28px 30px 34px;
  border-radius: 28px;
  background: linear-gradient(140deg, rgba(30, 64, 175, 0.14) 0%, rgba(59, 130, 246, 0.08) 45%, rgba(23, 37, 84, 0.12) 100%);
  border: 1px solid rgba(30, 64, 175, 0.18);
  box-shadow: 0 32px 70px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(12px);
}

#posts-table_wrapper .dataTables_length,
#posts-table_wrapper .dataTables_filter,
#posts-table_wrapper .dataTables_info,
#posts-table_wrapper .dataTables_paginate {
  margin-block: 14px;
}

#posts-table_wrapper .dataTables_length,
#posts-table_wrapper .dataTables_filter {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 600;
  color: #0f172a;
}

#posts-table_wrapper .dataTables_length select,
#posts-table_wrapper .dataTables_filter input {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  background: rgba(248, 250, 252, 0.96);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  transition: border-color .2s ease, box-shadow .2s ease;
}

#posts-table_wrapper .dataTables_filter input:focus,
#posts-table_wrapper .dataTables_length select:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.7);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}

#posts-table_wrapper .dataTables_info {
  font-size: 13px;
  font-weight: 500;
  color: rgba(15, 23, 42, 0.72);
}

#posts-table_wrapper .dataTables_paginate {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

#posts-table_wrapper .dataTables_paginate .paginate_button {
  min-width: 42px;
  height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(248, 250, 252, 0.9);
  color: #1e293b !important;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

#posts-table_wrapper .dataTables_paginate .paginate_button:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 16px 32px rgba(59, 130, 246, 0.22);
  color: #1d4ed8 !important;
}

#posts-table_wrapper .dataTables_paginate .paginate_button.current,
#posts-table_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.36));
  border-color: rgba(59, 130, 246, 0.55);
  color: #0f172a !important;
  box-shadow: 0 18px 36px rgba(59, 130, 246, 0.28);
}

#posts-table {
  border-collapse: separate !important;
  border-spacing: 0 14px !important;
  background: transparent;
  color: #0f172a;
}

#posts-table thead {
  background: transparent;
}

#posts-table thead th {
  position: relative;
  padding: 18px 26px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e2e8f0;
  border: none !important;
  background: none !important;
  overflow: hidden;
}

#posts-table thead th::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #38bdf8 100%);
  z-index: -1;
}

#posts-table thead th:first-child::before {
  border-radius: 18px 0 0 18px;
}

#posts-table thead th:last-child::before {
  border-radius: 0 18px 18px 0;
}

[dir="rtl"] #posts-table thead th:first-child::before,
#posts-table[dir="rtl"] thead th:first-child::before {
  border-radius: 0 18px 18px 0;
}

[dir="rtl"] #posts-table thead th:last-child::before,
#posts-table[dir="rtl"] thead th:last-child::before {
  border-radius: 18px 0 0 18px;
}

#posts-table thead th.sorting,
#posts-table thead th.sorting_asc,
#posts-table thead th.sorting_desc {
  padding-inline-end: 46px;
}

[dir="rtl"] #posts-table thead th.sorting,
[dir="rtl"] #posts-table thead th.sorting_asc,
[dir="rtl"] #posts-table thead th.sorting_desc,
#posts-table[dir="rtl"] thead th.sorting,
#posts-table[dir="rtl"] thead th.sorting_asc,
#posts-table[dir="rtl"] thead th.sorting_desc {
  padding-left: 46px;
}

[dir="ltr"] #posts-table thead th.sorting,
[dir="ltr"] #posts-table thead th.sorting_asc,
[dir="ltr"] #posts-table thead th.sorting_desc,
#posts-table[dir="ltr"] thead th.sorting,
#posts-table[dir="ltr"] thead th.sorting_asc,
#posts-table[dir="ltr"] thead th.sorting_desc {
  padding-right: 46px;
}

#posts-table thead th.sorting::after,
#posts-table thead th.sorting_asc::after,
#posts-table thead th.sorting_desc::after {
  content: '\2195';
  position: absolute;
  inset-inline-end: 22px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.6);
  opacity: 0.6;
  transition: opacity .18s ease, transform .18s ease;
}

[dir="rtl"] #posts-table thead th.sorting::after,
[dir="rtl"] #posts-table thead th.sorting_asc::after,
[dir="rtl"] #posts-table thead th.sorting_desc::after,
#posts-table[dir="rtl"] thead th.sorting::after,
#posts-table[dir="rtl"] thead th.sorting_asc::after,
#posts-table[dir="rtl"] thead th.sorting_desc::after {
  right: auto;
  left: 22px;
}

[dir="ltr"] #posts-table thead th.sorting::after,
[dir="ltr"] #posts-table thead th.sorting_asc::after,
[dir="ltr"] #posts-table thead th.sorting_desc::after,
#posts-table[dir="ltr"] thead th.sorting::after,
#posts-table[dir="ltr"] thead th.sorting_asc::after,
#posts-table[dir="ltr"] thead th.sorting_desc::after {
  left: auto;
  right: 22px;
}

#posts-table thead th.sorting_asc::after {
  content: '\25B2';
  opacity: 0.95;
  transform: translateY(-50%) scale(1.05);
}

#posts-table thead th.sorting_desc::after {
  content: '\25BC';
  opacity: 0.95;
  transform: translateY(-50%) scale(1.05);
}

#posts-table tbody tr {
  position: relative;
  transition: transform .2s ease, box-shadow .2s ease;
}

#posts-table tbody tr td {
  background: #ffffff;
  border: none;
  padding: 18px 22px;
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
  line-height: 1.6;
  box-shadow: inset 0 -1px 0 rgba(226, 232, 240, 0.7);
}

#posts-table tbody tr td:first-child {
  border-radius: 18px 0 0 18px;
  font-weight: 700;
}

#posts-table tbody tr td:last-child {
  border-radius: 0 18px 18px 0;
}

[dir="rtl"] #posts-table tbody tr td:first-child,
#posts-table[dir="rtl"] tbody tr td:first-child {
  border-radius: 0 18px 18px 0;
}

[dir="rtl"] #posts-table tbody tr td:last-child,
#posts-table[dir="rtl"] tbody tr td:last-child {
  border-radius: 18px 0 0 18px;
}

#posts-table tbody tr::before {
  content: '';
  position: absolute;
  inset-inline-start: 16px;
  top: 18px;
  bottom: 18px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #38bdf8 0%, #2563eb 100%);
  opacity: 0;
  transition: opacity .2s ease;
}

#posts-table tbody tr:hover,
#posts-table tbody tr:focus-within {
  transform: translateY(-4px);
  box-shadow: 0 24px 48px rgba(30, 64, 175, 0.18);
}

#posts-table tbody tr:hover::before,
#posts-table tbody tr:focus-within::before,
#posts-table tbody tr.highlight-row::before {
  opacity: 1;
}

#posts-table tbody tr:hover td,
#posts-table tbody tr:focus-within td {
  box-shadow: inset 0 -1px 0 rgba(59, 130, 246, 0.18);
}

#posts-table tbody tr td .status-badge,
#posts-table tbody tr td .tp-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
}

#posts-table tbody tr td .status-badge i,
#posts-table tbody tr td .tp-status-badge i {
  font-size: 12px;
}

.last-update-card {
  --progress: 0%;
  --status-color: #64748b;
  --status-soft: #cbd5f5;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(14, 165, 233, 0.08));
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(6px);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease, background .22s ease;
  isolation: isolate;
}

.last-update-card::before {
  content: '';
  position: absolute;
  inset: 8px 12px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0));
  pointer-events: none;
  opacity: 0.9;
  z-index: 0;
}

.last-update-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 44px rgba(14, 116, 144, 0.14);
  border-color: rgba(14, 165, 233, 0.3);
}

.last-update-card__edit {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: none;
  background: rgba(59, 130, 246, 0.16);
  color: var(--status-color);
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
  transition: transform .22s ease, box-shadow .22s ease, color .22s ease, background .22s ease;
}

.last-update-card__edit i {
  font-size: 14px;
}

.last-update-card__edit:hover,
.last-update-card__edit:focus {
  outline: none;
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 22px 40px rgba(14, 116, 144, 0.18);
  background: var(--status-color);
  color: #fff;
}

.last-update-card__body {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.last-update-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #1f2937;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.last-update-card__meta * {
  color: inherit;
}

.last-update-card__progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.last-update-card__progress-track {
  position: relative;
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.12);
}

.last-update-card__progress-fill {
  position: absolute;
  inset: 0;
  width: var(--progress);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--status-color) 0%, var(--status-soft) 100%);
  box-shadow: 0 0 16px var(--status-soft);
  transition: width .5s cubic-bezier(0.4, 0, 0.2, 1), background .3s ease, box-shadow .3s ease;
}

.last-update-card__progress-value {
  min-width: 44px;
  font-size: 11px;
  font-weight: 700;
  color: var(--status-color);
  text-align: center;
  letter-spacing: 0.02em;
}

.last-update-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.last-update-card__status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 11px;
  color: var(--status-color);
  background: rgba(59, 130, 246, 0.12);
  backdrop-filter: blur(4px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.last-update-card__status i {
  font-size: 12px;
}

.last-update-card__fields {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 11px;
  color: #1f2937;
  background: rgba(15, 23, 42, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.last-update-card__fields i {
  font-size: 11px;
  color: var(--status-color);
}

.last-update-card__contributors {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: inset 0 2px 6px rgba(15, 23, 42, 0.04);
}

.last-update-card__contributors .contributors-bar {
  margin: 0;
}

[dir="rtl"] .last-update-card__contributors .contributors-bar {
  direction: rtl;
}

.last-update-card__contributors-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  flex-shrink: 0;
}

.last-update-card__contributors-label i {
  font-size: 11px;
  color: var(--status-color);
}

.last-update-card__contributors-inline {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 6px;
}

.last-update-card__contributor {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  font-size: 11px;
  font-weight: 600;
  color: #1f2937;
  position: relative;
  white-space: nowrap;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.last-update-card__contributor:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.last-update-card__contributor-name {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.last-update-card__contributor-name span:last-child {
  display: inline-block;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.last-update-card__contributor-marker {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--contributor-accent, linear-gradient(135deg, #38bdf8, #2563eb));
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
}

.last-update-card__contributor-percent {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.12);
  color: var(--status-color);
  font-weight: 700;
  font-size: 10px;
}

.last-update-card__contributor[style*="--contributor-accent"] .last-update-card__contributor-percent {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

.last-update-card__contributors.--legacy {
  display: block;
  padding: 10px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.05);
  border: 1px dashed rgba(148, 163, 184, 0.25);
  box-shadow: inset 0 4px 12px rgba(15, 23, 42, 0.05);
}

.last-update-card[data-status="complete"] {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(56, 189, 248, 0.12));
  border-color: rgba(16, 185, 129, 0.3);
}

.last-update-card[data-status="good"] {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(14, 165, 233, 0.12));
  border-color: rgba(59, 130, 246, 0.28);
}

.last-update-card[data-status="average"] {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(249, 115, 22, 0.1));
  border-color: rgba(245, 158, 11, 0.28);
}

.last-update-card[data-status="weak"] {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(251, 146, 60, 0.12));
  border-color: rgba(239, 68, 68, 0.28);
}

.last-update-card[data-status="empty"] {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.08), rgba(226, 232, 240, 0.16));
  border-color: rgba(148, 163, 184, 0.24);
}

.last-update-card[data-status="weak"] .last-update-card__status,
.last-update-card[data-status="average"] .last-update-card__status,
.last-update-card[data-status="good"] .last-update-card__status,
.last-update-card[data-status="complete"] .last-update-card__status {
  background: rgba(255, 255, 255, 0.08);
}

.last-update-card[data-status="weak"] .last-update-card__fields,
.last-update-card[data-status="average"] .last-update-card__fields,
.last-update-card[data-status="good"] .last-update-card__fields,
.last-update-card[data-status="complete"] .last-update-card__fields {
  background: rgba(255, 255, 255, 0.16);
}

@media (max-width: 1024px) {
  .last-update-card {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .last-update-card__edit {
    align-self: flex-end;
  }

  [dir="rtl"] .last-update-card__edit {
    align-self: flex-start;
  }

  .last-update-card__footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: inset 0 2px 6px rgba(15, 23, 42, 0.04);
  .last-update-card {
    padding: 14px;
    border-radius: 14px;
  }

  .last-update-card__progress {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .last-update-card__progress-value {
    align-self: flex-start;
  }

  .last-update-card__status,
  .last-update-card__fields {
    width: 100%;
    justify-content: center;
  }
}

#posts-table tbody tr.selected td {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(96, 165, 250, 0.28));
  color: #0f172a;
  box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.08);
}

#posts-table tbody tr.selected::before {
  opacity: 1;
  background: linear-gradient(180deg, #f59e0b 0%, #f97316 100%);
}

body.dark-mode #posts-table_wrapper {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(96, 165, 250, 0.18);
  box-shadow: 0 28px 60px rgba(2, 6, 23, 0.6);
}

body.dark-mode #posts-table_wrapper .dataTables_length,
body.dark-mode #posts-table_wrapper .dataTables_filter,
body.dark-mode #posts-table_wrapper .dataTables_info {
  color: #e2e8f0;
}

body.dark-mode #posts-table_wrapper .dataTables_length select,
body.dark-mode #posts-table_wrapper .dataTables_filter input {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(148, 163, 184, 0.38);
  color: #e2e8f0;
  box-shadow: none;
}

body.dark-mode #posts-table_wrapper .dataTables_filter input:focus,
body.dark-mode #posts-table_wrapper .dataTables_length select:focus {
  border-color: rgba(96, 165, 250, 0.65);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.28);
}

body.dark-mode #posts-table_wrapper .dataTables_paginate .paginate_button {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(148, 163, 184, 0.26);
  color: #f8fafc !important;
  box-shadow: none;
}

body.dark-mode #posts-table_wrapper .dataTables_paginate .paginate_button.current,
body.dark-mode #posts-table_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.28), rgba(59, 130, 246, 0.36));
  border-color: rgba(96, 165, 250, 0.6);
  color: #f8fafc !important;
  box-shadow: 0 18px 42px rgba(37, 99, 235, 0.32);
}

body.dark-mode #posts-table tbody tr td {
  background: rgba(15, 23, 42, 0.82);
  color: #e2e8f0;
  box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.65);
}

body.dark-mode #posts-table tbody tr:hover td,
body.dark-mode #posts-table tbody tr:focus-within td {
  box-shadow: inset 0 -1px 0 rgba(59, 130, 246, 0.32);
}

body.dark-mode #posts-table tbody tr.selected td {
  color: #e2e8f0;
}

@media (max-width: 1280px) {
  #posts-table_wrapper {
    padding: 22px 18px 26px;
    border-radius: 22px;
  }

  #posts-table thead th {
    padding: 16px 20px;
  }

  #posts-table tbody tr td {
    padding: 16px 18px;
  }
}

@media (max-width: 768px) {
  #posts-table_wrapper {
    padding: 18px 12px 22px;
    border-radius: 18px;
  }

  #posts-table_wrapper .dataTables_length,
  #posts-table_wrapper .dataTables_filter,
  #posts-table_wrapper .dataTables_info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  #posts-table {
    border-spacing: 0 10px !important;
  }

  #posts-table thead th,
  #posts-table tbody tr td {
    padding-inline: 14px;
  }

  #posts-table thead th.sorting,
  #posts-table thead th.sorting_asc,
  #posts-table thead th.sorting_desc {
    padding-inline-end: 38px;
  }

  #posts-table thead th.sorting::after,
  #posts-table thead th.sorting_asc::after,
  #posts-table thead th.sorting_desc::after {
    inset-inline-start: 16px;
  }
}

/* ===== أنماط البحث المتقدم المحسنة ===== */

.advanced-search-container {
    padding: 0;
    background: transparent;
    position: relative;
    z-index: 50; /* فوق الجدول */
}

.search-section {
    background: var(--filter-bg-primary);
    border: var(--filter-border);
    border-radius: var(--filter-radius);
    margin-bottom: var(--filter-gap);
    box-shadow: var(--filter-shadow-light);
    transition: var(--transition-normal);
    position: relative;
    z-index: 50; /* فوق الجدول */
}

.search-section:hover {
    box-shadow: var(--filter-shadow-medium);
    transform: translateY(-2px);
}

.section-header {
    background: var(--filter-accent-gradient);
    color: var(--filter-text-white);
    padding: var(--filter-padding-small);
    border-radius: var(--filter-radius) var(--filter-radius) 0 0;
    margin: 0;
}

.search-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--filter-text-white);
}

.section-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

/* شبكات البحث المختلفة */
.search-options-grid,
.field-search-grid,
.range-search-grid,
.advanced-options-grid {
    display: grid;
    gap: var(--filter-gap);
    padding: var(--filter-padding);
}

.search-options-grid {
    grid-template-columns: 2fr 1fr 1fr;
}

.field-search-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.range-search-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.advanced-options-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* مجموعات البحث */
.search-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--filter-text-primary);
    margin-bottom: 4px;
}

.search-group input,
.search-group select {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: var(--filter-radius-small);
    font-size: 14px;
    font-family: inherit;
    background: var(--filter-bg-primary);
    color: var(--filter-text-primary);
    transition: var(--transition-normal);
}

.search-group input:focus,
.search-group select:focus {
    outline: none;
    border-color: var(--filter-text-accent);
    box-shadow: var(--filter-focus-shadow);
    transform: translateY(-1px);
}

.search-group input::placeholder {
    color: var(--filter-text-secondary);
    font-style: italic;
}

/* مجموعات النطاقات */
.range-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.range-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--filter-text-primary);
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
}

.range-inputs input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: var(--filter-radius-small);
    font-size: 14px;
    background: var(--filter-bg-primary);
    color: var(--filter-text-primary);
    transition: var(--transition-normal);
}

.range-inputs input:focus {
    outline: none;
    border-color: var(--filter-text-accent);
    box-shadow: var(--filter-focus-shadow);
}

.range-separator {
    font-weight: 600;
    color: var(--filter-text-secondary);
    font-size: 14px;
    white-space: nowrap;
    padding: 0 4px;
}

/* مجموعات الـ Checkbox المحسنة */
.checkbox-group {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--filter-text-primary);
    transition: color 0.3s ease;
    user-select: none;
}

.checkbox-label:hover {
    color: var(--filter-text-accent);
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    position: relative;
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    background: var(--filter-bg-primary);
    transition: var(--transition-normal);
    flex-shrink: 0;
}

.checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--filter-accent-gradient);
    border-color: var(--filter-text-accent);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    opacity: 1;
}

/* أزرار التحكم المحسنة */
.search-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    padding: var(--filter-padding);
    background: var(--filter-bg-secondary);
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 var(--filter-radius) var(--filter-radius);
}

.action-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--filter-radius-small);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition-normal);
    text-decoration: none;
    min-width: 140px;
    justify-content: center;
}

.button-icon {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.primary-button {
    background: var(--filter-accent-gradient);
    color: var(--filter-text-white);
    box-shadow: var(--filter-shadow-light);
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--filter-shadow-heavy);
}

.secondary-button {
    background: var(--filter-bg-primary);
    color: var(--filter-text-secondary);
    border: 2px solid #e2e8f0;
}

.secondary-button:hover {
    background: var(--filter-bg-secondary);
    color: var(--filter-text-primary);
    border-color: var(--filter-text-accent);
    transform: translateY(-1px);
}

.info-button {
    background: var(--filter-info-gradient);
    color: var(--filter-text-white);
    box-shadow: var(--filter-shadow-light);
}

.info-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(8, 145, 178, 0.3);
}

.success-button {
    background: var(--filter-success-gradient);
    color: var(--filter-text-white);
    box-shadow: var(--filter-shadow-light);
}

.success-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(5, 150, 105, 0.3);
}

/* الاستجابة للشاشات المختلفة */
@media (max-width: 1200px) {
    .search-options-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .field-search-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .range-search-grid {
        grid-template-columns: 1fr;
    }
    
    .advanced-options-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (max-width: 768px) {
    .search-options-grid,
    .field-search-grid,
    .range-search-grid,
    .advanced-options-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px;
    }
    
    .range-inputs {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .range-separator {
        text-align: center;
        padding: 4px 0;
    }
    
    .search-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .action-button {
        min-width: auto;
        width: 100%;
    }
    
    .section-header {
        padding: 16px;
    }
    
    .search-section-title {
        font-size: 15px;
    }
    
    .section-icon {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .search-section {
        margin-bottom: 16px;
        border-radius: var(--filter-radius-small);
    }
    
    .section-header {
        border-radius: var(--filter-radius-small) var(--filter-radius-small) 0 0;
        padding: 12px;
    }
    
    .search-section-title {
        font-size: 14px;
        gap: 8px;
    }
    
    .section-icon {
        width: 16px;
        height: 16px;
    }
    
    .search-group input,
    .search-group select {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .action-button {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .button-icon {
        width: 16px;
        height: 16px;
    }
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.checkbox-field input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #007cba;
}

.checkbox-field label {
    font-size: 14px;
    color: #333;
    cursor: pointer;
}

.search-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.search-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.search-btn-primary {
    background: #007cba;
    color: white;
}

.search-btn-primary:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.search-btn-secondary {
    background: #6c757d;
    color: white;
}

.search-btn-secondary:hover {
    background: #545b62;
    transform: translateY(-1px);
}

/* ===== أنماط الإحصائيات ===== */

.statistics-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #007cba;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.stat-card h4 {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #007cba;
    margin: 0;
}

.charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.chart-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chart-card h4 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.chart-container {
    position: relative;
    height: 300px;
}

/* ===== صف تحكم الفلاتر والإحصاءات ===== */
.filters-controls-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 16px 0;
    flex-wrap: wrap;
}

/* بطاقة الإحصاءات الأفقية */
.filter-stats-card.horizontal-stats {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 20px;
    min-width: 280px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.filter-stats-card.horizontal-stats .filter-stats-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stats-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
}

.stats-label {
    font-weight: 500;
    color: #6b7280;
}

.stats-value {
    font-weight: 700;
    color: #059669;
    font-size: 15px;
}

.stats-total {
    font-weight: 600;
    color: #374151;
}

.stats-separator {
    color: #9ca3af;
    font-weight: 400;
}

.stats-percentage {
    font-weight: 700;
    color: #7c3aed;
    font-size: 15px;
}

/* ===== التصميم المتجاوب ===== */

@media (max-width: 768px) {
    .function-tabs {
        flex-direction: column;
    }
    
    .function-tab {
        border-bottom: 1px solid #e5e7eb;
    }
    
    .function-tab:last-child {
        border-bottom: none;
    }
    
    .function-tab.active::after {
        height: 0;
        left: 0;
        width: 4px;
        top: 0;
        bottom: 0;
    }
    
    .tab-content {
        padding: 16px;
    }
    
    .search-options {
        grid-template-columns: 1fr;
    }
    
    .range-inputs {
        flex-direction: column;
        align-items: stretch;
    }
    
    .range-separator {
        text-align: center;
        padding: 4px 0;
    }
    
    .search-actions {
        flex-direction: column;
    }
    
    .stats-overview {
        grid-template-columns: 1fr;
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        padding: 16px;
    }
    
    .search-field-group {
        grid-template-columns: 1fr;
    }
    
    .search-buttons {
        flex-direction: column;
    }
    
    .search-btn {
        justify-content: center;
    }
    
    .statistics-overview {
        grid-template-columns: 1fr;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .notification {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
        transform: translateX(100%);
    }
    
    .notification.show {
        transform: translateX(0);
    }
}

@media (max-width: 480px) {
    .multi-function-container {
        margin: 0 -10px 20px -10px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .function-tab {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .tab-icon {
        width: 16px;
        height: 16px;
    }
}

:root {
  /* متغيرات الألوان للفلاتر - تصميم احترافي حديث */
  --filter-bg-primary: #ffffff;
  --filter-bg-secondary: #fafbfc;
  --filter-bg-tertiary: #f0f4f8;
  --filter-bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  --filter-accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --filter-success-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --filter-info-gradient: linear-gradient(135deg, #0891b2 0%, #0ea5e9 100%);
  --filter-warning-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  --filter-danger-gradient: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  --filter-premium-gradient: linear-gradient(135deg, #1e40af 0%, #3730a3 100%);
  
  /* متغيرات الحدود والظلال المحسنة */
  --filter-border: 2px solid #e2e8f0;
  --filter-border-focus: 2px solid #4f46e5;
  --filter-shadow-light: 0 4px 20px rgba(0, 0, 0, 0.08);
  --filter-shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.12);
  --filter-shadow-heavy: 0 12px 45px rgba(79, 70, 229, 0.25);
  --filter-focus-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
  --filter-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  
  /* متغيرات النصوص المحسنة */
  --filter-text-primary: #1e293b;
  --filter-text-secondary: #64748b;
  --filter-text-white: #ffffff;
  --filter-text-dark: #0f172a;
  --filter-text-accent: #4f46e5;
  
  /* متغيرات القياسات المحسنة */
  --filter-radius: 16px;
  --filter-radius-small: 10px;
  --filter-radius-tiny: 8px;
  --filter-padding: 24px;
  --filter-padding-small: 18px;
  --filter-padding-tiny: 12px;
  --filter-gap: 20px;
  --filter-gap-small: 12px;
  
  /* متغيرات الانتقالات المحسنة */
  --filter-transition: var(--transition-smooth);
  --filter-transition-fast: all 0.2s cubic-bezier(0.4, 0, 1, 1);
  --filter-transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  
  /* متغيرات التأثيرات الخاصة */
  --filter-glass-bg: rgba(255, 255, 255, 0.95);
  --filter-glass-border: 1px solid rgba(255, 255, 255, 0.2);
  --filter-glass-blur: blur(12px);
}

/* حاوية الفلاتر الرئيسية - تصميم زجاجي حديث */
.filters-container {
  background: var(--filter-glass-bg);
  backdrop-filter: var(--filter-glass-blur);
  -webkit-backdrop-filter: var(--filter-glass-blur);
  border-radius: var(--filter-radius);
  padding: var(--filter-padding);
  margin-bottom: var(--filter-padding);
  box-shadow: var(--filter-glass-shadow);
  border: var(--filter-glass-border);
  position: relative;
  z-index: 50; /* فوق الجدول */
  overflow: hidden;
  transition: var(--filter-transition-smooth);
}

.filters-container:hover {
  transform: translateY(-2px);
  box-shadow: var(--filter-shadow-heavy);
  background: rgba(255, 255, 255, 0.98);
}

.filters-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--filter-accent-gradient);
  background-size: 200% 100%;
  animation: gradientMove 3s ease-in-out infinite;
  z-index: 1;
}

.filters-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shimmer 3s infinite;
  pointer-events: none;
}

/* حاوية الفلاتر مع العداد */
.filters-with-counter {
  display: grid !important;
  grid-template-columns: 2fr 280px !important; /* أصغر بطاقة */
  gap: 10px !important; /* فراغ أقل */
  width: 100% !important;
  max-width: 100% !important;
  margin-bottom: 6px !important; /* فراغ أقل أسفل الحاوية */
  align-items: start !important;
}

/* ضبط موضع البطاقة لتكون في العمود الثاني (يسار في RTL) وجعلها عمودية أكثر */
.filters-with-counter .filter-stats-card {
  grid-column: 2 !important;
  max-width: 280px !important;
  min-height: 140px !important;
  padding: 16px !important;
}

.filters-with-counter .filters {
  grid-column: 1 !important; /* حقول الفلترة في العمود الأول (يمين في RTL) */
  order: initial !important; /* منع تأثير أي ترتيب سابق قد يفسد التبويب */
}

/* وضع خيار إخفاء الدشت أسفل البطاقة عندما يكون داخل حاوية خاصة */
.filters-with-counter .dasht-toggle-container {
  grid-column: 2 !important; /* أسفل البطاقة في عمودها */
  align-self: start;
  margin-top: 8px;
}
.filters-with-counter .dasht-toggle-container .checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
  color: #374151;
}

/* بطاقة الإحصاءات المفلترة - نمط قريب من الصورة */
.filter-stats-card {
  background: #ffffff !important;
  border-radius: 16px !important;
  padding: 20px !important;
  color: #1f2937 !important;
  box-shadow: 0 10px 25px rgba(31,41,55,0.08) !important;
  border: 1px solid #e5e7eb !important;
  position: relative !important;
  overflow: hidden !important;
}

/* حافة علوية متدرجة كما في الصورة */
.filter-stats-card::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  height: 6px;
  width: 30%;
  border-top-left-radius: 16px;
  background: linear-gradient(90deg,#7c3aed,#22d3ee,#22c55e);
}

/* إزالة المربع/الغطاء البنفسجي داخل البطاقة */
.filter-stats-card::after {
  display: none !important;
  content: none !important;
}

/* محتوى بطاقة الإحصاءات */
.filter-stats-content {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 12px;
  align-items: center;
  text-align: center;
}

.filter-stats-number {
  font-size: 3rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  color: #0f172a !important;
}

.filter-stats-label {
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  color: #374151 !important;
}

.filter-stats-description {
  color: #6b7280 !important;
}

/* خط فاصل رقيق أسفل المحتوى */
.filter-stats-content::after {
  content: '';
  grid-column: 1 / -1;
  margin-top: 14px;
  height: 3px;
  border-radius: 999px;
  background: #e5e7eb;
  opacity: .6;
}

.filter-stats-label {
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

.filter-stats-description {
  font-size: 0.75rem !important;
  opacity: 0.8;
  margin-top: 4px !important;
  font-weight: 500;
}

/* منطقة الفلاتر - تصميم عمودين */
.filters {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0,1fr)) !important; /* ثلاثة أعمدة لتقليل الارتفاع */
  gap: 10px !important;
  width: 100% !important;
  max-width: 100% !important;
  order: 1 !important;
  align-items: start !important;
}

/* تحسين عناصر الإدخال للتصميم الشبكي */
.filters .filter-group {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  min-width: 0 !important;
}

/* جعل مجموعتين محددتين تمتدان على عمودين لتجنب الانكماش */
.filters .filter-group.span-2 {
  grid-column: 1 / -1 !important;
}

.filters label {
  font-weight: 600 !important;
  color: var(--filter-text-primary) !important;
  font-size: 14px !important;
  margin-bottom: 4px !important;
  display: block !important;
}

/* تحسين عناصر الإدخال - تصميم حديث مع تأثيرات */
.filters select, 
.filters input {
  padding: 10px 14px;
  border: var(--filter-border);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  background: var(--filter-bg-primary);
  transition: var(--filter-transition-smooth);
  width: 100%;
  max-width: 100%;
  position: relative;
  color: var(--filter-text-primary);
  font-family: inherit;
}

.filters select:focus, 
.filters input:focus {
  outline: none;
  border: var(--filter-border-focus);
  box-shadow: var(--filter-focus-shadow);
  transform: translateY(-2px);
  background: var(--filter-bg-primary);
}

.filters select:hover,
.filters input:hover {
  border-color: #c7d2fe;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.1);
  transform: translateY(-1px);
}

/* تأثيرات خاصة لحقول البحث */
.filters input[type="search"] {
  background-position: right 16px center;
  background-size: 18px;
  padding-right: 48px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3e%3cpath fill-rule='evenodd' d='M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z' clip-rule='evenodd'/%3e%3c/svg%3e");
}

.filters input[type="search"]:focus {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%234f46e5'%3e%3cpath fill-rule='evenodd' d='M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z' clip-rule='evenodd'/%3e%3c/svg%3e");
}

/* تحسين القوائم المنسدلة */
.filters select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3e%3cpath fill-rule='evenodd' d='M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 11-1.1-1.02l3.25-3.5A.75.75 0 0110 3z' clip-rule='evenodd'/%3e%3c/svg%3e");
  background-position: right 16px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 48px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.filters select:focus {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%234f46e5'%3e%3cpath fill-rule='evenodd' d='M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 11-1.1-1.02l3.25-3.5A.75.75 0 0110 3z' clip-rule='evenodd'/%3e%3c/svg%3e");
}

/* تحسين القوائم المنسدلة */
.filters select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
}

/* تحسين حقول البحث */
.filters input[type="search"],
.filters input[type="text"] {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
}

/* ===== فلترة متقدمة مع شريط بحث ذكي ===== */

/* تنسيق الفلاتر مع العداد - تصميم متقدم */
.filters-with-counter .filters {
  background: var(--filter-glass-bg);
  backdrop-filter: var(--filter-glass-blur);
  -webkit-backdrop-filter: var(--filter-glass-blur);
  padding: 12px; /* أصغر */
  border-radius: 12px;
  border: var(--filter-glass-border);
  box-shadow: var(--filter-glass-shadow);
  transition: var(--filter-transition-smooth);
}

.filters-with-counter .filters:hover {
  box-shadow: var(--filter-shadow-medium);
  background: rgba(255, 255, 255, 0.98);
}

.filters-with-counter .filters label {
  font-weight: 600;
  color: var(--filter-text-primary);
  margin-bottom: 12px;
  display: block;
  font-size: 15px;
  position: relative;
  padding-left: 20px;
}

.filters-with-counter .filters label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  background: var(--filter-accent-gradient);
  border-radius: 3px;
  opacity: 0.8;
}

.filters-with-counter .filters .filter-group {
  margin-bottom: 6px;
  position: relative;
  padding: 6px;
  background: rgba(248, 250, 252, 0.4);
  border-radius: var(--radius-md);
  border: 1px solid rgba(226, 232, 240, 0.5);
  transition: var(--filter-transition-fast);
}

.filters-with-counter .filters .filter-group:hover {
  background: rgba(248, 250, 252, 0.8);
  border-color: rgba(199, 210, 254, 0.5);
  transform: translateX(4px);
}

.filters-with-counter .filters .filter-group:last-child {
  margin-bottom: 0;
}

/* شريط البحث الذكي */
.smart-search-container {
  position: relative;
  margin-bottom: var(--filter-gap);
}

.smart-search-input {
  width: 100%;
  padding: 16px 52px 16px 20px;
  border: 2px solid #e2e8f0;
  border-radius: var(--filter-radius);
  font-size: 16px;
  font-weight: 500;
  background: var(--filter-bg-primary);
  transition: var(--filter-transition-smooth);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.smart-search-input:focus {
  outline: none;
  border-color: var(--filter-text-accent);
  box-shadow: 0 8px 30px rgba(79, 70, 229, 0.15);
  transform: translateY(-2px);
}

.smart-search-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.smart-search-icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 18px;
  transition: var(--filter-transition-fast);
}

.smart-search-input:focus + .smart-search-icon {
  color: var(--filter-text-accent);
}

/* تصنيفات الفلترة السريعة */
.filter-categories {
  display: flex;
  flex-wrap: wrap;
  gap: var(--filter-gap-small);
  margin-bottom: var(--filter-gap);
}

.filter-category-btn {
  padding: 10px 20px;
  border: 2px solid #e2e8f0;
  border-radius: var(--filter-radius-small);
  background: var(--filter-bg-primary);
  color: var(--filter-text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--filter-transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-category-btn:hover {
  border-color: var(--filter-text-accent);
  color: var(--filter-text-accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.1);
}

.filter-category-btn.active {
  background: var(--filter-accent-gradient);
  border-color: transparent;
  color: var(--filter-text-white);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.2);
}

.filter-category-btn .category-icon {
  font-size: 16px;
}

/* فلترة متقدمة مع شرائح */
.advanced-filter-section {
  background: var(--filter-bg-gradient);
  border-radius: var(--filter-radius);
  padding: var(--filter-padding);
  margin-bottom: var(--filter-gap);
  border: 1px solid rgba(226, 232, 240, 0.5);
}

.advanced-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--filter-gap);
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(226, 232, 240, 0.5);
}

.advanced-filter-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--filter-text-primary);
  margin: 0;
}

.advanced-filter-toggle {
  background: none;
  border: none;
  color: var(--filter-text-secondary);
  cursor: pointer;
  font-size: 14px;
  transition: var(--filter-transition-fast);
}

.advanced-filter-toggle:hover {
  color: var(--filter-text-accent);
}

/* ===== فلترة سريعة مع أزرار تصفية شائعة ===== */

/* فلتر بسيط مع عداد - تصميم محسن */
.simple-filter-counter {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: var(--filter-gap);
  padding: 16px 20px;
  background: rgba(79, 70, 229, 0.05);
  border-radius: var(--filter-radius-small);
  border: 2px solid rgba(79, 70, 229, 0.1);
  transition: var(--filter-transition-smooth);
  backdrop-filter: blur(8px);
}

.simple-filter-counter:hover {
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.1);
}

.simple-filter-counter input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--filter-text-accent);
  cursor: pointer;
  border-radius: 6px;
  transition: var(--filter-transition-fast);
  border: 2px solid #e2e8f0;
}

.simple-filter-counter input[type="checkbox"]:hover {
  transform: scale(1.15);
  border-color: var(--filter-text-accent);
}

.simple-filter-counter input[type="checkbox"]:checked {
  background: var(--filter-accent-gradient);
  border-color: transparent;
}

.simple-filter-counter label {
  font-size: 15px;
  font-weight: 600;
  color: var(--filter-text-primary);
  cursor: pointer;
  margin: 0;
  user-select: none;
  flex: 1;
}

/* أزرار الفلترة السريعة */
.quick-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--filter-gap-small);
  margin: var(--filter-gap) 0;
  padding: var(--filter-padding-small);
  background: var(--filter-bg-gradient);
  border-radius: var(--filter-radius);
  border: 1px solid rgba(226, 232, 240, 0.5);
}

.quick-filter-btn {
  padding: 12px 24px;
  border: 2px solid #e2e8f0;
  border-radius: var(--filter-radius-small);
  background: var(--filter-bg-primary);
  color: var(--filter-text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--filter-transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.quick-filter-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(79, 70, 229, 0.1), transparent);
  transition: left 0.5s ease;
}

.quick-filter-btn:hover::before {
  left: 100%;
}

.quick-filter-btn:hover {
  border-color: var(--filter-text-accent);
  color: var(--filter-text-accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.15);
}

.quick-filter-btn.active {
  background: var(--filter-accent-gradient);
  border-color: transparent;
  color: var(--filter-text-white);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.25);
  transform: translateY(-2px);
}

.quick-filter-btn .btn-icon {
  font-size: 16px;
  transition: transform 0.3s ease;
}

.quick-filter-btn:hover .btn-icon {
  transform: scale(1.2);
}

.quick-filter-btn.active .btn-icon {
  transform: scale(1.2) rotate(15deg);
}

/* أنواع الأزرار المختلفة */
.quick-filter-btn.primary {
  background: var(--filter-accent-gradient);
  border-color: transparent;
  color: var(--filter-text-white);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.2);
}

.quick-filter-btn.success {
  background: var(--filter-success-gradient);
  border-color: transparent;
  color: var(--filter-text-white);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.2);
}

.quick-filter-btn.warning {
  background: var(--filter-warning-gradient);
  border-color: transparent;
  color: var(--filter-text-white);
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.2);
}

.quick-filter-btn.danger {
  background: var(--filter-danger-gradient);
  border-color: transparent;
  color: var(--filter-text-white);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.2);
}

.quick-filter-btn.info {
  background: var(--filter-info-gradient);
  border-color: transparent;
  color: var(--filter-text-white);
  box-shadow: 0 6px 20px rgba(8, 145, 178, 0.2);
}

/* شريط الفلترة السريعة */
.quick-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--filter-gap-small);
  margin: var(--filter-gap) 0;
  padding: var(--filter-padding-small);
  background: var(--filter-glass-bg);
  backdrop-filter: var(--filter-glass-blur);
  -webkit-backdrop-filter: var(--filter-glass-blur);
  border-radius: var(--filter-radius);
  border: var(--filter-glass-border);
  box-shadow: var(--filter-glass-shadow);
}

.quick-filter-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--filter-text-secondary);
  white-space: nowrap;
}

.quick-filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-filter-tag {
  padding: 8px 16px;
  background: var(--filter-bg-primary);
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  color: var(--filter-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--filter-transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}

.quick-filter-tag:hover {
  border-color: var(--filter-text-accent);
  color: var(--filter-text-accent);
  transform: translateY(-1px);
}

.quick-filter-tag.active {
  background: var(--filter-accent-gradient);
  border-color: transparent;
  color: var(--filter-text-white);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

/* عداد الفلاتر الأنيق */
.elegant-filter-counter {
  width: 100% !important;
  max-width: 100% !important;
  flex: none !important;
  order: 2 !important;
  background: var(--filter-accent-gradient);
  color: var(--filter-text-white);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--filter-shadow-heavy);
  position: relative;
  overflow: hidden;
  margin-top: var(--filter-padding);
  backdrop-filter: blur(10px);
  transition: var(--filter-transition);
}

.elegant-filter-counter:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 48px rgba(102, 126, 234, 0.4);
}

/* تأثير الإضاءة المتحركة */
.elegant-filter-counter::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  animation: pulse 4s ease-in-out infinite;
  pointer-events: none;
}

/* رأس العداد */
.elegant-filter-counter .counter-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  position: relative;
  z-index: 2;
  gap: 16px;
}

.elegant-filter-counter .counter-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--filter-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease;
}

.elegant-filter-counter:hover .counter-icon {
  transform: scale(1.1) rotate(5deg);
}

.elegant-filter-counter .counter-title {
  font-size: clamp(16px, 4vw, 18px);
  font-weight: 600;
  margin: 0;
  flex: 1;
}

/* محتوى العداد */
.elegant-filter-counter .counter-content {
  position: relative;
  z-index: 2;
}

.elegant-filter-counter .counter-number {
  font-size: clamp(28px, 8vw, 36px);
  font-weight: 700;
  display: block;
  margin-bottom: 8px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background: linear-gradient(45deg, #ffffff, #f0f0f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.elegant-filter-counter .counter-label {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 16px;
  font-weight: 500;
}

.elegant-filter-counter .counter-details {
  font-size: 12px;
  opacity: 0.8;
  line-height: 1.5;
}

/* شريط التقدم */
.elegant-filter-counter .progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  margin-top: 16px;
  overflow: hidden;
  position: relative;
  z-index: 2;
}

.elegant-filter-counter .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffffff, rgba(255, 255, 255, 0.8));
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  position: relative;
}

.elegant-filter-counter .progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

/* زر تحديث البيانات */
.refresh-data-btn {
  background: var(--filter-success-gradient);
  color: var(--filter-text-white);
  border: none;
  padding: 12px 24px;
  border-radius: var(--filter-radius-small);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--filter-transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(40, 167, 69, 0.2);
  margin-top: var(--filter-gap-small);
  position: relative;
  overflow: hidden;
}

.refresh-data-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.refresh-data-btn:hover::before {
  left: 100%;
}

.refresh-data-btn:hover {
  background: linear-gradient(135deg, #218838 0%, #1ba085 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}

.refresh-data-btn:active {
  transform: translateY(0);
}

.refresh-data-btn .icon {
  font-size: 16px;
  transition: transform 0.3s ease;
}

.refresh-data-btn:hover .icon {
  transform: rotate(180deg);
}

/* إشعارات التحديث */
.update-notification {
  background: var(--filter-info-gradient);
  color: var(--filter-text-white);
  padding: 16px 20px;
  border-radius: var(--filter-radius-small);
  margin: var(--filter-gap-small) 0;
  box-shadow: 0 4px 16px rgba(23, 162, 184, 0.2);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.update-notification::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: rgba(255, 255, 255, 0.3);
}

.update-notification .notification-icon {
  font-size: 20px;
  flex-shrink: 0;
  animation: bounce 2s infinite;
}

.update-notification .notification-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
}

/* أنواع الإشعارات */
.update-notification.success {
  background: var(--filter-success-gradient);
}

.update-notification.error {
  background: var(--filter-danger-gradient);
}

.update-notification.warning {
  background: var(--filter-warning-gradient);
  color: var(--filter-text-dark);
}

/* الحركات والتأثيرات */
@keyframes gradientMove {
  0%, 100% { 
    background-position: 0% 50%; 
  }
  50% { 
    background-position: 100% 50%; 
  }
}

@keyframes pulse {
  0%, 100% { 
    opacity: 0.5; 
    transform: scale(1); 
  }
  50% { 
    opacity: 1; 
    transform: scale(1.05); 
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% { 
    transform: translateX(-100%); 
  }
  100% { 
    transform: translateX(100%); 
  }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-4px);
  }
  60% {
    transform: translateY(-2px);
  }
}

/* التصميم المتجاوب */
@media (max-width: 1024px) {
  .filters-with-counter {
    grid-template-columns: 1fr !important; /* stack on small screens */
    gap: var(--filter-gap) !important;
  }
  
  /* Reset grid columns when stacked */
  .filters-with-counter .filter-stats-card,
  .filters-with-counter .filters {
    grid-column: auto !important;
  }
  
  .filter-stats-card {
    order: -1;
    margin-bottom: var(--filter-gap);
  }
}

@media (max-width: 768px) {
  .filters-with-counter {
    grid-template-columns: 1fr !important;
    gap: var(--filter-gap-small) !important;
  }
  
  .filters {
    grid-template-columns: 1fr !important;
    gap: var(--filter-gap-small) !important;
  }
  
  .filter-group {
    grid-column: 1 / -1 !important;
  }
  
  .filters select, 
  .filters input {
    max-width: 100%;
  }
  
  .filters-container {
    padding: var(--filter-padding-small);
  }
  
  .filter-stats-card {
    padding: var(--filter-padding-small);
    min-height: 120px;
    order: -1;
    margin-bottom: var(--filter-gap);
  }
  
  .filter-stats-number {
    font-size: 2rem !important;
  }
  
  .filter-stats-label {
    font-size: 0.8rem !important;
  }
  
  .filter-stats-description {
    font-size: 0.75rem !important;
  }
  
  .elegant-filter-counter {
    padding: var(--filter-padding-small);
  }
  
  .elegant-filter-counter .counter-header {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .filters-container {
    padding: var(--filter-padding-tiny);
    margin-bottom: var(--filter-gap-small);
  }
  
  .elegant-filter-counter {
    padding: var(--filter-padding-tiny);
    border-radius: var(--filter-radius-small);
  }
  
  .simple-filter-counter {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
  
  .refresh-data-btn {
    width: 100%;
    justify-content: center;
  }
}

/* تأثيرات الريبل والتفاعل */
.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* تأثيرات الأوفرلاي للموبايل */
.filters-overlay-active::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  backdrop-filter: blur(4px);
}

.filters-overlay-active #filters-container {
  z-index: 999;
  position: relative;
}

/* تحسينات إمكانية الوصول */
@media (prefers-reduced-motion: reduce) {
  .filters-container::before,
  .elegant-filter-counter::before,
  .elegant-filter-counter .counter-icon,
  .refresh-data-btn .icon,
  .update-notification .notification-icon,
  .elegant-filter-counter .progress-fill::after {
    animation: none;
  }
  
  .elegant-filter-counter:hover,
  .refresh-data-btn:hover {
    transform: none;
  }
}

/* تحسينات الطباعة */
@media print {
  .filters-container,
  .elegant-filter-counter,
  .update-notification {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
  
  .filters-container::before,
  .elegant-filter-counter::before,
  .refresh-data-btn::before,
  .update-notification::before {
    display: none;
  }
  
  .refresh-data-btn {
    display: none;
  }
}

/* ===== زر قمع الفلترة القابل للطي ===== */

/* حاوية زر الفلترة */
.filter-toggle-container {
  width: 100%;
  margin-bottom: var(--filter-gap);
  display: flex;
  justify-content: center;
}

/* زر قمع الفلترة الرئيسي */
.filter-toggle-btn {
  background: var(--filter-accent-gradient);
  color: var(--filter-text-white);
  border: none;
  border-radius: var(--filter-radius);
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--filter-transition);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--filter-shadow-medium);
  position: relative;
  overflow: hidden;
  min-width: 200px;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* تأثير الإضاءة المتحركة */
.filter-toggle-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s ease;
}

.filter-toggle-btn:hover::before {
  left: 100%;
}

/* حالة التمرير */
.filter-toggle-btn:hover {
  background: linear-gradient(135deg, #3730a3 0%, #6366f1 100%);
  transform: translateY(-3px) scale(1.05);
  box-shadow: var(--filter-shadow-heavy);
}

/* حالة النشاط */
.filter-toggle-btn:active {
  transform: translateY(-1px) scale(1.02);
}

/* أيقونة القمع */
.filter-toggle-btn .filter-icon {
  width: 20px;
  height: 20px;
  transition: var(--filter-transition);
}

/* نص الفلاتر */
.filter-toggle-btn .filter-text {
  font-weight: 700;
  font-size: 16px;
}

/* أيقونة السهم */
.filter-toggle-btn .chevron-icon {
  width: 18px;
  height: 18px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* دوران السهم عند الفتح */
.filter-toggle-btn.active .chevron-icon {
  transform: rotate(180deg);
}

/* تأثيرات إضافية عند النشاط */
.filter-toggle-btn.active {
  background: var(--filter-success-gradient);
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.3);
}

.filter-toggle-btn.active .filter-icon {
  transform: scale(1.1) rotate(5deg);
}

/* حاوية الفلاتر القابلة للطي */
.filters {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(-20px);
}

/* حالة الفتح */
.filters.show {
  max-height: 1000px;
  opacity: 1;
  transform: translateY(0);
  margin-bottom: var(--filter-gap);
}

/* تأثيرات الظهور المتدرج للعناصر */
.filters.show .filter-group {
  animation: slideInUp 0.5s ease-out forwards;
}

.filters.show .filter-group:nth-child(1) { animation-delay: 0.1s; }
.filters.show .filter-group:nth-child(2) { animation-delay: 0.2s; }
.filters.show .filter-group:nth-child(3) { animation-delay: 0.3s; }
.filters.show .filter-group:nth-child(4) { animation-delay: 0.4s; }
.filters.show .filter-group:nth-child(5) { animation-delay: 0.5s; }
.filters.show .filter-group:nth-child(6) { animation-delay: 0.6s; }
.filters.show .filter-group:nth-child(7) { animation-delay: 0.7s; }

/* حركة الظهور */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* تحسينات للتصميم المتجاوب */
@media (max-width: 768px) {
  .filter-toggle-btn {
    min-width: 180px;
    padding: 14px 20px;
    font-size: 14px;
  }
  
  .filter-toggle-btn .filter-icon,
  .filter-toggle-btn .chevron-icon {
    width: 16px;
    height: 16px;
  }
  
  .filter-toggle-btn .filter-text {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .filter-toggle-btn {
    min-width: 160px;
    padding: 12px 16px;
    font-size: 13px;
  }
  
  .filter-toggle-container {
    margin-bottom: var(--filter-gap-small);
  }
}

/* منع تأثير أنماط التبويبات على توزيع شبكة الفلاتر والبطاقة */
#filters-tab .filters-with-counter { display: grid !important; }
#filters-tab .filters-with-counter .filter-stats-card { position: relative !important; }
#filters-tab .filters-with-counter .filters { position: relative !important; }

/* ——— إصلاحات خاصة بتبويب الفلاتر (#filters-tab) ——— */
/* إخفاء جميع العناوين في تبويب الفلاتر */
#filters-tab .filters label { 
  display: none !important; 
}

/* جعل الحقول تتمدد لتملا المساحة المتاحة وإلغاء الخلفيات المضافة */
#filters-tab .filters select, 
#filters-tab .filters input { 
  flex: 1 1 auto !important; 
  width: 100% !important; 
  max-width: 100% !important; 
  background-image: none !important; 
  padding-right: 16px !important; 
  appearance: auto !important; 
  -webkit-appearance: auto !important; 
  -moz-appearance: auto !important; 
}

/* إلغاء المؤشر الزخرفي بجانب عناوين الحقول داخل تبويب الفلاتر فقط */
#filters-tab .filters label::before { display: none !important; }

/* تحسين مسافات النموذج لتقليل المساحة الفارغة */
#filters-tab .filters { 
  gap: 12px !important; 
}

/* ===== شريط شرائح الفلاتر المفعّلة ===== */
.active-filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 12px 0 16px;
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #6366f1;
  border: 1px solid #4f46e5;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-chip .chip-label {
  font-weight: 600;
  color: #ffffff;
}

.filter-chip .chip-value {
  color: #e0e7ff;
}

.filter-chip .chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all .2s ease;
}

.filter-chip .chip-remove:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  transform: scale(1.1);
}

.clear-filters-btn {
    margin-inline-start: auto;
    padding: 8px 12px;
}

/* ===== واجهة اختيار الحقول للطباعة ===== */
.print-fields-controls {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin: 16px 0;
    overflow: hidden;
}

.print-fields-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
}

.print-fields-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #334155;
}

.toggle-print-fields {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition-fast);
}

.toggle-print-fields:hover {
    background: #e2e8f0;
    color: #475569;
}

.print-fields-content {
    padding: 20px;
}

.available-fields-section h5,
.custom-fields-section h5 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
}

.available-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.field-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.field-checkbox:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.field-checkbox input[type="checkbox"] {
    margin: 0;
}

.field-checkbox span {
    font-size: 14px;
    color: #334155;
}

.custom-fields-container {
    margin-bottom: 20px;
}

.add-custom-field {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.custom-field-name {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
}

.add-custom-field-btn {
    padding: 8px 16px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
}

.add-custom-field-btn:hover {
    background: #2563eb;
}

.custom-fields-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-field-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.custom-field-name-display {
    flex: 1;
    font-size: 14px;
    color: #334155;
}

.remove-custom-field {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.remove-custom-field:hover {
    background: #dc2626;
}

.print-actions {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

/* تصميم متجاوب */
@media (max-width: 768px) {
    .available-fields-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .add-custom-field {
        flex-direction: column;
    }
    
    .print-fields-header {
        padding: 12px 16px;
    }
    
    .print-fields-content {
        padding: 16px;
    }
}

/* ===== إزالة الأسهم من القوائم المنسدلة داخل الفلاتر ===== */
.filters select {
  background-image: none !important;       /* لا رموز SVG */
  padding-right: 12px !important;          /* إعادة ضبط الفراغ يمين */
  -webkit-appearance: none !important;     /* إخفاء السهم الافتراضي */
  -moz-appearance: none !important;
  appearance: none !important;
}
/* إخفاء سهم IE/Edge القديم */
.filters select::-ms-expand { display: none; }


