/* ==========================================================
   RTL - دعم الاتجاه من اليمين لليسار
   الملف: assets/css/rtl.css
   الإصدار النهائي - تم إصلاح مشكلة الهيدر والقوائم
========================================================== */

/* ===== الاتجاه العام ===== */
[dir="rtl"] {
    direction: rtl !important;
    text-align: right !important;
}

/* ===== استثناء العناصر التي يجب أن تبقى LTR ===== */
[dir="rtl"] .slick-slider,
[dir="rtl"] .slick-track,
[dir="rtl"] .slick-slide,
[dir="rtl"] .slick-slide > div {
    direction: ltr !important;
}

[dir="rtl"] .slick-slide > div * {
    direction: rtl !important;
}

/* ===== container ===== */
[dir="rtl"] .container,
[dir="rtl"] .container-fluid {
    direction: rtl !important;
}

/* ==========================================================
   HEADER RTL - الحل النهائي
========================================================== */

/* إعادة ضبط الاتجاه للهيدر بالكامل */
[dir="rtl"] .Site-Header {
    direction: rtl !important;
    text-align: right !important;
}

[dir="rtl"] .Header-Container {
    flex-direction: row !important; /* ليس reverse لتجنب الخلل */
    direction: rtl !important;
}

[dir="rtl"] .Site-Logo {
    order: 0 !important; /* الشعار في البداية (يمين) */
}

[dir="rtl"] .Header-Right {
    flex-direction: row !important;
    direction: rtl !important;
}

/* ===== المنيو الرئيسي ===== */
[dir="rtl"] .Main-Menu {
    direction: rtl !important;
}

[dir="rtl"] .Main-Menu ul {
    flex-direction: row !important; /* ليس reverse */
    padding-right: 0 !important;
    padding-left: 0 !important;
    justify-content: flex-start !important;
}

[dir="rtl"] .Main-Menu li {
    text-align: right !important;
    direction: rtl !important;
}

[dir="rtl"] .Main-Menu a {
    text-align: right !important;
    direction: rtl !important;
}

/* ===== إعادة ترتيب عناصر الهيدر ===== */
[dir="rtl"] .Header-Actions {
    flex-direction: row !important;
    direction: rtl !important;
}

/* ===== قائمة اللغة ===== */
[dir="rtl"] .Language-Dropdown {
    direction: rtl !important;
}

[dir="rtl"] .Language-Dropdown select {
    direction: rtl !important;
    text-align: right !important;
    padding-right: 16px !important;
    padding-left: 35px !important;
    background-position: left 12px center !important;
}

/* ===== زر الكتالوج ===== */
[dir="rtl"] .Header-Catalog-Btn {
    flex-direction: row !important;
    direction: rtl !important;
}

[dir="rtl"] .Header-Catalog-Btn i {
    margin-left: 0 !important;
    margin-right: 8px !important;
}

/* ===== الميجا منيو ===== */
[dir="rtl"] .Mega-Menu {
    left: auto !important;
    right: 0 !important;
    direction: rtl !important;
    text-align: right !important;
}

[dir="rtl"] .Mega-Column {
    text-align: right !important;
    direction: rtl !important;
}

[dir="rtl"] .Mega-Column a {
    text-align: right !important;
    direction: rtl !important;
}

[dir="rtl"] .Mega-Column a:hover {
    padding-left: 0 !important;
    padding-right: 8px !important;
}

/* ==========================================================
   MOBILE RTL - إصلاح القائمة الجانبية
========================================================== */

@media (max-width: 991px) {
    [dir="rtl"] .Main-Menu {
        left: auto !important;
        right: -100% !important;
        transition: right 0.35s ease !important;
        direction: rtl !important;
        text-align: right !important;
    }
    
    [dir="rtl"] #Menu-Toggle:checked ~ .Header-Right .Main-Menu {
        left: auto !important;
        right: 0 !important;
    }
    
    [dir="rtl"] .Main-Menu ul {
        flex-direction: column !important;
        align-items: flex-end !important;
    }
    
    [dir="rtl"] .Main-Menu li {
        text-align: right !important;
        width: 100% !important;
    }
    
    [dir="rtl"] .Main-Menu a {
        text-align: right !important;
        padding: 15px 0 !important;
    }
    
    [dir="rtl"] .Mega-Menu {
        right: 0 !important;
        left: auto !important;
        text-align: right !important;
    }
    
    /* إعادة ترتيب زر القائمة في الموبايل */
    [dir="rtl"] .Mobile-Toggle {
        order: 0 !important; /* زر القائمة في البداية (يمين) */
    }
    
    [dir="rtl"] .Header-Right {
        flex-direction: row !important;
    }
}

/* ==========================================================
   HERO RTL
========================================================== */

[dir="rtl"] .Hero-Content {
    text-align: right !important;
}

[dir="rtl"] .Hero-Buttons {
    justify-content: flex-start !important;
}

[dir="rtl"] .Hero-Prev {
    left: auto !important;
    right: 35px !important;
}

[dir="rtl"] .Hero-Next {
    right: auto !important;
    left: 35px !important;
}

[dir="rtl"] .Hero-Dots {
    flex-direction: row-reverse !important;
}

/* ==========================================================
   FOOTER RTL
========================================================== */

[dir="rtl"] .Footer-Container {
    direction: rtl !important;
    text-align: right !important;
}

[dir="rtl"] .Footer-Links a {
    text-align: right !important;
}

[dir="rtl"] .Footer-Title {
    text-align: right !important;
}

/* ==========================================================
   SECTION TITLE RTL
========================================================== */

[dir="rtl"] .section-title {
    text-align: center !important;
}

[dir="rtl"] .section-title p {
    text-align: center !important;
}

/* ==========================================================
   CARDS RTL
========================================================== */

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

/* ==========================================================
   BUTTONS RTL
========================================================== */

[dir="rtl"] .btn {
    flex-direction: row !important;
}

[dir="rtl"] .btn i {
    margin-left: 0 !important;
    margin-right: 8px !important;
}

/* ==========================================================
   FORMS RTL
========================================================== */

[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select {
    text-align: right !important;
}

[dir="rtl"] label {
    text-align: right !important;
}

/* ==========================================================
   UTILITIES RTL
========================================================== */

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

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

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

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

[dir="rtl"] .ps-3 {
    padding-left: 0 !important;
    padding-right: 1rem !important;
}

[dir="rtl"] .pe-3 {
    padding-right: 0 !important;
    padding-left: 1rem !important;
}

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

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