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

/* Basic RTL styles */
.rtl {
    direction: rtl;
    text-align: right;
}

/* Navigation adjustments for RTL */
.rtl nav .flex {
    flex-direction: row-reverse;
}

.rtl .space-x-8 > * + * {
    margin-right: 2rem;
    margin-left: 0;
}

.rtl .space-x-4 > * + * {
    margin-right: 1rem;
    margin-left: 0;
}

.rtl .space-x-2 > * + * {
    margin-right: 0.5rem;
    margin-left: 0;
}

/* Form adjustments for RTL */
.rtl .grid {
    direction: rtl;
}

.rtl input,
.rtl select,
.rtl textarea {
    text-align: right;
}

.rtl input[type="email"],
.rtl input[type="url"] {
    direction: ltr;
    text-align: left;
}

/* Table adjustments for RTL */
.rtl table {
    direction: rtl;
}

.rtl th,
.rtl td {
    text-align: right;
}

.rtl .text-right {
    text-align: left;
}

.rtl .text-left {
    text-align: right;
}

.rtl .text-center {
    text-align: center;
}

/* Flexbox adjustments for RTL */
.rtl .justify-between {
    flex-direction: row-reverse;
}

.rtl .justify-end {
    justify-content: flex-start;
}

.rtl .justify-start {
    justify-content: flex-end;
}

/* Margin and padding adjustments */
.rtl .ml-2 {
    margin-right: 0.5rem;
    margin-left: 0;
}

.rtl .ml-3 {
    margin-right: 0.75rem;
    margin-left: 0;
}

.rtl .ml-4 {
    margin-right: 1rem;
    margin-left: 0;
}

.rtl .mr-2 {
    margin-left: 0.5rem;
    margin-right: 0;
}

.rtl .mr-3 {
    margin-left: 0.75rem;
    margin-right: 0;
}

.rtl .mr-4 {
    margin-left: 1rem;
    margin-right: 0;
}

.rtl .pl-3 {
    padding-right: 0.75rem;
    padding-left: 0;
}

.rtl .pl-4 {
    padding-right: 1rem;
    padding-left: 0;
}

.rtl .pr-3 {
    padding-left: 0.75rem;
    padding-right: 0;
}

.rtl .pr-4 {
    padding-left: 1rem;
    padding-right: 0;
}

/* Border adjustments */
.rtl .border-l-4 {
    border-right-width: 4px;
    border-left-width: 0;
}

.rtl .border-r-4 {
    border-left-width: 4px;
    border-right-width: 0;
}

/* Icon and button adjustments */
.rtl .absolute.left-0 {
    right: 0;
    left: auto;
}

.rtl .absolute.right-0 {
    left: 0;
    right: auto;
}

.rtl .inset-y-0.left-0 {
    right: 0;
    left: auto;
}

.rtl .inset-y-0.right-0 {
    left: 0;
    right: auto;
}

/* Calendar and modal adjustments */
.rtl .modal {
    direction: rtl;
}

.rtl .fc-toolbar {
    direction: ltr; /* Keep calendar controls in LTR for better UX */
}

/* Language selector specific styles */
#language-selector-container {
    order: -1;
}

.rtl #language-selector-container {
    order: 1;
}

/* Print adjustments for RTL */
@media print {
    .rtl {
        direction: rtl;
    }
    
    .rtl .invoice-header,
    .rtl .report-header {
        direction: rtl;
        text-align: right;
    }
    
    .rtl .invoice-table,
    .rtl .report-table {
        direction: rtl;
    }
    
    .rtl .text-right {
        text-align: left;
    }
    
    .rtl .text-left {
        text-align: right;
    }
}

/* Currency symbol positioning for RTL */
.rtl .currency-symbol {
    order: 2;
}

.rtl .currency-amount {
    order: 1;
}

/* Arabic font improvements */
.rtl {
    font-family: 'Tajawal', 'Inter', 'Arial', sans-serif;
}

/* Responsive RTL adjustments */
@media (max-width: 768px) {
    .rtl .md\\:flex-row {
        flex-direction: row-reverse;
    }
    
    .rtl .md\\:space-x-8 > * + * {
        margin-right: 2rem;
        margin-left: 0;
    }
}

/* Animation adjustments for RTL */
.rtl .slide-in-right {
    animation: slideInLeft 0.3s ease-out;
}

.rtl .slide-in-left {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInLeft {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
