/* RTL (Right-to-Left) styles for Arabic language */

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

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

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

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

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

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

/* Hero section adjustments */
body[dir="rtl"] .hero-features {
    flex-direction: row-reverse;
}

body[dir="rtl"] .feature-item {
    flex-direction: row-reverse;
}

/* Form and input adjustments */
body[dir="rtl"] .input-row {
    direction: rtl;
}

body[dir="rtl"] .input-field {
    text-align: right;
}

body[dir="rtl"] .input-field input,
body[dir="rtl"] .input-field select {
    text-align: right;
    padding-right: 3rem;
    padding-left: 0.75rem;
}

body[dir="rtl"] .input-unit {
    right: auto;
    left: 0.75rem;
}

/* Result panels */
body[dir="rtl"] .result-item {
    flex-direction: row-reverse;
}

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

body[dir="rtl"] .result-value {
    text-align: left;
}

/* Batch calculation adjustments */
body[dir="rtl"] .batch-controls {
    flex-direction: row-reverse;
}

body[dir="rtl"] .batch-item-header {
    flex-direction: row-reverse;
}

body[dir="rtl"] .batch-inputs {
    direction: rtl;
}

body[dir="rtl"] .batch-inputs input {
    text-align: right;
}

/* History section */
body[dir="rtl"] .history-section .section-header {
    flex-direction: row-reverse;
}

body[dir="rtl"] .history-item {
    flex-direction: row-reverse;
}

body[dir="rtl"] .history-details {
    text-align: right;
}

body[dir="rtl"] .history-time {
    text-align: left;
}

/* Guide section adjustments */
body[dir="rtl"] .guide-grid {
    direction: rtl;
}

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

body[dir="rtl"] .guide-icon {
    margin-left: 0;
    margin-right: 0;
}

/* About section adjustments */
body[dir="rtl"] .about-features {
    direction: rtl;
}

body[dir="rtl"] .about-feature {
    flex-direction: row-reverse;
    text-align: right;
}

/* Footer adjustments */
body[dir="rtl"] .footer-content {
    direction: rtl;
}

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

body[dir="rtl"] .footer-links {
    text-align: right;
}

/* Button adjustments */
body[dir="rtl"] .calculate-btn,
body[dir="rtl"] .btn-secondary {
    flex-direction: row-reverse;
}

body[dir="rtl"] .calculate-btn i,
body[dir="rtl"] .btn-secondary i {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Card title adjustments */
body[dir="rtl"] .card-title {
    flex-direction: row-reverse;
}

body[dir="rtl"] .card-title i {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Language selector adjustments for RTL */
body[dir="rtl"] .lang-btn {
    flex-direction: row-reverse;
}

body[dir="rtl"] .lang-option {
    flex-direction: row-reverse;
    text-align: right;
}

/* Specific Arabic font improvements */
body[lang="ar"] {
    font-family: 'Noto Sans Arabic', 'Cairo', 'Amiri', Arial, sans-serif;
    line-height: 1.8;
}

body[lang="ar"] .hero-title {
    line-height: 1.4;
}

body[lang="ar"] .section-title {
    line-height: 1.4;
}

body[lang="ar"] .guide-title,
body[lang="ar"] .card-title {
    line-height: 1.5;
}

/* Arabic number formatting */
body[lang="ar"] .result-value,
body[lang="ar"] input[type="number"] {
    font-family: 'Inter', monospace;
    direction: ltr;
    text-align: left;
}

/* Responsive adjustments for RTL */
@media (max-width: 768px) {
    body[dir="rtl"] .nav-menu {
        flex-direction: column;
        align-items: flex-end;
    }
    
    body[dir="rtl"] .hero-features {
        flex-direction: column;
    }
    
    body[dir="rtl"] .batch-controls {
        flex-direction: column;
        align-items: flex-end;
    }
    
    body[dir="rtl"] .history-section .section-header {
        flex-direction: column;
        align-items: flex-end;
    }
}

/* Ensure proper text alignment for mixed content */
body[dir="rtl"] .result-panel,
body[dir="rtl"] .input-group {
    text-align: right;
}

/* Fix for dropdowns in RTL */
body[dir="rtl"] select {
    background-position: left 0.75rem center;
}

/* Animation adjustments for RTL */
body[dir="rtl"] .calculator-card:hover {
    transform: translateY(-2px) translateX(2px);
}

body[dir="rtl"] .guide-card:hover {
    transform: translateY(-4px) translateX(2px);
}
