/*
 * vgs-design — product module (stage 2, ADR-047 / doc 33). Loaded on single product pages only.
 * The page is a Flatsome custom layout (UX Builder rows «mkh-single-product»). These rules find its parts by
 * Flatsome's own element classes (.product-title-container, .product-price-container, .add-to-cart-container,
 * .product-short-description), so a rearranged layout keeps working; where a part is missing, nothing moves.
 *
 *  - The purchase column: title → price → purchase button → «مشخصات اکانت» → the guide buttons. On
 *    desktop the specs take their own column beside the buy box.
 *  - The listing lines become a label/value table; the player card sits above them (PlayerCard.php).
 *  - Below 850px the tabs open under their own title (an accordion, no script); the buy bar sits on top of
 *    vgapp's bottom nav while the page's own button is out of view (product.js).
 * Every rule sits under body.vgs-design; tokens only.
 */

/* ── Breadcrumb (Rank Math): 44px targets, quiet ───────────────────────── */
body.vgs-design .product-breadcrumb-container .breadcrumbs {
	color: var(--vgs-muted);
	font-size: var(--vgs-fs-13);
	line-height: var(--vgs-lh-label);
}

body.vgs-design .product-breadcrumb-container .breadcrumbs a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: var(--vgs-tap);
	min-height: var(--vgs-tap);
	padding: 0 4px;
	color: var(--vgs-ink-2);
	text-decoration: none;
}

body.vgs-design .product-breadcrumb-container .breadcrumbs a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* One line: wrapped, the 44px targets made two rows (88px) above the gallery and the trail broke after a
 * separator. A long category scrolls sideways inside the row; the page itself never does. */
body.vgs-design .product-breadcrumb-container .breadcrumbs > p {
	display: flex;
	align-items: center;
	overflow-x: auto;
	white-space: nowrap;
	scrollbar-width: none;
}

body.vgs-design .product-breadcrumb-container .breadcrumbs > p::-webkit-scrollbar {
	display: none;
}

body.vgs-design .product-breadcrumb-container .breadcrumbs > p > * {
	flex: none;
}

/* Rank Math prints its separator as text (« - », a setting); here it reads as the direction of the trail. */
body.vgs-design .product-breadcrumb-container .breadcrumbs .separator {
	position: relative;
	width: 12px;
	margin: 0;
	overflow: hidden;
	color: transparent;
	opacity: 1;
}

body.vgs-design .product-breadcrumb-container .breadcrumbs .separator::before {
	content: "‹";
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--vgs-muted);
	font-size: var(--vgs-fs-18);
	line-height: 1;
}

/* The trail ends at the product's category: the product's own name is the H1 right below, and on a
 * phone it took two more lines above the gallery and pushed the purchase button out of the first screen. */
body.vgs-design .product-breadcrumb-container .breadcrumbs .last,
body.vgs-design .product-breadcrumb-container .breadcrumbs .separator:has(+ .last) {
	display: none;
}

/* ── Purchase column: order, and the empty half beside it ──────────────── */
/* The layout's inner row gives the purchase column half the width and leaves the other half empty. */
body.vgs-design.single-product .row > .col:has(> .col-inner > .product-price-container) {
	flex-basis: 100%;
	max-width: 100%;
}

body.vgs-design.single-product .row:has(> .col > .col-inner > .product-price-container) > .col:has(> .col-inner:empty) {
	display: none;
}

body.vgs-design.single-product .col-inner:has(> .product-price-container) {
	display: flex;
	flex-direction: column;
}

/* The layout wraps each element in <p>, which the parser leaves empty beside them. */
body.vgs-design.single-product .col-inner:has(> .product-price-container) > p:empty {
	display: none;
}

body.vgs-design.single-product .col-inner:has(> .product-price-container) > * {
	order: 6;
}

body.vgs-design.single-product .col-inner:has(> .product-price-container) > .product-title-container {
	order: 1;
}

body.vgs-design.single-product .col-inner:has(> .product-price-container) > .product-price-container {
	order: 2;
}

body.vgs-design.single-product .col-inner:has(> .product-price-container) > .add-to-cart-container {
	order: 3;
}

body.vgs-design.single-product .col-inner:has(> .product-price-container) > .product-short-description {
	order: 4;
}

body.vgs-design.single-product .col-inner:has(> .product-price-container) > .button {
	order: 5;
}

/* ── Title, badge, price, stock, button ────────────────────────────────── */
body.vgs-design.single-product .product-title-container {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--vgs-s2);
	margin: 0 0 var(--vgs-s3);
}

body.vgs-design.single-product .product-title-container .product-title {
	flex: 1 1 100%;
	margin: 0;
	color: var(--vgs-ink);
	font-size: var(--vgs-fs-22);
	font-weight: var(--vgs-fw-strong);
	line-height: var(--vgs-lh-head);
}

body.vgs-design.single-product .product-price-container {
	margin: 0;
}

body.vgs-design.single-product .product-price-container .price-wrapper {
	margin: 0;
}

body.vgs-design.single-product .product-page-price {
	display: flex;
	align-items: baseline;
	gap: var(--vgs-s2);
	margin: 0 0 var(--vgs-s2);
	color: var(--vgs-ink);
	font-size: var(--vgs-fs-22);
	line-height: var(--vgs-lh-head);
}

body.vgs-design.single-product .product-page-price .woocommerce-Price-amount {
	font-size: inherit;
}

/* «موجود است» is a status pill (the child theme draws it amber, the colour of waiting). */
body.vgs-design.single-product .add-to-cart-container p.stock {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	width: auto;
	min-height: 26px;
	margin: 0 0 var(--vgs-s3);
	padding: 0 10px;
	border-radius: var(--vgs-r-pill);
	background: var(--vgs-ok-soft);
	color: var(--vgs-ok-ink);
	font-size: var(--vgs-fs-12);
	font-weight: var(--vgs-fw-strong);
	line-height: var(--vgs-lh-label);
}

body.vgs-design.single-product .add-to-cart-container p.stock::before {
	content: "";
	flex: none;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--vgs-ok);
}

body.vgs-design.single-product .add-to-cart-container p.stock.out-of-stock {
	background: var(--vgs-plain-soft);
	color: var(--vgs-ink-2);
}

body.vgs-design.single-product .add-to-cart-container p.stock.out-of-stock::before {
	box-sizing: border-box;
	background: none;
	border: 1.5px solid var(--vgs-ink-2);
}

body.vgs-design.single-product .add-to-cart-container {
	margin: 0;
}

body.vgs-design.single-product .add-to-cart-container form.cart {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--vgs-s2);
	margin: 0 0 var(--vgs-s4);
}

body.vgs-design.single-product .add-to-cart-container form.cart .single_add_to_cart_button {
	flex: 1 1 100%;
	margin: 0;
}

/* mnsf's «مدت اعتبار آگهی» line: a quiet footnote. */
body.vgs-design.single-product .add-to-cart-container .mnsf-pl-timer {
	flex: 1 1 100%;
	margin: 0;
	color: var(--vgs-muted);
	font-size: var(--vgs-fs-13);
	line-height: 1.6;
}

body.vgs-design.single-product .col-inner:has(> .product-price-container) > .button {
	margin: 0 0 var(--vgs-s2);
	border-radius: var(--vgs-r-md) !important;
}

body.vgs-design.single-product .product_meta {
	margin: var(--vgs-s4) 0 0;
	color: var(--vgs-muted);
	font-size: var(--vgs-fs-13);
	line-height: var(--vgs-lh-body);
}

body.vgs-design.single-product .product_meta > span {
	display: block;
	margin: 0 0 4px;
}

/* Category and tag links: the child theme's pale blue is 2.15:1 on white. */
body.vgs-design.single-product .product_meta a {
	color: var(--vgs-primary-ink);
}

/* ── «مشخصات اکانت»: the seller's lines as a label / value table ───────── */
/* Each game's listing template nests the parts differently (mirror, 1405/07/06):
 *   Call of Duty   <p><span style="color:#3366ff"><strong>label : <span style="color:#282828">value</span></strong></span></p>
 *   Clash, Brawl   <p><span style="color:#0000ff"><b>label</b> : <span style="color:#282828"><strong>value</strong></span></span></p>
 *                  <p><span …><b>label : <span style="color:#282828">value</span></b></span></p>
 * What they share is the value's own colour, #282828. So the value floats to the end of its row
 * wherever it sits, and every other part of the line reads as the label. Inline colours and sizes need
 * !important to give way. ProductPage::dress() already removed the trailing breaks and empty tags. */
body.vgs-design.single-product .product-short-description {
	margin: var(--vgs-s2) 0 var(--vgs-s4);
	color: var(--vgs-ink-2);
	font-size: var(--vgs-fs-14);
	line-height: 1.6;
}

body.vgs-design.single-product .vgs-specs__title {
	margin: 0 0 var(--vgs-s3);
	color: var(--vgs-ink);
	font-size: var(--vgs-fs-18);
	font-weight: var(--vgs-fw-strong);
	line-height: var(--vgs-lh-head);
}

body.vgs-design.single-product .product-short-description > p {
	display: flow-root;
	margin: 0;
	padding: 12px 0;
	border-block-end: 1px solid var(--vgs-line);
	color: var(--vgs-ink-2);
	font-size: var(--vgs-fs-14);
	line-height: 1.6;
}

/* The label: every wrapper of the line, quiet. */
body.vgs-design.single-product .product-short-description > p span,
body.vgs-design.single-product .product-short-description > p strong,
body.vgs-design.single-product .product-short-description > p b {
	color: var(--vgs-ink-2) !important;
	font-size: var(--vgs-fs-14) !important;
	font-weight: var(--vgs-fw-body);
}

/* The value: at the row's end (left), bold ink. A long one (the seller's own description) takes the
 * whole width under its label and keeps its line breaks. */
body.vgs-design.single-product .product-short-description > p span[style*="282828"] {
	float: left;
	max-width: 100%;
	margin-inline-start: var(--vgs-s3);
	color: var(--vgs-ink) !important;
	font-weight: var(--vgs-fw-strong);
	overflow-wrap: anywhere;
}

body.vgs-design.single-product .product-short-description > p span[style*="282828"] span,
body.vgs-design.single-product .product-short-description > p span[style*="282828"] strong,
body.vgs-design.single-product .product-short-description > p span[style*="282828"] b {
	color: inherit !important;
	font-weight: inherit;
}

/* A long list folds after six lines (product.js adds .is-folded and the button). */
body.vgs-design.single-product .product-short-description.is-folded > p:nth-of-type(n+7) {
	display: none;
}

body.vgs-design.single-product .vgs-specs__more {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: var(--vgs-btn-md);
	margin: var(--vgs-s3) 0 0;
	padding: 0 16px;
	border: 1px solid var(--vgs-line-strong);
	border-radius: var(--vgs-r-md);
	background: var(--vgs-surface);
	color: var(--vgs-ink);
	font-family: inherit;
	font-feature-settings: "ss01";
	font-size: var(--vgs-fs-14);
	font-weight: var(--vgs-fw-strong);
	line-height: var(--vgs-lh-label);
	letter-spacing: normal;
	text-transform: none;
	cursor: pointer;
}

body.vgs-design.single-product .vgs-specs__more:hover {
	background: var(--vgs-field);
	border-color: var(--vgs-ink-2);
}

/* ── Player card (Call of Duty): four numbers above the table ──────────── */
/* Persian digits here — levels and counts, not IDs (the rest of the description keeps Latin ones). */
body.vgs-design.single-product .vgs-pstats {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	margin: 0 0 var(--vgs-s2);
	border: 1px solid var(--vgs-line);
	border-radius: var(--vgs-r-md);
	background: var(--vgs-field);
	font-feature-settings: "ss01";
}

body.vgs-design.single-product .vgs-pstats > div {
	display: grid;
	justify-items: center;
	padding: 10px 4px;
	text-align: center;
}

body.vgs-design.single-product .vgs-pstats > div + div {
	border-inline-start: 1px solid var(--vgs-line);
}

body.vgs-design.single-product .vgs-pstats b {
	color: var(--vgs-ink);
	font-size: var(--vgs-fs-22);
	font-weight: var(--vgs-fw-display);
	font-variant-numeric: tabular-nums;
	line-height: 1.3;
}

body.vgs-design.single-product .vgs-pstats span {
	color: var(--vgs-muted);
	font-size: var(--vgs-fs-12);
	line-height: var(--vgs-lh-label);
}

/* ── Gallery ────────────────────────────────────────────────────────────── */
body.vgs-design.single-product .woocommerce-product-gallery__image img {
	border-radius: var(--vgs-r-md);
}

body.vgs-design.single-product .product-thumbnails .col a,
body.vgs-design.single-product .product-thumbnails img {
	border-radius: var(--vgs-r-sm);
}

/* ── Tabs ───────────────────────────────────────────────────────────────── */
body.vgs-design.single-product .woocommerce-tabs .tabs > li > a {
	color: var(--vgs-ink-2);
	font-size: var(--vgs-fs-16);
	font-weight: var(--vgs-fw-strong);
	letter-spacing: normal;
	text-transform: none;
}

body.vgs-design.single-product .woocommerce-tabs .tabs > li.active > a {
	color: var(--vgs-ink);
}

body.vgs-design.single-product .woocommerce-tabs .tab-panels .panel.active {
	color: var(--vgs-ink-2);
	font-size: var(--vgs-fs-14);
	line-height: var(--vgs-lh-body);
}

/* ── Related («اکانت‌های مشابه») ────────────────────────────────────────── */
body.vgs-design.single-product .related-products-wrapper .product-section-title {
	margin: 0 0 var(--vgs-s2);
	color: var(--vgs-ink);
	font-size: var(--vgs-fs-18);
	font-weight: var(--vgs-fw-strong);
	letter-spacing: normal;
	text-transform: none;
}

/* ── Trust strip (the owner's UX block under the tabs, row class vg-icon-box) ── */
/* Its lines carry an inline font-size of 11px; the floor is 12 (DESIGN §3-2, ui round 1405/07/24). Only !important
 * answers an inline style. */
body.vgs-design.single-product .vg-icon-box .icon-box-text span[style*="font-size"] {
	font-size: var(--vgs-fs-12) !important;
}

/* ── Buy bar (mobile) ───────────────────────────────────────────────────── */
body.vgs-design .vgs-buybar {
	display: none;
}

@media (max-width: 849px) {
	/* The tabs open under their own title: the list and the panels become one column (display:contents),
	 * each panel ordered right after its tab. Flatsome keeps inactive panels at zero height. */
	body.vgs-design.single-product .woocommerce-tabs {
		display: flex;
		flex-direction: column;
		padding: 0;
	}

	body.vgs-design.single-product .woocommerce-tabs > .tabs,
	body.vgs-design.single-product .woocommerce-tabs > .tab-panels {
		display: contents;
	}

	body.vgs-design.single-product .woocommerce-tabs > .tabs > li {
		width: 100%;
		margin: 0 !important;
		border: 0;
		background: none;
	}

	body.vgs-design.single-product .woocommerce-tabs > .tabs > li > a {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: var(--vgs-s3);
		min-height: 56px;
		padding: 0 var(--vgs-s4) !important;
		border: 0 !important;
		border-block-end: 1px solid var(--vgs-line) !important;
		background: none !important;
		line-height: var(--vgs-lh-label);
	}

	body.vgs-design.single-product .woocommerce-tabs > .tabs > li > a::after {
		content: "";
		flex: none;
		width: 20px;
		height: 20px;
		background-color: var(--vgs-ink-2);
		-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E") center / 20px 20px no-repeat;
		mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E") center / 20px 20px no-repeat;
		transition: transform var(--vgs-dur) var(--vgs-ease);
	}

	body.vgs-design.single-product .woocommerce-tabs > .tabs > li.active > a::after {
		transform: rotate(180deg);
	}

	body.vgs-design.single-product .woocommerce-tabs > .tabs > li > a::before {
		display: none;
	}

	body.vgs-design.single-product .woocommerce-tabs > .tab-panels > .panel.active {
		padding: var(--vgs-s3) var(--vgs-s4) var(--vgs-s4);
		border-block-end: 1px solid var(--vgs-line);
	}

	body.vgs-design.single-product .woocommerce-tabs > .tabs > li:nth-child(1) { order: 1; }
	body.vgs-design.single-product .woocommerce-tabs > .tab-panels > .panel:nth-child(1) { order: 2; }
	body.vgs-design.single-product .woocommerce-tabs > .tabs > li:nth-child(2) { order: 3; }
	body.vgs-design.single-product .woocommerce-tabs > .tab-panels > .panel:nth-child(2) { order: 4; }
	body.vgs-design.single-product .woocommerce-tabs > .tabs > li:nth-child(3) { order: 5; }
	body.vgs-design.single-product .woocommerce-tabs > .tab-panels > .panel:nth-child(3) { order: 6; }
	body.vgs-design.single-product .woocommerce-tabs > .tabs > li:nth-child(4) { order: 7; }
	body.vgs-design.single-product .woocommerce-tabs > .tab-panels > .panel:nth-child(4) { order: 8; }
	body.vgs-design.single-product .woocommerce-tabs > .tabs > li:nth-child(5) { order: 9; }
	body.vgs-design.single-product .woocommerce-tabs > .tab-panels > .panel:nth-child(5) { order: 10; }
	body.vgs-design.single-product .woocommerce-tabs > .tabs > li:nth-child(6) { order: 11; }
	body.vgs-design.single-product .woocommerce-tabs > .tab-panels > .panel:nth-child(6) { order: 12; }
	body.vgs-design.single-product .woocommerce-tabs > .tabs > li:nth-child(7) { order: 13; }
	body.vgs-design.single-product .woocommerce-tabs > .tab-panels > .panel:nth-child(7) { order: 14; }
	body.vgs-design.single-product .woocommerce-tabs > .tabs > li:nth-child(8) { order: 15; }
	body.vgs-design.single-product .woocommerce-tabs > .tab-panels > .panel:nth-child(8) { order: 16; }

	/* Buy bar: sits on top of vgapp's nav while the page's own button is out of view (product.js). The nav's own
	 * height token is unset where the nav isn't drawn, so the bar then rests on the screen's edge. The layer is
	 * under the curtain of the menu and of a lightbox (magnific's 1042) and so under the nav (10050) too, whose
	 * raised «ثبت آگهی» button stays whole. */
	body.vgs-design .vgs-buybar {
		position: fixed;
		inset-inline: 0;
		inset-block-end: calc(var(--vgapp-nav-h, 0px) + var(--vgs-safe-b));
		z-index: 1040;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: var(--vgs-s3);
		box-sizing: border-box;
		min-height: var(--vgs-actionbar-h);
		padding: 8px var(--vgs-gutter);
		border-block-start: 1px solid var(--vgs-line);
		background: var(--vgs-surface);
		box-shadow: var(--vgs-elev-1);
		transform: translateY(110%);
		visibility: hidden;
		transition: transform var(--vgs-dur-slow) var(--vgs-ease), visibility 0s linear var(--vgs-dur-slow);
	}

	body.vgs-design.vgs-buybar-on .vgs-buybar {
		transform: none;
		visibility: visible;
		transition: transform var(--vgs-dur-slow) var(--vgs-ease);
	}

	body.vgs-design .vgs-buybar__price {
		display: grid;
		min-width: 0;
		color: var(--vgs-ink);
		font-size: var(--vgs-fs-18);
		line-height: var(--vgs-lh-label);
	}

	body.vgs-design .vgs-buybar__label {
		color: var(--vgs-muted);
		font-size: var(--vgs-fs-12);
		font-weight: var(--vgs-fw-body);
	}

	body.vgs-design .vgs-buybar__price .woocommerce-Price-amount {
		font-size: inherit;
	}

	body.vgs-design .vgs-buybar__btn {
		display: inline-flex;
		flex: none;
		align-items: center;
		justify-content: center;
		gap: var(--vgs-s2);
		min-height: var(--vgs-tap);
		margin: 0;
		padding: 0 var(--vgs-s4);
		border: 0;
		border-radius: var(--vgs-r-md);
		background: var(--vgs-primary);
		color: var(--vgs-on-primary);
		font-family: inherit;
		font-size: var(--vgs-fs-16);
		font-weight: var(--vgs-fw-strong);
		line-height: var(--vgs-lh-label);
		letter-spacing: normal;
		text-transform: none;
		cursor: pointer;
	}

	body.vgs-design .vgs-buybar__btn:hover {
		background: var(--vgs-primary-hover);
	}

	body.vgs-design .vgs-buybar__btn:active {
		background: var(--vgs-primary-press);
		transform: scale(0.98);
	}

	body.vgs-design .vgs-buybar__btn .vgsd-i {
		flex: none;
		width: 20px;
		height: 20px;
		fill: none;
		stroke: currentColor;
		stroke-width: 1.75;
		stroke-linecap: round;
		stroke-linejoin: round;
	}

	/* The nav stays in reach (the owner's decision, ADR-183); the page keeps room for both bars. */
	body.vgs-design.vgs-buybar-on {
		padding-bottom: calc(var(--vgapp-nav-h, 0px) + var(--vgs-actionbar-h) + var(--vgs-safe-b)) !important;
	}

	/* What floats above the nav moves up with the bar: the notification bell and popup (vgs-auth) and Goftino's closed
	 * bubble. A margin, not `bottom`: Goftino writes `bottom` inline and the popup's entrance animates `transform`.
	 * Goftino's open window is 100% wide and tall (inline as well), so it stays where it is. */
	body.vgs-design.vgs-buybar-on .vgs-bell,
	body.vgs-design.vgs-buybar-on .vgs-toast,
	body.vgs-design.vgs-buybar-on #goftino_w:not([style*="100%"]) {
		margin-block-end: var(--vgs-actionbar-h);
	}
}

/* ── Desktop: specs beside the buy box ─────────────────────────────────── */
@media (min-width: 850px) {
	body.vgs-design.single-product .product-title-container .product-title {
		font-size: var(--vgs-fs-28);
	}

	/* The specs take the first column over every row of the buy box; the buy box stacks in the second.
	 * The last row is flexible, so a long spec table grows only that row, never the gaps between the
	 * buy box's parts. */
	body.vgs-design.single-product .col-inner:has(> .product-price-container) {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
		grid-template-rows: repeat(8, auto) 1fr;
		column-gap: var(--vgs-s6);
		align-items: start;
	}

	body.vgs-design.single-product .col-inner:has(> .product-price-container) > * {
		grid-column: 2;
	}

	body.vgs-design.single-product .col-inner:has(> .product-price-container) > .product-short-description {
		grid-column: 1;
		grid-row: 1 / -1;
		margin-block-start: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.vgs-design .vgs-buybar,
	body.vgs-design.vgs-buybar-on .vgs-buybar {
		transition: none;
	}

	body.vgs-design.single-product .woocommerce-tabs > .tabs > li > a::after {
		transition: none;
	}
}
