/* RTL (Right-to-Left) Stylesheet for Arabic */
/* This file handles all RTL-specific styling for the bilingual website */

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

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

/* Arabic Typography & Fonts */
body.lang-ar {
    font-family: 'Cairo', 'IBM Plex Sans Arabic', 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.65;
    font-size: 1.05rem;
}

body.lang-ar h1,
body.lang-ar h2,
body.lang-ar h3,
body.lang-ar h4,
body.lang-ar h5,
body.lang-ar h6 {
    font-family: 'Cairo', 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 600;
    line-height: 1.4;
}

body.lang-ar strong {
    font-weight: 700;
}

/* Language Switcher - RTL Specific */
html[dir="rtl"] .language-switcher {
    flex-direction: row-reverse;
    margin-left: 16px;
    margin-right: 0;
}

html[dir="rtl"] .header-end {
    flex-direction: row-reverse;
    margin-left: auto;
    margin-right: 0;
}

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

html[dir="rtl"] .header-inner {
    flex-direction: row-reverse;
    padding-left: 0;
    padding-right: 2rem;
}

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

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

/* Navigation Dropdown RTL */
html[dir="rtl"] .nav-has-dropdown .nav-dropdown {
    right: auto;
    left: 0;
    text-align: right;
}

html[dir="rtl"] .nav-services-caret-icon {
    transform: scaleX(-1);
}

/* Text Alignment RTL */
html[dir="rtl"] body {
    text-align: right;
}

html[dir="rtl"] p,
html[dir="rtl"] li,
html[dir="rtl"] span,
html[dir="rtl"] a,
html[dir="rtl"] strong,
html[dir="rtl"] em {
    text-align: inherit;
}

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

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

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

/* Flexbox RTL */
html[dir="rtl"] .flex,
html[dir="rtl"] .flex-row {
    flex-direction: row-reverse;
}

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

html[dir="rtl"] .justify-start {
    justify-content: flex-end;
}

html[dir="rtl"] .justify-end {
    justify-content: flex-start;
}

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

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

/* Margin & Padding RTL */
html[dir="rtl"] .ml-auto,
html[dir="rtl"] .ms-auto {
    margin-left: 0;
    margin-right: auto;
}

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

html[dir="rtl"] .pl-4 {
    padding-left: 0;
    padding-right: 1rem;
}

html[dir="rtl"] .pr-4 {
    padding-right: 0;
    padding-left: 1rem;
}

html[dir="rtl"] .pl-8 {
    padding-left: 0;
    padding-right: 2rem;
}

html[dir="rtl"] .pr-8 {
    padding-right: 0;
    padding-left: 2rem;
}

/* Borders RTL */
html[dir="rtl"] .border-l {
    border-left: 0;
    border-right: 1px solid currentColor;
}

html[dir="rtl"] .border-r {
    border-right: 0;
    border-left: 1px solid currentColor;
}

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

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

/* Lists RTL */
html[dir="rtl"] ul,
html[dir="rtl"] ol {
    margin-left: 0;
    margin-right: 1.5rem;
    padding-left: 0;
    padding-right: 1.5rem;
}

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

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

html[dir="rtl"] .button svg {
    margin-left: 8px;
    margin-right: 0;
}

/* Icons - Preserve Direction for Neutral Icons */
html[dir="rtl"] svg[role="img"],
html[dir="rtl"] svg[data-preserve-ltr] {
    direction: ltr;
}

/* Prevent image mirroring */
html[dir="rtl"] img {
    direction: ltr;
}

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

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

/* Footer RTL */
html[dir="rtl"] footer {
    text-align: right;
    direction: rtl;
}

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

/* Hero Section RTL */
html[dir="rtl"] .page-hero-copy {
    text-align: right;
}

html[dir="rtl"] .page-hero-copy .eyebrow {
    text-align: right;
}

/* Ensure LTR content stays LTR */
[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

/* Arabic Number Support */
body.lang-ar {
    direction: rtl;
}

/* Responsive RTL Adjustments */
@media (max-width: 768px) {
    html[dir="rtl"] .nav-links {
        gap: 1.5rem;
    }

    html[dir="rtl"] .header-inner {
        padding-right: 1rem;
    }

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

    html[dir="rtl"] ul,
    html[dir="rtl"] ol {
        margin-right: 1rem;
        padding-right: 1rem;
    }
}

/* =============================================================================
   RTL — phone numbers & email addresses stay left-to-right
   ============================================================================= */
html[dir="rtl"] a[href^="tel:"],
html[dir="rtl"] a[href^="mailto:"],
html[dir="rtl"] .iic-ltr,
html[dir="rtl"] [dir="ltr"] {
    direction: ltr;
    unicode-bidi: embed;
    display: inline-block;
}

html[dir="rtl"] a.iic-contact-card__value[href^="tel:"],
html[dir="rtl"] a.iic-contact-card__value[href^="mailto:"],
html[dir="rtl"] a.iic-quick-card[href^="tel:"] .iic-quick-card__value,
html[dir="rtl"] a.iic-quick-card[href^="mailto:"] .iic-quick-card__value,
html[dir="rtl"] .iic-contact-card__meta a[href^="tel:"],
html[dir="rtl"] .iic-assistant-email-fallback__link {
    direction: ltr;
    unicode-bidi: embed;
    display: inline-block;
}

html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="email"] {
    direction: ltr;
    unicode-bidi: embed;
    text-align: left;
}
