/*
 * Cart page.
 */

.cartpage {
	padding-block: 14px 96px;
}

.cartlist {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* Figma 120:216 «Product Row»: 343×99, r6, white, pad 16, no border. */
.cartitem {
	display: flex;
	gap: 12px;
	min-height: 99px;
	background: var(--c-surface);
	border: 0;
	border-radius: var(--r);
	padding: 16px;
}

/* The row's content band is 66px in the frame (99 − 2×16 padding). */
.cartitem__media {
	flex: 0 0 auto;
	width: 66px;
	height: 66px;
	border-radius: var(--r);
	overflow: hidden;
	background: var(--c-bg);
}

.cartitem__media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* Title column — two lines max, vertically centred beside the image. */
.cartitem__main {
	flex: 1;
	min-width: 0;
	display: flex;
	align-items: center;
}

.cartitem__title {
	font-size: var(--fs-12);
	font-weight: var(--fw-medium);
	line-height: 22px;
	color: #40444C;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Price above, stepper below — the frame's 112-wide end column. */
.cartitem__side {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	justify-content: center;
	gap: 12px;
}

.cartitem__remove {
	flex: 0 0 auto;
	color: var(--c-gray-400);
	display: inline-flex;
	margin-inline-start: 2px;
}

.cartitem__remove svg {
	width: 18px;
	height: 18px;
}

/* Quantity stepper */
.qty {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	background: var(--c-bg);
	border-radius: var(--r);
	padding: 2px;
}

.qty__btn {
	width: 24px;
	height: 24px;
	border-radius: var(--r-sm);
	background: var(--c-surface);
	color: var(--c-text);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.qty__btn svg {
	width: 16px;
	height: 16px;
}

.qty__input {
	width: 28px;
	border: 0;
	background: none;
	text-align: center;
	font-size: var(--fs-12);
	font-weight: var(--fw-bold);
	color: var(--c-text);
	font-family: inherit;
}

.cartitem__prices {
	display: flex;
	align-items: center;
	gap: 6px;
	justify-content: flex-end;
	white-space: nowrap;
}

.cartitem__prices .price {
	font-size: var(--fs-12);
	font-weight: var(--fw-medium);
	line-height: 18px;
	color: #40444C;
}

/* Hidden native update button — steppers submit the form. */
.cartpage__update {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
}

/* ---- Sticky total bar --------------------------------------------------- */

/* Figma 120:393: a floating 338×70 r6 card inset 19px from each edge with a
   soft shadow — not an edge-to-edge bar. Inner row 296×34, gap 21. */
.cartbar {
	position: fixed;
	bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom, 0px));
	left: 50%;
	transform: translateX(-50%);
	width: calc(100% - 38px);
	max-width: calc(var(--app-max) - 38px);
	height: 70px;
	background: var(--c-surface);
	border: 0;
	border-radius: var(--r);
	padding-inline: 21px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 21px;
	z-index: 45;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.cartbar__total {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.cartbar__label {
	font-size: var(--fs-10);
	line-height: 18px;
	color: #626C83;
	font-weight: var(--fw-medium);
}

.cartbar__price {
	font-size: var(--fs-12);
	line-height: 18px;
	font-weight: var(--fw-medium);
	color: #40444C;
}

/* 164×34, r8, #EB5757 (the design's CTA red — lighter than --c-red). */
.cartbar__btn {
	flex: 0 0 auto;
	width: 164px;
	min-height: 34px;
	padding: 8px 16px;
	border-radius: 8px;
	background: var(--c-red-cta);
	font-size: var(--fs-12);
	font-weight: var(--fw-medium);
}

/* ---- Empty cart --------------------------------------------------------- */

.cart-empty-wrap {
	padding: 60px 24px;
	text-align: center;
}

.cart-empty-wrap .cart-empty__icon {
	color: var(--c-text-dim);
	margin-bottom: 16px;
}

.cart-empty-wrap .cart-empty__icon svg {
	width: 64px;
	height: 64px;
}

.cart-empty-wrap p {
	color: var(--c-text-muted);
	margin-bottom: 20px;
}

.cart-empty-wrap .btn {
	display: inline-flex;
	width: auto;
	padding-inline: 32px;
}

/* Page heading — «سبد خرید (۲ کالا)». Mobile keeps it modest; the desktop
   layer scales it to the frame's 24/400. */
.cartpage__title {
	font-size: var(--fs-16);
	font-weight: var(--fw-bold);
	color: #40444C;
	margin: 0 0 14px;
}

/* ---- Lines that can't be bought any more (inc/cart-issues.php) ----------- */

.cartissues {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin-bottom: 12px;
	padding: 12px 14px;
	border: 1px solid #F5C2C2;
	border-radius: var(--r);
	background: #FFF4F4;
	color: var(--c-red-ink);
	font-size: var(--fs-12);
	line-height: 22px;
}

.cartissues svg {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	margin-top: 1px;
}

.cartitem--issue {
	box-shadow: inset 0 0 0 1px #F5C2C2;
}

.cartitem--issue .cartitem__main {
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	gap: 4px;
}

/* A line that can't be bought: dim the picture, keep the name readable. */
.cartitem--issue .cartitem__media img {
	opacity: .45;
	filter: grayscale(1);
}

.cartitem__issue {
	margin: 0;
	font-size: 11px;
	font-weight: var(--fw-medium);
	line-height: 18px;
	color: var(--c-red);
}

.cartitem__drop {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-height: 28px;
	padding: 4px 10px;
	border-radius: var(--r);
	background: var(--c-red-cta);
	color: #fff;
	font-size: var(--fs-12);
	font-weight: var(--fw-medium);
	white-space: nowrap;
}

.cartitem__drop:hover {
	background: var(--c-red-ink);
	color: #fff;
}

.cartitem__drop svg {
	width: 16px;
	height: 16px;
}

.cartbar__btn.is-disabled,
.cartpage .cartbar__btn.is-disabled {
	background: #C7CCD6;
	color: #fff;
	cursor: not-allowed;
	pointer-events: none;
}
