/* ===========================
   Admin RTL – Arabic Only
   =========================== */

/* اتجاه عربي وخطوط مناسبة */
html[lang="ar"] body,
html[dir="rtl"] body {
  direction: rtl;
  text-align: right;
  font-family: "Cairo","Tajawal", system-ui, -apple-system, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* نص عام */
h1,h2,h3,h4,h5,h6 { text-align: right; }
p, label, small { text-align: right; }

/* جداول */
table th, table td,
.data-table th, .data-table td {
  text-align: right;
  vertical-align: middle;
}

/* أدوات محاذاة سريعة */
.text-start { text-align: right !important; }
.text-end   { text-align: left  !important; }

/* عناصر فورم */
input, select, textarea { text-align: right; }

/* روابط/قوائم عامة */
.nav, .menu, .sidebar, .admin-sidebar { direction: rtl; }

/* سايدبار شائع */
.sidebar { float: right; }
.content { margin-right: 260px; margin-left: 0; }

/* إن كان الاستايل الأصلي يضع حدًا يسارًا في العنصر النشط، اعكسه */
.nav-item        { border-right: 3px solid transparent; border-left: none; }
.nav-item.active { border-right-color: #ffd700; border-left-color: transparent; }

/* أيقونات أسهم */
.icon-left, .chevron-left { transform: scaleX(-1); }

/* مجموعات أزرار */
.btn-group > .btn { margin-left: .4rem; margin-right: 0; }

/* =============== أقسام قابلة للفتح (Collapsible) =============== */
/* مخفي افتراضيًا – يظهر عبر JS بإزالة display:none */
.hidden, [data-collapsible] { display: none; }

/* ضمان الإخفاء حتى لو لم تُحمّل الـCSS في وقت مبكر – سيُعاد ضبطها بالـJS */
@supports (display: block) {
  [data-collapsible] { display: none; }
}

/* =============== نموذج نافذة منبثقة (Modal) عام =============== */
.modal-overlay {
  position: fixed;
  inset: 0; /* top/right/bottom/left: 0 */
  background: rgba(0,0,0,.6);
  display: none;           /* يُفتح بإضافة .open */
  z-index: 1000;
}

.modal-overlay.open { display: block; }

.modal-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  width: min(700px, 90vw);
  max-height: 90vh;
  overflow: auto;
  background: #0b0b0b;
  border: 2px solid #ffd700;
  border-radius: 16px;
  padding: 20px;
  z-index: 1001;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.modal-close {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;  /* يدعم RTL/LTR */
  background: transparent;
  border: 0;
  color: #ffd700;
  font-size: 22px;
  cursor: pointer;
}

body.modal-open { overflow: hidden; }

/* في حال عناصر أعلى من المودال – أقلّل z-index للعناصر العامة */
header, nav, .topbar, .admin-topbar, .sidebar, .content {
  position: relative;
  z-index: auto;
}

/* =============== تحسينات عامة للمظهر الداكن (اختياري) =============== */
.rtl-card, .card, .panel {
  direction: rtl;
}

/* الجريدات الشائعة إن وُجدت */
.stats-grid, .form-grid, .grid {
  direction: rtl;
  gap: 1rem;
}

/* عناصر فلتر وأكشن */
.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-start;
}

/* رسائل */
.alert { direction: rtl; text-align: right; }

/* =============== استجابة الشاشات الصغيرة =============== */
@media (max-width: 768px) {
  .sidebar { float: none; width: 100%; }
  .content { margin-right: 0; }
  .btn-group > .btn { margin-left: 0; }
}
