/* RTL Support for Arabic */

[dir="rtl"] body,
body.rtl {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .container,
body.rtl .container {
    direction: rtl;
}

[dir="rtl"] .row,
body.rtl .row {
    direction: rtl;
}

[dir="rtl"] .float-left,
body.rtl .float-left {
    float: right !important;
}

[dir="rtl"] .float-right,
body.rtl .float-right {
    float: left !important;
}

[dir="rtl"] .text-left,
body.rtl .text-left {
    text-align: right !important;
}

[dir="rtl"] .text-right,
body.rtl .text-right {
    text-align: left !important;
}

[dir="rtl"] .menu,
body.rtl .menu {
    direction: rtl;
}

[dir="rtl"] .submenu,
body.rtl .submenu {
    direction: rtl;
    right: auto;
    left: 0;
}

[dir="rtl"] .form-control,
body.rtl .form-control {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] textarea.form-control,
body.rtl textarea.form-control {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .flat-button i.fa-angle-double-right,
body.rtl .flat-button i.fa-angle-double-right {
    transform: rotate(180deg);
}

[dir="rtl"] .col-lg-6,
body.rtl .col-lg-6 {
    direction: rtl;
}

[dir="rtl"] .col-lg-4,
body.rtl .col-lg-4 {
    direction: rtl;
}

[dir="rtl"] .col-md-6,
body.rtl .col-md-6 {
    direction: rtl;
}

[dir="rtl"] .col-sm-6,
body.rtl .col-sm-6 {
    direction: rtl;
}

[dir="rtl"] .col-sm-4,
body.rtl .col-sm-4 {
    direction: rtl;
}

[dir="rtl"] .col-4,
body.rtl .col-4 {
    direction: rtl;
}

[dir="rtl"] .col-md-8,
body.rtl .col-md-8 {
    direction: rtl;
}

[dir="rtl"] .col-md-4,
body.rtl .col-md-4 {
    direction: rtl;
}

[dir="rtl"] .col-md-12,
body.rtl .col-md-12 {
    direction: rtl;
}

[dir="rtl"] .col-lg-3,
body.rtl .col-lg-3 {
    direction: rtl;
}

[dir="rtl"] .col-lg-9,
body.rtl .col-lg-9 {
    direction: rtl;
}

[dir="rtl"] .col-lg-12,
body.rtl .col-lg-12 {
    direction: rtl;
}

/* Adjust padding and margins for RTL */
[dir="rtl"] .pl-5,
body.rtl .pl-5 {
    padding-left: 0 !important;
    padding-right: 3rem !important;
}

[dir="rtl"] .pr-5,
body.rtl .pr-5 {
    padding-right: 0 !important;
    padding-left: 3rem !important;
}

[dir="rtl"] .px-5,
body.rtl .px-5 {
    padding-left: 3rem !important;
    padding-right: 3rem !important;
}

[dir="rtl"] .ml-auto,
body.rtl .ml-auto {
    margin-left: 0 !important;
    margin-right: auto !important;
}

[dir="rtl"] .mr-auto,
body.rtl .mr-auto {
    margin-right: 0 !important;
    margin-left: auto !important;
}

/* Navigation alignment for RTL */
[dir="rtl"] .nav-wrap,
body.rtl .nav-wrap {
    direction: rtl;
    position: relative;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

[dir="rtl"] .nav-wrap.clearfix::after,
body.rtl .nav-wrap.clearfix::after {
    display: none !important;
}

[dir="rtl"] .flat-wrap-header,
body.rtl .flat-wrap-header {
    direction: rtl;
}

/* Mirror the English layout: mainnav centered, menu-extra on left */
[dir="rtl"] .nav-wrap .mainnav,
body.rtl .nav-wrap .mainnav {
    float: none !important;
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
    width: auto !important;
    order: 2 !important;
}

[dir="rtl"] .menu.menu-extra,
body.rtl .menu.menu-extra {
    float: none !important;
    padding-left: 0 !important;
    padding-right: 20px !important;
    order: 1 !important;
}

[dir="rtl"] .top-search,
body.rtl .top-search {
    order: 0 !important;
}

[dir="rtl"] .btn-menu,
body.rtl .btn-menu {
    order: 3 !important;
}

[dir="rtl"] #mainnav,
body.rtl #mainnav {
    position: relative !important;
    width: auto !important;
}

[dir="rtl"] #mainnav > ul,
body.rtl #mainnav > ul {
    text-align: center !important;
    direction: rtl !important;
    margin: 0 !important;
    padding: 0 !important;
}

[dir="rtl"] #mainnav > ul > li,
body.rtl #mainnav > ul > li {
    margin-right: 0 !important;
    margin-left: -5px !important;
}

[dir="rtl"] #mainnav > ul > li > a,
body.rtl #mainnav > ul > li > a {
    padding: 0 30px 0px 25px !important;
}

[dir="rtl"] #mainnav ul.submenu,
body.rtl #mainnav ul.submenu {
    right: auto !important;
    left: 0 !important;
    text-align: right !important;
    direction: rtl !important;
}

[dir="rtl"] #mainnav ul.submenu > li > a,
body.rtl #mainnav ul.submenu > li > a {
    padding: 0 31px 0 0 !important;
    text-align: right !important;
}

/* Button menu positioning for RTL */
[dir="rtl"] .btn-menu,
body.rtl .btn-menu {
    float: left !important;
}

/* Top search positioning for RTL */
[dir="rtl"] .top-search,
body.rtl .top-search {
    right: auto !important;
    left: 0px !important;
}

