/**
 * Baijia Attribute Swatches - 产品属性样式
 */

/* === 属性组 === */
.baijia-product-attributes {
	width: 100%;
}

.baijia-attr-group + .baijia-attr-group {
	margin-top: 20px;
}

/* 属性标签 */
.baijia-attr-label {
	font-size: 14px;
	font-weight: 600;
	color: #333;
	margin-bottom: 8px;
	line-height: 1.4;
}

.baijia-attr-selected-value {
	font-weight: 400;
	margin-left: 6px;
	color: #666;
}

.baijia-attr-selected-value::before {
	content: '：';
}

.baijia-attr-selected-value:empty {
	display: none;
}

/* === 色块通用容器 === */
.baijia-swatches {
	display: flex;
	flex-wrap: wrap;
}

/* === 颜色色块 === */
.baijia-swatches-color {
	gap: 8px;
}

.baijia-swatch-color {
	position: relative;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	border: 1px solid rgba(0, 0, 0, 0.08);
	box-sizing: border-box;
}

.baijia-swatch-color:hover {
	transform: scale(1.2);
	z-index: 2;
}

/* 选中状态 */
.baijia-swatch-color.is-active {
	box-shadow: 0 0 0 2px #333;
}

/* 颜色名称提示框 */
.baijia-color-tooltip {
	position: absolute;
	bottom: -32px;
	left: 50%;
	transform: translateX(-50%);
	background: #fff;
	color: #222;
	font-size: 12px;
	line-height: 1;
	padding: 5px 10px;
	border-radius: 6px;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	z-index: 10;
}

.baijia-color-tooltip::before {
	content: '';
	position: absolute;
	top: -4px;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-left: 5px solid transparent;
	border-right: 5px solid transparent;
	border-bottom: 5px solid #fff;
}

.baijia-swatch-color:hover .baijia-color-tooltip {
	opacity: 1;
	visibility: visible;
}

/* === 按钮样式 === */
.baijia-swatches-button {
	gap: 8px;
}

.baijia-swatch-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 6px 18px;
	font-size: 13px;
	line-height: 1.4;
	color: #333;
	background: transparent;
	border: 1px solid #333;
	border-radius: 2px;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
	user-select: none;
}

.baijia-swatch-button:hover {
	background-color: #000;
	border-color: #000;
	color: #fff;
}

.baijia-swatch-button.is-active {
	background-color: #000;
	border-color: #000;
	color: #fff;
}

/* === 默认下拉框 === */
.baijia-swatches-default select {
	width: 100%;
	max-width: 300px;
	padding: 8px 12px;
	font-size: 14px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #fff;
}

/* === 不可用状态 === */
.baijia-swatch-color.is-disabled,
.baijia-swatch-button.is-disabled {
	opacity: 0.3;
	cursor: not-allowed;
	pointer-events: none;
}

/* === 内联色块（在 WooCommerce 变体表格内） === */
.baijia-inline-swatches {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	padding: 4px 0;
}

/* 隐藏被替换的原始 select */
.baijia-hidden-select,
.variations td select[style*="display:none"] {
	display: none !important;
	position: absolute !important;
	visibility: hidden !important;
	width: 0 !important;
	height: 0 !important;
	overflow: hidden !important;
}

/* ============================================================
   变体表格布局：属性名称在上方，选项在下方（纵向排列）
   ============================================================ */

form.variations_form table.variations,
form.variations_form table.variations tbody {
	display: block;
	width: 100%;
	overflow: visible;
}

form.variations_form table.variations tr {
	display: block;
	width: 100%;
	margin-bottom: 16px;
	overflow: visible;
}

form.variations_form table.variations tr:last-child {
	margin-bottom: 0;
}

/* 属性名称：上方，细体 */
form.variations_form table.variations th.label {
	display: block;
	width: 100%;
	text-align: left;
	padding: 0 0 6px 0;
}

form.variations_form table.variations th.label label {
	font-weight: 300;
	font-size: 14px;
	color: #333;
	letter-spacing: 0.02em;
}

/* 选项容器：下方 */
form.variations_form table.variations td.value {
	display: block;
	width: 100%;
	padding: 0;
	position: relative;
	overflow: visible;
}

/* 重置链接样式 */
form.variations_form table.variations td.value .reset_variations {
	display: inline-block;
	margin-top: 8px;
	font-size: 12px;
	color: #999;
	text-decoration: none;
}

form.variations_form table.variations td.value .reset_variations:hover {
	color: #333;
}
