/* === VARIABLES === */
:root {
  --sidebar-width: 200px;
  --sidebar-width-mobile: 250px;
  --topbar-height: 60px;
  --footer-height: 60px;
}

/* === RESET === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  background: #1f2a44;
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
.container {
  margin-top: 60px;
  flex: 1;
  min-height: calc(100vh 695.2px - 60px - 60px);
}

/* === TOPBAR === */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #2c3e50;
  padding: 10px 20px;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--topbar-height);
  z-index: 1000;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.profile-pic {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.topbar-icon {
  font-size: 20px;
  color: #ecf0f1;
  cursor: pointer;
  transition: color 0.3s ease;
}

.topbar-icon:hover {
  color: #3498db;
}

.logo {
  height: 30px;
  margin-left: 15px;
}

/* === USER DROPDOWN === */
.user-dropdown {
  position: relative;
  display: inline-block;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 5px;
  transition: background 0.3s ease;
}

.user-info:hover {
  background: #34495e;
}

.user-info .username {
  font-size: 14px;
  color: #ecf0f1;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #34495e;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  min-width: 200px;
  z-index: 1001;
  overflow: hidden;
}

.user-dropdown:hover .dropdown-menu {
  display: block;
}

.dropdown-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  color: #ecf0f1;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.3s ease;
}

.dropdown-btn:hover {
  background: #2980b9;
}

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-width);
  background: #2c3e50;
  padding: 20px;
  height: calc(100vh - var(--topbar-height));
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  z-index: 900;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
  transform: translateX(0);
}

.sidebar.hidden {
  transform: translateX(100%);
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.sidebar h3 {
  font-size: 20px;
  color: #3498db;
  border-bottom: 1px solid #7f8c8d;
  padding-bottom: 10px;
}

.toggle-sidebar {
  background: #3498db;
  color: white;
  border: none;
  padding: 5px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 5px;
  font-size: 18px;
}

.sidebar ul {
  list-style: none;
}

.sidebar ul li {
  margin-bottom: 10px;
}

.sidebar ul li a {
  color: #ecf0f1;
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 10px;
  border-radius: 5px;
  transition: background 0.3s ease, color 0.3s ease;
}

.sidebar ul li a:hover {
  background: #34495e;
  color: #3498db;
}

.sidebar ul li a.active {
  background: #3498db;
  color: #fff;
  font-weight: bold;
}

.sidebar-icon {
  margin-left: 10px;
  font-size: 18px;
}

/* === MAIN CONTENT === */
.main-content {
  flex: 1;
  padding: 20px;
  margin-right: calc(var(--sidebar-width) + 20px);
  transition: margin-right 0.3s ease;
}

body.sidebar-closed .main-content {
  margin-right: 0;
}

.breadcrumb {
  margin-bottom: 20px;
}

.breadcrumb span {
  color: #7f8c8d;
}

.breadcrumb h2 {
  margin-top: 5px;
}
/* === TABLE === */
.footer-container {
  background: #34495e; /* لون الخلفية */
  color: #ffffff; /* لون النص ليكون واضح على الخلفية */
  text-align: center; /* محاذاة النص في الوسط */
  padding: 12px;
  border-radius: 10px;
  font-size: 14px; /* حجم مناسب للفوتر */
  overflow-x: auto;
  margin-top: 20px; /* مسافة من المحتوى فوقه */
}

/* === TABLE === */
.table-container {
  background: #34495e;
  padding: 20px;
  border-radius: 10px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
}

th,
td {
  padding: 12px;
  vertical-align: middle !important;
  text-align: center !important;
  border-bottom: 1px solid #7f8c8d;
}

th {
  background: #1b2733;
}

td button {
  padding: 5px 10px;
  margin: 0 5px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}
td.action-buttons {
  /* لجعل اتجاه النص من اليمين لليسار */
  text-align: left;
  /* منع الالتفاف */
  display: flex;
  /* ترتيب العناصر أفقياً */
  flex-direction: row;
  /* ترتيب طبيعي (يسار لليمين داخل الـ flex) */
  gap: 5px;
  /* مسافة بين الأيقونات */
}

td.action-buttons span {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  font-size: 18px;
  /* حجم الأيقونات */
  /* لون الأيقونات */
  transition: color 0.2s ease;
}

td.action-buttons span:hover {
  color: #eead7bff;
  /* لون عند المرور بالفأرة */
}
/* زر عام - Flat */
.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  margin: 5px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  transition: background-color 0.3s ease, color 0.3s ease;
  background-color: #ddd; /* لون افتراضي لو نسيت إضافة كلاس */
  color: #fff;
  box-shadow: none; /* no shadow => flat */
}

.action-button:hover {
  background-color: #ccc; /* لون خفيف عند hover */
  color: #fff;
}

/* أزرار حسب الوظيفة - Flat */

/* زر إضافة */
.button-add {
  background-color: #28a745;
}

.button-add:hover {
  background-color: #218838;
}

/* زر تعديل */
.button-edit {
  background-color: #ffc107;
  color: #212529;
}

.button-edit:hover {
  background-color: #e0a800;
}

/* زر حذف */
.button-delete {
  background-color: #dc3545;
}

.button-delete:hover {
  background-color: #c82333;
}

/* زر عرض التفاصيل */
.button-view {
  background-color: #6c757d;
}

.button-view:hover {
  background-color: #5a6268;
}

/* زر تصدير */
.button-export {
  background-color: #17a2b8;
}

.button-export:hover {
  background-color: #138496;
}

/* زر حفظ */
.button-submit {
  background-color: #007bff;
}

.button-submit:hover {
  background-color: #0069d9;
}

/* زر إلغاء */
.button-cancel {
  background-color: #e0a800;
}

.button-cancel:hover {
  background-color: #937005;
}

/* زر بحث */
.button-search {
  background-color: #20c997;
}

.button-search:hover {
  background-color: #17a589;
}

/* زر طباعة */
.button-print {
  background-color: #6610f2;
}

.button-print:hover {
  background-color: #520dc2;
}

/* زر تحديث */
.button-refresh {
  background-color: #fd7e14;
}

.button-refresh:hover {
  background-color: #e8590c;
}

/* === FOOTER === */
.footer {
  display: flex;
  align-items: center;
  background: #2c3e50;
  padding: 10px 20px;
  position: relative;
  width: 100%;
  height: var(--footer-height);
  z-index: 1;
  margin-top: auto;
  margin-right: calc(var(--sidebar-width) + 20px);
  transition: margin-right 0.3s ease;
  justify-content: center;
  text-align: center;
}

body.sidebar-closed .footer {
  margin-right: 0;
}

.footer-links {
  display: flex;
  gap: 15px;
}

.footer-links a {
  color: #ecf0f1;
  text-decoration: none;
  font-size: 14px;
}

.footer-links a:hover {
  color: #3498db;
}

/* تصميم النموذج (Popup) */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000; /* نفس مستوى الشريط العلوي */
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: #34495e;
  padding: 20px;
  border-radius: 8px;
  width: 95%;
  max-width: 1000px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  text-align: right;
  position: relative;
  margin: auto; /* ✅ يضمن وجود مسافة من الأعلى والأسفل */
  max-height: 90vh; /* ✅ لا يتجاوز 90% من الشاشة */
  overflow-y: auto; /* ✅ يجعل محتوى modal نفسه قابل للتمرير */
  transform: scale(0.95);
  animation: modalPopIn 0.3s ease-out forwards;
}
.modal-title {
  text-align: center;
  font-size: 28px; /* حجم أكبر للعنوان */
  color: #ffffff; /* لون داكن للعنوان */
  margin-bottom: 5px; /* مسافة أكبر */
  font-weight: 700; /* خط سميك */
  position: relative;
  padding-bottom: 5px;
}

.modal-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px; /* خط قصير تحت العنوان */
  height: 3px;
  background-color: #3498db; /* لون مميز للخط */
  border-radius: 2px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalPopIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.close-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 24px;
  cursor: pointer;
  color: #ecf0f1;
}

/* === FORM === */
.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  color: #ecf0f1;
  font-size: 14px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid #7f8c8d;
  border-radius: 5px;
  background: #2c3e50;
  color: #ecf0f1;
  font-size: 16px;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #3498db;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr); /* 8 أعمدة متساوية */
  gap: 10px 20px; /* مسافة رأسية وأفقية متناسقة */
  margin-bottom: 20px;
}

/* الحقول التي تمتد عبر كل الأعمدة (صف كامل) */
.form-grid .full-width {
  grid-column: span 8;
}

/* الحقول التي تمتد على 2 أعمدة */
.form-grid .span-2-columns {
  grid-column: span 2;
}

/* الحقول التي تمتد على 3 أعمدة */
.form-grid .span-3-columns {
  grid-column: span 3;
}

/* الحقول التي تمتد على 4 أعمدة */
.form-grid .span-4-columns {
  grid-column: span 4;
}

/* الحقول التي تمتد على 5 أعمدة */
.form-grid .span-5-columns {
  grid-column: span 5;
}

@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* === FORM ACTIONS === */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.form-actions .submit-btn {
  background: #3498db;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

.form-actions .submit-btn:hover {
  background: #2980b9;
  transform: scale(1.05);
}

.form-actions .cancel-btn {
  background: #7f8c8d;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

.form-actions .cancel-btn:hover {
  background: #95a5a6;
  transform: scale(1.05);
}

/* === RESPONSIVE === */
@media (max-width: 992px) {
  .main-content,
  .footer {
    margin-right: 0;
  }

  .sidebar {
    width: var(--sidebar-width-mobile);
    transform: translateX(100%);
  }

  .sidebar.hidden {
    transform: translateX(0);
  }
}

@media (max-width: 480px) {
  .topbar {
    flex-direction: column;
    height: auto;
  }

  .sidebar {
    padding: 10px;
  }

  .export-btn,
  .add-btn {
    width: 100%;
  }

  .breadcrumb h2 {
    font-size: 16px;
  }
}
/* تنسيق حاوية الرأس (زر + بحث) */
.dt-header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 15px;
}

/* تنسيق مربع البحث */
div.dataTables_filter {
  order: 2; /* حتى يظهر على اليمين */
  margin-right: auto; /* يدفعه إلى أقصى اليمين */
  text-align: right;
}

div.dataTables_filter input {
  width: 250px;
  padding: 8px 12px;
  border: 2px solid #007bff;
  border-radius: 25px;
  font-size: 16px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  outline: none;
  box-shadow: none;
}

div.dataTables_filter input:focus {
  border-color: #0056b3;
  box-shadow: 0 0 8px rgba(0, 123, 255, 0.4);
}

div.dataTables_filter label {
  font-weight: 600;
  font-size: 16px;
  margin-left: 10px;
  color: #333;
  user-select: none;
}

/* أزرار التصدير */
div.dt-buttons {
  margin-top: 15px;
  text-align: left;
}
div.dt-buttons button {
  margin: 0 5px;
  padding: 8px 15px;
  border-radius: 6px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.25s ease;
}
div.dt-buttons button.buttons-excel {
  background-color: #27ae60;
  color: #fff;
}
div.dt-buttons button.buttons-excel:hover {
  background-color: #219150;
}
div.dt-buttons button.buttons-csv {
  background-color: #2980b9;
  color: #fff;
}
div.dt-buttons button.buttons-csv:hover {
  background-color: #1c5d8a;
}
div.dt-buttons button.buttons-pdf {
  background-color: #c0392b;
  color: #fff;
}
div.dt-buttons button.buttons-pdf:hover {
  background-color: #87221e;
}
div.dt-buttons button.buttons-print {
  background-color: #16a085;
  color: #fff;
}
div.dt-buttons button.buttons-print:hover {
  background-color: #117a67;
}

.view_details {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  padding: 20px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  color: #ecf0f1;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.view_details .detail-item {
  background-color: #34495e;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease, background-color 0.3s ease;
  cursor: default;
}

.view_details .detail-item:hover {
  background-color: #3d5a72;
  transform: translateY(-3px);
}

.view_details .detail-item i {
  color: #81a2be;
  font-size: 20px;
  flex-shrink: 0;
  width: 26px;
  text-align: center;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.4));
}

.view_details .detail-item span {
  flex-grow: 1;
  font-size: 15px;
  line-height: 1.4;
  user-select: text;
}

.view_details .detail-item span strong {
  font-weight: 600;
  color: #f5f7fa;
}

.view_details .detail-item span.not-available {
  font-style: italic;
  color: #7f8c8d;
}

.view_details .copyable {
  cursor: pointer;
  position: relative;
  user-select: text;
}

.view_details .copyable:hover::after {
  content: "نسخ";
  position: absolute;
  top: -26px;
  right: 0;
  background-color: #2980b9;
  color: white;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.8em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0.95;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

@media print {
  div {
    display: none;
  }
}
