/* RTL Layout Support for Arabic Language */

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

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

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

/* Text alignment */
html[dir="rtl"] .text-left,
body.rtl .text-left {
    text-align: right;
}

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

/* Padding and margin adjustments */
html[dir="rtl"] .pl-*,
html[dir="rtl"] [class*="pl-"],
body.rtl .pl-*,
body.rtl [class*="pl-"] {
    padding-left: 0;
    padding-right: var(--original-padding);
}

html[dir="rtl"] .pr-*,
html[dir="rtl"] [class*="pr-"],
body.rtl .pr-*,
body.rtl [class*="pr-"] {
    padding-right: 0;
    padding-left: var(--original-padding);
}

html[dir="rtl"] .ml-*,
html[dir="rtl"] [class*="ml-"],
body.rtl .ml-*,
body.rtl [class*="ml-"] {
    margin-left: 0;
    margin-right: var(--original-margin);
}

html[dir="rtl"] .mr-*,
html[dir="rtl"] [class*="mr-"],
body.rtl .mr-*,
body.rtl [class*="mr-"] {
    margin-right: 0;
    margin-left: var(--original-margin);
}

/* Float direction */
html[dir="rtl"] .float-left,
body.rtl .float-left {
    float: right;
}

html[dir="rtl"] .float-right,
body.rtl .float-right {
    float: left;
}

/* Transform origin for animations */
html[dir="rtl"] [class*="transform"],
body.rtl [class*="transform"] {
    transform-origin: right center;
}

/* Header specific RTL adjustments */
html[dir="rtl"] .header-top-v4,
html[dir="rtl"] .header-middle-v4,
html[dir="rtl"] .header-bottom-v4,
body.rtl .header-top-v4,
body.rtl .header-middle-v4,
body.rtl .header-bottom-v4 {
    direction: rtl;
}

/* Navigation menu RTL */
html[dir="rtl"] nav ul,
html[dir="rtl"] .menu ul,
body.rtl nav ul,
body.rtl .menu ul {
    direction: rtl;
}

/* Dropdown menus */
html[dir="rtl"] .dropdown-content,
body.rtl .dropdown-content {
    right: auto;
    left: 0;
    text-align: right;
}

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

html[dir="rtl"] input[type="text"],
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="password"],
html[dir="rtl"] textarea,
body.rtl input[type="text"],
body.rtl input[type="email"],
body.rtl input[type="password"],
body.rtl textarea {
    direction: rtl;
}

/* Buttons */
html[dir="rtl"] button,
html[dir="rtl"] .btn,
body.rtl button,
body.rtl .btn {
    direction: rtl;
}

/* Grid and container adjustments */
html[dir="rtl"] .container,
html[dir="rtl"] .container-fluid,
body.rtl .container,
body.rtl .container-fluid {
    direction: rtl;
}

/* Swiper slider RTL support */
html[dir="rtl"] .swiper,
body.rtl .swiper {
    direction: rtl;
}

/* Card and box layouts */
html[dir="rtl"] .card,
html[dir="rtl"] .box,
body.rtl .card,
body.rtl .box {
    direction: rtl;
    text-align: right;
}

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

/* Icon positioning */
html[dir="rtl"] [class*="icon"]:before,
html[dir="rtl"] [class*="icon"]:after,
body.rtl [class*="icon"]:before,
body.rtl [class*="icon"]:after {
    transform: scaleX(-1);
}

/* Arrow icons should point left in RTL */
html[dir="rtl"] .arrow-right,
html[dir="rtl"] [class*="arrow-right"],
body.rtl .arrow-right,
body.rtl [class*="arrow-right"] {
    transform: scaleX(-1);
}

html[dir="rtl"] .arrow-left,
html[dir="rtl"] [class*="arrow-left"],
body.rtl .arrow-left,
body.rtl [class*="arrow-left"] {
    transform: scaleX(-1);
}

/* Utility classes for RTL-specific adjustments */
.rtl\:text-right {
    text-align: right;
}

.rtl\:text-left {
    text-align: left;
}

.rtl\:flex-row-reverse {
    flex-direction: row-reverse;
}

.rtl\:pr-0 {
    padding-right: 0;
}

.rtl\:pl-0 {
    padding-left: 0;
}

.rtl\:mr-0 {
    margin-right: 0;
}

.rtl\:ml-0 {
    margin-left: 0;
}

/* Specific component adjustments */
html[dir="rtl"] .language-currency-selector-v4,
body.rtl .language-currency-selector-v4 {
    direction: ltr; /* Keep language selector LTR */
}

/* Keep numbers LTR in RTL context */
html[dir="rtl"] .number,
html[dir="rtl"] [class*="number"],
body.rtl .number,
body.rtl [class*="number"] {
    direction: ltr;
    display: inline-block;
}

/* Price and currency should remain LTR */
html[dir="rtl"] .price,
html[dir="rtl"] .currency,
html[dir="rtl"] [class*="price"],
html[dir="rtl"] [class*="currency"],
body.rtl .price,
body.rtl .currency,
body.rtl [class*="price"],
body.rtl [class*="currency"] {
    direction: ltr;
    display: inline-block;
}
