/* ===================================
   RTL (Right-to-Left) Support
   For Arabic Language
   =================================== */

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

[dir="rtl"] body {
    font-family: 'Inter', 'Tajawal', 'Cairo', 'Amiri', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Navigation RTL */
[dir="rtl"] .navbar-content {
    flex-direction: row-reverse;
}

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

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

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

/* Flex Utilities RTL */
[dir="rtl"] .flex-between {
    flex-direction: row-reverse;
}

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

/* Grid RTL - No change needed, grid auto-flows correctly */

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

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

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

/* Form Elements RTL */
[dir="rtl"] .form-label {
    text-align: right;
}

[dir="rtl"] .form-input,
[dir="rtl"] .form-textarea,
[dir="rtl"] .form-select {
    text-align: right;
}

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

/* Badge RTL - No specific changes needed */

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

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

/* Alert RTL */
[dir="rtl"] .alert {
    flex-direction: row-reverse;
    text-align: right;
}

/* Chat Interface RTL */
[dir="rtl"] .message {
    flex-direction: row-reverse;
}

[dir="rtl"] .message.user {
    flex-direction: row;
}

[dir="rtl"] .chat-input-form {
    flex-direction: row-reverse;
}

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

/* Course Card RTL */
[dir="rtl"] .detail-item {
    flex-direction: row-reverse;
    text-align: right;
}

/* Quiz RTL */
[dir="rtl"] .answer-option {
    flex-direction: row-reverse;
    text-align: right;
}

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

/* Pricing Cards RTL */
[dir="rtl"] .pricing-grid {
    direction: rtl;
}

[dir="rtl"] .plan-features li {
    flex-direction: row-reverse;
    text-align: right;
}

/* Language Switcher */
.language-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background-color: var(--bg-light);
    border-radius: var(--radius-md);
}

.lang-btn {
    padding: 0.375rem 0.75rem;
    border: none;
    background-color: transparent;
    color: var(--text-gray);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background-color: white;
    color: var(--primary-color);
}

.lang-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* RTL Specific Text Direction */
[dir="rtl"] .hero-content,
[dir="rtl"] .section-title,
[dir="rtl"] .feature-card {
    text-align: center;
}

[dir="rtl"] .step-card {
    flex-direction: row-reverse;
    text-align: right;
}

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

/* Activity List RTL */
[dir="rtl"] .activity-item {
    flex-direction: row-reverse;
    border-left: none;
    border-right: 3px solid var(--primary-color);
    text-align: right;
}

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

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

/* Progress Bar RTL */
[dir="rtl"] .progress-bar-container {
    direction: ltr; /* Progress bars should fill left to right even in RTL */
}

/* Table RTL */
[dir="rtl"] table {
    direction: rtl;
}

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

/* FAQ RTL */
[dir="rtl"] .faq-question {
    flex-direction: row-reverse;
    text-align: right;
}

[dir="rtl"] .faq-answer {
    text-align: right;
}

/* Comparison Table RTL */
[dir="rtl"] .comparison-table {
    direction: rtl;
}

/* Step Numbers RTL - Keep LTR for numbers */
[dir="rtl"] .step-number {
    direction: ltr;
}

/* Pricing Toggle RTL */
[dir="rtl"] .pricing-toggle {
    flex-direction: row-reverse;
}

/* Plan Price RTL - Keep numbers LTR */
[dir="rtl"] .plan-price {
    direction: ltr;
    text-align: center;
}

[dir="rtl"] .price-amount {
    direction: ltr;
}

/* Session Card RTL */
[dir="rtl"] .session-header {
    flex-direction: row-reverse;
    text-align: right;
}

/* Auth Card RTL */
[dir="rtl"] .auth-header {
    text-align: center;
}

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

/* Subscription Banner RTL */
[dir="rtl"] #subscriptionBanner {
    flex-direction: row-reverse;
    text-align: right;
}

/* Course Actions RTL */
[dir="rtl"] .course-actions {
    text-align: right;
}

/* Results Stats RTL */
[dir="rtl"] .results-stats {
    direction: rtl;
}

/* Mobile RTL Adjustments */
@media (max-width: 768px) {
    [dir="rtl"] .navbar-content {
        flex-direction: row-reverse;
    }
    
    [dir="rtl"] .hero-buttons {
        flex-direction: row-reverse;
    }
}

/* Arabic Font Improvements */
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4,
[dir="rtl"] h5,
[dir="rtl"] h6 {
    font-weight: 700;
}

[dir="rtl"] p,
[dir="rtl"] span,
[dir="rtl"] div {
    line-height: 1.8; /* Better for Arabic text */
}

/* Ensure numbers and English text within Arabic stay LTR */
[dir="rtl"] .price-amount,
[dir="rtl"] .stat-value,
[dir="rtl"] .badge,
[dir="rtl"] .day-number {
    direction: ltr;
    display: inline-block;
}
