@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&display=swap');

:root {
  --sidebar-width: 260px;
  --primary: #1a6b4e;
  --primary-light: #2d9a6f;
  --primary-dark: #0d4a35;
  --secondary: #1a4e7a;
  --dark: #0f172a;
  --light: #f8fafc;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border: #e2e8f0;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Cairo', sans-serif;
  direction: rtl;
  text-align: right;
  background-color: var(--light);
  color: var(--text-dark);
}

a {
  text-decoration: none;
  color: inherit;
}

/* تخطيط لوحة التحكم Admin Layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* الشريط الجانبي Sidebar (Right-side in RTL) */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--dark);
  color: #94a3b8;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 24px;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.sidebar-brand img {
  height: 40px;
}

.sidebar-brand h2 {
  font-size: 1.05rem;
  font-weight: 800;
}

.sidebar-menu {
  flex: 1;
  padding: 20px 0;
  overflow-y: auto;
}

.menu-section-label {
  padding: 10px 24px;
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1px;
  color: #475569;
}

.menu-item a {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
  border-right: 4px solid transparent;
}

.menu-item a:hover, .menu-item.active a {
  color: #fff;
  background: #1e293b;
  border-right-color: var(--primary);
}

.menu-item i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid #1e293b;
}

.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}

.logout-btn:hover {
  background: #dc2626;
}

/* المحتوى الرئيسي Main Content */
.admin-main {
  flex: 1;
  margin-right: var(--sidebar-width);
  padding: 30px;
  min-width: 0; /* يمنع تمدد العناصر خارج الشاشة */
}

/* الهيدر العلوي */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  background: #fff;
  padding: 15px 30px;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
  border: 1px solid var(--border);
}

.header-title h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
}

.header-title span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(26, 107, 78, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* لوحة الإحصائيات (الرئيسية) Dashboard cards */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-info h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 8px;
}

.stat-info p {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-dark);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.primary { background: rgba(26,107,78,0.1); color: var(--primary); }
.stat-icon.secondary { background: rgba(26,78,122,0.1); color: var(--secondary); }
.stat-icon.warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-icon.danger { background: rgba(239,68,68,0.1); color: var(--danger); }

/* الجداول وسجلات البيانات */
.admin-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
  margin-bottom: 30px;
  overflow: hidden;
}

.card-header {
  padding: 20px 30px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-dark);
}

.card-body {
  padding: 30px;
}

/* أزرار العمليات */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: var(--transition);
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; border-radius: 4px; }

/* تصميم الجداول */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
}

.table th, .table td {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.table th {
  background: #f8fafc;
  font-weight: 800;
  color: var(--text-muted);
}

.table tr:hover td {
  background: #f8fafc;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-success { background: rgba(16,185,129,0.1); color: var(--success); }
.badge-danger { background: rgba(239,68,68,0.1); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.1); color: var(--warning); }

.table-actions {
  display: flex;
  gap: 8px;
}

/* النماذج الإدارية Admin Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,107,78,0.1);
}

/* معاينة الصورة المرفوعة */
.image-preview {
  width: 150px;
  height: 100px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f8fafc;
  padding: 8px;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

/* شاشة تسجيل الدخول */
.login-body {
  background: linear-gradient(135deg, var(--primary-dark), var(--secondary));
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 25px;
}

.login-logo img {
  height: 70px;
}

.login-card h2 {
  font-size: 1.25rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 30px;
  color: var(--primary);
}

/* تنبيهات */
.alert {
  padding: 15px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.alert-success { background: rgba(16,185,129,0.1); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.alert-danger { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }

/* موبايل وتجاوب */
@media (max-width: 992px) {
  .admin-sidebar {
    transform: translateX(100%);
  }
  .admin-sidebar.active {
    transform: translateX(0);
  }
  .admin-main {
    margin-right: 0;
  }
}
