/*! Avloon — Cart Design 1.2.0, round 2: the cart page. Printed right after assets/cartpage.css (it depends on it), only
 * with the round-2 switch on (inc/ux2-cart.php). Same scope and weight as cartpage.css: body.avl-cui-cartpage:not(#avl-cui).
 * Colours: the design's ink / steel / white only; «مجاني» keeps the green of «وفّرت» (cartpage.css). */

/* ------------------------------------------------------------------ item 1: the coupon row right above «الإجمالي»
 * inc/ux2-cart.php prints it as the last row before «الإجمالي»; the rows also form one column whose order is fixed here,
 * so a row another script adds later can never come between the coupon and «الإجمالي». */
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage .cart_totals > table.shop_table > tbody{display:flex;flex-direction:column}
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage .cart_totals > table.shop_table > tbody > tr.avl-cp-coupon-row{order:1;display:block;min-height:0;padding:6px 0 5px}
/* an applied coupon («الكوبون: so70 [حذف] −70») joins the coupon row: the shipping row stays above both, so the coupon's own
   row, its field and its answer stand together right above «الإجمالي» */
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage .cart_totals > table.shop_table > tbody > tr.cart-discount{order:1}
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage .cart_totals > table.shop_table > tbody > tr.order-total{order:2}
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage .cart_totals > table.shop_table > tbody > tr.order-total ~ tr{order:3}
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage .cart_totals > table.shop_table > tbody > tr.avl-cp-coupon-row > td{display:block;margin:0;padding:0;text-align:start}
/* without JavaScript (body.rey-no-js) the coupon field of the cart form is the working one: this row stays out of sight */
body.avl-cui-cartpage:not(#avl-cui).rey-no-js .rey-cartPage .cart_totals > table.shop_table > tbody > tr.avl-cp-coupon-row{display:none}
/* a redraw that came without the row (the store then puts its box at the end of the totals, and assets/cartpage.js moves
   it into a row of its own right away): until then the box stands right under the summary card, above the pay card, so
   the cursor the coupon script gives back after an answer lands on a field that is on the screen. */
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage .cart_totals > .avs-cp-coupon,
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage .cart_totals > .coupon{order:1}

/* the store's «عندك كود خصم؟» button → a full-width row «لديك كوبون؟» like the checkout's (tag chip at the start). The
   button disappears on tap and the field takes its place, so no chevron. Ink against the store's own colour (!important there). */
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage tr.avl-cp-coupon-row .avs-cp-coupon{display:flex;align-items:center;justify-content:flex-start;gap:10px;box-sizing:border-box;width:100%;min-height:44px;margin:0;padding:2px 0 0;border:0;background:none;color:var(--cp-ink) !important;font-family:inherit;font-size:15px;font-weight:500;line-height:1.4;text-decoration:none;text-align:start;cursor:pointer}
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage tr.avl-cp-coupon-row .avs-cp-coupon > svg{display:none}
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage tr.avl-cp-coupon-row .avs-cp-coupon::before{content:"";flex:0 0 28px;box-sizing:border-box;width:28px;height:28px;margin-top:-3px;border:1px solid #d5d9df;border-radius:8px;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a4f57' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 11.6V4.5a1 1 0 0 1 1-1h7.1a1 1 0 0 1 .7.3l8 8a1 1 0 0 1 0 1.4l-7.1 7.1a1 1 0 0 1-1.4 0l-8-8a1 1 0 0 1-.3-.7z'/%3E%3Ccircle cx='8' cy='8' r='1.4'/%3E%3C/svg%3E") center / 15px 15px no-repeat,linear-gradient(150deg,#ffffff,var(--cp-steel-2))}
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage tr.avl-cp-coupon-row .avs-cp-coupon:active{opacity:.6}
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage tr.avl-cp-coupon-row .avs-cp-coupon:focus-visible{outline:2px solid var(--cp-ink);outline-offset:2px}
/* the open field inside the row: no card of its own (the summary card is the card) */
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage tr.avl-cp-coupon-row .coupon{display:flex;margin:6px 0 0;padding:0;border:0;border-radius:0;background:none;box-shadow:none}
/* first paint: inc/ux2-cart.php prints the box already folded (the store's own class avs-cp-collapsed) behind the button,
   so the row is the button row before any script runs; the button's own handler hides it and opens the box on a tap */
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage tr.avl-cp-coupon-row .coupon.avs-cp-collapsed,
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage tr.avl-cp-coupon-row .avs-cp-coupon[hidden]{display:none !important}

/* ------------------------------------------------------------------ shipping line (inc/ux2-cart.php)
 * free: «الشحن | مجاني» (the green «مجاني» is cartpage.css's rule for this row class).
 * under the minimum: «باقي X ر.س على الشحن المجاني», at the start of the row, the amount in ink and bold. */
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage .cart_totals > table.shop_table > tbody > tr.avl-cp-shipaway > td{flex:1 1 auto;color:var(--cp-ink-2);font-weight:500;text-align:start !important}
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage .cart_totals > table.shop_table > tbody > tr.avl-cp-shipaway .avl-cp-shipaway__amt{color:var(--cp-ink);font-weight:700}
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage .cart_totals > table.shop_table > tbody > tr.avl-cp-shipaway .avl-cp-shipaway__amt .woocommerce-Price-amount{color:inherit;font-weight:inherit}
/* the narrowest phones: the line stands under «الشحن» from the first paint. There the store's font (Tajawal, which comes
   with font-display:swap) puts it under the label anyway once it has loaded, while the stand-in font of the first paint
   still fitted it beside the label: the row grew by one line a moment later and moved «الإجمالي». */
@media (max-width:329px){
	body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage .cart_totals > table.shop_table > tbody > tr.avl-cp-shipaway > td{flex-basis:100%}
}

/* ------------------------------------------------------------------ item 2
 * the second «الإجمالي: X» beside «إتمام الطلب» is no longer printed (inc/ux2-cart.php); if a copy of the old markup
 * still arrives it stays out of sight, and «إتمام الطلب» takes the whole row (cartpage.css: flex 1 1 130px). */
body.avl-cui-cartpage:not(#avl-cui) .rey-cartPage .cart_totals > .wc-proceed-to-checkout > .avl-cp-grand{display:none}
/* the phone bar steps aside while the pay card, or the coupon row in use, is on the screen (body classes set by
   assets/cartpage.js); it uses the bar's own 0.25s slide. The store keeps its own rule: the bar shows only while «إتمام الطلب» is below the screen. */
@media (max-width:767px){
	body.avl-cui-cartpage:not(#avl-cui).avl-cp-pay-seen .avs-cp-bar,
	body.avl-cui-cartpage:not(#avl-cui).avl-cp-coupon-seen .avs-cp-bar{transform:translateY(110%);box-shadow:none;pointer-events:none}
}
