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

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

/* Reverse flex directions */
[dir="rtl"] .flex {
    flex-direction: row-reverse;
}

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

/* Reverse spacing */
[dir="rtl"] .space-x-1 > * + * {
    margin-left: 0;
    margin-right: 0.25rem;
}

[dir="rtl"] .space-x-2 > * + * {
    margin-left: 0;
    margin-right: 0.5rem;
}

[dir="rtl"] .space-x-3 > * + * {
    margin-left: 0;
    margin-right: 0.75rem;
}

[dir="rtl"] .space-x-4 > * + * {
    margin-left: 0;
    margin-right: 1rem;
}

[dir="rtl"] .space-x-6 > * + * {
    margin-left: 0;
    margin-right: 1.5rem;
}

/* Margins */
[dir="rtl"] .mr-1 {
    margin-right: 0;
    margin-left: 0.25rem;
}

[dir="rtl"] .mr-2 {
    margin-right: 0;
    margin-left: 0.5rem;
}

[dir="rtl"] .mr-3 {
    margin-right: 0;
    margin-left: 0.75rem;
}

[dir="rtl"] .ml-1 {
    margin-left: 0;
    margin-right: 0.25rem;
}

[dir="rtl"] .ml-2 {
    margin-left: 0;
    margin-right: 0.5rem;
}

[dir="rtl"] .ml-3 {
    margin-left: 0;
    margin-right: 0.75rem;
}

[dir="rtl"] .ml-8 {
    margin-left: 0;
    margin-right: 2rem;
}

/* Padding */
[dir="rtl"] .pr-3 {
    padding-right: 0;
    padding-left: 0.75rem;
}

[dir="rtl"] .pl-3 {
    padding-left: 0;
    padding-right: 0.75rem;
}

/* Text alignment */
[dir="rtl"] .text-left {
    text-align: right !important;
}

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

/* Position */
[dir="rtl"] .left-0 {
    left: auto;
    right: 0;
}

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

/* Border radius */
[dir="rtl"] .rounded-l-xl {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 0.75rem;
    border-bottom-right-radius: 0.75rem;
}

[dir="rtl"] .rounded-r-xl {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 0.75rem;
    border-bottom-left-radius: 0.75rem;
}

[dir="rtl"] .first\:rounded-t-xl:first-child {
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.75rem;
}

[dir="rtl"] .last\:rounded-b-xl:last-child {
    border-bottom-left-radius: 0.75rem;
    border-bottom-right-radius: 0.75rem;
}

/* Icons - Don't flip icons, but adjust their margins */
[dir="rtl"] i.fa,
[dir="rtl"] i.fas,
[dir="rtl"] i.fab {
    margin-left: 0;
}

/* Header Navigation */
[dir="rtl"] header nav {
    flex-direction: row-reverse;
}

/* Dropdowns */
[dir="rtl"] .group:hover .absolute {
    left: auto;
    right: 0;
}

/* Transform adjustments */
[dir="rtl"] .hover\:-translate-y-0\.5:hover {
    transform: translate(0, -0.125rem);
}

[dir="rtl"] .group-hover\:rotate-180 {
    transform: scaleX(-1);
}

/* Grid adjustments for RTL */
[dir="rtl"] .grid {
    direction: rtl;
}

/* Form inputs */
[dir="rtl"] input,
[dir="rtl"] select,
[dir="rtl"] textarea {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] input[type="checkbox"],
[dir="rtl"] input[type="radio"] {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Bullets and lists */
[dir="rtl"] ul,
[dir="rtl"] ol {
    padding-right: 1.5rem;
    padding-left: 0;
}

/* Mobile menu */
[dir="rtl"] #mobileMenu {
    direction: rtl;
}

[dir="rtl"] #mobileMenu nav {
    align-items: flex-end;
}

/* Font family for Arabic */
[dir="rtl"] body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, 'Arabic UI Text', 'Traditional Arabic';
}

/* Adjust icon positions in buttons */
[dir="rtl"] button svg,
[dir="rtl"] a svg {
    margin-left: 0;
}

/* Fix for absolute positioned elements */
[dir="rtl"] .absolute.left-0 {
    left: auto;
    right: 0;
}

[dir="rtl"] .absolute.right-0 {
    right: auto;
    left: 0;
}

/* Language selector flag spacing */
[dir="rtl"] .language-flag {
    margin-left: 0.5rem;
    margin-right: 0;
}
