@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

/* Initial RTL Setup */
html[dir="rtl"] body {
    font-family: 'Cairo', sans-serif !important;
    text-align: right;
}

/* Force Cairo font only on text elements, excluding icons */
html[dir="rtl"] p,
html[dir="rtl"] a:not([class*="fa"]):not([class*="flaticon"]),
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6,
html[dir="rtl"] span:not([class*="fa"]):not([class*="flaticon"]),
html[dir="rtl"] div:not([class*="fa"]):not([class*="flaticon"]),
html[dir="rtl"] li:not([class*="fa"]):not([class*="flaticon"]),
html[dir="rtl"] input,
html[dir="rtl"] button {
    font-family: 'Cairo', sans-serif !important;
}

/* Base Layout Overrides */
html[dir="rtl"] .float-start {
    float: right !important;
}

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

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

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

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

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

/* Navbar & Header Adjustments */
html[dir="rtl"] .ace-responsive-menu {
    text-align: left !important;
    /* This was text-end in LTR */
}

html[dir="rtl"] .ace-responsive-menu>li {
    float: none !important;
    display: inline-block !important;
}

html[dir="rtl"] .navbar_brand {
    float: right !important;
}

html[dir="rtl"] .header_top_contact_opening_widget ul li {
    margin-right: 0px !important;
    margin-left: 15px !important;
}

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

/* Dropdown Menu alignment */
html[dir="rtl"] .dropdown-menu {
    text-align: right !important;
    left: auto !important;
    right: 0 !important;
}

/* Fixing icons and padding */
html[dir="rtl"] .flaticon-phone-call,
html[dir="rtl"] .flaticon-map,
html[dir="rtl"] .flaticon-clock {
    margin-right: 0px !important;
    margin-left: 5px !important;
}

/* Sidebar fixes if needed */
html[dir="rtl"] .sidebar_switch {
    margin-left: 0px !important;
    margin-right: 15px !important;
}

/* Persistence Switcher Styles */
.lang-switcher-btn {
    cursor: pointer;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 4px;
    background: #f8f9fa;
    font-size: 14px;
    transition: all 0.3s;
}

.lang-switcher-btn:hover {
    background: #e9ecef;
}

html[dir="rtl"] .lang-switcher-btn {
    margin-right: 10px;
}

/* --- ROBUST RTL FIXES --- */

/* 1. TOP HEADER SOCIAL ICONS FIX */
body.rtl-active .header_top_social_widgets {
    text-align: left !important;
    float: left !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

body.rtl-active .header_top_social_widgets ul {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: row-reverse !important;
    /* Forces correct logical order */
    justify-content: flex-end !important;
}

body.rtl-active .header_top_social_widgets ul li {
    margin-right: 15px !important;
    margin-left: 0 !important;
}

body.rtl-active .header_top_social_widgets ul li:first-child {
    margin-right: 0 !important;
}

/* 2. HERO SECTION SHIFT FIX */
/* Force the body/wrapper to account for the fixed header height in RTL */
body.rtl-active .wrapper {
    padding-top: 0 !important;
}

body.rtl-active .home-one {
    margin-top: 0 !important;
    padding-top: 200px !important;
    /* Increased padding to prevent overlap */
}

/* Adjust for sticky header state */
body.rtl-active header.header-nav.stricky-fixed+section {
    margin-top: 0 !important;
}

/* 3. CONTACT WIDGET ICONS */
body.rtl-active .header_top_contact_opening_widget ul li {
    margin-left: 20px !important;
    margin-right: 0 !important;
}

body.rtl-active .header_top_contact_opening_widget ul li span[class^="flaticon-"] {
    margin-left: 8px !important;
    margin-right: 0 !important;
}

/* 4. MAIN NAV FLIPPING */
body.rtl-active .ace-responsive-menu {
    text-align: left !important;
}

body.rtl-active .ace-responsive-menu>li {
    float: none !important;
    display: inline-block !important;
}

body.rtl-active .navbar_brand {
    float: right !important;
}