/* WC Size Selector — UI 还原自 Size Selector.dc.html (StockX 风格) */

.wcss {
	--wcss-ink: #121212;
	--wcss-muted: #8A8A8A;
	--wcss-line: #E2E2E2;
	--wcss-green: #006340;
	--wcss-sel-bg: #F0EFED;
	--wcss-tab-bg: #F0F1F2;
	box-sizing: border-box;
	width: 100%;
	max-width: 576px;
	margin: 0 0 18px;
	font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
	color: var(--wcss-ink);
	line-height: 1.2;
}

.wcss *,
.wcss *::before,
.wcss *::after {
	box-sizing: border-box;
}

/* 锁定行高，挡住主题把大 line-height 继承进来撑大控件（"看起来偏大"的主因）。 */
.wcss button,
.wcss span,
.wcss h2 {
	line-height: 1.2;
}

/* 卡片 + 折叠条 -------------------------------------------------- */

.wcss-card {
	background: #FFFFFF;
	border: 1px solid var(--wcss-line);
	border-radius: 10px;
}

.wcss-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	background: none;
	border: none;
	border-radius: 10px;
	padding: 15px 18px;
	cursor: pointer;
	font-size: 16px;
	line-height: 1.2;
	color: var(--wcss-ink);
	font-family: inherit;
	transition: background-color 0.15s;
}

.wcss-bar:hover {
	background-color: #FAFAFA;
}

.wcss-bar-right {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	font-weight: 700;
}

.wcss-selected-label.wcss-placeholder {
	color: var(--wcss-muted);
	font-weight: 400;
}

.wcss-chevron {
	flex: 0 0 auto;
	transform: rotate(0deg);
	transition: transform 0.2s;
	color: var(--wcss-ink);
}

/* 强制描边型箭头，挡住主题对 svg 的 fill 覆盖（否则路径被填充成实心三角）。 */
.wcss-chevron,
.wcss-chevron path {
	fill: none !important;
	stroke: currentColor !important;
}

.wcss-chevron path {
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.wcss-bar[aria-expanded="true"] .wcss-chevron {
	transform: rotate(180deg);
}

/* 面板（桌面内联）---------------------------------------------- */

.wcss-panel {
	padding: 0 18px 18px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	animation: wcss-panelIn 0.18s ease;
}

.wcss-panel[hidden] {
	display: none;
}

.wcss-panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.wcss-panel-title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	color: var(--wcss-ink);
}

/* Size Guide 按钮（标题行右侧，下划线文字 + 尺子图标） */
.wcss-size-guide-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: 0 0 auto;
	background: none;
	border: none;
	cursor: pointer;
	font: inherit;
	line-height: 1.2;
	padding: 2px 0;
	color: var(--wcss-ink);
	font-size: 13px;
	font-weight: 700;
	transition: opacity 0.15s;
	-webkit-appearance: none;
	appearance: none;
}

.wcss-size-guide-btn:hover {
	opacity: 0.6;
}

.wcss-size-guide-text {
	border-bottom: 1.5px solid var(--wcss-ink);
	padding-bottom: 1px;
	white-space: nowrap;
}

/* 尺子图标：同样挡住主题对 svg 的 fill 覆盖 */
.wcss-size-guide-btn svg,
.wcss-guide-title svg {
	flex: 0 0 auto;
	fill: none !important;
	stroke: currentColor !important;
}

/* 单位切换 pill ------------------------------------------------- */

.wcss-tabs {
	display: flex;
	gap: 9px;
	overflow-x: auto;
	padding: 2px;
	-webkit-overflow-scrolling: touch;
}

.wcss-tab {
	flex: 0 0 auto;
	border: none;
	cursor: pointer;
	border-radius: 999px;
	padding: 9px 16px;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
	background: var(--wcss-tab-bg);
	color: var(--wcss-ink);
	transition: background 0.15s;
}

.wcss-tab.is-active {
	background: var(--wcss-ink);
	color: #FFFFFF;
}

/* 尺码网格 ----------------------------------------------------- */

.wcss-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
}

.wcss-cell {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	min-height: 56px;
	padding: 9px 6px;
	background: #FFFFFF;
	border: 1px solid var(--wcss-line);
	border-radius: 10px;
	box-shadow: none;
	cursor: pointer;
	font-family: inherit;
	transition: border-color 0.12s, background 0.12s;
}

.wcss-cell:hover {
	border-color: var(--wcss-green);
}

.wcss-cell.is-selected {
	background: var(--wcss-sel-bg);
	border: 1px solid var(--wcss-green);
	box-shadow: inset 0 0 0 1px var(--wcss-green);
}

.wcss-cell-label {
	font-size: 14px;
	font-weight: 700;
	color: var(--wcss-ink);
	white-space: nowrap;
}

.wcss-cell-price,
.wcss-cell-price .amount,
.wcss-cell-price .woocommerce-Price-amount {
	font-size: 14px;
	font-weight: 700;
	color: var(--wcss-green);
}

/* 多选项选择器（.wcss-opt：堆叠卡片，内联展开）----------------- */

.wcss-opt {
	margin-bottom: 12px;
}

.wcss-opt .wcss-panel {
	padding: 0 18px 16px;
	gap: 0;
}

/* 选项选中态：黑底白字（对齐设计稿；区别于尺码的米色+绿框） */
.wcss-opt .wcss-cell.is-selected {
	background: var(--wcss-ink);
	border-color: var(--wcss-ink);
	box-shadow: none;
}

.wcss-opt .wcss-cell.is-selected .wcss-cell-label,
.wcss-opt .wcss-cell.is-selected .wcss-cell-price,
.wcss-opt .wcss-cell.is-selected .wcss-cell-price .amount,
.wcss-opt .wcss-cell.is-selected .wcss-cell-price .woocommerce-Price-amount {
	color: #FFFFFF;
}

.wcss-opt .wcss-cell:hover {
	border-color: var(--wcss-ink);
}

/* 遮罩（仅移动端可见）----------------------------------------- */

.wcss-scrim {
	display: none;
}

/* 加购按钮在未选尺码时的禁用态 -------------------------------- */

.single_add_to_cart_button.wcss-atc-disabled {
	opacity: 0.45;
	cursor: not-allowed;
	pointer-events: none;
}

/* 移动端：底部 sheet ----------------------------------------- */

@media (max-width: 700px) {
	.wcss-scrim.is-open {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(15, 15, 15, 0.45);
		animation: wcss-scrimIn 0.2s ease;
		z-index: 99998;
	}

	/* sheet 自身不滚动；内部分三段：标题 + tabs 固定，网格滚动。
	   仅尺码选择器用底部 sheet；多选项（.wcss-opt）保持内联展开。 */
	.wcss:not(.wcss-opt) .wcss-panel:not([hidden]) {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 99999;
		max-height: 80vh;
		display: flex;
		flex-direction: column;
		gap: 0;
		margin: 0;
		padding: 0;
		overflow: hidden;
		background: #FFFFFF;
		border-radius: 8px 8px 0 0;
		box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
		animation: wcss-sheetIn 0.28s cubic-bezier(0.32, 0.72, 0, 1);
	}

	/* 固定：标题行（标题 + Size Guide 按钮） */
	.wcss:not(.wcss-opt) .wcss-panel:not([hidden]) .wcss-panel-head {
		flex: 0 0 auto;
		margin: 0;
		padding: 18px 20px 12px;
		background: #FFFFFF;
		border-bottom: 1px solid #E8E8E8;
	}

	/* 固定：单位切换 */
	.wcss:not(.wcss-opt) .wcss-panel:not([hidden]) .wcss-tabs {
		flex: 0 0 auto;
		margin: 0;
		padding: 14px 20px 0;
		background: #FFFFFF;
	}

	/* 滚动：尺码网格 */
	.wcss:not(.wcss-opt) .wcss-panel:not([hidden]) .wcss-grid {
		flex: 1 1 auto;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		margin: 0;
		padding: 14px 20px 28px;
	}
}

/* Size Guide 弹窗 -------------------------------------------- */

.wcss-guide {
	position: fixed;
	inset: 0;
	z-index: 100000;
	background: rgba(0, 0, 0, 0.45);
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.wcss-guide.is-open {
	display: flex;
	animation: wcss-scrimIn 0.18s ease;
}

.wcss-guide-card {
	background: #FFFFFF;
	border-radius: 10px;
	width: 100%;
	max-width: min(880px, 94vw);
	max-height: 85vh;
	overflow-y: auto;
	box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
	animation: wcss-guidePop 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
	font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
	color: var(--wcss-ink);
	line-height: 1.4;
}

.wcss-guide-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px 4px;
}

.wcss-guide-title {
	display: flex;
	align-items: center;
	gap: 9px;
}

.wcss-guide-h3 {
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.wcss-guide-close {
	width: 30px;
	height: 30px;
	border-radius: 6px;
	border: 1px solid #E4E4E4;
	background: #FFFFFF;
	cursor: pointer;
	font-size: 13px;
	color: #555555;
	line-height: 1;
	display: grid;
	place-items: center;
	-webkit-appearance: none;
	appearance: none;
}

.wcss-guide-close:hover {
	background: #F6F6F6;
}

/* 弹窗正文：渲染尺码表文章 HTML。:where() 零特异度兜底，文章自带样式可轻松覆盖。 */
.wcss-guide-content {
	padding: 12px 20px 18px;
	font-size: 13px;
	line-height: 1.6;
	color: var(--wcss-ink);
}

.wcss-guide-content :where(img) {
	max-width: 100%;
	height: auto;
}

.wcss-guide-content :where(table) {
	width: 100%;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
	margin: 8px 0;
}

.wcss-guide-content :where(th),
.wcss-guide-content :where(td) {
	border-top: 1px solid #E4E4E4;
	padding: 9px 10px;
	text-align: center;
	font-size: 12.5px;
	font-weight: 500;
}

.wcss-guide-content :where(th) {
	border-top: none;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #8A8A8A;
}

.wcss-guide-content :where(p) {
	margin: 0 0 8px;
}

.wcss-guide-content :where(p:last-child) {
	margin-bottom: 0;
}

/* 动画 -------------------------------------------------------- */

@keyframes wcss-guidePop {
	from { opacity: 0; transform: translateY(8px) scale(0.98); }
	to   { opacity: 1; transform: none; }
}

@keyframes wcss-panelIn {
	from { opacity: 0; transform: translateY(-6px); }
	to   { opacity: 1; transform: translateY(0); }
}

@keyframes wcss-scrimIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes wcss-sheetIn {
	from { transform: translateY(100%); }
	to   { transform: translateY(0); }
}
