/* ==========================================================================
   آیسو | استایل نمونه‌رنگ محصولات
   تمام کلاس‌ها با پیشوند iso-cs- نام‌گذاری شده‌اند تا با هیچ قالب یا افزونه‌ای
   تداخل نداشته باشند و ظاهر سایت را به هم نریزند.
   ========================================================================== */

:root {
	--iso-cs-size: 32px;
	--iso-cs-radius: 50%;
}

.iso-cs-swatch-wrapper {
	margin: 0 0 8px 0;
}

/* سلکت اصلی ووکامرس را کاملاً از کار نمی‌اندازیم، فقط بصری پنهان می‌کنیم
   تا سازگاری کامل با اسکریپت‌های داخلی ووکامرس (قیمت، موجودی و ...) حفظ شود. */
.iso-cs-swatch-wrapper select.iso-cs-native-select.iso-cs-hidden {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.iso-cs-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 6px;
	align-items: center;
}

.iso-cs-swatch {
	position: relative;
	box-sizing: border-box;
	width: var(--iso-cs-size);
	height: var(--iso-cs-size);
	border-radius: var(--iso-cs-radius);
	border: 2px solid #e2e2e2;
	background-color: #eee;
	background-size: cover;
	background-position: center;
	cursor: pointer;
	padding: 0;
	margin: 0;
	transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
	outline: none;
	flex: 0 0 auto;
}

.iso-cs-swatch:hover {
	transform: translateY(-2px);
	border-color: #999;
}

.iso-cs-swatch:focus-visible {
	box-shadow: 0 0 0 3px rgba(0, 115, 170, .35);
}

/* حالت انتخاب‌شده: حلقه (پیش‌فرض) */
.iso-cs-swatch.iso-cs-selected {
	border-color: #333;
	box-shadow: 0 0 0 2px #fff inset, 0 0 0 3px #333;
}

/* حالت انتخاب‌شده: تیک */
.iso-cs-selected-style-check .iso-cs-swatch.iso-cs-selected::after {
	content: "✓";
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	text-shadow: 0 0 2px rgba(0,0,0,.9), 0 0 2px rgba(0,0,0,.9);
	font-size: calc(var(--iso-cs-size) * 0.5);
	font-weight: bold;
	pointer-events: none;
}

/* حالت انتخاب‌شده: بزرگ‌نمایی */
.iso-cs-selected-style-zoom .iso-cs-swatch.iso-cs-selected {
	transform: scale(1.18);
	border-color: #333;
}

.iso-cs-swatch.iso-cs-disabled {
	opacity: .3;
	cursor: not-allowed;
	filter: grayscale(60%);
}

.iso-cs-swatch.iso-cs-disabled::before {
	content: "";
	position: absolute;
	left: 10%;
	right: 10%;
	top: 50%;
	height: 2px;
	background: #999;
	transform: rotate(-45deg);
}

/* راهنما (Tooltip) */
.iso-cs-swatch-tooltip {
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%) translateY(4px);
	background: #1e1e1e;
	color: #fff;
	font-size: 12px;
	line-height: 1.4;
	padding: 4px 8px;
	border-radius: 4px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity .15s ease, transform .15s ease;
	z-index: 20;
}

.iso-cs-swatch-tooltip::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: #1e1e1e;
}

.iso-cs-show-tooltip .iso-cs-swatch:hover .iso-cs-swatch-tooltip {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* نمونه‌رنگ کوچک در فروشگاه/آرشیو */
.iso-cs-loop-swatches {
	display: flex;
	gap: 6px;
	justify-content: center;
	margin: 8px 0;
	flex-wrap: wrap;
}

.iso-cs-loop-swatch {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 1px solid #e2e2e2;
	background-size: cover;
	background-position: center;
	display: inline-block;
}

.iso-cs-loop-more {
	font-size: 12px;
	color: #777;
	line-height: 16px;
}

/* ---------- استایل پنل مدیریت (فیلد رنگ در Terms) ---------- */
.iso-cs-term-field .iso-cs-color-picker {
	max-width: 120px;
}

.iso-cs-term-field .iso-cs-image-preview img {
	border-radius: 4px;
	border: 1px solid #dcdcde;
}

.iso-cs-wrap h1 {
	display: flex;
	align-items: center;
	gap: 8px;
}
