/*
Theme Name: LUXURYOD-THEME
Description: Right-to-Left styling for Arabic language.
*/

/* --- GLOBAL FONT RESET --- */
body.rtl,
body.rtl *:not(i):not([class^="fa-"]):not([class*=" fa-"]):not(.fas):not(.far):not(.fa-solid):not(.fa-brands):not(.fa-regular):not(.fa) {
    font-family: 'Cairo', sans-serif !important;
}

/* --- AUTOMATIC ICON MIRRORING --- */
/* Mirror icons that imply direction (arrows, etc.) */
body.rtl i.fa-arrow-right,
body.rtl i.fa-arrow-left,
body.rtl i.fa-chevron-right,
body.rtl i.fa-chevron-left,
body.rtl i.fa-angles-right,
body.rtl i.fa-angles-left,
body.rtl i.fa-long-arrow-right,
body.rtl i.fa-long-arrow-left,
body.rtl i.fa-truck-fast,
body.rtl .cat-menu-btn i,
body.rtl .help-btn i,
body.rtl .lang-current i {
    display: inline-block;
    transform: scaleX(-1) !important;
}

/* --- GLOBAL RTL ADJUSTMENTS --- */
body.rtl {
    text-align: right;
    --rtl-flip: -1;
}

/* Punctuation handling for Arabic */
body.rtl p,
body.rtl span,
body.rtl li,
body.rtl h1,
body.rtl h2,
body.rtl h3,
body.rtl h4,
body.rtl h5,
body.rtl h6 {
    unicode-bidi: isolate;
}

/* --- WOOCOMMERCE NOTICES --- */
body.rtl .woocommerce-message::before,
body.rtl .woocommerce-info::before,
body.rtl .woocommerce-error::before {
    inset-inline-start: 1.5em;
    inset-inline-end: auto;
}

/* --- MINI-CART ADJUSTMENTS --- */
body.rtl li.woocommerce-mini-cart-item .remove {
    margin-inline-start: auto;
    margin-inline-end: 0;
}

/* --- PAGINATION --- */
body.rtl .woocommerce-pagination ul.page-numbers li {
    border-inline-end: 1px solid rgba(255, 255, 255, 0.1);
    border-inline-start: none;
}

body.rtl .woocommerce-pagination ul.page-numbers li:last-child {
    border-inline-end: none;
}

/* --- PUNCTUATION & LISTS --- */
body.rtl ul,
body.rtl ol {
    padding-inline-start: 20px;
    padding-inline-end: 0;
}

/* Fix for punctuation jumping to start of line in short Arabic strings */
body.rtl p,
body.rtl span,
body.rtl li,
body.rtl h1,
body.rtl h2,
body.rtl h3,
body.rtl h4,
body.rtl h5,
body.rtl h6 {
    unicode-bidi: isolate;
    text-wrap: pretty;
}

/* --- FORM ALIGNMENTS --- */
body.rtl .woocommerce form .form-row label {
    text-align: right;
}

body.rtl .woocommerce-password-strength {
    text-align: left;
    /* Keep logic indicators readable */
}

/* --- ESSENTIAL PRODUCT GALLERY VISIBILITY FIX --- */
body.rtl .woocommerce-product-gallery {
    opacity: 1 !important;
    visibility: visible !important;
}

body.rtl .woocommerce-product-gallery .flex-viewport {
    direction: ltr !important;
    transform: scaleX(-1);
    /* Mirror the viewpoint to flip transition animation */
}

body.rtl .woocommerce-product-gallery .flex-viewport img {
    transform: scaleX(-1);
    /* Un-mirror the images so they appear correctly */
}


/* --- SIDE CART RTL FIX --- */
body.rtl .side-cart {
    left: auto !important;
    right: -450px !important;
    transition: right 0.4s cubic-bezier(0.77, 0, 0.175, 1) !important;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.7) !important;
}

body.rtl .side-cart.open {
    right: 0 !important;
    left: auto !important;
}

@media (max-width: 768px) {
    body.rtl .side-cart {
        right: -100% !important;
        left: auto !important;
    }

    body.rtl .side-cart.open {
        right: 0 !important;
    }

    /* Fix Search Input Padding in Mobile RTL */
    body.rtl .search-container input {
        padding: 0 30px 0 10px !important;
        /* Swap 30px from left to right for icon */
    }

    /* Fix Help & Lang Dropup Position in Mobile RTL */
    body.rtl .main-header .dropup-content {
        right: auto !important;
        left: 0 !important;
    }

    body.rtl .lang-dropdown {
        inset-inline-end: auto !important;
        left: 0 !important;
    }

    /* Flip Account Sidebar Toggle Shadow */
    body.rtl .luxury-account-toggle {
        box-shadow: -4px 0 10px rgba(0, 0, 0, 0.5) !important;
    }

    /* Product Gallery Dots & Thumbnails Mobile RTL */
    body.rtl .woocommerce-product-gallery ol.flex-control-nav {
        direction: rtl !important;
        display: flex !important;
        justify-content: center !important;
        padding: 0 !important;
    }

    body.rtl .woocommerce-product-gallery .flex-control-thumbs {
        direction: rtl !important;
    }

    /* Fix Short Description Padding in Mobile */
    body.rtl .woocommerce-product-details__short-description {
        padding-inline-start: 0 !important;
        padding-inline-end: 15px !important;
        text-align: right !important;
    }
}


/* --- DROPDOWN & MENU ALIGNMENTS --- */
body.rtl .dropup-content,
body.rtl .lang-dropdown,
body.rtl .help-dropup-menu li a {
    text-align: right !important;
    direction: rtl !important;
}

/* --- WORDPRESS CORE RTL ALIGNMENTS --- */
body.rtl .alignleft {
    float: right;
    margin: 0 0 1em 1em;
}

body.rtl .alignright {
    float: left;
    margin: 0 1em 1em 0;
}