/**
 * SkyHost RTL additions (Arabic, Farsi, Hebrew).
 *
 * Loaded after custom.rtl.css only when the active language is right-to-left.
 * Mirroring of the theme itself is generated by build-rtl.js; this file holds
 * what mirroring cannot express. It is hand-written and never regenerated.
 */

/* Typography ------------------------------------------------------------ */
html[dir="rtl"] body,
html[dir="rtl"] body button,
html[dir="rtl"] body input,
html[dir="rtl"] body select,
html[dir="rtl"] body textarea,
html[dir="rtl"] body .btn {
    font-family: "Cairo", Tahoma, "Segoe UI", Arial, sans-serif;
}

/* Letter-spacing breaks the joins between Arabic/Persian letters. */
html[dir="rtl"] body,
html[dir="rtl"] body *,
html[dir="rtl"] body *::before,
html[dir="rtl"] body *::after {
    letter-spacing: 0 !important;
}

/* Latin-script fields --------------------------------------------------- */
/* Emails, URLs, phone numbers and passwords are typed left-to-right but
   should still sit against the start (right) edge of the field. */
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="url"],
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="number"],
html[dir="rtl"] input[type="password"],
html[dir="rtl"] input.pw-input {
    direction: ltr;
    text-align: right;
}

html[dir="rtl"] input[type="email"]::placeholder,
html[dir="rtl"] input[type="url"]::placeholder,
html[dir="rtl"] input[type="tel"]::placeholder,
html[dir="rtl"] input[type="number"]::placeholder,
html[dir="rtl"] input[type="password"]::placeholder {
    direction: rtl;
    text-align: right;
}

/* The phone dropdown is deliberately not mirrored (see build-rtl.js), so keep
   its input flush with the flag. */
html[dir="rtl"] .fivem-phone-wrap input[type="tel"],
html[dir="rtl"] .intl-tel-input input[type="tel"] {
    text-align: left;
}

/* Directional icons ----------------------------------------------------- */
/* Icons supplied by WHMCS core templates hard-code left/right. The SkyHost
   templates choose their arrow through $skyArrowFwd / $skyArrowBack instead. */
html[dir="rtl"] .fa-arrow-circle-right,
html[dir="rtl"] .fa-arrow-circle-left,
html[dir="rtl"] .fa-chevron-right,
html[dir="rtl"] .fa-chevron-left,
html[dir="rtl"] .fa-angle-right,
html[dir="rtl"] .fa-angle-left,
html[dir="rtl"] .fa-angle-double-right,
html[dir="rtl"] .fa-angle-double-left,
html[dir="rtl"] .fa-caret-right,
html[dir="rtl"] .fa-caret-left,
html[dir="rtl"] .fa-long-arrow-right,
html[dir="rtl"] .fa-long-arrow-left {
    transform: scaleX(-1);
}

/* Numbers, prices and identifiers stay left-to-right -------------------- */
html[dir="rtl"] .price,
html[dir="rtl"] .amt,
html[dir="rtl"] .invoice-amount,
html[dir="rtl"] .fivem-plan-price strong,
html[dir="rtl"] .view-cart-items .item-price,
html[dir="rtl"] td.text-nowrap,
html[dir="rtl"] .domain-name,
html[dir="rtl"] code {
    unicode-bidi: isolate;
}

/* Order summary --------------------------------------------------------- */
/* The standard cart floats its summary rows; in RTL the floats collide, so
   lay them out with flex instead. */
html[dir="rtl"] .fivem-theme #order-standard_cart .order-summary .subtotal,
html[dir="rtl"] .fivem-theme #order-standard_cart .order-summary .bordered-totals,
html[dir="rtl"] .fivem-theme #order-standard_cart .order-summary .recurring-totals {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
}

html[dir="rtl"] .fivem-theme #order-standard_cart .order-summary .subtotal > span,
html[dir="rtl"] .fivem-theme #order-standard_cart .order-summary .bordered-totals > span,
html[dir="rtl"] .fivem-theme #order-standard_cart .order-summary .recurring-totals > span {
    float: none !important;
    width: auto;
    min-width: 0;
    margin: 0;
}

html[dir="rtl"] .fivem-theme #order-standard_cart .order-summary .subtotal > span:last-child,
html[dir="rtl"] .fivem-theme #order-standard_cart .order-summary .bordered-totals > span:last-child,
html[dir="rtl"] .fivem-theme #order-standard_cart .order-summary .recurring-totals > span:last-child,
html[dir="rtl"] .fivem-theme #order-standard_cart .order-summary .amt,
html[dir="rtl"] .fivem-theme #order-standard_cart .view-cart-items .item-price {
    direction: ltr;
    text-align: left;
    unicode-bidi: isolate;
}

html[dir="rtl"] .fivem-theme #order-standard_cart .order-summary .recurring-charges {
    flex: 0 1 auto;
    overflow-wrap: anywhere;
}

html[dir="rtl"] .fivem-theme #order-standard_cart .view-cart-items .item > .row {
    align-items: center;
}

html[dir="rtl"] .fivem-theme #order-standard_cart .view-cart-items .item-title,
html[dir="rtl"] .fivem-theme #order-standard_cart .view-cart-items .item-group,
html[dir="rtl"] .fivem-theme #order-standard_cart .view-cart-items .item-domain,
html[dir="rtl"] .fivem-theme #order-standard_cart .view-cart-items small {
    overflow-wrap: anywhere;
}

html[dir="rtl"] .fivem-theme #order-standard_cart .btn-remove-from-cart {
    margin: 0;
}

@media (max-width: 575px) {
    html[dir="rtl"] .fivem-theme #order-standard_cart .view-cart-items .item-price {
        text-align: right;
    }
}

/* Footer: the "next" arrow points the other way in RTL */
html[dir="rtl"] .fivem-footer-arrow { transform: scaleX(-1); }
