/* ===== RTL STYLES FOR ARABIC ===== */

/* Global RTL adjustments */
body[dir="rtl"] {
    font-family: 'Tajawal', sans-serif;
    text-align: right;
}

/* Typography adjustments */
body[dir="rtl"] h1,
body[dir="rtl"] h2,
body[dir="rtl"] h3,
body[dir="rtl"] h4,
body[dir="rtl"] h5,
body[dir="rtl"] h6 {
    text-align: right;
}

/* Navbar RTL */
body[dir="rtl"] .navbar-nav {
    margin-right: auto;
    margin-left: 0;
}

body[dir="rtl"] .navbar-brand {
    margin-right: 0;
    margin-left: 1rem;
}

body[dir="rtl"] .nav-link.active::after {
    right: 50%;
    left: auto;
    transform: translateX(50%);
}

body[dir="rtl"] .dropdown-menu {
    right: 0;
    left: auto;
}

body[dir="rtl"] .dropdown-item:hover {
    transform: translateX(-5px);
}

/* Hero section RTL */
body[dir="rtl"] .hero-section {
    text-align: right;
}

body[dir="rtl"] .hero-buttons .btn {
    margin-left: 1rem;
    margin-right: 0;
}

body[dir="rtl"] .hero-buttons .btn:last-child {
    margin-left: 0;
}

/* Section titles RTL */
body[dir="rtl"] .section-title::after {
    right: 50%;
    left: auto;
    transform: translateX(50%);
}

/* Service cards RTL */
body[dir="rtl"] .service-card {
    text-align: center;
}

/* Footer RTL */
body[dir="rtl"] .footer-title::after {
    right: 0;
    left: auto;
}

body[dir="rtl"] .footer-links a {
    padding-right: 15px;
    padding-left: 0;
}

body[dir="rtl"] .footer-links a::before {
    right: 0;
    left: auto;
}

body[dir="rtl"] .footer-links a:hover {
    padding-right: 20px;
    padding-left: 0;
}

body[dir="rtl"] .social-links {
    justify-content: flex-end;
}

body[dir="rtl"] .footer-bottom .col-md-6:last-child {
    text-align: right;
}

/* Contact info RTL */
body[dir="rtl"] .contact-item {
    flex-direction: row-reverse;
}

body[dir="rtl"] .contact-item i {
    margin-left: 1rem;
    margin-right: 0;
}

/* Form RTL */
body[dir="rtl"] .form-label {
    text-align: right;
}

body[dir="rtl"] .input-group .btn {
    border-radius: 25px 0 0 25px;
}

body[dir="rtl"] .input-group .form-control {
    border-radius: 0 25px 25px 0;
}

/* WhatsApp button RTL */
body[dir="rtl"] .whatsapp-float {
    right: auto;
    left: 20px;
}

/* Project overlay RTL */
body[dir="rtl"] .project-info {
    text-align: right;
}

/* Breadcrumb RTL */
body[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
    content: "\\";
    transform: rotate(180deg);
}

/* Pagination RTL */
body[dir="rtl"] .page-link {
    margin-left: -1px;
    margin-right: 0;
}

body[dir="rtl"] .page-item:first-child .page-link {
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

body[dir="rtl"] .page-item:last-child .page-link {
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Modal RTL */
body[dir="rtl"] .modal-header .btn-close {
    margin: -0.5rem 0 -0.5rem auto;
}

/* Alert RTL */
body[dir="rtl"] .alert-dismissible .btn-close {
    left: 0;
    right: auto;
}

/* Card RTL */
body[dir="rtl"] .card-header-tabs .nav-link {
    margin-left: -1px;
    margin-right: 0;
}

/* List group RTL */
body[dir="rtl"] .list-group-horizontal .list-group-item:first-child {
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

body[dir="rtl"] .list-group-horizontal .list-group-item:last-child {
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Carousel RTL */
body[dir="rtl"] .carousel-control-prev {
    right: 0;
    left: auto;
}

body[dir="rtl"] .carousel-control-next {
    left: 0;
    right: auto;
}

body[dir="rtl"] .carousel-control-prev-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='m3.86 8.753 5.482 4.796c.646.566 1.658.106 1.658-.753V3.204a1 1 0 0 0-1.659-.753l-5.48 4.796a1 1 0 0 0 0 1.506z'/%3e%3c/svg%3e");
}

body[dir="rtl"] .carousel-control-next-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z'/%3e%3c/svg%3e");
}

/* Offcanvas RTL */
body[dir="rtl"] .offcanvas-start {
    right: 0;
    left: auto;
    border-right: 1px solid rgba(0, 0, 0, 0.2);
    border-left: 0;
    transform: translateX(100%);
}

body[dir="rtl"] .offcanvas-end {
    left: 0;
    right: auto;
    border-left: 1px solid rgba(0, 0, 0, 0.2);
    border-right: 0;
    transform: translateX(-100%);
}

/* Toast RTL */
body[dir="rtl"] .toast-header .btn-close {
    margin-left: 0;
    margin-right: auto;
}

/* Progress RTL */
body[dir="rtl"] .progress-bar {
    right: 0;
    left: auto;
}

/* Dropdown RTL */
body[dir="rtl"] .dropdown-toggle::after {
    margin-right: 0.255em;
    margin-left: 0;
}

body[dir="rtl"] .dropdown-toggle:empty::after {
    margin-right: 0;
}

body[dir="rtl"] .dropup .dropdown-toggle::after {
    margin-right: 0.255em;
    margin-left: 0;
}

body[dir="rtl"] .dropend .dropdown-toggle::after {
    margin-right: 0.255em;
    margin-left: 0;
    transform: rotate(-90deg);
}

body[dir="rtl"] .dropstart .dropdown-toggle::after {
    margin-right: 0.255em;
    margin-left: 0;
    transform: rotate(90deg);
}

body[dir="rtl"] .dropstart .dropdown-toggle::before {
    margin-left: 0.255em;
    margin-right: 0;
}

/* Custom RTL animations */
@keyframes fadeInRight-rtl {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInLeft-rtl {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Apply RTL animations */
body[dir="rtl"] .hero-image {
    animation: fadeInLeft-rtl 1s ease-out 0.6s both;
}

body[dir="rtl"] [data-aos="fade-right"] {
    animation: fadeInLeft-rtl 1s ease-out;
}

body[dir="rtl"] [data-aos="fade-left"] {
    animation: fadeInRight-rtl 1s ease-out;
}

/* Arabic font improvements */
body[dir="rtl"] {
    font-family: 'Segoe UI', 'Tahoma', 'Arial', 'Helvetica Neue', sans-serif;
}

body[dir="rtl"] h1,
body[dir="rtl"] h2,
body[dir="rtl"] h3,
body[dir="rtl"] h4,
body[dir="rtl"] h5,
body[dir="rtl"] h6 {
    font-weight: 700;
}

/* Number formatting for Arabic */
body[dir="rtl"] .arabic-numbers {
    font-family: 'Arial', sans-serif;
    direction: ltr;
    unicode-bidi: embed;
}

/* Mobile RTL adjustments */
@media (max-width: 768px) {
    body[dir="rtl"] .hero-buttons .btn {
        margin-left: 0;
        margin-right: 0;
    }
    
    body[dir="rtl"] .whatsapp-float {
        left: 15px;
        right: auto;
    }
    
    body[dir="rtl"] .footer-section {
        text-align: center;
    }
    
    body[dir="rtl"] .footer-title::after {
        right: 50%;
        left: auto;
        transform: translateX(50%);
    }
    
    body[dir="rtl"] .social-links {
        justify-content: center;
    }
    
    body[dir="rtl"] .footer-bottom .col-md-6:last-child {
        text-align: center !important;
    }
}

/* Text alignment utilities for RTL */
body[dir="rtl"] .text-start {
    text-align: right !important;
}

body[dir="rtl"] .text-end {
    text-align: left !important;
}



/* Margin and padding utilities for RTL */
body[dir="rtl"] .me-1 { margin-left: 0.25rem !important; margin-right: 0 !important; }
body[dir="rtl"] .me-2 { margin-left: 0.5rem !important; margin-right: 0 !important; }
body[dir="rtl"] .me-3 { margin-left: 1rem !important; margin-right: 0 !important; }
body[dir="rtl"] .me-4 { margin-left: 1.5rem !important; margin-right: 0 !important; }
body[dir="rtl"] .me-5 { margin-left: 3rem !important; margin-right: 0 !important; }

body[dir="rtl"] .ms-1 { margin-right: 0.25rem !important; margin-left: 0 !important; }
body[dir="rtl"] .ms-2 { margin-right: 0.5rem !important; margin-left: 0 !important; }
body[dir="rtl"] .ms-3 { margin-right: 1rem !important; margin-left: 0 !important; }
body[dir="rtl"] .ms-4 { margin-right: 1.5rem !important; margin-left: 0 !important; }
body[dir="rtl"] .ms-5 { margin-right: 3rem !important; margin-left: 0 !important; }

body[dir="rtl"] .pe-1 { padding-left: 0.25rem !important; padding-right: 0 !important; }
body[dir="rtl"] .pe-2 { padding-left: 0.5rem !important; padding-right: 0 !important; }
body[dir="rtl"] .pe-3 { padding-left: 1rem !important; padding-right: 0 !important; }
body[dir="rtl"] .pe-4 { padding-left: 1.5rem !important; padding-right: 0 !important; }
body[dir="rtl"] .pe-5 { padding-left: 3rem !important; padding-right: 0 !important; }

body[dir="rtl"] .ps-1 { padding-right: 0.25rem !important; padding-left: 0 !important; }
body[dir="rtl"] .ps-2 { padding-right: 0.5rem !important; padding-left: 0 !important; }
body[dir="rtl"] .ps-3 { padding-right: 1rem !important; padding-left: 0 !important; }
body[dir="rtl"] .ps-4 { padding-right: 1.5rem !important; padding-left: 0 !important; }
body[dir="rtl"] .ps-5 { padding-right: 3rem !important; padding-left: 0 !important; }