/* RTL Support for Hebrew Language */
html[dir="rtl"] {
    font-family: var(--font-body-rtl, system-ui);
    text-align: right;
}

/* Keep code blocks LTR even in RTL mode */
html[dir="rtl"] pre,
html[dir="rtl"] code,
html[dir="rtl"] .code-block,
html[dir="rtl"] .code-block code {
    direction: ltr;
    text-align: left;
}

/* Navigation Direction Controls */
.main-nav[data-direction="ltr"] ul {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    gap: 18px;
}

.main-nav[data-direction="ltr"] ul li {
    text-align: center;
}

.main-nav[data-direction="rtl"] ul {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    gap: 18px;
}

.main-nav[data-direction="rtl"] ul li {
    text-align: center;
}

.mobile-nav[data-direction="ltr"] ul {
    flex-direction: column;
    text-align: left;
}

.mobile-nav[data-direction="rtl"] ul {
    flex-direction: column;
    text-align: right;
}

/* Header Navigation */
html[dir="rtl"] .main-nav ul {
    padding-right: 0;
    padding-left: 20px;
}

html[dir="rtl"] .main-nav ul li {
    margin-right: 0;
    margin-left: 15px;
}

html[dir="rtl"] .main-nav li {
    text-align: right;
}

html[dir="rtl"] .dropdown-arrow {
    margin-right: 4px;
    margin-left: 0;
}

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

html[dir="rtl"] .dropdown-content {
    left: auto;
    right: 0;
    text-align: right;
}

html[dir="rtl"] .language-dropdown {
    text-align: right;
    left: auto;
    right: 0;
}

html[dir="rtl"] .language-option {
    text-align: right;
}

html[dir="rtl"] .notification-dropdown {
    left: auto;
    right: 0;
    text-align: right;
}

html[dir="rtl"] .notification-item-icon {
    margin-right: 0;
    margin-left: 16px;
}

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

html[dir="rtl"] .mobile-menu-toggle {
    margin-left: 0;
    margin-right: auto;
}

/* Button Icons */
html[dir="rtl"] .btn svg {
    margin-right: 8px;
    margin-left: 0;
}

html[dir="rtl"] .btn-arrow {
    transform: scaleX(-1);
    margin-right: 8px;
    margin-left: 0;
}

/* Hero Section */
html[dir="rtl"] .hero-features {
    direction: rtl;
}

html[dir="rtl"] .scrolling-wrapper {
    direction: rtl;
    overflow: hidden;
}

html[dir="rtl"] .scrolling-content {
    direction: rtl;
    display: flex;
    flex-wrap: nowrap;
    white-space: nowrap;
    animation: none !important; /* Disable default animation, let JS handle it */
}

/* Ensure each term in RTL has proper styling */
html[dir="rtl"] .scrolling-content span {
    text-align: right;
    direction: rtl;
}

/* Add space to prevent content from disappearing */
html[dir="rtl"] .scrolling-content {
    padding-right: 20px;
    padding-left: 20px;
}

/* Feature Cards */
html[dir="rtl"] .feature-card {
    text-align: right;
}

/* Call Interface */
html[dir="rtl"] .call-interface {
    text-align: right;
}

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

/* Document Editor */
html[dir="rtl"] .document-content {
    flex-direction: row-reverse;
}

html[dir="rtl"] .document-info {
    text-align: right;
}

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

/* GitHub Integration */
html[dir="rtl"] .github-features {
    direction: rtl;
}

html[dir="rtl"] .github-feature {
    text-align: right;
}

/* MetaBrain Section */
html[dir="rtl"] .metabrain-features ul {
    text-align: right;
}

/* Community Section */
html[dir="rtl"] .community-platforms {
    direction: rtl;
}

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

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

/* Testimonials */
html[dir="rtl"] .testimonial-content {
    text-align: right;
}

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

html[dir="rtl"] .testimonial-author .author-info {
    text-align: right;
}

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

html[dir="rtl"] .prev-btn svg,
html[dir="rtl"] .next-btn svg {
    transform: scaleX(-1);
}

html[dir="rtl"] .metric-box {
    text-align: right;
}

html[dir="rtl"] .quote-icon {
    left: auto;
    right: 0;
    transform: scaleX(-1);
}

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

html[dir="rtl"] .feature-icon {
    margin-right: 0;
    margin-left: 10px;
}

/* Integrations */
html[dir="rtl"] .integration-tabs {
    direction: rtl;
}

html[dir="rtl"] .integration-grid {
    direction: rtl;
}

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

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

/* Footer */
html[dir="rtl"] .footer-links {
    flex-direction: row-reverse;
}

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

/* Newsletter */
html[dir="rtl"] .newsletter-form {
    flex-direction: row-reverse;
}

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

/* Notifications */
html[dir="rtl"] .notification-container {
    right: auto;
    left: 20px;
}

html[dir="rtl"] .notification-item {
    text-align: right;
}

html[dir="rtl"] .notification-close {
    right: auto;
    left: 10px;
}

/* Tooltip adaptations */
html[dir="rtl"] [data-tooltip]::after {
    right: 50%;
    left: auto;
    transform: translateX(50%);
}

/* Make sure search direction is RTL */
html[dir="rtl"] input[type="search"],
html[dir="rtl"] input[type="text"],
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="password"],
html[dir="rtl"] textarea {
    text-align: right;
    direction: rtl;
}

/* Mobile menu adaptations */
@media (max-width: 768px) {
    html[dir="rtl"] .mobile-nav {
        align-items: flex-start;
        text-align: right;
    }
    
    html[dir="rtl"] .mobile-menu-container {
        text-align: right;
    }
    
    html[dir="rtl"] .mobile-actions {
        flex-direction: column;
    }
    
    html[dir="rtl"] .mobile-nav ul {
        padding-right: 0;
    }
    
    html[dir="rtl"] .mobile-nav ul li {
        text-align: right;
    }
    
    html[dir="rtl"] .mobile-dropdown-toggle {
        flex-direction: row-reverse;
        justify-content: flex-end;
    }
    
    html[dir="rtl"] .mobile-dropdown-toggle .dropdown-arrow {
        margin-right: 8px;
        margin-left: 0;
    }
    
    html[dir="rtl"] .mobile-dropdown-content {
        padding-right: 16px;
        padding-left: 0;
    }
    
    html[dir="rtl"] .theme-toggle-mobile .theme-toggle-icon {
        margin-right: 0;
        margin-left: 10px;
    }
}

/* RTL Animation for scrolling content */
@keyframes rtl-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Special rule to override any conflicting styles */
html[dir="rtl"] body .scrolling-content,
html[dir="rtl"] body .scrolling-content span {
    text-align: right !important;
    direction: rtl !important;
}

/* Critical styles for scrolling wrapper in RTL mode */
html[dir="rtl"] .scrolling-wrapper {
    overflow: hidden !important;
    position: relative !important;
}

/* Ensure text items are properly aligned */
html[dir="rtl"] .scrolling-content span:not(.feature-dot) {
    display: inline-block !important;
    padding: 0 4px !important;
    vertical-align: middle !important;
}

/* Properly style dots in RTL */
html[dir="rtl"] .scrolling-content .feature-dot {
    margin: 0 12px !important;
    opacity: 0.7 !important;
    display: inline-block !important;
    vertical-align: middle !important;
} 