/* RTL (Right-to-Left) Support for Arabic */

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

/* Typography adjustments for Arabic */
[dir="rtl"] body {
    font-family: 'Noto Sans Arabic', 'Cairo', 'Amiri', var(--font-family);
}

/* Navigation adjustments */
[dir="rtl"] .nav-container {
    flex-direction: row-reverse;
}

[dir="rtl"] .nav-brand {
    order: 2;
}

[dir="rtl"] .nav-menu {
    order: 1;
}

[dir="rtl"] .logo {
    margin-right: 0;
    margin-left: var(--spacing-2);
}

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

[dir="rtl"] .language-toggle {
    order: 3;
}

/* Hero section RTL */
[dir="rtl"] .hero-container {
    grid-template-columns: 1fr 1fr;
}

[dir="rtl"] .hero-content {
    order: 2;
    text-align: right;
}

[dir="rtl"] .hero-image {
    order: 1;
}

[dir="rtl"] .hero-actions {
    justify-content: flex-end;
}

/* About section RTL */
[dir="rtl"] .about-content {
    grid-template-columns: 1fr 1fr;
}

[dir="rtl"] .about-text {
    order: 2;
}

[dir="rtl"] .about-features {
    order: 1;
}

/* Features list RTL */
[dir="rtl"] .features-list li {
    padding-left: 0;
    padding-right: var(--spacing-6);
}

[dir="rtl"] .features-list li:before {
    left: auto;
    right: 0;
}

/* Contact section RTL */
[dir="rtl"] .contact-content {
    grid-template-columns: 1fr 1fr;
}

[dir="rtl"] .contact-info {
    order: 2;
}

[dir="rtl"] .contact-form {
    order: 1;
}

/* Modal RTL */
[dir="rtl"] .modal-header {
    flex-direction: row-reverse;
}

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

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

/* Footer RTL */
[dir="rtl"] .footer-content {
    text-align: right;
}

[dir="rtl"] .footer-bottom {
    text-align: center;
}

/* Form elements RTL */
[dir="rtl"] .form-group input,
[dir="rtl"] .form-group textarea {
    text-align: right;
}

[dir="rtl"] .form-group label {
    text-align: right;
}

/* Button groups RTL */
[dir="rtl"] .hero-actions {
    flex-direction: row-reverse;
}

/* Navigation link underline animation RTL */
[dir="rtl"] .nav-link::after {
    left: auto;
    right: 0;
}

/* Mobile menu RTL */
@media (max-width: 767px) {
    [dir="rtl"] .nav-container {
        flex-direction: row;
    }
    
    [dir="rtl"] .mobile-menu-btn {
        order: 1;
    }
    
    [dir="rtl"] .nav-brand {
        order: 2;
    }
    
    [dir="rtl"] .hero-container {
        grid-template-columns: 1fr;
    }
    
    [dir="rtl"] .hero-content {
        order: 1;
    }
    
    [dir="rtl"] .hero-image {
        order: 2;
    }
    
    [dir="rtl"] .about-content {
        grid-template-columns: 1fr;
    }
    
    [dir="rtl"] .about-text {
        order: 1;
    }
    
    [dir="rtl"] .about-features {
        order: 2;
    }
    
    [dir="rtl"] .contact-content {
        grid-template-columns: 1fr;
    }
    
    [dir="rtl"] .contact-info {
        order: 1;
    }
    
    [dir="rtl"] .contact-form {
        order: 2;
    }
}

/* Arabic typography improvements */
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4,
[dir="rtl"] h5,
[dir="rtl"] h6 {
    font-weight: 600;
    line-height: 1.4;
}

[dir="rtl"] p {
    line-height: 1.8;
}

/* RTL-specific spacing adjustments */
[dir="rtl"] .nav-link {
    padding-left: 0;
    padding-right: 0;
}

[dir="rtl"] .logo-text {
    font-family: 'Cairo', 'Amiri', sans-serif;
}

/* Ensure proper text alignment in cards */
[dir="rtl"] .product-card,
[dir="rtl"] .store-item {
    text-align: right;
}

[dir="rtl"] .product-content,
[dir="rtl"] .store-item-header {
    text-align: center;
}

/* Price display RTL */
[dir="rtl"] .price {
    flex-direction: row-reverse;
}

/* Contact item RTL */
[dir="rtl"] .contact-item {
    text-align: right;
}

/* Skip link RTL */
[dir="rtl"] .skip-link {
    left: auto;
    right: 6px;
}

[dir="rtl"] .skip-link:focus {
    right: 6px;
}

/* Arabic font loading optimization */
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('./assets/fonts/cairo-var.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+200C-2010, U+2013-2014, U+2018-2019, U+201C-201D, U+2020-2022, U+2026, U+20A0-20AB, U+20AD-20CF, U+2113, U+2116, U+2122, U+2126, U+212E, U+2150-218F, U+2190-21FF;
}

/* Ensure RTL elements maintain proper spacing */
[dir="rtl"] .container {
    padding-left: var(--spacing-4);
    padding-right: var(--spacing-4);
}

@media (min-width: 768px) {
    [dir="rtl"] .container {
        padding-left: var(--spacing-6);
        padding-right: var(--spacing-6);
    }
}

/* RTL hover effects */
[dir="rtl"] .nav-link:hover::after,
[dir="rtl"] .nav-link:focus::after {
    transform-origin: right;
}

/* Ensure icons and images are properly aligned in RTL */
[dir="rtl"] .payment-option img {
    order: 2;
}

[dir="rtl"] .payment-option span {
    order: 1;
}

/* Breadcrumb RTL (if needed) */
[dir="rtl"] .breadcrumb {
    flex-direction: row-reverse;
}

/* Notification RTL (if needed) */
[dir="rtl"] .notification {
    text-align: right;
}

/* Table RTL (if needed) */
[dir="rtl"] table {
    text-align: right;
}

[dir="rtl"] th,
[dir="rtl"] td {
    text-align: right;
}

/* Form validation RTL */
[dir="rtl"] .error-message {
    text-align: right;
}

/* Loading spinner RTL - no changes needed as it's circular */

/* Ensure proper text selection in RTL */
[dir="rtl"] ::selection {
    direction: rtl;
}

/* Smooth transition for direction changes */
html {
    transition: direction 0s;
}

/* Print styles RTL */
@media print {
    [dir="rtl"] body {
        direction: rtl;
        text-align: right;
    }
}