/* Cart page — page-cart.php, parts/cart/*. Follows the live cart page. */
.cart-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-24); padding-top: var(--crumbs-gap); transition: opacity .2s; }
.cart-page[aria-busy="true"] { opacity: .6; pointer-events: none; }
.cart-page .woocommerce-notices-wrapper:empty { display: none; }

/* Free shipping progress (compact card at the top of the items column): [ gift ] how much more … threshold / bar */
.free-ship { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: var(--sp-8) var(--sp-16); padding: var(--sp-12) var(--sp-16); border-radius: var(--r-16); background: var(--n-100); box-shadow: 0 6px 24px rgb(0 0 0 / .06); }
.free-ship__icon { grid-row: 1 / 3; display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-12); color: var(--n-100); background: var(--orange); box-shadow: 0 6px 16px rgb(255 130 14 / .3); padding: var(--sp-8); } /* the SVG is the tile: padding sets the drawing's size (28px; 24px on phones) */
.free-ship p { margin: 0; }
.cart-items .free-ship { margin-bottom: var(--sp-12); }
.free-ship__status { color: var(--n-30); font-size: var(--fs-body-m); }
.free-ship__status strong { color: var(--n-10); font-weight: 800; }
.free-ship__min { color: var(--n-50); font-size: var(--fs-body-s); white-space: nowrap; }
.free-ship__bar { grid-column: 2 / -1; height: 6px; border-radius: var(--r-pill); background: var(--n-93); }
.free-ship__bar::before { content: ""; display: block; width: var(--done); height: 100%; border-radius: inherit; background: var(--blue); transition: width .4s; }
.free-ship small { font-size: .85em; font-weight: 400; }
.free-ship.is-done .free-ship__icon { background: var(--c-success); box-shadow: none; }
.free-ship.is-done .free-ship__bar::before { background: var(--c-success); }
.free-ship.is-done .free-ship__status strong { color: var(--c-success); }

/* Items | summary card */
.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; gap: var(--sp-24); }
.cart-items form { margin: 0; }
.cart-items__list { display: grid; gap: var(--sp-12); margin: 0; padding: 0; list-style: none; }

.cart-item { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: start; gap: var(--sp-16); padding: var(--sp-16); border-radius: var(--r-16); background: var(--n-100); box-shadow: 0 6px 24px rgb(0 0 0 / .06); }
.cart-item__thumb { display: block; overflow: hidden; aspect-ratio: 1; border-radius: var(--r-12); background: var(--n-97); }
.cart-item__img { width: 100%; height: 100%; object-fit: contain; }
.cart-item__info { display: grid; gap: var(--sp-8); min-width: 0; }
.cart-item__title { margin: 0; font-size: var(--fs-body-l); line-height: var(--lh-body-l); font-weight: 700; }
.cart-item__title a { color: var(--n-10); }
.cart-item__title a:hover { color: var(--blue); }
/* Picked options as small grey chips (colour dot + name), then the warranty in green */
.cart-item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-8); margin: 0; padding: 0; list-style: none; font-size: var(--fs-body-s); }
.cart-item__option { display: flex; align-items: center; gap: 6px; height: 28px; padding-inline: 10px; border-radius: var(--r-pill); color: var(--n-30); background: var(--n-97); font-weight: 600; }
.cart-item__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--dot); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12); }
.cart-item__warranty { display: flex; align-items: center; gap: 4px; color: var(--c-success); }
.cart-item__warranty .icon { flex: none; font-size: 16px; }
.cart-item__bottom { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--sp-12); margin-top: var(--sp-8); }
/* Price: «۲ × unit» (when more than one), the line total, the saving in green */
.cart-item__price { display: grid; justify-items: end; line-height: 1.5; white-space: nowrap; }
.cart-item__unit { color: var(--n-50); font-size: var(--fs-body-s); }
.cart-item__total { margin: 0; color: var(--n-10); font-size: var(--fs-title-s); font-weight: 800; }
.cart-item__total small, .cart-item__saving small { font-size: var(--fs-label-m); font-weight: 400; }
.cart-item__total small { color: var(--n-50); }
.cart-item__saving { color: var(--c-success); font-size: var(--fs-body-s); font-weight: 600; }

/* Stepper: − (or trash at 1) · count · + */
.cart-qty { display: grid; grid-template-columns: 40px 32px 40px; align-items: center; height: 40px; border: 1px solid var(--n-90); border-radius: var(--r-12); background: var(--n-97); }
.cart-qty button, .cart-qty__remove { display: grid; place-items: center; height: 100%; padding: 0; border: 0; color: var(--n-30); background: none; font-size: 18px; cursor: pointer; transition: color .15s; }
.cart-qty button:hover:not(:disabled) { color: var(--blue); }
.cart-qty button:disabled { color: var(--n-80); cursor: default; }
.cart-qty__remove { color: var(--n-50); }
.cart-qty__remove:hover { color: var(--c-danger); }
.cart-qty button:focus-visible, .cart-qty__remove:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: var(--r-8); }
.cart-qty output { color: var(--n-10); font-weight: 700; text-align: center; }

/* «اطلاعات پرداخت»: blue card — totals on a lighter panel, orange button, coupon folded at the end */
.cart-summary { position: sticky; top: var(--sp-24); display: grid; gap: var(--sp-16); padding: var(--sp-32) var(--sp-24) var(--sp-24); border-radius: var(--r-32); color: var(--n-100); background: var(--blue); box-shadow: 0 16px 40px rgb(0 170 233 / .25); }
.cart-summary__title { margin: 0; padding-bottom: var(--sp-16); border-bottom: 1px solid rgb(255 255 255 / .3); color: inherit; font-size: var(--fs-title-l); font-weight: 800; text-align: center; }

.cart-summary__totals { display: grid; gap: var(--sp-12); margin: 0; padding: var(--sp-16); border-radius: var(--r-16); background: rgb(255 255 255 / .12); }
.cart-summary__totals div { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-12); }
.cart-summary__totals dt { display: flex; align-items: center; gap: 6px; font-size: var(--fs-body-m); font-weight: 600; }
.cart-summary__totals dd { margin: 0; white-space: nowrap; font-size: var(--fs-body-m); font-weight: 600; }
.cart-summary__totals small { font-size: var(--fs-label-m); font-weight: 400; opacity: .85; }
.cart-summary__saving dd { font-weight: 800; }
.cart-summary__percent, .cart-summary__free { display: inline-block; height: 20px; padding-inline: 7px; padding-top: 1.5px; border-radius: 10px; font-size: var(--fs-label-m); font-weight: 700; line-height: 18.5px; } /* same tag as the product page's discount */
.cart-summary__percent { color: var(--n-100); background: var(--orange); }
.cart-summary__free { color: var(--c-success); background: var(--n-100); }
.cart-summary__final { margin-top: var(--sp-8); padding-top: var(--sp-16); border-top: 1px solid rgb(255 255 255 / .3); }
.cart-summary__final dt { font-size: var(--fs-title-s); font-weight: 800; }
.cart-summary__final dd { font-size: var(--fs-title-l); font-weight: 800; }
.cart-summary .cart-summary__go { width: 100%; height: 52px; border-radius: var(--r-12); font-size: var(--fs-body-l); font-weight: 700; box-shadow: 0 8px 24px rgb(0 0 0 / .12); }

/* Coupon: folded behind «کد تخفیف دارید؟» (open when a code is applied or was just tried) */
.coupon { margin: 0; padding-top: var(--sp-16); border-top: 1px solid rgb(255 255 255 / .3); }
.coupon summary { display: flex; align-items: center; gap: var(--sp-8); list-style: none; font-size: var(--fs-body-m); font-weight: 700; cursor: pointer; }
.coupon summary::-webkit-details-marker { display: none; }
.coupon summary .icon { font-size: 22px; }
.coupon summary::after { content: ""; width: 7px; height: 7px; margin-inline-start: auto; border: solid currentColor; border-width: 0 0 1.5px 1.5px; rotate: -45deg; transition: rotate .2s; }
.coupon[open] summary::after { rotate: 135deg; }
.coupon summary:focus-visible { outline: 2px solid var(--n-100); outline-offset: 4px; border-radius: var(--r-8); }
.coupon form { margin: var(--sp-12) 0 0; }
.coupon__field { display: flex; gap: var(--sp-8); padding: 6px; border-radius: var(--r-12); background: var(--n-100); }
.coupon__field input { flex: 1; min-width: 0; padding: 0 var(--sp-8); border: 0; color: var(--n-10); background: none; font: inherit; font-size: var(--fs-body-m); }
.coupon__field input::placeholder { color: var(--n-60); }
.coupon__field input:focus { outline: none; }
.coupon__field:focus-within { outline: 2px solid var(--blue-darker); outline-offset: 2px; }
.coupon__field button { flex: none; height: 40px; padding-inline: var(--sp-16); border: 0; border-radius: var(--r-8); color: var(--n-100); background: var(--blue); font: inherit; font-size: var(--fs-body-m); font-weight: 600; cursor: pointer; transition: background-color .15s; }
.coupon__field button:hover { background: var(--blue-hover); }
.coupon__applied { display: flex; flex-wrap: wrap; gap: var(--sp-8); margin: 0; padding: 0; list-style: none; }
.coupon__applied li { display: flex; align-items: center; gap: 6px; height: 34px; padding-inline: 10px 4px; border-radius: var(--r-pill); background: rgb(255 255 255 / .18); font-size: var(--fs-body-s); font-weight: 700; }
.coupon__applied .icon { font-size: 18px; }
.coupon__applied a { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--n-100); font-size: 14px; }
.coupon__applied a:hover { background: rgb(255 255 255 / .25); }

.cart-bar { display: none; } /* phones only */

/* Empty cart */
.cart-empty { display: grid; justify-items: center; gap: var(--sp-12); padding: var(--sp-56) var(--sp-24); border-radius: var(--r-24); background: var(--n-100); box-shadow: 0 6px 24px rgb(0 0 0 / .06); text-align: center; }
.cart-empty__icon { display: grid; place-items: center; width: 88px; height: 88px; border-radius: 50%; color: var(--blue); background: var(--blue-light); font-size: 40px; }
.cart-empty__title { margin: var(--sp-8) 0 0; color: var(--n-10); font-size: var(--fs-title-l); font-weight: 800; }
.cart-empty p { margin: 0 0 var(--sp-12); color: var(--n-40); }

/* «دیگران خریده‌اند» / «تخفیف‌دار»: full-width sections (content on the container edge) with the live site's slanted band
   behind the title and the top of the cards — orange from the right edge, blue from the left (title moves onto it). */
.cart-more {
	--edge: max(var(--gutter), (100% - var(--container)) / 2);
	--band: var(--orange);
	position: relative;
	isolation: isolate;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--sp-32);
	margin-top: var(--sp-80);
	padding: var(--sp-40) var(--edge) var(--sp-72);
}
.cart-more::before {
	content: "";
	position: absolute;
	inset-block: 0;
	inset-inline-start: 0;
	z-index: -1;
	width: max(44%, var(--edge) + 420px);
	background: var(--band);
	-webkit-mask: url("../../img/cart/band.svg") center / 100% 100% no-repeat;
	mask: url("../../img/cart/band.svg") center / 100% 100% no-repeat;
}
.cart-more--sale { --band: var(--blue); }
.cart-more--sale::before { inset-inline: auto 0; scale: -1 1; } /* mirrored: slant faces the content on the other side */
.cart-more--sale .section-head { flex-direction: row-reverse; }
.cart-more .section-title { padding-inline: var(--sp-24); }
body .cart-more .section-title, .cart-more .section-title strong { color: var(--n-100); }
.cart-more .cart-more__track { --per-view: 4; }
.cart-more + .cart-more { margin-top: var(--sp-24); }

@media (max-width: 1024px) {
	.cart-layout { grid-template-columns: minmax(0, 1fr) 320px; }
	.cart-more .cart-more__track { --per-view: 3; }
}

@media (max-width: 860px) {
	.cart-layout { grid-template-columns: minmax(0, 1fr); }
	.cart-summary { position: static; }
}

@media (max-width: 769px) {
	.cart-page { gap: var(--sp-16); }

	.free-ship { grid-template-columns: 40px minmax(0, 1fr); gap: var(--sp-8) var(--sp-12); }
	.free-ship__icon { grid-row: 1 / 4; width: 40px; height: 40px; }
	.free-ship__min { grid-row: 3; }
	.free-ship__bar { grid-column: 2; grid-row: 2; }

	.cart-item { grid-template-columns: 72px minmax(0, 1fr); gap: var(--sp-12); padding: var(--sp-12); }
	.cart-item__title { font-size: var(--fs-body-m); line-height: var(--lh-body-m); }
	.cart-item__info { display: contents; }
	.cart-item__thumb { grid-row: 1 / 3; }
	.cart-item__title, .cart-item__meta { grid-column: 2; }
	.cart-item__bottom { grid-column: 1 / -1; margin-top: 0; padding-top: var(--sp-12); border-top: 1px solid var(--n-95); }

	.cart-summary { padding: var(--sp-24) var(--sp-16); border-radius: var(--r-24); }

	/* Fixed bottom bar: «تکمیل سفارش» on the right, «مبلغ کل» on the far left */
	.cart-bar { position: fixed; inset-inline: 0; bottom: 0; z-index: 900; display: flex; align-items: center; gap: var(--sp-12); padding: var(--sp-12) var(--gutter) calc(var(--sp-12) + env(safe-area-inset-bottom)); background: var(--n-100); box-shadow: 0 -6px 24px rgb(0 0 0 / .08); }
	.cart-bar .btn { order: -1; height: 48px; padding-inline: var(--sp-24); border-radius: var(--r-12); font-weight: 700; }
	.cart-bar__total { display: grid; justify-items: end; margin: 0 auto 0 0; line-height: 1.4; white-space: nowrap; }
	.cart-bar__total span { color: var(--n-50); font-size: var(--fs-body-s); }
	.cart-bar__total b { color: var(--n-10); font-size: var(--fs-title-s); font-weight: 800; }
	.cart-bar__total small { color: var(--n-50); font-size: var(--fs-label-m); font-weight: 400; }
	.cart-bar__total .cart-bar__saving { color: var(--c-success); font-weight: 600; }
	.cart-bar__saving small { color: inherit; }
	body:has(.cart-bar) { padding-bottom: 96px; } /* page end stays reachable above the bar */

	.cart-more { gap: var(--sp-24); margin-top: var(--sp-48); padding-block: var(--sp-24) var(--sp-48); }
	.cart-more::before { width: 82%; }
	.cart-more .section-title { padding-inline: var(--sp-8); }
	.cart-more + .cart-more { margin-top: var(--sp-16); }
	.cart-more .cart-more__track { --per-view: 2.15; --shadow-x: var(--gutter); --loop-gap: var(--sp-12); }
}
