/* ========================================
   تصميم موحد وأنيق لجميع صفحات النظام
   ======================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* خلفية متحركة - معطلة لتحسين الأداء */
/* body::before {
  content: '';
  position: fixed;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.1), transparent);
  border-radius: 50%;
  top: -200px;
  right: -200px;
  animation: float 20s infinite ease-in-out;
  z-index: 0;
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,0.08), transparent);
  border-radius: 50%;
  bottom: -250px;
  left: -250px;
  animation: float 25s infinite ease-in-out reverse;
  z-index: 0;
  pointer-events: none;
} */

/* @keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 40px) scale(1.15); }
} */

/* الحاوية الرئيسية */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
  position: relative;
  z-index: 1;
}

/* البطاقات */
.card {
  background: rgba(255, 255, 255, 0.98);
  /* backdrop-filter: blur(15px); معطل لتحسين الأداء */
  border-radius: 24px;
  padding: 35px;
  margin-bottom: 25px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.3);
  /* animation: slideIn 0.5s ease; معطل لتحسين الأداء */
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 15px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card h3 {
  font-size: 22px;
  font-weight: 600;
  color: #1e293b;
  margin: 25px 0 15px;
}

.card p {
  color: #64748b;
  line-height: 1.7;
  margin-bottom: 15px;
}

.card p.muted {
  font-size: 14px;
  color: #94a3b8;
}

/* الأزرار */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.btn-secondary {
  background: linear-gradient(135deg, #64748b, #475569);
  color: white;
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.btn-info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

/* النماذج */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 25px 0;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field label {
  font-weight: 600;
  color: #334155;
  font-size: 14px;
}

.form-field input,
.form-field select,
.form-field textarea {
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 15px;
  transition: all 0.3s ease;
  background: white;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-field textarea {
  resize: vertical;
  min-height: 100px;
}

/* الجداول */
.table-wrapper {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

thead {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

thead th {
  padding: 16px;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  position: sticky;
  top: 0;
  z-index: 10;
}

tbody td {
  padding: 14px;
  text-align: center;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

tbody tr {
  transition: all 0.2s ease;
}

tbody tr:hover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
  transform: scale(1.01);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* البطاقات الصغيرة (Stats) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 25px 0;
}

.stat-card {
  background: white;
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  border-color: #667eea;
  box-shadow: 0 12px 30px rgba(102, 126, 234, 0.2);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 15px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

.stat-label {
  font-size: 13px;
  color: white !important;
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: white !important;
}

.stat-card.success .stat-icon {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(22, 163, 74, 0.15));
}

.stat-card.success .stat-value {
  color: white !important;
}

.stat-card.warning .stat-icon {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.15), rgba(249, 115, 22, 0.15));
}

.stat-card.warning .stat-value {
  color: white !important;
}

.stat-card.danger .stat-icon {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.15));
}

.stat-card.danger .stat-value {
  color: white !important;
}

.stat-card.info .stat-icon {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.15));
}

.stat-card.info .stat-value {
  color: white !important;
}

/* الإشعارات */
.alert {
  padding: 16px 20px;
  border-radius: 12px;
  margin: 20px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}

.alert-success {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(22, 163, 74, 0.1));
  border: 2px solid #86efac;
  color: #166534;
}

.alert-warning {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.1), rgba(249, 115, 22, 0.1));
  border: 2px solid #fcd34d;
  color: #92400e;
}

.alert-danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
  border: 2px solid #fca5a5;
  color: #991b1b;
}

.alert-info {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.1));
  border: 2px solid #93c5fd;
  color: #1e40af;
}

/* شبكة البطاقات */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 25px 0;
}

.tile {
  background: white;
  border-radius: 18px;
  padding: 25px;
  text-decoration: none;
  color: inherit;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
}

.tile::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tile:hover::before {
  opacity: 1;
}

.tile:hover {
  transform: translateY(-8px);
  border-color: #667eea;
  box-shadow: 0 15px 35px rgba(102, 126, 234, 0.2);
}

.tile-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 15px;
  box-shadow: 0 6px 18px rgba(102, 126, 234, 0.3);
  position: relative;
  z-index: 1;
}

.tile-title {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.tile-text {
  font-size: 14px;
  color: #64748b;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.badge-success {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(22, 163, 74, 0.15));
  color: #16a34a;
}

.badge-danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.15));
  color: #dc2626;
}

.badge-warning {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.15), rgba(249, 115, 22, 0.15));
  color: #ea580c;
}

.badge-info {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.15));
  color: #2563eb;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 20px 15px;
  }

  .card {
    padding: 25px 20px;
    border-radius: 18px;
  }

  .card h2 {
    font-size: 22px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .grid {
    grid-template-columns: 1fr;
  }

  table {
    font-size: 13px;
  }

  thead th,
  tbody td {
    padding: 10px 8px;
  }
}

/* تحسينات إضافية */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #5568d3, #6a3d8f);
}

/* تأثيرات الحركة */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.fade-in {
  animation: fadeIn 0.5s ease;
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(102, 126, 234, 0.2);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
