/* =============================================================================
 * FOLDER-TAB MODALS, RIGHT-TO-LEFT
 * =============================================================================
 * Component: every popup built with the parent theme's "folder tab" shape
 *            (.modal.has-rbt-top-folder-shape): a white card with a notch at one top corner
 *            that holds the round close button.
 * Where:     Shared by several pages of the site. The ones a shopper can reach:
 *              #couponSelectionModal    checkout: "أضف رمز الخصم" (template coupon-popup.php)
 *              #quickviewEditCartModal  cart drawer / cart page: edit a cart item
 *              #recent-viewModal        recently viewed products
 *              #signinModal             sign-in (printed on every page)
 *            plus the account-page modals (addresses, password, contact information).
 * Owner:     Child theme. Markup and the left-to-right rules are the parent's.
 *
 * The problem this fixes
 * ----------------------
 * In left-to-right the notch is at the top RIGHT, the close button inside it, and the title
 * starts at the left, clear of the button. In right-to-left the title starts at the right, so it
 * ran UNDER the close button: measured on the checkout popup, the title text overlapped the
 * button box at every width (320, 440 and 1024 px) and the first word was partly hidden.
 *
 * The parent theme already has the right answer, a mirrored version (notch and button at the
 * LEFT, shape flipped), in common-rtl.css. Those four rules start with
 * "body.wp-theme-unimart.rtl", and this site's parent theme folder is
 * "unimart-multipurpose-woocommerce-wordpress-theme", so the body class is different and they
 * never match (670 of the 678 rules of that stylesheet are in this state; see
 * payment-methods.css for the measurement that shows why the class is not simply added).
 *
 * What this file does
 * -------------------
 * The same four rules, copied from the parent's intent with one change: the prefix is
 * "body.rtl", the class WordPress really sets on Arabic pages. Nothing is invented here; this
 * switches on the parent's own mirrored design for this one component. Because it is shared,
 * all the modals above change together and stay consistent with each other.
 *
 * The four rules, in the order of the parent's file:
 *   1. The white card behind the title (::before) is anchored to the right edge and rounded at
 *      its top-right corner instead of left/top-left. Its width stops short of the notch.
 *   2. The close button sits 8px from the LEFT edge, inside the notch.
 *   3. The notch (".rbt-folder-shape-right-portion", whose name describes the left-to-right
 *      layout) is anchored to the left edge.
 *   4. The notch's drawing (an inline SVG) is flipped so its slope faces the card.
 *
 * Specificity: "body.rtl" adds one class and one element to the parent's selectors, so each rule
 * wins over its left-to-right twin without "!important".
 * ============================================================================= */

body.rtl .modal.has-rbt-top-folder-shape .modal-dialog .modal-content::before {
    right: 0;
    left: auto;
    border-top-right-radius: 12px;
    border-top-left-radius: 0;
}

body.rtl .modal.has-rbt-top-folder-shape .modal-dialog .modal-content .modal-header .rbt-modal-dis-btn {
    left: 8px;
    right: auto;
}

body.rtl .modal.has-rbt-top-folder-shape .rbt-folder-shape-right-portion {
    left: 0;
    right: auto;
}

body.rtl .modal.has-rbt-top-folder-shape .rbt-folder-shape-right-portion > svg {
    transform: rotateX(180deg);
    scale: -1;
}
