.cvs-swatches-wrap {
	margin-bottom: 8px;
}

/* ซ่อน select เดิมของ WooCommerce แต่ยังให้ทำงานได้ (accessibility friendly) */
.cvs-hidden-select select {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.cvs-swatch-list {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 6px 0 10px;
	padding: 0;
}

.cvs-swatch {
	position: relative;
	cursor: pointer;
	transition: border-color 0.15s ease, transform 0.1s ease, background-color 0.15s ease;
	box-sizing: border-box;
}

.cvs-swatch:hover {
	transform: scale(1.05);
}

/* ---------- Color swatch: วงกลมสี ---------- */
.cvs-swatch.cvs-type-color {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 2px solid #e2e2e2;
}

.cvs-swatch.cvs-type-color:hover {
	border-color: #999;
}

.cvs-swatch.cvs-type-color.selected {
	border-color: #333;
	box-shadow: 0 0 0 2px #fff inset, 0 0 0 3px #333;
}

/* ---------- Image swatch: รูปสี่เหลี่ยม ---------- */
.cvs-swatch.cvs-type-image {
	width: 44px;
	height: 44px;
	border-radius: 6px;
	border: 2px solid #e2e2e2;
	background-size: cover;
	background-position: center;
}

.cvs-swatch.cvs-type-image:hover {
	border-color: #999;
}

.cvs-swatch.cvs-type-image.selected {
	border-color: #d10024;
	box-shadow: 0 0 0 1px #d10024;
}

/* ---------- Button swatch: ปุ่มข้อความ (ใช้กับไซส์) ---------- */
.cvs-swatch.cvs-type-button {
	min-width: 44px;
	height: 38px;
	padding: 0 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	border: 1px solid #d6d6d6;
	background-color: #fff;
	font-size: 13px;
	color: #333;
}

.cvs-swatch.cvs-type-button:hover {
	border-color: #333;
}

.cvs-swatch.cvs-type-button.selected {
	border-color: #d10024;
	background-color: #d10024;
	color: #fff;
}

/* ---------- Radio swatch: ปุ่มขอบมนพร้อมจุดกลม ---------- */
.cvs-swatch.cvs-type-radio {
	min-width: 44px;
	height: 38px;
	padding: 0 14px 0 28px;
	display: inline-flex;
	align-items: center;
	border-radius: 20px;
	border: 1px solid #d6d6d6;
	background-color: #fff;
	font-size: 13px;
	color: #333;
}

.cvs-swatch.cvs-type-radio::before {
	content: "";
	position: absolute;
	left: 10px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	border: 1px solid #999;
	background: #fff;
}

.cvs-swatch.cvs-type-radio.selected {
	border-color: #333;
}

.cvs-swatch.cvs-type-radio.selected::before {
	border-color: #d10024;
	background: #d10024;
	box-shadow: 0 0 0 2px #fff inset;
}

/* ---------- สถานะ disabled (สินค้าหมด) ---------- */
.cvs-swatch.disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.cvs-swatch.disabled::after {
	content: "";
	position: absolute;
	top: 50%;
	left: -10%;
	width: 120%;
	height: 2px;
	background: #999;
	transform: translateY(-50%) rotate(45deg);
}

/* ---------- Tooltip ---------- */
.cvs-swatch-tooltip {
	display: none;
	position: absolute;
	bottom: 130%;
	left: 50%;
	transform: translateX(-50%);
	background: #333;
	color: #fff;
	font-size: 11px;
	line-height: 1.4;
	padding: 3px 8px;
	border-radius: 3px;
	white-space: nowrap;
	z-index: 5;
}

.cvs-swatch-tooltip::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 4px solid transparent;
	border-top-color: #333;
}

.cvs-swatch.cvs-type-color:hover .cvs-swatch-tooltip,
.cvs-swatch.cvs-type-image:hover .cvs-swatch-tooltip {
	display: block;
}

/* ---------- Loop swatch: วงกลมสีเล็กๆ ใต้สินค้าในหน้า shop/archive ---------- */
.cvs-loop-swatch-list {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0;
	margin: 8px 0 0;
	justify-content: center;
}

.cvs-loop-swatch {
	position: relative;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 2px solid #e9e9e9;
	cursor: pointer;
	transition: border-color 0.15s ease, transform 0.1s ease;
}

.cvs-loop-swatch:hover {
	border-color: #999;
	transform: scale(1.1);
}

.cvs-loop-swatch.selected {
	border-color: #333;
	box-shadow: 0 0 0 1px #fff inset, 0 0 0 2px #333;
}

.cvs-loop-swatch:hover .cvs-swatch-tooltip {
	display: block;
}
