/* ZHIYAR — color swatch picker for the رنگ variation attribute. */

/* رنگ is currently the only variation attribute on the site, so this can be universal. */
.variations th.label label {
	font-size: 1.15em;
	font-weight: 700;
	color: var(--ast-global-color-3, #12241c);
}

.zhiyar-swatch-native {
	display: none;
}

/* WooCommerce's own "پاک کردن" reset-selection link, rendered by the
   template right after our swatch field — redundant with the swatches
   themselves (clicking another swatch already changes the selection).
   رنگ is currently the only variation attribute, so this can be universal. */
.variations a.reset_variations {
	display: none !important;
}

.zhiyar-swatch-list {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding: 4px 0;
}

.zhiyar-swatch {
	position: relative;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 2px solid #2e443a;
	box-shadow: 0 4px 10px -4px rgba(13, 31, 23, 0.35);
	cursor: pointer;
	padding: 0;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.zhiyar-swatch:hover {
	transform: translateY(-2px);
}

/* Selection shown purely as an outer ring — nothing drawn over the circle
   itself, so the actual color always stays fully, cleanly visible. */
.zhiyar-swatch.is-selected {
	transform: scale(1.08);
	box-shadow:
		0 0 0 2px #fff,
		0 0 0 4px var(--ast-global-color-2, #1a3d2e),
		0 4px 10px -4px rgba(13, 31, 23, 0.35);
}

.zhiyar-swatch.is-selected:hover {
	transform: scale(1.08) translateY(-2px);
}

/* A colorful 7-hue ring by default, signaling "pick your own color" — once
   the customer actually picks one via the RGB input, JS fills this circle
   with that exact color instead (see zhiyar-color-swatches.js). */
.zhiyar-swatch--custom {
	/* Astra forces `background-color !important` on every <button> sitewide,
	   which otherwise silently wins over this — must out-rank it. */
	background: conic-gradient(from 0deg, #ff5f6d, #ffc371, #f6d365, #a8bb96, #bcdcea, #9b7ede, #f7c6d9, #ff5f6d) !important;
}

/* Name tooltip, shown above the swatch on hover/focus. */
.zhiyar-swatch::before {
	content: attr(data-name);
	position: absolute;
	bottom: calc(100% + 9px);
	left: 50%;
	transform: translateX(-50%) translateY(4px);
	background: rgba(18, 36, 28, 0.92);
	color: #f5f0e6;
	padding: 4px 10px;
	border-radius: 8px;
	font-size: 11px;
	font-weight: 600;
	white-space: nowrap;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.15s ease, transform 0.15s ease;
	z-index: 10;
}

.zhiyar-swatch:hover::before,
.zhiyar-swatch:focus-visible::before {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
}

.zhiyar-swatch-field {
	position: relative;
	display: inline-block;
}

/* Static explanation of WHY non-white colors cost more (testing + wasted
   leftover paint, extra coats for metallics) — shown in the "توضیحات تکمیلی"
   tab, right under the انتخاب رنگ attribute row (see woocommerce_product_additional_information
   in zhiyar-color-swatches.php). */
.zhiyar-swatch-price-note {
	margin: 14px 0 0;
	max-width: 560px;
}

.zhiyar-swatch-price-note__heading {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0 0 6px;
	font-size: 0.95em;
	font-weight: 700;
	color: #2e7d4f;
}

.zhiyar-swatch-price-note__icon {
	display: inline-flex;
	color: #2e7d4f;
}

.zhiyar-swatch-price-note__icon svg {
	width: 18px;
	height: 18px;
}

.zhiyar-swatch-price-note__text {
	margin: 0;
	font-size: 0.9em;
	line-height: 1.7;
	color: rgba(18, 36, 28, 0.6);
}

/* "این رنگ X% به قیمت اضافه می‌کند" — appears only for colors that actually
   add to the price; hidden entirely for سفید (no addition). */
.zhiyar-swatch-percent-note {
	display: block;
	margin-top: 6px;
	font-size: 0.85em;
	font-weight: 600;
	color: var(--ast-global-color-2, #1a3d2e);
}

.zhiyar-swatch-percent-note[hidden] {
	display: none;
}

/* Pops up above the swatches (instead of sitting inline below them) — only
   when the رنگ دلخواه swatch is actually clicked. An explicit `display`
   here would override the browser's [hidden] default and show it always,
   so visibility is gated by :not([hidden]) instead. */
.zhiyar-swatch-custom-picker {
	display: none;
	position: absolute;
	bottom: calc(100% + 12px);
	right: 0;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	border-radius: 10px;
	background: linear-gradient(160deg, rgba(255, 255, 255, 0.9) 0%, rgba(250, 247, 240, 0.85) 100%);
	-webkit-backdrop-filter: blur(16px);
	backdrop-filter: blur(16px);
	border: 1px solid rgba(46, 68, 58, 0.25);
	box-shadow: 0 12px 28px -10px rgba(13, 31, 23, 0.35);
	white-space: nowrap;
	z-index: 15;
}

.zhiyar-swatch-custom-picker:not([hidden]) {
	display: flex;
}

.zhiyar-swatch-custom-input {
	width: 40px;
	height: 32px;
	border: none;
	border-radius: 6px;
	padding: 0;
	background: none;
	cursor: pointer;
}

.zhiyar-swatch-custom-label {
	font-size: 0.88em;
	color: var(--ast-global-color-3, #12241c);
}

.zhiyar-swatch-custom-hex {
	font-weight: 700;
	direction: ltr;
	display: inline-block;
}
