/* الخطوط والقواعد الأساسية */
html {
  font-size: 14px;
  direction: rtl;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, 'Cairo', sans-serif;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background-color: #f8f9fa;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* تنسيق المنيو الرئيسي */
.main-navbar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
  padding: 0;
}

.navbar-brand {
  font-weight: bold;
  font-size: 1.5rem;
  color: white !important;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* منيو التنقل الجانبي */
.sidebar {
  position: fixed;
  top: 76px;
  right: 0;
  height: calc(100vh - 76px);
  width: 280px;
  background: white;
  box-shadow: -2px 0 5px rgba(0,0,0,.1);
  transform: translateX(280px);
  transition: transform 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
}

.sidebar.show {
  transform: translateX(0);
}

.sidebar-toggle {
  background: none;
  border: none;
  color: white;
  font-size: 1.2rem;
  padding: 8px 12px;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.sidebar-toggle:hover {
  background-color: rgba(255,255,255,0.1);
  color: white;
}

.sidebar-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px 20px;
  border-bottom: 1px solid #e9ecef;
}

.sidebar-header h5 {
  margin: 0;
  font-weight: 600;
}

/* قوائم المنيو */
.nav-section {
  margin: 15px 0;
}

.nav-section-title {
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e9ecef;
  margin-bottom: 5px;
}

.nav-item-custom {
  margin: 2px 10px;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: #495057;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.nav-link-custom:hover {
  background-color: #f8f9fa;
  color: #667eea;
  text-decoration: none;
  transform: translateX(-3px);
}

.nav-link-custom.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.nav-link-custom i {
  margin-left: 12px;
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

/* المحتوى الرئيسي */
.main-content {
  margin-right: 0;
  transition: margin-right 0.3s ease;
  min-height: calc(100vh - 76px);
}

.sidebar.show ~ .main-content {
  margin-right: 280px;
}

/* البطاقات والعناصر */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
}

.card-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px 12px 0 0 !important;
  font-weight: 600;
}

/* الأزرار المطورة */
.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.btn-success {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-weight: 500;
}

.btn-warning {
  background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
  border: none;
  border-radius: 8px;
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, #dc3545 0%, #e83e8c 100%);
  border: none;
  border-radius: 8px;
}

/* الجداول المطورة */
.table {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

.table thead th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  font-weight: 600;
  text-align: center;
}

.table tbody tr {
  transition: background-color 0.3s ease;
}

.table tbody tr:hover {
  background-color: #f8f9fa;
}

/* شاشة التراكب عند فتح المنيو */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.overlay.show {
  opacity: 1;
  visibility: visible;
}

/* تخصيص للشاشات الصغيرة */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    transform: translateX(100%);
  }
  
  .sidebar.show ~ .main-content {
    margin-right: 0;
  }
  
  .main-content {
    margin-right: 0;
  }
}

/* تحسينات للنصوص العربية */
.text-arabic {
  font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.8;
}

/* إحصائيات لوحة التحكم */
.stats-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  padding: 25px;
  text-align: center;
  transition: transform 0.3s ease;
}

.stats-card:hover {
  transform: translateY(-5px);
}

.stats-card h3 {
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 10px;
}

.stats-card p {
  margin: 0;
  font-size: 1.1rem;
  opacity: 0.9;
}