/********** Final RTL CSS with All Fixes **********/
:root {
    --primary: #1E60AA;
    --secondary: #FF4917;
    --light: #EDF1FC;
    --dark: #17224D;
}
html, body {
   
    width: 100% !important;
    position: relative;
    right: 0;
    left: 0;
}

[dir="rtl"] body {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
}

/* Base RTL Styles */
html[dir="rtl"] {
    text-align: right;
}


body {
    font-family: 'Tajawal', sans-serif;
    text-align: right;
    direction: rtl;
}


/* Loader Fix */
#spinner {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
    z-index: 99999;
}

#spinner.show {
    transition: opacity 0.3s ease;
    visibility: visible;
    opacity: 1;
}

/* Logo Fix */
[dir="rtl"] .navbar-brand {
    padding: 15px 0;
    height: 80px;
    display: flex;
    align-items: center;
}

[dir="rtl"] .top-bar {
    height: 110px;
}

/* Ensure proper stacking context */
[dir="rtl"] .header-carousel {
    margin-top: 0 !important;
}
/* Icon Spacing */
[dir="rtl"] .fa-map-marker-alt,
[dir="rtl"] .far.fa-building,
[dir="rtl"] .fa-phone-alt {
    margin-left: 10px;
    margin-right: 0;
}

/* Social Icons Spacing */
[dir="rtl"] .top-bar .btn-sm-square {
    margin-left: 5px;
    margin-right: 0;
}

/* Email Input Fix */
[dir="rtl"] .footer input::placeholder {
    opacity: 1;
    text-align: right;
    padding-right: 10px;
}

/* Section Titles - Removed Red Underline */
[dir="rtl"] h6.text-secondary.text-uppercase:not(.footer h6) {
    margin-bottom: 45px;
}

[dir="rtl"] h6.text-secondary.text-uppercase:not(.footer h6)::after {
    content: none;
}

[dir="rtl"] .text-center.text-lg-start h6.text-secondary,
[dir="rtl"] .text-center.text-lg-start h1 {
    text-align: right !important;
    padding-top: 30px;
    width: 100%;
}

/* Phone Number Fix */
[dir="rtl"] .phone-number {
    direction: ltr;
    display: inline-block;
    unicode-bidi: bidi-override;
}

/* Emergency Text Spacing */
[dir="rtl"] .bg-primary p.fs-5 {
    padding-right: 10px;
}

/* Hero Slider Fix */
[dir="rtl"] .header-carousel {
    direction: ltr;
    margin-top: 0;
}

[dir="rtl"] .header-carousel .owl-stage-outer {
    direction: rtl;
}

[dir="rtl"] .header-carousel .container {
    padding: 45px 35px 45px 0;
    border-right: 15px solid #FFFFFF;
    border-left: none;
    right: 0;
    left: auto;
}

/* Animation Fixes */
[dir="rtl"] .header-carousel .animated {
    animation-duration: 1s;
    animation-fill-mode: both;
}

/* Layout Adjustments */
[dir="rtl"] .ms-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

[dir="rtl"] .me-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}

[dir="rtl"] .float-start {
    float: right !important;
}

[dir="rtl"] .float-end {
    float: left !important;
}

[dir="rtl"] .text-start {
    text-align: right !important;
}

/* Navbar RTL Fixes */
[dir="rtl"] .navbar-nav {
    padding-right: 0;
}

[dir="rtl"] .nav-item {
    margin-left: 15px;
    margin-right: 0;
}

[dir="rtl"] .navbar .dropdown-toggle::after {
    content: "\f104";
    margin-right: 8px;
    margin-left: 0;
}

[dir="rtl"] .dropdown-menu {
    text-align: right;
    left: auto !important;
    right: 0;
}

/* Button Adjustments */
[dir="rtl"] .btn i.fa-arrow-right {
    transform: rotate(180deg);
    margin-left: 5px;
}

/* Services Slider RTL Fix */
[dir="rtl"] .service-carousel .owl-stage-outer {
    direction: ltr;
}

[dir="rtl"] .service-carousel .owl-item {
    direction: rtl;
}

[dir="rtl"] .service-carousel .btn i.fa-arrow-right {
    transform: rotate(180deg);
    margin-left: 0;
    margin-right: 5px;
}

/* Testimonials Slider RTL Fix */
[dir="rtl"] .testimonial-carousel .owl-stage-outer {
    direction: ltr;
}

[dir="rtl"] .testimonial-carousel .owl-item {
    direction: rtl;
}

[dir="rtl"] .testimonial-carousel .owl-nav {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    flex-direction: row-reverse;
}

[dir="rtl"] .testimonial-carousel .owl-prev {
    right: auto;
    left: 0;
}

[dir="rtl"] .testimonial-carousel .owl-next {
    left: auto;
    right: 0;
}

/* Footer RTL Fixes */
[dir="rtl"] .footer .btn.btn-link {
    text-align: right;
}

[dir="rtl"] .footer .btn.btn-link::before {
    content: "\f104";
    margin-left: 10px;
    margin-right: 0;
}

/* Back to Top Button */
[dir="rtl"] .back-to-top {
    left: 45px;
    right: auto;
}

/* Utility Classes */
[dir="rtl"] .ps-2 {
    padding-left: 0 !important;
    padding-right: 0.5rem !important;
}

[dir="rtl"] .pe-2 {
    padding-right: 0 !important;
    padding-left: 0.5rem !important;
}

/* Bootstrap Overrides */
[dir="rtl"] .start-0 {
    right: 0 !important;
    left: auto !important;
}

[dir="rtl"] .end-0 {
    left: 0 !important;
    right: auto !important;
}

[dir="rtl"] .translate-middle {
    transform: translate(50%, -50%) !important;
}

/* Responsive Fixes */
@media (max-width: 991.98px) {
    [dir="rtl"] .navbar-light .navbar-nav .nav-link {
        margin-left: 0;
        text-align: right;
    }
}

@media (max-width: 768px) {
    [dir="rtl"] .header-carousel .owl-nav {
        left: 50%;
        transform: translateX(-50%);
    }
    
    [dir="rtl"] .header-carousel .container {
        padding: 30px 15px 30px 0;
    }
    
    [dir="rtl"] .header-carousel .owl-item {
        min-height: 500px;
    }
    
    [dir="rtl"] .navbar-brand {
        height: auto;
        padding: 10px 0;
    }
}

/* Original Styles (Preserved) */
.fw-medium {
    font-weight: 600 !important;
}

.btn {
    font-weight: 600;
    transition: .5s;
}

.btn.btn-primary,
.btn.btn-secondary {
    color: #FFFFFF;
}

.btn-square {
    width: 38px;
    height: 38px;
}

.btn-sm-square {
    width: 32px;
    height: 32px;
}

.btn-lg-square {
    width: 48px;
    height: 48px;
}

.btn-square,
.btn-sm-square,
.btn-lg-square {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: normal;
}

.top-bar {
    height: 120px;
    padding: 0 4rem;
}

.nav-bar {
    position: relative;
    padding: 0 4.75rem;
    transition: .5s;
    z-index: 9999;
}

.nav-bar.sticky-top {
    position: sticky ;
    padding: 0;
    z-index: 9999;
}


.header-carousel .owl-nav .owl-prev,
.header-carousel .owl-nav .owl-next {
    margin: 7px 0;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    background: transparent;
    border: 1px solid #FFFFFF;
    border-radius: 45px;
    font-size: 22px;
    transition: .5s;
}

.header-carousel .owl-nav .owl-prev:hover,
.header-carousel .owl-nav .owl-next:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.service-item-top img {
    transition: .5s;
}

.service-item-top:hover img {
    transform: scale(1.1);
}

.service-carousel .owl-dots {
    margin-top: 24px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.service-carousel .owl-dot {
    position: relative;
    display: inline-block;
    margin: 0 5px;
    width: 15px;
    height: 15px;
    background: var(--primary);
    border: 5px solid var(--light);
    transition: .5s;
}

.service-carousel .owl-dot.active {
    background: var(--light);
    border-color: var(--primary);
}

.testimonial-carousel .owl-item .testimonial-text,
.testimonial-carousel .owl-item.center .testimonial-text * {
    position: relative;
    transition: .5s;
}

.testimonial-carousel .owl-item.center .testimonial-text {
    background: var(--primary) !important;
}

.testimonial-carousel .owl-item.center .testimonial-text * {
    color: #FFFFFF !important;
}

.testimonial-carousel .owl-item .testimonial-text::after {
    position: absolute;
    content: "";
    width: 0;
    height: 0;
    left: 50%;
    bottom: -30px;
    transform: translateX(-50%);
    border: 15px solid;
    border-color: var(--light) transparent transparent transparent;
    transition: .5s;
}

.testimonial-carousel .owl-item.center .testimonial-text::after {
    border-color: var(--primary) transparent transparent transparent;
}

.footer .btn.btn-social {
    margin-right: 5px;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--light);
    border: 1px solid #FFFFFF;
    border-radius: 35px;
    transition: .3s;
}

.footer .btn.btn-social:hover {
    color: var(--primary);
}

.footer .copyright {
    padding: 25px 0;
    font-size: 15px;
    border-top: 1px solid rgba(256, 256, 256, .1);
}