/**
 * Swatches CSS — color/image/label swatches, active/hover/disabled states, tooltips.
 *
 * Module 56, Block 56.1.
 *
 * @package WPAIC
 */

/* Container */
.wpaic-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 8px 0;
	align-items: center;
}

.wpaic-swatches--compact {
	gap: 4px;
	margin: 4px 0;
}

/* Swatch item (shared) */
.wpaic-swatch {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	border: 2px solid #ddd;
	border-radius: 4px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
	user-select: none;
	-webkit-user-select: none;
}

.wpaic-swatch:hover {
	border-color: #666;
}

.wpaic-swatch:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

/* Active state */
.wpaic-swatch--active {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
}

/* Disabled state — cross-out */
.wpaic-swatch--disabled {
	opacity: 0.35;
	cursor: not-allowed;
	position: relative;
}

.wpaic-swatch--disabled::after {
	content: '';
	position: absolute;
	top: 50%;
	left: -2px;
	right: -2px;
	height: 2px;
	background: #cc0000;
	transform: rotate(-45deg);
	pointer-events: none;
}

/* Color swatch */
.wpaic-swatch--color {
	width: 36px;
	height: 36px;
	padding: 2px;
	border-radius: 50%;
}

.wpaic-swatches--compact .wpaic-swatch--color {
	width: 24px;
	height: 24px;
}

.wpaic-swatch__color {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Image swatch */
.wpaic-swatch--image {
	width: 44px;
	height: 44px;
	padding: 2px;
	overflow: hidden;
}

.wpaic-swatches--compact .wpaic-swatch--image {
	width: 30px;
	height: 30px;
}

.wpaic-swatch__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 2px;
}

/* Label swatch */
.wpaic-swatch--label {
	min-width: 36px;
	height: 36px;
	padding: 4px 12px;
}

.wpaic-swatches--compact .wpaic-swatch--label {
	min-width: 24px;
	height: 24px;
	padding: 2px 6px;
	font-size: 11px;
}

.wpaic-swatch__label {
	font-size: 13px;
	line-height: 1;
	white-space: nowrap;
	color: #333;
}

.wpaic-swatch--active .wpaic-swatch__label {
	font-weight: 600;
	color: #2271b1;
}

/* More indicator */
.wpaic-swatch--more {
	font-size: 11px;
	color: #666;
	padding: 2px 6px;
	border: 1px dashed #ccc;
	border-radius: 4px;
	cursor: default;
}

/* Tooltip */
.wpaic-swatch__tooltip {
	position: absolute;
	bottom: calc(100% + 6px);
	left: 50%;
	transform: translateX(-50%);
	background: #333;
	color: #fff;
	font-size: 11px;
	line-height: 1.3;
	padding: 4px 8px;
	border-radius: 4px;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.15s ease, visibility 0.15s ease;
	z-index: 10;
}

.wpaic-swatch__tooltip::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: #333;
}

.wpaic-swatch:hover .wpaic-swatch__tooltip {
	opacity: 1;
	visibility: visible;
}

/* Archive swatches container */
.wpaic-swatches-archive {
	margin: 4px 0 8px;
}

/* None type — hide tooltip for unstyled fallback */
.wpaic-swatch--none .wpaic-swatch__tooltip {
	display: none;
}
