/*
 * Rasam Server – parts layout for the variations table.
 * Applies only to table.vartable.vt-rasam-parts (products outside the server / storage categories).
 * The row background (theme) and the add-to-cart / quotation buttons are intentionally left untouched.
 */

table.vartable.vt-rasam-parts {
	--vtr-accent: #46b041;
	--vtr-ink: #0f172a;
	--vtr-muted: #64748b;
	--vtr-line: rgba(15, 23, 42, .09);
	border: 0;
}

table.vartable.vt-rasam-parts tr {
	gap: 14px 22px;
	padding: 18px 22px;
}

/* the theme forces td{padding:10px!important}; spacing here comes from the row gap instead */
table.vartable.vt-rasam-parts td {
	border: 0;
	padding: 0 !important;
}

/* ---------- variation images (one tile per image, max 4 in the card) ---------- */
table.vartable.vt-rasam-parts td.vt-rimgcol {
	flex: 0 0 auto;
	width: auto;
	max-width: none;
	margin: 0;
	line-height: 0;
}

table.vartable.vt-rasam-parts .vt-rimgs {
	--vtr-tile: 96px;
	display: flex;
	flex-wrap: nowrap;
	gap: 8px;
}

table.vartable.vt-rasam-parts .vt-rimgs--multi {
	--vtr-tile: 80px;
}

table.vartable.vt-rasam-parts .vt-rimg {
	position: relative;
	z-index: 1;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--vtr-tile);
	height: var(--vtr-tile);
	overflow: hidden;
	background: #fff;
	border: 1px solid var(--vtr-line);
	border-radius: 14px;
	box-shadow: 0 4px 14px rgba(15, 23, 42, .06);
	box-sizing: border-box;
	cursor: zoom-in;
	text-decoration: none;
	transform-origin: right center;
	transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease, border-radius .35s ease;
}

table.vartable.vt-rasam-parts .vt-rimg img.vt-rimg__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	padding: 7px;
	box-sizing: border-box;
	object-fit: contain;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

/* last tile when there are more images than tiles: "+N" over the photo */
table.vartable.vt-rasam-parts .vt-rimg__more {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(15, 23, 42, .58);
	color: #fff;
	font-size: 17px;
	font-weight: 800;
	line-height: 1;
	direction: ltr;
	unicode-bidi: isolate;
	transition: opacity .2s ease;
}

/* big hover preview: the image grows out of its box over the card (desktop / mouse only) */
@media (hover: hover) and (pointer: fine) {
	table.vartable.vt-rasam-parts .vt-rimg:hover,
	table.vartable.vt-rasam-parts .vt-rimg:focus-visible {
		z-index: 30;
		transform: scale(2.7);
		border-radius: 8px;
		box-shadow: 0 12px 34px rgba(15, 23, 42, .22);
		transition-delay: .06s;
	}

	table.vartable.vt-rasam-parts .vt-rimgs--multi .vt-rimg:hover,
	table.vartable.vt-rasam-parts .vt-rimgs--multi .vt-rimg:focus-visible {
		transform: scale(3.2);
	}

	table.vartable.vt-rasam-parts .vt-rimg:hover .vt-rimg__more,
	table.vartable.vt-rasam-parts .vt-rimg:focus-visible .vt-rimg__more {
		opacity: 0;
	}
}

/* ---------- name / labels ---------- */
table.vartable.vt-rasam-parts td.optionscol {
	display: flex;
	flex: 1 1 220px;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	gap: 6px;
	min-width: 0;
	margin: 0;
	font-family: inherit;
	font-size: 19px;
	font-weight: 800;
	line-height: 1.5;
	color: var(--vtr-ink);
	text-align: right;
	word-break: break-word;
}

/* no attribute name (e.g. «نوع هارد») anywhere in this layout, also not the plugin's mobile data-label */
table.vartable.vt-rasam-parts td::before {
	content: none !important;
	display: none !important;
}

table.vartable.vt-rasam-parts td.optionscol > br {
	display: none;
}

table.vartable.vt-rasam-parts td.optionscol .pvl-labels {
	display: flex;
	flex-wrap: wrap;
	order: -2;
	gap: 6px;
	margin: 0 0 2px;
}

table.vartable.vt-rasam-parts td.optionscol .pvl-label {
	display: inline-block;
	padding: 3px 11px;
	border-radius: 999px;
	font-size: 11.5px;
	font-weight: 700;
	line-height: 1.7;
	white-space: nowrap;
	box-shadow: 0 1px 2px rgba(15, 23, 42, .12);
}

table.vartable.vt-rasam-parts td.optionscol .vdesccol {
	order: 1;
	width: 100%;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.9;
	color: #475569;
}

table.vartable.vt-rasam-parts td.optionscol .vdesccol:empty {
	display: none;
}

/* ---------- price ---------- */
table.vartable.vt-rasam-parts td.pricecol {
	display: flex;
	flex: 0 0 auto;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	gap: 6px;
	margin: 0;
	padding: 4px 22px !important;
	border-right: 1px solid var(--vtr-line);
	text-align: right;
	line-height: 1.35;
}

table.vartable.vt-rasam-parts td.pricecol > .woocommerce-Price-amount,
table.vartable.vt-rasam-parts td.pricecol ins {
	font-size: 25px;
	font-weight: 900;
	color: var(--vtr-ink);
	text-decoration: none;
	white-space: nowrap;
}

table.vartable.vt-rasam-parts td.pricecol .woocommerce-Price-currencySymbol {
	margin-right: 2px;
	font-size: 13px;
	font-weight: 600;
	color: var(--vtr-muted);
}

table.vartable.vt-rasam-parts td.pricecol del {
	display: block;
	margin: 0;
	font-size: 14px;
	font-weight: 400;
	color: #94a3b8;
}

table.vartable.vt-rasam-parts td.pricecol del .woocommerce-Price-amount {
	font-size: inherit;
	font-weight: inherit;
}

table.vartable.vt-rasam-parts td.pricecol .ppua-updated {
	display: inline-flex !important;
	flex: 0 0 auto;
	align-items: center;
	gap: 4px;
	width: auto;
	margin: 0;
	padding: 3px 10px 3px 11px;
	border-radius: 999px;
	background: rgba(70, 176, 65, .1);
	color: #2f7d2b;
	font-size: 11.5px;
	font-weight: 600;
	line-height: 1.7;
	white-space: nowrap;
}

table.vartable.vt-rasam-parts td.pricecol .ppua-updated::before {
	content: "";
	flex: 0 0 6px;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--vtr-accent);
}

table.vartable.vt-rasam-parts td.pricecol .ppua-updated[hidden] {
	display: none !important;
}

/* ---------- buttons area (buttons themselves keep the theme style) ---------- */
table.vartable.vt-rasam-parts td.cartcol {
	flex: 0 0 auto;
	margin: 0;
}

table.vartable.vt-rasam-parts td.cartcol form {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
}

/* spacing only – colours, size and shape of both buttons stay as they are */
table.vartable.vt-rasam-parts td.cartcol form .wc-rq-btn,
table.vartable.vt-rasam-parts td.cartcol form .single_add_to_cart_button {
	margin: 0;
}

/* empty stock cell (stock text disabled) takes no space */
table.vartable.vt-rasam-parts td.stockcol:has(> span:empty) {
	display: none;
}

/* ---------- description list (same "نمایش بیشتر / کمتر" toggle as the server pages, from the theme script) ---------- */
table.vartable.vt-rasam-parts td.vbreak {
	display: none;
}

table.vartable.vt-rasam-parts td:has(.vdescrow) {
	display: block;
	flex: 0 0 100%;
	order: 10;
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 14px 0 0 !important;
	border-top: 1px dashed rgba(15, 23, 42, .14);
	font-size: 14px;
	line-height: 2;
	color: #334155;
	text-align: right;
}

/* line the list up under the name, not under the photo */
table.vartable.vt-rasam-parts tr.vt-has-img:not(.vt-multi-img) td:has(.vdescrow) {
	flex-basis: calc(100% - 118px);
	max-width: calc(100% - 118px);
	margin-right: 118px;
}

table.vartable.vt-rasam-parts td:has(.vdescrow) p.vdescrow:empty,
table.vartable.vt-rasam-parts td:has(.vdescrow) > p:empty {
	display: none;
}

table.vartable.vt-rasam-parts td:has(.vdescrow) ul {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 32px;
	margin: 0;
	padding: 0;
	list-style: none;
}

table.vartable.vt-rasam-parts td:has(.vdescrow) li {
	position: relative;
	margin: 0;
	padding: 0 14px 0 0;
}

table.vartable.vt-rasam-parts td:has(.vdescrow) li::before {
	content: "";
	position: absolute;
	top: .95em;
	right: 0;
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--vtr-accent);
}

table.vartable.vt-rasam-parts td:has(.vdescrow) li strong {
	font-weight: 700;
	color: var(--vtr-ink);
}

/* soft fade at the bottom of the closed list */
table.vartable.vt-rasam-parts .spec-toggle-list:not(.is-expanded),
table.vartable.vt-rasam-parts .spec-toggle-text:not(.is-expanded) {
	-webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent);
	mask-image: linear-gradient(to bottom, #000 60%, transparent);
}

table.vartable.vt-rasam-parts .spec-toggle-btn {
	margin-top: 4px;
	font-size: 12.5px;
	font-weight: 700;
	color: var(--vtr-accent);
	box-shadow: none;
	height: auto;
	line-height: 1.8;
}

table.vartable.vt-rasam-parts .spec-toggle-btn:hover {
	color: #378b33;
}

/* ---------- tablet / mobile ---------- */
@media screen and (max-width: 767px) {
	table.vartable.vt-rasam-parts tr {
		gap: 12px 14px;
		padding: 16px;
		align-items: center;
	}

	table.vartable.vt-rasam-parts td.vt-rimgcol {
		display: block;
		flex: 0 0 auto;
		width: auto;
		max-width: 100%;
	}

	table.vartable.vt-rasam-parts .vt-rimgs {
		--vtr-tile: 76px;
	}

	/* several photos: their own full-width strip under the name, scrolls sideways if needed */
	table.vartable.vt-rasam-parts tr.vt-multi-img td.vt-rimgcol {
		flex: 0 0 100%;
		order: 1;
	}

	table.vartable.vt-rasam-parts .vt-rimgs--multi {
		--vtr-tile: 68px;
		overflow-x: auto;
		scrollbar-width: none;
		padding-bottom: 2px;
	}

	table.vartable.vt-rasam-parts .vt-rimgs--multi::-webkit-scrollbar {
		display: none;
	}

	table.vartable.vt-rasam-parts .vt-rimg img.vt-rimg__img {
		padding: 6px;
	}

	table.vartable.vt-rasam-parts td.optionscol {
		display: flex;
		flex: 1 1 0;
		width: auto;
		max-width: 100%;
		font-size: 16px !important;
		text-align: right !important;
	}

	table.vartable.vt-rasam-parts td.pricecol {
		display: flex;
		flex: 0 0 100%;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		max-width: 100%;
		margin: 0;
		padding: 12px 0 0 !important;
		border-right: 0;
		border-top: 1px dashed rgba(15, 23, 42, .14);
		text-align: right;
	}

	table.vartable.vt-rasam-parts td.pricecol > .woocommerce-Price-amount,
	table.vartable.vt-rasam-parts td.pricecol ins {
		font-size: 21px;
	}

	table.vartable.vt-rasam-parts td.pricecol del {
		flex: 0 0 100%;
	}

	table.vartable.vt-rasam-parts td.cartcol {
		display: block;
		flex: 0 0 100%;
		width: 100%;
		max-width: 100%;
		margin: 0;
	}

	table.vartable.vt-rasam-parts td.cartcol form {
		justify-content: center;
	}

	/* phone: name → description → price → buttons */
	table.vartable.vt-rasam-parts td.pricecol,
	table.vartable.vt-rasam-parts td.cartcol {
		order: 20;
	}

	table.vartable.vt-rasam-parts td:has(.vdescrow),
	table.vartable.vt-rasam-parts tr.vt-has-img:not(.vt-multi-img) td:has(.vdescrow) {
		flex-basis: 100%;
		max-width: 100%;
		margin-right: 0;
		padding-top: 12px !important;
		font-size: 13.5px;
		line-height: 1.95;
	}

	table.vartable.vt-rasam-parts td:has(.vdescrow) ul {
		grid-template-columns: 1fr;
	}
}

/* ---------- gallery lightbox (appended to <body>) ---------- */
html.vt-rlb-open,
html.vt-rlb-open body {
	overflow: hidden !important;
}

.vt-rlb {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: flex;
	flex-direction: column;
	background: rgba(9, 13, 22, .92);
	color: #fff;
	font-family: inherit;
	opacity: 0;
	transition: opacity .2s ease;
	-webkit-tap-highlight-color: transparent;
}

.vt-rlb[hidden] {
	display: none;
}

.vt-rlb.is-open {
	opacity: 1;
}

.vt-rlb button {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	line-height: 1;
	cursor: pointer;
	height: auto;
	min-height: 0;
}

.vt-rlb__top {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 18px;
	font-size: 14px;
}

.vt-rlb__counter {
	flex: 0 0 auto;
	min-width: 44px;
	font-weight: 700;
	opacity: .85;
}

.vt-rlb__title {
	flex: 1 1 auto;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	opacity: .85;
	text-align: center;
}

.vt-rlb .vt-rlb__close {
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .12);
	font-size: 28px;
	transition: background .2s ease;
}

.vt-rlb .vt-rlb__close:hover {
	background: rgba(255, 255, 255, .22);
}

.vt-rlb__stage {
	position: relative;
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 0 72px;
}

.vt-rlb__img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
	user-select: none;
	transition: opacity .2s ease;
}

.vt-rlb.is-loading .vt-rlb__img {
	opacity: 0;
}

.vt-rlb__spin {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 34px;
	height: 34px;
	margin: -17px 0 0 -17px;
	border: 3px solid rgba(255, 255, 255, .25);
	border-top-color: #46b041;
	border-radius: 50%;
	opacity: 0;
	animation: vt-rlb-spin .8s linear infinite;
	pointer-events: none;
}

.vt-rlb.is-loading .vt-rlb__spin {
	opacity: 1;
}

@keyframes vt-rlb-spin {
	to { transform: rotate(360deg); }
}

.vt-rlb .vt-rlb__nav {
	position: absolute;
	top: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 50px;
	height: 50px;
	margin-top: -25px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .12);
	transition: background .2s ease;
}

.vt-rlb .vt-rlb__nav:hover {
	background: #46b041;
}

.vt-rlb .vt-rlb__prev { right: 14px; }
.vt-rlb .vt-rlb__next { left: 14px; }

.vt-rlb.is-single .vt-rlb__nav,
.vt-rlb.is-single .vt-rlb__thumbs {
	display: none;
}

.vt-rlb__thumbs {
	display: flex;
	justify-content: center;
	gap: 8px;
	padding: 14px 16px 18px;
	overflow-x: auto;
	scrollbar-width: none;
}

.vt-rlb__thumbs::-webkit-scrollbar {
	display: none;
}

.vt-rlb .vt-rlb__thumb {
	flex: 0 0 auto;
	width: 60px;
	height: 60px;
	overflow: hidden;
	border-radius: 10px;
	background: #fff;
	opacity: .5;
	outline: 2px solid transparent;
	outline-offset: 2px;
	transition: opacity .2s ease, outline-color .2s ease;
}

.vt-rlb .vt-rlb__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.vt-rlb .vt-rlb__thumb:hover,
.vt-rlb .vt-rlb__thumb.is-active {
	opacity: 1;
}

.vt-rlb .vt-rlb__thumb.is-active {
	outline-color: #46b041;
}

@media (max-width: 767px) {
	.vt-rlb__stage {
		padding: 0 10px;
	}

	.vt-rlb .vt-rlb__nav {
		width: 40px;
		height: 40px;
		margin-top: -20px;
		background: rgba(0, 0, 0, .45);
	}

	.vt-rlb .vt-rlb__prev { right: 6px; }
	.vt-rlb .vt-rlb__next { left: 6px; }

	.vt-rlb__thumbs {
		justify-content: flex-start;
	}

	.vt-rlb .vt-rlb__thumb {
		width: 52px;
		height: 52px;
	}
}
