/* ================================================
   RTL (Right-to-Left) Support
   For Arabic and Persian languages
   ================================================ */

/* Apply RTL direction */
html[dir="rtl"] {
    direction: rtl;
}

html[dir="rtl"] body {
    text-align: right;
    font-family: var(--font-arabic);
}

/* -------------------- Typography -------------------- */
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6 {
    letter-spacing: 0;
}

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

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

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

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

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

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

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

/* Mobile Menu */
html[dir="rtl"] .mobile-menu {
    right: auto;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.1);
}

html[dir="rtl"] .mobile-menu.open {
    transform: translateX(0);
}

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

html[dir="rtl"] .mobile-menu-links a {
    border-left: none;
    border-right: 3px solid transparent;
    flex-direction: row-reverse;
}

html[dir="rtl"] .mobile-menu-links a:hover,
html[dir="rtl"] .mobile-menu-links a:active {
    border-left-color: transparent;
    border-right-color: var(--color-primary);
}

html[dir="rtl"] .mobile-menu-links li {
    transform: translateX(-20px);
}

html[dir="rtl"] .mobile-menu.open .mobile-menu-links li {
    transform: translateX(0);
}

/* -------------------- Hero Section -------------------- */
html[dir="rtl"] .hero-content {
    text-align: center;
}

@media (min-width: 1024px) {
    html[dir="rtl"] .hero-content {
        text-align: right;
    }

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

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

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

@media (min-width: 1024px) {
    html[dir="rtl"] .hero-buttons {
        justify-content: flex-end;
    }
}

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

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

html[dir="rtl"] .btn-store .store-text {
    align-items: flex-end;
}

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

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

/* -------------------- How It Works Section -------------------- */
@media (min-width: 768px) {
    html[dir="rtl"] .step:not(:last-child)::after {
        left: auto;
        right: calc(50% + 40px);
    }
}

/* -------------------- Stats Section -------------------- */
html[dir="rtl"] .stat {
    text-align: center;
}

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

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

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

html[dir="rtl"] .testimonial-stars {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

/* -------------------- Footer -------------------- */
html[dir="rtl"] .footer-brand p {
    text-align: right;
}

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

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

html[dir="rtl"] .footer-links {
    align-items: flex-end;
}

html[dir="rtl"] .footer-bottom {
    flex-direction: column;
}

@media (min-width: 768px) {
    html[dir="rtl"] .footer-bottom {
        flex-direction: row-reverse;
    }
}

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

/* -------------------- Animations -------------------- */
html[dir="rtl"] [data-animate="fade-left"] {
    transform: translateX(-30px);
}

html[dir="rtl"] [data-animate="fade-right"] {
    transform: translateX(30px);
}

/* -------------------- Utility Overrides -------------------- */
html[dir="rtl"] .text-left {
    text-align: right;
}

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

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

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

/* Flex direction reversals */
html[dir="rtl"] .flex-row {
    flex-direction: row-reverse;
}

/* Gap adjustments for specific elements */
html[dir="rtl"] .gap-left {
    margin-left: 0;
    margin-right: var(--space-4);
}

html[dir="rtl"] .gap-right {
    margin-right: 0;
    margin-left: var(--space-4);
}

/* -------------------- Icons -------------------- */
html[dir="rtl"] .icon-arrow-right {
    transform: scaleX(-1);
}

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

/* -------------------- Section Headers -------------------- */
html[dir="rtl"] .section-header {
    text-align: center;
}

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

html[dir="rtl"] input::placeholder,
html[dir="rtl"] textarea::placeholder {
    text-align: right;
}

/* -------------------- Lists -------------------- */
html[dir="rtl"] ul,
html[dir="rtl"] ol {
    padding-right: var(--space-6);
    padding-left: 0;
}

/* -------------------- Badge -------------------- */
html[dir="rtl"] .hero-badge {
    flex-direction: row-reverse;
}

/* -------------------- Language Selector -------------------- */
html[dir="rtl"] .lang-btn {
    flex-direction: row-reverse;
}

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

/* -------------------- Support Section -------------------- */
html[dir="rtl"] .support-card {
    flex-direction: row-reverse;
    text-align: right;
}

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

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

html[dir="rtl"] .support-link:hover {
    transform: translateX(-3px);
}

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

html[dir="rtl"] .officials-desc {
    padding-left: 0;
    padding-right: calc(48px + var(--space-4));
    text-align: right;
}

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

html[dir="rtl"] .agent-link:hover {
    transform: translateX(-5px);
}

html[dir="rtl"] .agent-info {
    text-align: right;
    align-items: flex-end;
}

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

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

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

@media (max-width: 767px) {
    html[dir="rtl"] .support-card,
    html[dir="rtl"] .officials-header,
    html[dir="rtl"] .agent-link,
    html[dir="rtl"] .channel-card {
        flex-direction: column;
        text-align: center;
    }

    html[dir="rtl"] .support-card-content,
    html[dir="rtl"] .channel-content,
    html[dir="rtl"] .agent-info {
        text-align: center;
        align-items: center;
    }

    html[dir="rtl"] .officials-desc {
        padding-right: 0;
        text-align: center;
    }
}