/* ==========================================================================
   RTL Layout overrides for Nyrix Theme v2 (Morocco / Arabic)
   ========================================================================== */

/* @font-face Definitions for local Cairo font */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&display=swap');

@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('assets/fonts/cairo/Cairo-Regular.woff2') format('woff2'),
         url('assets/fonts/cairo/Cairo-Regular.woff') format('woff');
}
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('assets/fonts/cairo/Cairo-Medium.woff2') format('woff2'),
         url('assets/fonts/cairo/Cairo-Medium.woff') format('woff');
}
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('assets/fonts/cairo/Cairo-SemiBold.woff2') format('woff2'),
         url('assets/fonts/cairo/Cairo-SemiBold.woff') format('woff');
}
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('assets/fonts/cairo/Cairo-Bold.woff2') format('woff2'),
         url('assets/fonts/cairo/Cairo-Bold.woff') format('woff');
}

/* ─── Global Font & Typography ─── */
body.rtl {
    direction: rtl;
    text-align: right;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

body.rtl :not(i):not(.fa):not(.fab):not(.far):not(.fas):not([class*="fa-"]),
body.rtl :not(i):not(.fa):not(.fab):not(.far):not(.fas):not([class*="fa-"])::before,
body.rtl :not(i):not(.fa):not(.fab):not(.far):not(.fas):not([class*="fa-"])::after {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* Prevent font override from breaking WordPress Admin Bar and Dashicons */
body.rtl #wpadminbar,
body.rtl #wpadminbar * {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
}
body.rtl #wpadminbar .ab-icon,
body.rtl #wpadminbar .ab-icon::before,
body.rtl #wpadminbar .ab-item::before,
body.rtl #wpadminbar .ab-item::after,
body.rtl .dashicons,
body.rtl .dashicons::before,
body.rtl [class*="dashicons-"],
body.rtl [class*="dashicons-"]::before {
    font-family: 'dashicons' !important;
}

/* Global Form Controls RTL alignment */
body.rtl input[type="text"],
body.rtl input[type="tel"],
body.rtl input[type="email"],
body.rtl input[type="search"],
body.rtl input[type="number"],
body.rtl input[type="password"],
body.rtl textarea,
body.rtl select {
    direction: rtl !important;
    text-align: right !important;
}
body.rtl input::placeholder,
body.rtl textarea::placeholder {
    text-align: right !important;
    direction: rtl !important;
}

/* Align text to right for RTL containers */
body.rtl h1,
body.rtl h2,
body.rtl h3,
body.rtl h4,
body.rtl h5,
body.rtl h6,
body.rtl p,
body.rtl span,
body.rtl li,
body.rtl td,
body.rtl th {
    text-align: right;
}

/* Mirror icon arrows and positions */
body.rtl .arrow-icon svg,
body.rtl .fa-chevron-right,
body.rtl .fa-chevron-left,
body.rtl .chevron-right,
body.rtl .chevron-left {
    transform: scaleX(-1);
}

/* ─── Header Component ─── */
body.rtl .header-promo-bar,
body.rtl .header-promo-bar p {
    text-align: center;
}

body.rtl .header-icons a .cart-count-badge {
    right: auto;
    left: -8px;
}

body.rtl .main-navigation ul {
    direction: rtl;
    padding: 0;
}

/* Language Switcher RTL */
body.rtl .header-language-switcher .lang-dropdown {
    right: auto;
    left: 0;
}

body.rtl .header-language-switcher .arrow-icon {
    margin-left: 0;
    margin-right: 4px;
}

/* Header mobile layout: preserve LTR layout for logo and icons to prevent overlapping in Arabic */
@media (max-width: 1024px) {
    body.rtl .site-header {
        direction: ltr !important;
    }

    body.rtl .header-inner {
        flex-direction: row !important;
    }

    body.rtl .site-branding {
        text-align: left !important;
        justify-content: flex-start !important;
    }

    body.rtl .header-right {
        flex-direction: row !important;
        justify-content: flex-end !important;
    }

    body.rtl .header-controls {
        flex-direction: row !important;
        gap: 10px !important;
    }

    body.rtl .header-icons {
        flex-direction: row !important;
        gap: 10px !important;
    }

    body.rtl .header-icons a .cart-count-badge {
        right: -8px !important;
        left: auto !important;
    }

    body.rtl .header-language-switcher .lang-selected {
        flex-direction: row !important;
    }

    body.rtl .header-language-switcher .lang-dropdown {
        right: 0 !important;
        left: auto !important;
    }

    body.rtl .header-language-switcher .arrow-icon {
        margin-left: 2px !important;
        margin-right: 0 !important;
    }
}

/* ─── Side Menu Drawer ─── */
body.rtl .side-drawer {
    left: auto;
    right: 0;
    transform: translateX(100%);
    box-shadow: -20px 0 50px rgba(0, 0, 0, 0.05);
}

body.rtl .side-drawer.is-open {
    transform: translateX(0);
}

body.rtl .drawer-close {
    right: auto;
    left: 30px;
}

body.rtl .drawer-cat-item i {
    transform: scaleX(-1);
}

/* ─── Cart Drawer Component ─── */
body.rtl .cart-drawer .cart-drawer-container {
    right: auto;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
}

body.rtl .cart-drawer.open .cart-drawer-container {
    transform: translateX(0);
}

body.rtl .cart-drawer .cart-drawer-items .cart-item .item-image {
    margin-right: 0;
    margin-left: 15px;
}

body.rtl .cart-drawer .cart-drawer-items .cart-item .item-details .item-header .remove-item {
    margin-left: 0;
    margin-right: 10px;
}

body.rtl .cart-drawer .cart-drawer-items .cart-item .item-details .item-header .item-title {
    padding-right: 0;
    padding-left: 20px;
    text-align: right;
}

body.rtl .cart-drawer .cart-drawer-items .cart-item .item-details .item-footer .item-price {
    align-items: flex-start;
}

/* Express checkout form inside Drawer */
body.rtl .cart-drawer .cart-drawer-order-form .order-form-header .back-to-cart {
    margin-right: 0;
    margin-left: 15px;
    flex-direction: row-reverse;
}

body.rtl .cart-drawer .cart-drawer-order-form .cod-input-group .input-icon {
    border-right: none;
    border-left: 1px solid #ddd;
}

body.rtl .cart-drawer .cart-drawer-order-form .cod-input-group input {
    text-align: right !important;
    direction: rtl !important;
}

body.rtl .cart-drawer .cart-drawer-order-form .cod-input-group input::placeholder {
    text-align: right;
}

body.rtl .cart-drawer-shipping .shipping-message {
    text-align: right;
}

body.rtl .cart-drawer-footer .cart-subtotal {
    flex-direction: row-reverse;
}

/* ─── Single Product Page ─── */
body.rtl .price del {
    margin-right: 0;
    margin-left: 8px;
    text-decoration: line-through !important;
}

body.rtl .ridge-color-selection .swatch-control {
    margin-right: 0;
    margin-left: 10px;
}

body.rtl .ridge-color-selection .color-label .label-title {
    margin-right: 0;
    margin-left: 5px;
}

body.rtl .cod-shipping-rule .shipping-message {
    text-align: right;
}

body.rtl .cod-shipping-rule .progress-percent {
    text-align: right;
}

body.rtl .cod-shipping-rule .checkpoint.end {
    text-align: right;
}

body.rtl .product-sticky-bar .text-details {
    text-align: right;
}

body.rtl .ridge-gallery .features-badge {
    left: auto;
    right: 20px;
    flex-direction: row-reverse;
}

/* Quantity Offers (Bundles) */
body.rtl .opsim-quantity-bundles {
    direction: rtl;
}

body.rtl .opsim-quantity-bundles .bundle-card .bundle-pricing {
    text-align: right;
    align-items: flex-start;
}

body.rtl .opsim-quantity-bundles .bundle-card .bundle-variation-selections .bundle-variation-row .selector-item select {
    padding: 0 10px 0 24px;
    background-position: left 8px center;
}

body.rtl .opsim-quantity-bundles .bundle-card .bundle-variation-selections .bundle-variation-row .selector-item label {
    text-align: right;
}

/* ─── Thank You Page ─── */
body.rtl .opsim-thank-you-container .opsim-order-summary-card .order-meta-grid .meta-item {
    text-align: right;
}

body.rtl .opsim-thank-you-container .summary-item .item-thumb {
    margin-right: 0;
    margin-left: 15px;
}

body.rtl .opsim-thank-you-container .summary-item .item-main {
    text-align: right;
}

body.rtl .opsim-thank-you-container address,
body.rtl .opsim-thank-you-container .customer-phone {
    text-align: right;
}

body.rtl .opsim-thank-you-container .summary-totals .total-line {
    flex-direction: row-reverse;
}

/* ─── Swiper Slider RTL ─── */
body.rtl .swiper {
    direction: rtl;
}

/* ─── Prevent horizontal scroll in RTL ─── */
html[dir="rtl"],
body.rtl,
body.rtl #page {
    overflow-x: hidden !important;
    max-width: 100% !important;
    position: relative;
}

/* ─── Fix cart drawer overlay position (must be fixed, not absolute) ─── */
body.rtl .cart-drawer .cart-drawer-overlay,
body .cart-drawer .cart-drawer-overlay {
    position: fixed !important;
}

/* ─── Fix side drawer in RTL ─── */
body.rtl .side-drawer {
    left: auto;
    right: 0;
    transform: translateX(100%);
}

body.rtl .side-drawer.is-open {
    transform: translateX(0);
}
