/* ===================================
   AKED - Arabic RTL Styles
   =================================== */

/* RTL Base */
[dir="rtl"] {
    direction: rtl !important;
    text-align: right;
}

[dir="rtl"] body {
    font-family: 'Cairo', 'Tajawal', 'IBM Plex Sans Arabic', 'Roboto', sans-serif;
    direction: rtl;
}

[dir="rtl"] * {
    direction: inherit;
}

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

/* RTL Typography */
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4,
[dir="rtl"] h5,
[dir="rtl"] h6 {
    font-family: 'Cairo', 'Tajawal', 'Poppins', sans-serif;
}

/* Navigation RTL */
[dir="rtl"] .navbar-nav {
    margin-left: 0 !important;
    margin-right: auto !important;
}

[dir="rtl"] .nav-link {
    margin: 0 0.25rem;
}

[dir="rtl"] .btn-nav-cta {
    margin-left: 0;
    margin-right: 0.5rem;
}

[dir="rtl"] .dropdown-menu {
    text-align: right;
    right: 0;
    left: auto;
}

[dir="rtl"] .dropdown-item {
    text-align: right;
}

[dir="rtl"] .dropdown-item i {
    margin-right: 0;
    margin-left: 10px;
}

/* Mobile RTL Navigation */
@media (max-width: 991px) {
    [dir="rtl"] .navbar-nav {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
    
    [dir="rtl"] .dropdown-menu {
        margin-right: 1rem !important;
        margin-left: 0.5rem !important;
        border-right: 3px solid var(--color-primary);
        border-left: none;
        box-shadow: inset -3px 0 0 var(--color-primary) !important;
    }
}

/* Hero Section RTL */
[dir="rtl"] .hero-content {
    text-align: center;
}

[dir="rtl"] .hero-buttons {
    flex-direction: row-reverse;
}

[dir="rtl"] .hero-buttons .btn:first-child {
    margin-right: 0;
    margin-left: var(--spacing-md);
}

/* Service Cards RTL */
[dir="rtl"] .service-link i {
    margin-left: 0;
    margin-right: 8px;
    transform: rotate(180deg);
}

/* Feature Items RTL */
[dir="rtl"] .why-choose-section {
    direction: rtl;
}

[dir="rtl"] .why-choose-section .col-lg-6 {
    max-width: 100%;
}

[dir="rtl"] .features-list {
    text-align: right;
    direction: rtl;
    max-width: 100%;
}

[dir="rtl"] .feature-item {
    display: flex !important;
    flex-direction: row-reverse !important;
    text-align: right;
    direction: rtl;
    align-items: flex-start;
    gap: 0;
    margin-bottom: var(--spacing-lg);
    max-width: 100%;
}

[dir="rtl"] .feature-item > div {
    text-align: right;
    flex: 1;
    padding-left: 0;
    max-width: calc(100% - 80px);
}

[dir="rtl"] .feature-icon {
    margin-right: 0 !important;
    margin-left: var(--spacing-md) !important;
    flex-shrink: 0;
    order: 2;
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    height: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.5rem !important;
}

[dir="rtl"] .feature-icon i {
    margin: 0 !important;
    padding: 0 !important;
}

[dir="rtl"] .feature-item > div:last-child {
    order: 1;
    flex: 1;
}

[dir="rtl"] .feature-item h4 {
    text-align: right !important;
    direction: rtl;
    margin-bottom: 0.5rem;
}

[dir="rtl"] .feature-item p {
    text-align: right !important;
    direction: rtl;
    margin: 0;
    line-height: 1.6;
}

/* Check Icons RTL */
[dir="rtl"] .check-icon,
[dir="rtl"] .check-icon-gradient {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* List Items RTL */
[dir="rtl"] .list-unstyled li {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .list-unstyled li i {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* Stats Grid RTL */
[dir="rtl"] .stat-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .stat-item i {
    margin-right: 0;
    margin-left: var(--spacing-sm);
}

/* Footer RTL */
[dir="rtl"] .footer-links a {
    direction: rtl;
}

[dir="rtl"] .footer-links a::before {
    content: '\f104' !important;  /* Left arrow for RTL */
    margin-left: 8px;
    margin-right: 0;
}

[dir="rtl"] .footer-links a:hover {
    padding-left: 0;
    padding-right: 8px;
}

[dir="rtl"] .footer-contact li i {
    margin-right: 0;
    margin-left: 10px;
}

[dir="rtl"] .social-links {
    flex-direction: row-reverse;
}

/* Buttons RTL */
[dir="rtl"] .btn i {
    margin-right: 0;
    margin-left: 8px;
}

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

[dir="rtl"] .me-3.feature-icon {
    margin-right: 0 !important;
    margin-left: var(--spacing-md) !important;
}

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

/* Cards RTL */
[dir="rtl"] .feature-card::after {
    right: auto;
    left: 0;
    border-radius: var(--radius-lg) 0 100% 0;
}

[dir="rtl"] .card-custom {
    text-align: right;
}

/* Section Header RTL */
[dir="rtl"] .section-header {
    text-align: right;
}

[dir="rtl"] .section-header p {
    text-align: right;
}

/* Contact Info Items RTL */
[dir="rtl"] .d-flex.align-items-start {
    flex-direction: row-reverse !important;
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .d-flex.align-items-start .feature-icon {
    order: 2 !important;
    margin-right: 0 !important;
    margin-left: var(--spacing-md) !important;
}

[dir="rtl"] .d-flex.align-items-start > div:not(.feature-icon) {
    order: 1;
    flex: 1;
    text-align: right;
}

[dir="rtl"] .d-flex.align-items-start h4 {
    text-align: right;
    margin-bottom: 0.5rem;
}

[dir="rtl"] .d-flex.align-items-start p {
    text-align: right;
}

[dir="rtl"] .d-flex.align-items-start small {
    text-align: right;
}

/* Contact page card */
[dir="rtl"] .card-custom {
    direction: rtl;
}

/* Blog Cards RTL */
[dir="rtl"] .blog-card-meta {
    flex-direction: row-reverse;
}

[dir="rtl"] .blog-card-link i {
    transform: rotate(180deg);
}

/* Testimonials RTL */
[dir="rtl"] .testimonial-quote {
    left: auto;
    right: var(--spacing-md);
}

[dir="rtl"] .testimonial-author {
    flex-direction: row-reverse;
}

/* CTA Section RTL */
[dir="rtl"] .cta-content .btn:first-child {
    margin-right: 0;
    margin-left: 1rem;
}

/* Clients Grid - stays centered */
[dir="rtl"] .clients-grid {
    direction: ltr;
}

/* Language Switcher RTL */
[dir="rtl"] .language-switcher {
    margin-left: 0;
    margin-right: 1rem;
}

[dir="rtl"] .lang-icon {
    margin: 0 0.25rem;
}

/* Language Switcher - Icon Only */
.language-switcher {
    display: flex;
    align-items: center;
    margin-left: 1rem;
}

.lang-icon {
    color: var(--text-white) !important;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    font-size: 1.25rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: transparent;
}

.lang-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white) !important;
}

.lang-icon:active {
    transform: scale(0.98);
}

/* Tooltip for language icon */
.lang-icon::after {
    content: attr(data-lang);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: var(--color-dark);
    color: var(--text-white);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    transition: all 0.2s ease;
    pointer-events: none;
}

.lang-icon:hover::after {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

/* RTL Animation Adjustments */
[dir="rtl"] .animate-slide-right {
    animation: slideLeft 0.8s ease-out forwards;
}

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

[dir="rtl"] .animate-slide-left {
    animation: slideRight 0.8s ease-out forwards;
}

@keyframes slideRightRTL {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Arabic Font Optimization */
[dir="rtl"] {
    font-size: 16px;
    line-height: 1.8;
}

[dir="rtl"] .section-title {
    font-weight: 700;
    line-height: 1.4;
}

[dir="rtl"] .hero-title {
    line-height: 1.3;
    font-weight: 800;
}

/* Mobile RTL Adjustments */
@media (max-width: 767px) {
    [dir="rtl"] .navbar-collapse {
        text-align: right;
    }
    
    [dir="rtl"] .hero-buttons {
        flex-direction: column;
    }
    
    [dir="rtl"] .hero-buttons .btn:first-child {
        margin-left: 0;
    }
    
    .language-switcher {
        margin-left: 0;
        margin-top: 0.25rem;
    }
    
    .lang-icon {
        font-size: 1.125rem;
        padding: 0.5rem;
        margin: 0.25rem 0;
    }
}
