/* RTL (Right-to-Left) Layout Support for Arabic */

/* Base RTL direction */
html[dir="rtl"],
body.rtl {
    direction: rtl;
    text-align: right;
}

/* Flip layout margins and paddings */
body.rtl .ms-1,
body.rtl .ms-2,
body.rtl .ms-3,
body.rtl .ms-4,
body.rtl .ms-5 {
    margin-left: 0 !important;
}

body.rtl .me-1,
body.rtl .me-2,
body.rtl .me-3,
body.rtl .me-4,
body.rtl .me-5 {
    margin-right: 0 !important;
}

/* Navigation RTL adjustments */
body.rtl .top-navbar .nav-container {
    flex-direction: row-reverse;
}

body.rtl .desktop-nav {
    flex-direction: row-reverse;
}

body.rtl .nav-brand {
    flex-direction: row-reverse;
}

/* Mobile menu RTL */
body.rtl .mobile-menu-content {
    left: 0;
    right: auto;
    transform: translateX(-100%);
}

body.rtl .mobile-menu.active .mobile-menu-content {
    transform: translateX(0);
}

body.rtl .mobile-nav-item {
    flex-direction: row-reverse;
    text-align: right;
}

body.rtl .mobile-nav-item:hover {
    transform: translateX(-5px);
}

body.rtl .menu-close {
    left: 1rem;
    right: auto;
}

/* Form controls RTL */
body.rtl input,
body.rtl textarea,
body.rtl select {
    text-align: right;
}

body.rtl .form-label {
    text-align: right;
}

/* Tables RTL */
body.rtl table {
    direction: rtl;
}

body.rtl th,
body.rtl td {
    text-align: right;
}

/* Buttons and icons RTL */
body.rtl .btn i,
body.rtl .btn .bi {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Dropdown menus RTL */
body.rtl .dropdown-menu {
    text-align: right;
}

/* Cards and panels RTL */
body.rtl .card-body {
    text-align: right;
}

/* Lists RTL */
body.rtl ul,
body.rtl ol {
    padding-right: 2rem;
    padding-left: 0;
}

/* Syncfusion Grid RTL support */
body.rtl .e-grid {
    direction: rtl;
}

body.rtl .e-grid .e-headercell,
body.rtl .e-grid .e-rowcell {
    text-align: right;
}

/* Footer RTL */
body.rtl footer .row {
    flex-direction: row-reverse;
}

/* Language selector specific RTL */
body.rtl .language-selector {
    direction: ltr;
    /* Keep selector LTR for consistency */
}

body.rtl .language-selector .dropdown-menu {
    left: 0;
    right: auto;
}