/**
 * ملف CSS الموحد للنظام
 * يحتوي على جميع الأنماط المشتركة بين صفحات النظام
 */

/* ===== المتغيرات ===== */
:root {
  /* الألوان الأساسية */
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #818cf8;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --primary-300: #a5b4fc;
  --primary-400: #818cf8;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;
  --primary-800: #3730a3;
  --primary-900: #312e81;

  /* الألوان الثانوية */
  --secondary: #f59e0b;
  --secondary-dark: #d97706;
  --secondary-light: #fbbf24;
  --secondary-50: #fffbeb;
  --secondary-100: #fef3c7;
  --secondary-200: #fde68a;
  --secondary-300: #fcd34d;
  --secondary-400: #fbbf24;
  --secondary-500: #f59e0b;
  --secondary-600: #d97706;
  --secondary-700: #b45309;
  --secondary-800: #92400e;
  --secondary-900: #78350f;

  /* ألوان الحالات */
  --success: #10b981;
  --success-light: #34d399;
  --success-dark: #059669;
  --success-50: #ecfdf5;
  --success-100: #d1fae5;
  --success-200: #a7f3d0;
  --success-300: #6ee7b7;
  --success-400: #34d399;
  --success-500: #10b981;
  --success-600: #059669;
  --success-700: #047857;
  --success-800: #065f46;
  --success-900: #064e3b;

  --danger: #ef4444;
  --danger-light: #f87171;
  --danger-dark: #dc2626;
  --danger-50: #fef2f2;
  --danger-100: #fee2e2;
  --danger-200: #fecaca;
  --danger-300: #fca5a5;
  --danger-400: #f87171;
  --danger-500: #ef4444;
  --danger-600: #dc2626;
  --danger-700: #b91c1c;
  --danger-800: #991b1b;
  --danger-900: #7f1d1d;

  --warning: #f59e0b;
  --warning-light: #fbbf24;
  --warning-dark: #d97706;
  --warning-50: #fffbeb;
  --warning-100: #fef3c7;
  --warning-200: #fde68a;
  --warning-300: #fcd34d;
  --warning-400: #fbbf24;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --warning-700: #b45309;
  --warning-800: #92400e;
  --warning-900: #78350f;

  --info: #3b82f6;
  --info-light: #60a5fa;
  --info-dark: #2563eb;
  --info-50: #eff6ff;
  --info-100: #dbeafe;
  --info-200: #bfdbfe;
  --info-300: #93c5fd;
  --info-400: #60a5fa;
  --info-500: #3b82f6;
  --info-600: #2563eb;
  --info-700: #1d4ed8;
  --info-800: #1e40af;
  --info-900: #1e3a8a;

  /* ألوان الرمادي */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* ألوان أخرى */
  --dark: #1e293b;
  --light: #f8fafc;

  /* خلفية القائمة الجانبية */
  --sidebar-bg: #0f1e3d;
  --sidebar-gradient: linear-gradient(135deg, #0f1e3d 0%, #1a365d 100%);

  /* الظلال والتأثيرات */
  --border-radius: 0.75rem;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

  /* الانتقالات */
  --transition: all 0.3s ease;
  --transition-slow: all 0.5s ease;
  --transition-fast: all 0.15s ease;
}

/* ===== الأنماط العامة ===== */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;600;700;800&display=swap');

body {
  font-family: 'Tajawal', sans-serif;
  background-color: var(--gray-100);
  color: var(--dark);
  overflow-x: hidden;
}

/* ===== القائمة الجانبية ===== */
aside {
  background: var(--sidebar-gradient);
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 30;
}

aside .logo-container {
  background: white;
  border-radius: var(--border-radius);
  padding: 0.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.8);
  position: relative;
  overflow: hidden;
  max-width: 75%;
  margin-left: auto;
  margin-right: auto;
  transform: translateY(0);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

aside .logo-container:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

aside .logo-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 50%, rgba(255,255,255,0.3) 100%);
  transform: translateX(-100%);
  transition: transform 1s ease;
}

aside .logo-container:hover::before {
  transform: translateX(100%);
}

.logo-reveal {
  animation: logoReveal 1.5s ease-out forwards;
}

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

aside nav a {
  border-radius: var(--border-radius);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

aside nav a:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

aside nav a.active {
  background-color: rgba(255, 255, 255, 0.2);
  position: relative;
}

aside nav a.active::before {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background-color: var(--secondary);
  border-radius: 0 4px 4px 0;
}

aside nav a i {
  transition: var(--transition);
}

aside nav a:hover i {
  transform: translateX(-5px);
}

/* ===== الشريط العلوي ===== */
.top-bar {
  background-color: white;
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.user-profile:hover {
  background-color: var(--gray-100);
}

.user-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  box-shadow: var(--shadow);
}

/* ===== البطاقات والأقسام ===== */
.card {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  background-color: var(--gray-50);
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  background-color: var(--gray-50);
}

/* ===== الأزرار ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  outline: none;
  box-shadow: var(--shadow);
  gap: 0.5rem;
  font-size: 0.875rem;
  height: 2.5rem;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.1);
  transition: width 0.3s ease;
  z-index: 0;
}

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

.btn i, .btn svg {
  margin-left: 0.5rem;
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease;
}

.btn:hover i, .btn:hover svg {
  transform: translateX(-3px);
}

.btn span {
  position: relative;
  z-index: 1;
}

/* أنواع الأزرار */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 10px -1px rgba(79, 70, 229, 0.4);
}

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

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.3);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, var(--secondary-dark) 0%, var(--secondary) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 10px -1px rgba(245, 158, 11, 0.4);
}

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

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background: linear-gradient(135deg, var(--success-dark) 0%, var(--success) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 10px -1px rgba(16, 185, 129, 0.4);
}

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

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: linear-gradient(135deg, var(--danger-dark) 0%, var(--danger) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 10px -1px rgba(239, 68, 68, 0.4);
}

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

.btn-info {
  background: linear-gradient(135deg, var(--info) 0%, var(--info-dark) 100%);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn-info:hover {
  background: linear-gradient(135deg, var(--info-dark) 0%, var(--info) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 10px -1px rgba(59, 130, 246, 0.4);
}

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

/* أحجام الأزرار */
.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  height: 2rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  height: 3rem;
}

/* أزرار مستديرة */
.btn-rounded {
  border-radius: 9999px;
}

/* أزرار شفافة */
.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  box-shadow: none;
}

.btn-outline-primary:hover {
  background-color: var(--primary);
  color: white;
}

.btn-outline-secondary {
  background: transparent;
  color: var(--secondary);
  border: 1px solid var(--secondary);
  box-shadow: none;
}

.btn-outline-secondary:hover {
  background-color: var(--secondary);
  color: white;
}

.btn-outline-success {
  background: transparent;
  color: var(--success);
  border: 1px solid var(--success);
  box-shadow: none;
}

.btn-outline-success:hover {
  background-color: var(--success);
  color: white;
}

.btn-outline-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  box-shadow: none;
}

.btn-outline-danger:hover {
  background-color: var(--danger);
  color: white;
}

.btn-outline-info {
  background: transparent;
  color: var(--info);
  border: 1px solid var(--info);
  box-shadow: none;
}

.btn-outline-info:hover {
  background-color: var(--info);
  color: white;
}

/* أزرار مسطحة */
.btn-flat {
  background: transparent;
  box-shadow: none;
}

.btn-flat-primary {
  color: var(--primary);
}

.btn-flat-primary:hover {
  background-color: var(--primary-50);
}

.btn-flat-secondary {
  color: var(--secondary);
}

.btn-flat-secondary:hover {
  background-color: var(--secondary-50);
}

.btn-flat-success {
  color: var(--success);
}

.btn-flat-success:hover {
  background-color: var(--success-50);
}

.btn-flat-danger {
  color: var(--danger);
}

.btn-flat-danger:hover {
  background-color: var(--danger-50);
}

.btn-flat-info {
  color: var(--info);
}

.btn-flat-info:hover {
  background-color: var(--info-50);
}

/* مجموعة الأزرار */
.btn-group {
  display: flex;
  gap: 0.5rem;
}

/* أزرار التصفية */
.filter-btn {
  display: inline-flex;
  align-items: center;
  background-color: var(--primary-50);
  color: var(--primary-dark);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  transition: var(--transition);
}

.filter-btn:hover {
  background-color: var(--primary-100);
}

.filter-btn i, .filter-btn svg {
  margin-left: 0.25rem;
}

/* ===== الجداول ===== */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th {
  background-color: var(--gray-50);
  font-weight: 600;
  text-align: right;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--gray-200);
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background-color: var(--gray-50);
}

/* ===== تأثيرات الحركة ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fadeIn {
  animation: fadeIn 0.5s ease forwards;
}

@keyframes logo-shine {
  0% {
    transform: scale(1) rotate(0deg);
    filter: brightness(1) drop-shadow(0 5px 15px rgba(0, 0, 0, 0.1));
  }
  25% {
    transform: scale(1.01) rotate(0.5deg);
    filter: brightness(1.05) drop-shadow(0 8px 20px rgba(0, 0, 0, 0.15));
  }
  50% {
    transform: scale(1.02) rotate(0deg);
    filter: brightness(1.1) drop-shadow(0 10px 25px rgba(0, 0, 0, 0.2));
  }
  75% {
    transform: scale(1.01) rotate(-0.5deg);
    filter: brightness(1.05) drop-shadow(0 8px 20px rgba(0, 0, 0, 0.15));
  }
  100% {
    transform: scale(1) rotate(0deg);
    filter: brightness(1) drop-shadow(0 5px 15px rgba(0, 0, 0, 0.1));
  }
}

.logo-animation {
  animation: logo-shine 6s ease-in-out infinite;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-radius: 8px;
  position: relative;
  z-index: 2;
  max-height: 100px;
  width: auto;
}

/* ===== تصميم متجاوب ===== */
@media (max-width: 768px) {
  aside {
    position: fixed;
    right: -280px;
    top: 0;
    height: 100vh;
    z-index: 50;
    width: 280px;
  }

  aside.active {
    right: 0;
  }

  .overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
  }

  .overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .main-content {
    margin-right: 0 !important;
  }
}
