/**
 * CartNexa Custom Color Swatches Widget CSS
 * Isolated per-widget styling with luxury baby aesthetic
 */

.cn-color-swatches-wrapper {
	width: 100%;
	font-family: var(--cn-font-family, sans-serif);
	box-sizing: border-box;
}

/* Header & Selected Value */
.cn-swatch-header {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 12px;
	font-size: 14px;
}

.cn-swatch-label {
	color: var(--cn-body, #667085);
	font-weight: 500;
}

.cn-swatch-selected-value {
	color: var(--cn-dark, #233547);
	font-weight: 700;
	transition: color 0.2s ease;
}

/* Swatches List Container */
.cn-swatches-list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

/* Swatch Item Base */
.cn-swatch-item {
	width: 36px;
	height: 36px;
	border: 2px solid var(--cn-border, #E6EEF2);
	background-clip: padding-box;
	padding: 0;
	margin: 0;
	cursor: pointer;
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	outline: none;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	box-sizing: border-box;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	-webkit-user-select: none;
	user-select: none;
}

/* Shapes */
.cn-swatch-shape-circle .cn-swatch-item {
	border-radius: 50%;
}

.cn-swatch-shape-square .cn-swatch-item {
	border-radius: 6px;
}

/* Hover & Active Highlight */
@media (hover: hover) {
	.cn-swatch-item:hover {
		transform: translateY(-2px) scale(1.08);
		border-color: var(--cn-primary-hover, #19B0B4);
		box-shadow: 0 4px 12px rgba(35, 53, 71, 0.1);
	}

	.cn-swatch-item:hover .cn-swatch-tooltip {
		opacity: 1;
		visibility: visible;
		transform: translateX(-50%) translateY(-10px);
	}
}

.cn-swatch-item.active {
	border-color: var(--cn-primary, #25C4C8);
	box-shadow: 0 0 0 3px rgba(37, 196, 200, 0.25), 0 4px 10px rgba(37, 196, 200, 0.2);
	transform: scale(1.05);
}

.cn-swatch-item:focus-visible {
	box-shadow: 0 0 0 3px var(--cn-primary, #25C4C8);
}

/* Out of Stock Swatches */
.cn-swatch-item.out-of-stock {
	opacity: 0.45;
}

.cn-swatch-item.out-of-stock::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 10%;
	width: 80%;
	height: 2px;
	background-color: var(--cn-danger, #EF4444);
	transform: translateY(-50%) rotate(-45deg);
	border-radius: 2px;
}

/* Tooltip */
.cn-swatch-tooltip {
	position: absolute;
	bottom: 100%;
	left: 50%;
	transform: translateX(-50%) translateY(-6px);
	background-color: var(--cn-dark, #233547);
	color: #FFFFFF;
	font-size: 11px;
	font-weight: 600;
	padding: 4px 8px;
	border-radius: 6px;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transition: all 0.2s ease;
	z-index: 10;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cn-swatch-tooltip::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border-width: 4px;
	border-style: solid;
	border-color: var(--cn-dark, #233547) transparent transparent transparent;
}
