/* Single product: variation picker (swatches / pills) + AJAX add-to-cart states. */

body.eyn-native-single-product table.variations td.eyn-vs-ready select {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
	opacity: 0;
	pointer-events: none;
}
body.eyn-native-single-product td.eyn-vs-ready .eiw-var-options { display: none !important; }

body.eyn-native-single-product table.variations th.label label { display: block; }
body.eyn-native-single-product .eyn-vs-label { font-weight: 700; }
body.eyn-native-single-product .eyn-vs-current { font-weight: 500; color: #555; }

body.eyn-native-single-product .eyn-vs-row { border-radius: 12px; transition: box-shadow .3s ease, background-color .3s ease; }
body.eyn-native-single-product .eyn-vs-row.eyn-vs-attention { box-shadow: 0 0 0 2px #900000; background-color: #fff6f6 !important; animation: eyn-vs-shake .45s ease 1; }
@keyframes eyn-vs-shake {
	0%, 100% { transform: translateX(0); }
	25% { transform: translateX(-4px); }
	75% { transform: translateX(4px); }
}

.eyn-vs { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 2px; }

.eyn-vs__opt {
	position: relative;
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	margin: 0;
	padding: 8px 18px;
	border: 1px solid #e3e3e3;
	border-radius: 999px;
	background: #fff;
	color: #333;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.5;
	cursor: pointer;
	transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
	-webkit-tap-highlight-color: transparent;
}
.eyn-vs__opt:hover { border-color: #b9b9b9; }
.eyn-vs__opt:focus { outline: none; }
.eyn-vs__opt:focus-visible { outline: 2px solid #900000; outline-offset: 3px; }
.eyn-vs__opt.is-selected { border-color: #900000; box-shadow: inset 0 0 0 1px #900000; color: #900000; }

.eyn-vs__name { display: block; white-space: nowrap; }
.eyn-vs__desc { display: block; margin-top: 1px; color: #888; font-size: 11px; font-weight: 400; line-height: 1.4; }

/* Colour swatches: image of the variation. */
.eyn-vs--color .eyn-vs__opt {
	width: 64px;
	height: 64px;
	padding: 3px;
	border-radius: 12px;
}
.eyn-vs__img { display: block; width: 100%; height: 100%; overflow: hidden; border-radius: 9px; background: #f4f4f4; }
.eyn-vs__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.eyn-vs--color .eyn-vs__opt.is-selected { border-width: 2px; padding: 2px; box-shadow: none; }

/* Check mark on the selected option. */
.eyn-vs__check {
	position: absolute;
	top: -6px;
	inset-inline-start: -6px;
	display: none;
	width: 18px;
	height: 18px;
	align-items: center;
	justify-content: center;
	border: 2px solid #fff;
	border-radius: 50%;
	background: #900000;
	color: #fff;
	box-sizing: border-box;
}
.eyn-vs__opt.is-selected .eyn-vs__check { display: flex; }

/* Unavailable / out of stock: dimmed + diagonal strike, still clickable. */
.eyn-vs__opt.is-unavailable { color: #999; }
.eyn-vs__opt.is-unavailable .eyn-vs__img,
.eyn-vs__opt.is-unavailable .eyn-vs__name { opacity: .45; }
.eyn-vs__opt.is-unavailable::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(to top left, transparent calc(50% - 1px), rgba(0, 0, 0, .35) 50%, transparent calc(50% + 1px));
	pointer-events: none;
}

/* Low stock badge. */
.eyn-vs__badge {
	position: absolute;
	bottom: -9px;
	left: 50%;
	transform: translateX(-50%);
	padding: 0 6px;
	border-radius: 999px;
	background: #900000;
	color: #fff;
	font-size: 10px;
	font-weight: 600;
	line-height: 17px;
	white-space: nowrap;
	pointer-events: none;
}
.eyn-vs__badge[hidden] { display: none; }
.eyn-vs--color { row-gap: 16px; padding-bottom: 10px; }

/* Desktop tooltip with the colour name. */
.eyn-vs__tip {
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	z-index: 5;
	transform: translateX(-50%);
	padding: 4px 9px;
	border-radius: 6px;
	background: #222;
	color: #fff;
	font-size: 11px;
	font-weight: 500;
	line-height: 1.6;
	white-space: nowrap;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity .15s ease;
}
@media (hover: hover) {
	.eyn-vs__opt:hover .eyn-vs__tip,
	.eyn-vs__opt:focus-visible .eyn-vs__tip { opacity: 1; visibility: visible; }
}

/* Mobile: one horizontally scrollable row of colours. */
@media (max-width: 767px) {
	.eyn-vs--color {
		flex-wrap: nowrap;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x proximity;
		scrollbar-width: none;
		margin: 0 -4px;
		padding: 8px 6px 12px;
	}
	.eyn-vs--color::-webkit-scrollbar { display: none; }
	.eyn-vs--color .eyn-vs__opt { flex: 0 0 auto; width: 60px; height: 60px; scroll-snap-align: start; }
	.eyn-vs__tip { display: none; }
}

/* Add-to-cart: "انتخاب …" state, loading state, inline message. */
body.eyn-native-single-product .single_add_to_cart_button.eyn-needs-choice { opacity: 1 !important; cursor: pointer; }
body.eyn-native-single-product .single_add_to_cart_button.is-loading,
body.eyn-native-single-product .sticky_btn_add_to_cart.is-loading { position: relative; pointer-events: none; }
body.eyn-native-single-product .single_add_to_cart_button.is-loading { color: transparent !important; }
body.eyn-native-single-product .single_add_to_cart_button.is-loading > * { visibility: hidden; }
body.eyn-native-single-product .single_add_to_cart_button.is-loading::after,
body.eyn-native-single-product .m_add_to_cart_sticky.is-loading > span::before {
	content: "";
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 2px solid rgba(255, 255, 255, .45);
	border-top-color: #fff;
	border-radius: 50%;
	animation: eyn-atc-spin .7s linear infinite;
	box-sizing: border-box;
}
body.eyn-native-single-product .single_add_to_cart_button.is-loading::after {
	position: absolute;
	top: 50%;
	left: 50%;
	margin: -9px 0 0 -9px;
}
body.eyn-native-single-product .m_add_to_cart_sticky.is-loading > span::before { margin-inline-end: 8px; vertical-align: middle; }
body.eyn-native-single-product .m_add_to_cart_sticky.is-loading > span svg { display: none; }
body.eyn-native-single-product .add_to_cart_sticky.is-loading svg { animation: eyn-atc-pulse .8s ease-in-out infinite; }
@keyframes eyn-atc-spin { to { transform: rotate(360deg); } }
@keyframes eyn-atc-pulse { 50% { opacity: .5; } }

body.eyn-native-single-product .eyn-atc-msg {
	flex-basis: 100%;
	margin: 10px 0 0;
	padding: 9px 12px;
	border: 1px solid #f1c9c9;
	border-radius: 10px;
	background: #fff5f5;
	color: #900000;
	font-size: 13px;
	line-height: 1.8;
}
body.eyn-native-single-product .eyn-atc-msg[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
	.eyn-vs__opt,
	.eyn-vs__tip,
	body.eyn-native-single-product .eyn-vs-row { transition: none; }
	body.eyn-native-single-product .eyn-vs-row.eyn-vs-attention { animation: none; }
	body.eyn-native-single-product .single_add_to_cart_button.is-loading::after,
	body.eyn-native-single-product .m_add_to_cart_sticky.is-loading > span::before { animation-duration: 2s; }
	body.eyn-native-single-product .add_to_cart_sticky.is-loading svg { animation: none; }
}
