/**
 * NextShop — شبکه تصاویر و دکمه‌های ویژگی در صفحه تک‌محصول
 */

.nextshop-variations-table,
.nextshop-variations-table tbody {
	display: block;
	width: 100%;
}

.nextshop-variations-table tr.nextshop-variation-row {
	display: block;
	width: 100%;
}

.nextshop-variations-table tr.nextshop-variation-row > th.label,
.nextshop-variations-table tr.nextshop-variation-row > td.value {
	display: block;
	width: 100%;
	max-width: 100%;
	padding: 0;
	border: none;
	box-sizing: border-box;
}

.nextshop-variations-table tr.nextshop-variation-row > th.label {
	font-weight: 700;
	font-size: 0.875rem;
	color: var(--sp-text, #1e293b);
	margin-bottom: 0.35rem;
}

.nextshop-variation-row + .nextshop-variation-row {
	margin-top: 0.75rem;
}

/* --- شبکه تصویر (ویژگی اصلی: رنگ) --- */

.nextshop-variation-grid {
	margin-bottom: 0.25rem;
}

.nextshop-variation-grid__items {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
	gap: 0.65rem;
}

.nextshop-variation-grid__item {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0.35rem;
	min-width: 0;
	width: 100%;
	padding: 0.35rem;
	border: 2px solid var(--sp-border, #e2e8f0);
	border-radius: 0;
	background: var(--sp-card);
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
	font-family: inherit;
	font-size: 0.75rem;
	color: var(--sp-text, #1e293b);
	line-height: 1.3;
}

.nextshop-variation-grid__item:hover {
	border-color: var(--sp-accent, #2271b1);
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.nextshop-variation-grid__item.is-active {
	border-color: var(--sp-accent, #2271b1);
	box-shadow: 0 0 0 1px var(--sp-accent, #2271b1);
}

.nextshop-variation-grid__item:focus-visible {
	outline: 2px solid var(--sp-accent, #2271b1);
	outline-offset: 2px;
}

/* قاب مربعی — ابعاد width/height اینلاین وردپرس روی img را خنثی می‌کند */
.nextshop-variation-grid__thumb {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: 8px;
	background: var(--sp-bg-subtle);
	flex-shrink: 0;
}

.nextshop-variation-grid__thumb .nextshop-variation-grid__img,
.nextshop-variation-grid__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center;
	border-radius: 0;
}

.nextshop-variation-grid__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	min-height: 100%;
	background: var(--sp-bg-muted);
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--sp-muted, #64748b);
	text-transform: uppercase;
}

.nextshop-variation-grid__label {
	display: block;
	width: 100%;
	text-align: center;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.nextshop-variation-grid__select-wrap,
.nextshop-variation-pills__select-wrap {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* --- ویژگی‌های وابسته (مثلاً سایز) --- */

.nextshop-variations--grid-enabled .nextshop-variation-row--depends {
	display: none;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.nextshop-variations--grid-enabled.has-primary-variation-selected .nextshop-variation-row--depends.is-visible {
	display: block;
	opacity: 1;
	transform: translateY(0);
}

.nextshop-variation-pills {
	width: 100%;
}

.nextshop-variation-pills__items {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(3.25rem, 1fr));
	gap: 0.5rem;
	width: 100%;
	max-width: 100%;
}

.nextshop-product-buybox .nextshop-variation-pills__items,
.nextshop-buy-box .nextshop-variation-pills__items {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(3.25rem, 1fr));
}

.nextshop-variation-pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	min-height: 42px;
	padding: 0.45rem 0.65rem;
	flex: none;
	border: 1.5px solid var(--sp-border, #e2e8f0);
	border-radius: 10px;
	background: var(--sp-card);
	color: var(--sp-text, #1e293b);
	font-family: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.nextshop-variation-pill:hover:not(:disabled) {
	border-color: var(--sp-accent, #2271b1);
	background: var(--sp-bg-subtle);
}

.nextshop-variation-pill.is-active {
	border-color: var(--sp-accent, #2271b1);
	background: var(--sp-accent, #2271b1);
	color: #fff;
	box-shadow: 0 4px 12px rgba(34, 113, 177, 0.25);
}

.nextshop-variation-pill.is-disabled,
.nextshop-variation-pill:disabled {
	opacity: 0.35;
	cursor: not-allowed;
	text-decoration: line-through;
}

.nextshop-variation-pill:focus-visible {
	outline: 2px solid var(--sp-accent, #2271b1);
	outline-offset: 2px;
}

.nextshop-variations--grid-enabled .nextshop-variation-row--secondary > th.label {
	margin-top: 0.5rem;
}

/* دکمه‌های سایز داخل buybox — جدا از استایل دکمه افزودن به سبد */
.nextshop-product-buybox form.cart .nextshop-variation-pill,
.nextshop-buy-box form.cart .nextshop-variation-pill {
	flex: none;
	width: 100%;
	min-width: 0;
	min-height: 42px;
	/* background: #fff !important; */
	color: var(--sp-text, #1e293b) !important;
	border: 1.5px solid var(--sp-border, #e2e8f0) !important;
	padding: 0.45rem 0.65rem !important;
	border-radius: 10px !important;
	font-size: 0.875rem !important;
	font-weight: 600 !important;
	box-shadow: none !important;
	transform: none !important;
}

.nextshop-product-buybox form.cart .nextshop-variation-pill.is-active,
.nextshop-buy-box form.cart .nextshop-variation-pill.is-active {
	background: var(--sp-accent, #2271b1) !important;
	color: #fff !important;
	border-color: var(--sp-accent, #2271b1) !important;
	box-shadow: 0 4px 12px rgba(34, 113, 177, 0.25) !important;
}

.nextshop-product-buybox form.cart .nextshop-variation-pill:hover:not(:disabled),
.nextshop-buy-box form.cart .nextshop-variation-pill:hover:not(:disabled) {
	background: var(--sp-bg-subtle) !important;
	border-color: var(--sp-accent, #2271b1) !important;
	color: var(--sp-text, #1e293b) !important;
	transform: none !important;
}

.nextshop-product-buybox form.cart .nextshop-variation-pill.is-active:hover:not(:disabled),
.nextshop-buy-box form.cart .nextshop-variation-pill.is-active:hover:not(:disabled) {
	background: var(--sp-accent, #2271b1) !important;
	color: #fff !important;
}

@media (max-width: 480px) {
	.nextshop-variation-grid__items {
		grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
		gap: 0.5rem;
	}

	.nextshop-variation-pills__items {
		grid-template-columns: repeat(auto-fill, minmax(2.85rem, 1fr));
		gap: 0.45rem;
	}

	.nextshop-variation-pill {
		min-height: 38px;
		padding: 0.4rem 0.5rem;
		font-size: 0.8125rem;
	}
}
