/* =========================
   Felah v4.1.9 RTL Fix
   ========================= */

/* عام */
html,
body{
  direction: rtl !important;
  text-align: right !important;
}

body,
input,
textarea,
select,
button{
  font-family: "IBM Plex Sans Arabic", sans-serif !important;
}

/* نجبر المستند على RTL */
html[dir="rtl"] body{
  direction: rtl !important;
}

/* عناصر إدخال عربية */
input,
textarea,
select{
  direction: rtl;
  text-align: right;
}

/* بعض الحقول الأفضل لها LTR */
input[type="email"],
input[type="url"],
input[type="number"],
input[type="password"]{
  direction: ltr;
  text-align: left;
}

/* =========================
   الهيدر العلوي العام
   ========================= */
.felah-real-topbar{
  direction: rtl !important;
  flex-direction: row-reverse !important;
  justify-content: space-between !important;
}

.felah-real-brand{
  order: 1;
}

.felah-real-search{
  order: 2;
  direction: rtl;
  text-align: right;
}

.felah-real-search input{
  direction: rtl !important;
  text-align: right !important;
}

.felah-real-icon{
  order: 3;
}

.felah-real-user{
  order: 4;
  direction: rtl;
}

.felah-real-user-btn{
  direction: rtl;
  flex-direction: row-reverse;
}

.felah-real-avatar{
  order: 3;
}

.felah-real-user-name{
  order: 2;
  text-align: right;
}

.felah-real-dropdown{
  inset-inline-start: auto !important;
  inset-inline-end: 0 !important;
  text-align: right !important;
}

.felah-real-dropdown a{
  direction: rtl;
  text-align: right;
  flex-direction: row-reverse;
}

/* =========================
   شريط التبويبات
   ========================= */
.felah-real-tabs{
  direction: rtl !important;
  justify-content: flex-start !important;
  text-align: right !important;
}

.felah-real-tabs a{
  direction: rtl;
  text-align: center;
}

/* =========================
   البطاقات والعناصر العامة
   ========================= */
.card,
.panel,
.widget,
.section,
.box,
.felah-card,
.felah-panel,
.hero-card,
.feature-card,
.lesson-card,
.book-card,
.category-card{
  direction: rtl !important;
  text-align: right !important;
}

h1,h2,h3,h4,h5,h6,
p,
label,
small,
span,
div{
  text-align: inherit;
}

/* زرار / شارات */
.badge,
.pill,
.tag,
.chip{
  direction: rtl;
}

/* =========================
   الأقسام وأحدث الدروس
   ========================= */
.sections-grid,
.categories-grid,
.lessons-grid,
.books-grid{
  direction: rtl;
}

.section-title,
.block-title,
.page-title{
  text-align: right !important;
}

/* =========================
   الجداول
   ========================= */
table{
  direction: rtl !important;
}

th,
td{
  text-align: right !important;
  vertical-align: middle;
}

/* =========================
   النماذج
   ========================= */
form{
  direction: rtl;
}

form label{
  display: block;
  text-align: right;
  margin-bottom: 6px;
}

.form-row,
.field,
.input-group{
  direction: rtl;
}

/* =========================
   صفحات الإدارة
   ========================= */
.layout,
.admin-layout,
.dashboard-layout{
  direction: rtl !important;
}

.layout{
  display: flex;
  flex-direction: row-reverse !important;
}

.layout > .sidebar,
.admin-layout > .sidebar{
  order: 1 !important;
}

.layout > .content,
.admin-layout > .content,
main{
  order: 0 !important;
  text-align: right !important;
}

.sidebar,
.admin-sidebar{
  direction: rtl !important;
  text-align: right !important;
}

.sidebar a,
.admin-sidebar a,
.nav a{
  direction: rtl;
  text-align: right;
}

.felah-admin-topline,
.admin-mini-topbar{
  direction: rtl !important;
  flex-direction: row-reverse !important;
}

.felah-admin-topline .group,
.admin-mini-topbar .group,
.admin-mini-topbar .left,
.admin-mini-topbar .right{
  direction: rtl !important;
}

/* =========================
   محتوى الصفحة الرئيسية
   ========================= */
.hero,
.hero-section,
.banner,
.top-banner{
  direction: rtl;
  text-align: right;
}

.cta-row,
.action-row,
.quick-links{
  direction: rtl;
  justify-content: flex-start;
}

/* =========================
   إصلاحات للشاشات الصغيرة
   ========================= */
@media (max-width: 760px){
  .felah-real-topbar{
    flex-direction: row-reverse !important;
  }

  .felah-real-user{
    order: 1 !important;
  }

  .felah-real-icon{
    order: 2 !important;
  }

  .felah-real-search{
    order: 10 !important;
    flex-basis: 100%;
  }

  .felah-real-brand{
    order: 0 !important;
  }

  .layout{
    flex-direction: column !important;
  }

  .layout > .sidebar,
  .layout > .content{
    order: initial !important;
  }
}
