/**
 * Orphit – Variation Swatches (Eigenbau).
 *
 * Styling für die vom Plugin gerenderten Swatches im Configurator
 * (/produkt/orphit-tech|sport/). Das `<select>` bleibt funktional für
 * WooCommerce-Core-JS, wird aber visuell ausgeblendet.
 */

/* Select ausblenden – bleibt für WC-JS im DOM. */
.orphit-variation-raw-select {
	display: none !important;
}

/* Swatch-Liste */
.orphit-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	list-style: none;
	margin: 12px 0 4px;
	padding: 0;
}

.orphit-swatch {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--orphit-swatch-w, 50px);
	height: var(--orphit-swatch-h, 50px);
	border-radius: 999px; /* round */
	border: 1px solid rgba(31, 39, 43, 0.18);
	background: #fff;
	cursor: pointer;
	overflow: hidden;
	transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

.orphit-swatches--square .orphit-swatch {
	border-radius: 10px;
}

.orphit-swatch:hover {
	transform: scale(1.05);
	border-color: var(--primary-medium, #3c9fc3);
}

.orphit-swatch.is-selected {
	border-color: var(--primary-dark, #1e5062);
	box-shadow: 0 0 0 2px var(--primary-dark, #1e5062);
}

.orphit-swatch:focus-visible {
	outline: 2px solid var(--primary, #205669);
	outline-offset: 2px;
}

/* Farb-Swatch */
.orphit-swatch__color {
	width: calc(100% - 6px);
	height: calc(100% - 6px);
	border-radius: inherit;
	background-color: #ccc;
}

/* Bild-Swatch */
.orphit-swatch__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.orphit-swatch__placeholder {
	font-size: 11px;
	color: var(--textmuted, #5e676b);
	text-align: center;
	padding: 2px;
	line-height: 1.2;
}

/* Button / Label-Swatch */
.orphit-swatch__label {
	font-family: var(--font-body, inherit);
	font-size: var(--orphit-swatch-font, 14px);
	font-weight: 600;
	color: var(--text, #1f272b);
	padding: 0 6px;
	white-space: nowrap;
}

.orphit-swatch--button {
	width: auto;
	min-width: var(--orphit-swatch-w, 50px);
	height: var(--orphit-swatch-h, 50px);
	border-radius: 10px;
	padding: 0 14px;
}

/* Nicht verfügbare Kombinationen (OOS) */
.orphit-swatch.is-unavailable--blur {
	opacity: 0.35;
	pointer-events: none;
}

.orphit-swatch.is-unavailable--cross {
	opacity: 0.45;
}

.orphit-swatch.is-unavailable--cross::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 130%;
	height: 2px;
	background: rgba(162, 50, 50, 0.85);
	transform: translate(-50%, -50%) rotate(-45deg);
}

.orphit-swatch.is-unavailable--hide {
	display: none;
}

/* Preloader-Overlay über dem Produktbild */
.orphit-swatch-preloader {
	position: absolute;
	inset: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(247, 248, 249, 0.55);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.orphit-swatch-preloader.is-active {
	opacity: 1;
	pointer-events: auto;
}

.orphit-swatch-preloader::before {
	content: "";
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: 4px solid rgba(32, 86, 105, 0.2);
	border-top-color: var(--primary, #205669);
	animation: orphit-swatch-spin 0.7s linear infinite;
}

@keyframes orphit-swatch-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Produktbild-Container für das Preloader-Overlay positionieren */
.woocommerce-product-gallery,
.brxe-product-gallery,
.product-image {
	position: relative;
}

/* Gewählter Wert neben dem Label */
.orphit-selected-name {
	font-weight: 700;
	color: var(--primary-dark, #1e5062);
}

@media (prefers-reduced-motion: reduce) {
	.orphit-swatch,
	.orphit-swatch-preloader::before {
		animation: none;
		transition: none;
	}
}
