/**
 * Product page buy flow (inc/buy-flow.php, assets/js/buy-flow.js): layout with the buy box in a
 * column of its own on wide screens, the in-cart stepper, buy box lines, the «کالا اضافه شد!»
 * panel and its suggestions.
 */

/* ---------- Layout: photos · information · buy box ---------- */
.sc-pd__buy,
.sc-pd__trust {
	min-width: 0;
}

.sc-pd__trust > * {
	margin: 0 !important;
}

@media (min-width: 900px) {
	.sc-pd__top {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		column-gap: 32px;
		row-gap: 20px;
	}

	.sc-pd__media {
		grid-column: 1;
		grid-row: 1 / span 3;
	}

	.sc-pd__info,
	.sc-pd__buy,
	.sc-pd__trust {
		grid-column: 2;
	}
}

@media (min-width: 1180px) {
	.sc-pd__top {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 360px;
		column-gap: 28px;
	}

	.sc-pd__media {
		grid-row: 1 / span 2;
	}

	.sc-pd__info {
		grid-column: 2;
		grid-row: 1;
	}

	.sc-pd__trust {
		grid-column: 2;
		grid-row: 2;
	}

	.sc-pd__buy {
		grid-column: 3;
		grid-row: 1 / span 2;
		align-self: stretch;
	}

	.sc-pd__buy .sc-buybox {
		position: sticky;
		top: 110px;
		background: #f7f6f4;
	}
}

/* ---------- Buy box ---------- */
.sc-pd .sc-buybox {
	gap: 14px;
}

/* One at a time, like Digikala: the count lives in the stepper. */
.sc-pd form.cart.sc-bf-form .quantity {
	display: none !important;
}

.sc-pd .sc-buybox.is-incart form.cart.sc-bf-form {
	display: none !important;
}

.sc-buybox.is-busy,
.sc-incart.is-busy {
	pointer-events: none;
}

.sc-buybox.is-busy .single_add_to_cart_button {
	opacity: .7;
}

/* Stepper */
.sc-incart {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
}

.sc-incart[hidden] {
	display: none !important;
}

.sc-qty {
	display: inline-flex;
	align-items: center;
	height: 52px;
	padding: 0 4px;
	border: 1px solid var(--sc-line);
	border-radius: var(--sc-r);
	background: var(--sc-surface);
	box-shadow: 0 1px 6px rgba(31, 42, 46, .08);
}

.sc-qty .sc-qty__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--sc-petrol);
	box-shadow: none;
	cursor: pointer;
}

.sc-qty .sc-qty__minus {
	color: var(--sc-coral-ink);
}

.sc-qty .sc-qty__btn:hover,
.sc-qty .sc-qty__btn:focus-visible {
	background: #f1f0ee;
	outline: none;
}

.sc-qty .sc-qty__btn:disabled {
	color: #c3bdb4;
	background: transparent;
	cursor: not-allowed;
}

.sc-qty__n {
	min-width: 34px;
	color: var(--sc-petrol);
	font-size: 1.125rem;
	font-weight: 800;
	line-height: 1;
	text-align: center;
}

.sc-incart.is-busy .sc-qty__n {
	opacity: .45;
}

.sc-incart__txt {
	display: flex;
	flex-direction: column;
	gap: 2px;
	font-size: .8125rem;
	line-height: 1.6;
}

.sc-incart__txt span {
	color: var(--sc-ink);
	font-weight: 700;
}

.sc-incart__txt a {
	color: var(--sc-petrol);
	font-weight: 700;
	text-decoration: none;
}

.sc-incart__txt a:hover {
	text-decoration: underline;
}

.sc-incart__msg {
	flex: 1 1 100%;
	margin: 0;
	color: var(--sc-coral-ink);
	font-size: .8125rem;
}

/* Buy box lines */
.sc-bb-lines {
	display: grid;
	gap: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--sc-line);
}

.sc-bb-lines li {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 10px 0;
	border-bottom: 1px solid #f0ece6;
	color: var(--sc-ink);
	font-size: .8125rem;
	font-weight: 600;
	line-height: 1.7;
}

.sc-bb-lines li:last-child {
	border-bottom: 0;
}

.sc-bb-lines__i {
	display: inline-flex;
	flex: none;
	color: var(--sc-muted);
}

.sc-bb-lines__i .sc-i {
	width: 20px;
	height: 20px;
}

.sc-bb-lines__t {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-width: 0;
}

.sc-bb-lines__t small {
	color: var(--sc-muted);
	font-size: .75rem;
	font-weight: 400;
}

.sc-bb-lines__a {
	flex: none;
	color: var(--sc-petrol);
	font-size: .75rem;
	font-weight: 700;
	text-decoration: none;
}

/* Phone buy bar: the stepper instead of the button while the product is in the cart. */
.sc-buybar .sc-incart--bar {
	flex: none;
	gap: 10px;
}

.sc-buybar .sc-incart--bar .sc-qty {
	height: 46px;
}

.sc-buybar .sc-incart--bar .sc-qty__btn {
	width: 38px;
	height: 38px;
}

.sc-buybar .sc-incart--bar .sc-incart__msg {
	display: none;
}

body.sc-pd-incart .sc-buybar .sc-buybar__btn {
	display: none;
}

/* WooCommerce's added-to-cart notice: no button, store colours. */
.woocommerce-notices-wrapper .woocommerce-message {
	border-top-color: var(--sc-petrol);
	background: var(--sc-surface);
	color: var(--sc-ink);
}

.woocommerce-notices-wrapper .woocommerce-message::before {
	color: var(--sc-petrol);
}

/* ---------- «کالا اضافه شد!» ---------- */
html.sc-added-open {
	overflow: visible;
}

.sc-added {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 100000;
	direction: rtl;
	pointer-events: none;
}

.sc-added[hidden] {
	display: none;
}

.sc-added__backdrop {
	display: none;
}

.sc-added__card {
	position: absolute;
	bottom: 24px;
	left: 24px;
	display: flex;
	flex-direction: column;
	width: 380px;
	max-height: min(76vh, 640px);
	border: 1px solid var(--sc-line);
	border-radius: 16px;
	background: var(--sc-surface, #fff);
	box-shadow: 0 12px 40px rgba(20, 28, 30, .18);
	opacity: 0;
	transform: translateY(16px);
	transition: opacity .2s, transform .2s;
	pointer-events: auto;
	outline: none;
	overflow: hidden;
}

.sc-added.is-open .sc-added__card {
	opacity: 1;
	transform: none;
}

.sc-added__head {
	display: flex;
	flex: none;
	align-items: center;
	gap: 8px;
	padding: 12px 12px 12px 14px;
	border-bottom: 1px solid #f0ece6;
}

.sc-added .sc-added__x {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--sc-ink);
	box-shadow: none;
	cursor: pointer;
}

.sc-added .sc-added__x:hover {
	background: #f1f0ee;
}

.sc-added__title {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	gap: 6px;
	margin: 0;
	color: #b85a33; /* the site's coral, a shade darker for text contrast (4.6:1) */
	font-size: .9375rem;
	font-weight: 800;
	line-height: 1.6;
}

.sc-added__ok {
	display: inline-flex;
	color: var(--sc-coral);
}

.sc-added__go {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 4px;
	height: 34px;
	padding: 0 12px;
	border-radius: 17px;
	background: #f1f0ee;
	color: var(--sc-ink) !important;
	font-size: .8125rem;
	font-weight: 700;
	text-decoration: none !important;
	white-space: nowrap;
}

.sc-added__go:hover {
	background: #e8e5e0;
}

.sc-added__more {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-height: 0;
}

.sc-added__more[hidden] {
	display: none;
}

.sc-added__h {
	flex: none;
	margin: 0;
	padding: 14px 16px 6px;
	color: var(--sc-ink);
	font-size: .9375rem;
	font-weight: 800;
}

.sc-added__list {
	flex: 1 1 auto;
	margin: 0;
	padding: 0 0 8px;
	overflow-y: auto;
	overscroll-behavior: contain;
	list-style: none;
}

/* Suggestion row */
.sc-sg {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 12px 16px;
	border-bottom: 1px solid #f0ece6;
}

.sc-sg:last-child {
	border-bottom: 0;
}

.sc-sg__media {
	display: block;
	flex: none;
	width: 76px;
	height: 76px;
	border-radius: 10px;
	background: #fff;
	overflow: hidden;
}

.sc-sg__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.sc-sg__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.sc-sg__name {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	color: var(--sc-ink) !important;
	font-size: .8125rem;
	font-weight: 600;
	line-height: 1.7;
	text-decoration: none !important;
}

.sc-sg__why {
	color: var(--sc-muted);
	font-size: .6875rem;
	line-height: 1.6;
}

.sc-sg__price {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	color: var(--sc-ink);
	font-size: .875rem;
	font-weight: 800;
}

.sc-sg__price del {
	color: #a8a199;
	font-size: .75rem;
	font-weight: 400;
}

.sc-sg__price ins {
	text-decoration: none;
}

.sc-sg__off {
	display: inline-block;
	padding: 1px 6px;
	border-radius: 8px;
	background: var(--sc-coral-soft);
	color: var(--sc-coral-ink);
	font-size: .6875rem;
	font-weight: 800;
}

.sc-added .sc-sg__add {
	position: absolute;
	right: 58px; /* on the photo's lower corner, clear of the text */
	bottom: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--sc-line);
	border-radius: 50%;
	background: #fff;
	color: var(--sc-petrol);
	box-shadow: 0 2px 8px rgba(31, 42, 46, .14);
	cursor: pointer;
}

.sc-added .sc-sg__add:hover {
	border-color: var(--sc-petrol);
}

.sc-added .sc-sg__add.is-busy {
	opacity: .5;
}

/* After adding: + / count / − (trash at one), on the photo's lower edge like Digikala. */
.sc-added .sc-sgq {
	position: absolute;
	right: 16px; /* the photo's width, on its lower edge */
	bottom: 6px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 76px;
	height: 34px;
	padding: 0 1px;
	border: 1px solid var(--sc-line);
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 2px 8px rgba(31, 42, 46, .14);
}

.sc-added .sc-sgq.is-busy {
	opacity: .55;
	pointer-events: none;
}

.sc-added .sc-sgq__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 28px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--sc-petrol);
	box-shadow: none;
	cursor: pointer;
}

.sc-added .sc-sgq__btn svg {
	width: 18px;
	height: 18px;
}

.sc-added .sc-sgq__btn:hover {
	background: var(--sc-petrol-soft);
}

.sc-added .sc-sgq__btn:disabled {
	color: #b9b3ab;
	background: transparent;
	cursor: default;
}

.sc-added .sc-sgq__btn.is-trash {
	color: var(--sc-sale);
}

.sc-added .sc-sgq__n {
	min-width: 20px;
	color: var(--sc-petrol);
	font-size: 1rem;
	font-weight: 800;
	text-align: center;
	outline: 0;
}

.sc-sg--ghost .sc-sg__media,
.sc-sg--ghost .sc-sg__body span {
	display: block;
	border-radius: 8px;
	background: linear-gradient(90deg, #f1f0ee 25%, #f8f7f5 50%, #f1f0ee 75%);
	background-size: 200% 100%;
	animation: sc-bf-ghost 1.2s infinite linear;
}

.sc-sg--ghost .sc-sg__body span {
	height: 12px;
}

.sc-sg--ghost .sc-sg__body span + span {
	width: 50%;
}

@keyframes sc-bf-ghost {
	to {
		background-position: -200% 0;
	}
}

/* Phones: a bottom sheet with a dimmed page behind it. */
@media (max-width: 767px) {
	html.sc-added-open,
	html.sc-added-open body {
		overflow: hidden;
	}

	.sc-added {
		top: 0;
		pointer-events: auto;
	}

	.sc-added__backdrop {
		position: absolute;
		inset: 0;
		display: block;
		background: rgba(20, 28, 30, .45);
		opacity: 0;
		transition: opacity .2s;
	}

	.sc-added.is-open .sc-added__backdrop {
		opacity: 1;
	}

	.sc-added__card {
		right: 0;
		bottom: 0;
		left: 0;
		width: auto;
		max-height: 82vh;
		padding-bottom: env(safe-area-inset-bottom);
		border: 0;
		border-radius: 18px 18px 0 0;
		opacity: 1;
		transform: translateY(100%);
		transition: transform .24s cubic-bezier(.2, .8, .2, 1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.sc-added__card,
	.sc-added__backdrop,
	.sc-sg--ghost .sc-sg__media,
	.sc-sg--ghost .sc-sg__body span {
		transition: none;
		animation: none;
	}
}

/* Shipping: one small grey line under the add-to-cart button. */
.sc-bb-ship {
	margin: 8px 0 0;
	color: var(--sc-muted);
	font-size: .75rem;
	line-height: 1.7;
	text-align: center;
}

.sc-bb-ship span {
	white-space: nowrap;
}

/* «این محصول به پوست من می‌خوره؟» → the skin/hair test, judged for this product. */
.sc-fit {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 12px 0 4px;
	padding: 12px 14px;
	border: 1px solid var(--sc-line);
	border-radius: var(--sc-r-lg);
	background: #f3f1ee;
	color: var(--sc-ink);
	text-decoration: none;
	transition: border-color .15s, background-color .15s;
}

.sc-fit:hover,
.sc-fit:focus-visible {
	border-color: var(--sc-petrol);
	background: var(--sc-petrol-soft);
	color: var(--sc-ink);
}

.sc-fit__i {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: #fff;
	color: var(--sc-petrol);
}

.sc-fit__i .sc-i {
	width: 22px;
	height: 22px;
}

.sc-fit__t {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-width: 0;
}

.sc-fit__t b {
	font-size: .875rem;
	font-weight: 700;
	line-height: 1.6;
}

.sc-fit__t small {
	color: var(--sc-muted);
	font-size: .75rem;
	line-height: 1.6;
}

.sc-fit__go {
	display: inline-flex;
	flex: none;
	color: var(--sc-petrol);
}

.sc-fit__go .sc-i {
	width: 20px;
	height: 20px;
}

.sc-fit + .sc-bb-lines {
	margin-top: 8px;
}

/* «این محصول به … من می‌خوره؟»: lens over a molecule, a lab-instrument look. */
.sc-fit__i {
	background: radial-gradient(circle at 35% 30%, #fff 0%, #eef5f4 55%, #dcebe9 100%);
	box-shadow: inset 0 0 0 1px #cfe3e1, 0 1px 2px rgba(15, 92, 90, .08);
}
.sc-fit__svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: var(--sc-petrol);
	stroke-linecap: round;
	stroke-linejoin: round;
}
.sc-fit__lens { stroke-width: 1.7; }
.sc-fit__mol { stroke-width: 1.3; }
.sc-fit__dot { fill: var(--sc-petrol); stroke: none; }
.sc-fit__handle { stroke-width: 2.6; }
/* sc-added: head always visible on iPhone. The phone sheet's height follows the real visible
   area (its fixed container), not 82vh, which iOS measures with the toolbars hidden; the card
   is clipped, not scrollable, so focusing a suggestion can't push the head out of view. */
.sc-added__list {
	min-height: 0;
}
@supports (overflow: clip) {
	.sc-added__card {
		overflow: clip;
	}
}
@media (max-width: 767px) {
	.sc-added__card {
		max-height: calc(100% - 40px - env(safe-area-inset-top, 0px));
	}
}
