/* تنسيق زر الرجوع للمتجر */
.btn-back-home {
  background-color: #e8f5e9 !important; /* خلفية خضراء فاتحة */
  color: #2e7d32 !important; /* نص أخضر غامق */
  border: 1px solid #c8e6c9 !important;
  font-weight: 800 !important;
  margin-top: 10px;
  transition: all 0.3s ease;
}
/* =========================================
   الوضع المظلم (Dark Mode)
========================================= */
/* المتغيرات الأساسية للوضع المظلم */
body.dark-mode {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #aaa;
    --border-color: #333;
    background-color: var(--bg-color);
    color: var(--text-main);
}

body.dark-mode .sidebar {
    background-color: #1a1a1a;
    border-left: 1px solid var(--border-color);
}

body.dark-mode .nav-link { color: #bbb; }
body.dark-mode .nav-link:hover, body.dark-mode .nav-link.active {
    background-color: #333;
    color: #fff;
}

body.dark-mode .main-header {
    background-color: #1a1a1a;
    border-bottom: 1px solid var(--border-color);
}

body.dark-mode #darkModeToggle { color: #FFD700 !important; } /* لون أيقونة الشمس */

body.dark-mode .data-table th { background-color: #2c2c2c; color: #fff; }
body.dark-mode .data-table td { border-bottom: 1px solid var(--border-color); }
body.dark-mode .data-table tr:hover { background-color: #252525; }

body.dark-mode input, body.dark-mode select, body.dark-mode .modal-content {
    background-color: #2c2c2c;
    color: #fff;
    border-color: #444;
}

body.dark-mode .modal-content h3 { color: #fff; border-bottom-color: #444; }
.btn-back-home:hover {
  background-color: #c8e6c9 !important; /* تغميق اللون عند الوقوف عليه */
  transform: translateX(-5px); /* حركة بسيطة لليمين */
}

.btn-back-home i {
  color: #2e7d32 !important;
}
.draggable-row {
  cursor: grab;
  background: #fff;
  transition: transform 0.2s, box-shadow 0.2s;
}

/* شكل الصف أثناء السحب */
.draggable-row.dragging {
  opacity: 0.5;
  background: #e3f2fd;
  border: 2px dashed #2196f3;
}

/* مقبض السحب (الأيقونة) */
.drag-handle {
  cursor: grab;
  color: #999;
  font-size: 1.2rem;
  padding: 15px !important;
  text-align: center !important;
}

.drag-handle:active {
  cursor: grabbing;
  color: #333;
}

/* (تنسيقات CSS كما هي) */
:root {
  --accent-gold: #ff9d00;
  --text-main: #111111;
  --danger-color: #f44336;
  --success-color: #4caf50;
  /* 💡 إضافة ألوان للحالات الجديدة في الداشبورد */
  --status-review: #ff9800; /* برتقالي لـ "قيد المراجعة" */
  --status-processing: #2196f3; /* أزرق لـ "قيد التجهيز" */
  --status-completed: #4caf50; /* أخضر لـ "منتهى" */
  --status-canceled: #f44336; /* أحمر لـ "ملغى" */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Almarai", sans-serif;
}

body {
  background-color: #f4f7f6;
  direction: rtl;
}

.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* الشريط الجانبي (Sidebar) */
.sidebar {
  width: 250px;
  background-color: #ffffff;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.sidebar .logo img {
  max-width: 100%;
  height: 40px;
  margin-bottom: 30px;
}

.nav-menu a {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  margin-bottom: 10px;
  color: #444;
  text-decoration: none;
  font-weight: 600;
  border-radius: 8px;
  transition: 0.3s;
}

.nav-menu a i {
  margin-left: 10px;
  font-size: 1.1rem;
}

.nav-menu a:hover,
.nav-menu a.active {
  background-color: #fff3cd;
  color: var(--accent-gold);
}

.main-content {
  flex-grow: 1;
  padding: 20px 30px;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  margin-bottom: 30px;
  border-bottom: 1px solid #eee;
}

.main-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #333;
}

/* الأقسام الداخلية */
.dashboard-section {
  background-color: #fff;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  margin-bottom: 30px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.section-header input[type="text"] {
  padding: 8px 15px;
  border: 1px solid #ddd;
  border-radius: 20px;
  width: 300px;
  font-size: 0.9rem;
}

/* تنسيق الجدول */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px;
  text-align: right;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9rem;
}

.data-table th {
  background-color: #f8f8f8;
  color: #555;
  font-weight: 700;
}

/* أزرار الإجراءات */
.btn-action {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  margin-left: 8px;
  transition: 0.3s;
}

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

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

.btn-view {
  background-color: #2196f3;
  color: white;
}

.btn-primary {
  padding: 10px 20px;
  background-color: var(--accent-gold);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  transition: 0.3s;
}

.btn-primary:hover {
  opacity: 0.9;
}

.hidden {
  display: none !important;
}

/* مودال (النافذة المنبثقة) */
.modal {
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: #fff;
  padding: 30px;
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  position: relative;
}

.modal-content h3 {
  margin-bottom: 20px;
}

.close-btn {
  position: absolute;
  left: 15px;
  top: 15px;
  font-size: 24px;
  cursor: pointer;
}

.modal-content button {
  margin-top: 20px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
  margin-left: 10px;
}

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

/* حالة الطلب في الجدول */
.status-badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: bold;
}

/* 💡 تحديث الألوان لتعكس الحالات الأربعة الجديدة */
.status-قيد_المراجعة {
  background-color: #fff3cd;
  color: #cc8400; /* برتقالي */
}

.status-قيد_التجهيز {
  background-color: #e3f2fd;
  color: #2196f3; /* أزرق */
}

.status-منتهى {
  background-color: #e8f5e9;
  color: #2e7d32; /* أخضر */
}

.status-ملغى {
  background-color: #ffebee;
  color: #c62828; /* أحمر */
}

@media (max-width: 768px) {
  .dashboard-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    padding: 10px;
  }

  .main-content {
    padding: 15px;
  }

  .main-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-header input {
    width: 100%;
  }

  .orders-table-container,
  .stock-table-container {
    overflow-x: auto;
  }

  .data-table {
    min-width: 600px; /* لضمان عرض مناسب للجدول */
  }
}
/* تنسيق قائمة المنتجات داخل المودال */
.product-list-container {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 15px;
  background-color: #fff;
  max-height: 300px;
  overflow-y: auto;
}

.product-item {
  padding: 10px 0;
  border-bottom: 1px solid #e0e0e0; /* الخط الرفيع الفاصل */
  color: #333;
  font-size: 0.95rem;
  line-height: 1.6;
  display: flex;
  justify-content: space-between; /* لو حبيت تفصل السعر عن الاسم مستقبلاً */
}

/* إزالة الخط من آخر منتج */
.product-item:last-of-type {
  border-bottom: none;
}

/* تمييز السطور الخاصة بالشحن والخصم */
.summary-item {
  background-color: #f9f9f9;
  padding: 8px 10px;
  border-radius: 5px;
  margin-top: 5px;
  font-weight: bold;
  color: #555;
  font-size: 0.9rem;
  border: 1px dashed #ccc;
}
/* ================================================= */
/* 📱 تجميعة تنسيقات الموبايل الشاملة (Dashboard Mobile) */
/* ================================================= */
@media (max-width: 768px) {
  /* 1. تخطيط الصفحة والقائمة العلوية */
  .dashboard-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    padding: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    z-index: 100;
  }

  .sidebar .logo img {
    height: 35px;
    margin-bottom: 15px;
  }

  /* القائمة تكون أفقية مع سكرول */
  .nav-menu {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
  }

  .nav-menu a {
    white-space: nowrap;
    font-size: 0.85rem;
    padding: 10px 15px;
    margin: 0;
    background: #f9f9f9;
    flex: 1;
    justify-content: center;
    border: 1px solid #eee;
  }

  /* 2. المحتوى الرئيسي والأزرار */
  .main-content {
    padding: 15px;
    width: 100%;
  }

  .main-header,
  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 20px;
  }

  .main-header h1 {
    font-size: 1.5rem;
  }

  .section-header input[type="text"] {
    width: 100%;
    font-size: 1rem;
    padding: 12px;
  }

  .btn-primary {
    width: 100%;
    padding: 12px;
  }

  /* 3. ⚡ جدول الطلبات (إظهار الرقم والزر فقط) ⚡ */
  .orders-table-container {
    overflow-x: hidden;
    border: 1px solid #eee;
    border-radius: 8px;
  }

  .orders-table-container .data-table {
    width: 100%;
    min-width: auto;
    border-collapse: collapse;
  }

  /* إخفاء كل الأعمدة ما عدا الأول (الرقم) والأخير (الزر) */
  .orders-table-container .data-table th:not(:first-child):not(:last-child),
  .orders-table-container .data-table td:not(:first-child):not(:last-child) {
    display: none !important;
  }

  /* تنسيق الخلايا المتبقية */
  .orders-table-container .data-table th,
  .orders-table-container .data-table td {
    padding: 15px 10px;
    text-align: center;
    border-bottom: 1px solid #eee;
  }

  /* عمود رقم الطلب */
  .orders-table-container .data-table td:first-child {
    width: 35%;
    font-weight: 800;
    font-size: 0.95rem;
    color: #333;
  }

  /* عمود الزر */
  .orders-table-container .data-table td:last-child {
    width: 65%;
  }

  .btn-view {
    width: 100% !important;
    padding: 10px !important;
    font-size: 0.9rem !important;
    background-color: #2196f3;
    color: white;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
  }

  /* 4. 📦 جدول المخزون (سكرول عشان تقدر تعدل الكميات) 📦 */
  .stock-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .stock-table-container .data-table {
    min-width: 600px; /* ضمان عرض مناسب للخانات */
  }

  /* 5. 🔍 النافذة المنبثقة (Modal) */
  .modal-content {
    width: 95% !important;
    max-width: none !important;
    padding: 20px !important;
    margin: 10px auto;
    border-radius: 15px;
    max-height: 85vh;
    overflow-y: auto; /* سكرول داخلي للنافذة */
  }

  #modalOrderDetails {
    font-size: 0.95rem;
  }

  .product-list-container {
    max-height: 200px;
  }

  /* أزرار الإجراءات تحت بعض */
  #modalActions {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  #modalActions div {
    /* لو الأزرار جوه div */
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  #modalActions button {
    width: 100%;
    margin: 0;
    padding: 12px;
    font-size: 1rem;
  }
}