/* 商品展示组件 - 前端样式 */

.wc-pd-grid {
	display: grid;
	grid-template-columns: repeat( 3, 1fr );
	gap: 20px;
	padding: 0;
	margin: 0;
	list-style: none;
}

.wc-pd-grid.wc-pd-layout-vertical {
	grid-template-columns: 1fr !important;
}

.wc-pd-card {
	background: #ffffff;
	border: 1px solid #e8e8e8;
	border-radius: 8px;
	padding: 0;
	overflow: hidden;
	transition: box-shadow 0.3s ease, transform 0.2s ease;
	display: flex;
	flex-direction: column;
}

.wc-pd-card:hover {
	box-shadow: 0 8px 25px rgba( 0, 0, 0, 0.1 );
	transform: translateY( -2px );
}

.wc-pd-image {
	width: 100%;
	min-height: 100px;
	overflow: hidden;
	background: #f8f8f8;
	position: relative;
	display: block;
}

.wc-pd-image-small {
	height: 150px;
}

.wc-pd-image-medium {
	height: 250px;
}

.wc-pd-image-large {
	height: 350px;
}

.wc-pd-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.wc-pd-card:hover .wc-pd-image img {
	transform: scale( 1.05 );
}

.wc-pd-card > *:not(.wc-pd-image) {
	padding-left: 16px;
	padding-right: 16px;
}

.wc-pd-card > *:last-child:not(.wc-pd-button) {
	padding-bottom: 16px;
}

.wc-pd-title {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.4;
	margin: 12px 0 8px;
	color: #333333;
}

.wc-pd-title a {
	color: inherit;
	text-decoration: none;
	transition: color 0.2s;
}

.wc-pd-title a:hover {
	color: #0066cc;
}

.wc-pd-price {
	font-size: 18px;
	font-weight: 700;
	color: #e74c3c;
	margin: 8px 0;
	line-height: 1.3;
}

.wc-pd-price {
	min-height: 1.3em;
}

.wc-pd-price del {
	color: #999999;
	font-size: 14px;
	font-weight: 400;
	margin-right: 8px;
}

.wc-pd-price ins {
	text-decoration: none;
	color: #e74c3c;
}

.wc-pd-desc {
	font-size: 14px;
	color: #666666;
	line-height: 1.6;
	margin: 8px 0;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wc-pd-desc {
	min-height: 4.8em;
}

.wc-pd-rating {
	margin: 8px 0;
	display: flex;
	align-items: center;
	gap: 4px;
}

.wc-pd-rating .star-rating {
	font-size: 14px;
	color: #ffb900;
}

.wc-pd-stock {
	display: inline-block;
	font-size: 12px;
	padding: 3px 10px;
	border-radius: 12px;
	margin: 8px 0;
	font-weight: 500;
}

.wc-pd-stock-instock {
	background: #e8f5e9;
	color: #2e7d32;
}

.wc-pd-stock-outofstock {
	background: #ffebee;
	color: #c62828;
}

.wc-pd-stock-onbackorder {
	background: #fff3e0;
	color: #e65100;
}

.wc-pd-button {
	display: inline-block;
	padding: 10px 24px;
	background: #0066cc;
	color: #ffffff;
	text-decoration: none;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 500;
	text-align: center;
	margin: 12px 16px 0;
	transition: background-color 0.3s ease, transform 0.2s ease;
	cursor: pointer;
	border: none;
}

.wc-pd-button {
	margin-top: auto;
}

.wc-pd-button:hover {
	background: #0052a3;
	color: #ffffff;
	transform: translateY( -1px );
}

.wc-pd-empty {
	padding: 40px 20px;
	text-align: center;
	color: #999999;
	font-size: 14px;
	background: #f9f9f9;
	border: 2px dashed #ddd;
	border-radius: 8px;
}

.wc-pd-category-grid {
	--wc-pd-columns: 3;
	--wc-pd-column-gap: 20px;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	row-gap: 20px;
	column-gap: var(--wc-pd-column-gap);
}

.wc-pd-category-card {
	width: calc( ( 100% - ( var(--wc-pd-columns) - 1 ) * var(--wc-pd-column-gap) ) / var(--wc-pd-columns) );
	max-width: 100%;
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

.wc-pd-category-image {
	display: block;
	width: 100%;
	height: 250px;
	overflow: hidden;
	background: #f8f8f8;
}

.wc-pd-category-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.wc-pd-category-card:hover .wc-pd-category-image img {
	transform: scale( 1.05 );
}

.wc-pd-category-title {
	display: block;
	width: 100%;
	margin: 10px 0 0;
	font-size: 16px;
	line-height: 1.4;
	text-align: center;
	color: #333333;
}

.wc-pd-category-title a {
	display: block;
	width: 100%;
	color: inherit;
	text-decoration: none;
}

.wc-pd-category-title a:hover {
	color: #0066cc;
}

.wc-sp-wrap {
	display: grid;
	grid-template-columns: minmax( 0, 1.08fr ) minmax( 320px, 1fr );
	align-items: start;
	gap: 54px;
	width: 100%;
}

.wc-sp-image {
	display: block;
	width: 100%;
	height: 792px;
	overflow: hidden;
	background: #f5f5f5;
	text-decoration: none;
}

.wc-sp-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wc-sp-summary {
	padding: 0;
	color: #000000;
}

.wc-sp-title {
	margin: 0 0 4px;
	font-size: 32px;
	line-height: 1.2;
	font-weight: 700;
	color: #000000;
}

.wc-sp-price {
	margin: 0 0 14px;
	font-size: 16px;
	line-height: 1.3;
	font-weight: 700;
	color: #000000;
}

.wc-sp-price del {
	margin-left: 4px;
	font-size: 12px;
	font-weight: 400;
	color: #777777;
}

.wc-sp-price ins {
	text-decoration: none;
	color: #000000;
}

.wc-sp-form {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.wc-sp-attribute,
.wc-sp-row {
	display: grid;
	grid-template-columns: 150px minmax( 0, 1fr );
	align-items: start;
	column-gap: 28px;
}

.wc-sp-attributes {
	display: flex;
	flex-direction: column;
	gap: 22px;
}

.wc-sp-attribute-label,
.wc-sp-row-label {
	padding-top: 10px;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	color: #000000;
}

.wc-sp-options {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px;
}

.wc-sp-option {
	min-height: 39px;
	padding: 0 14px;
	border: 1px solid #cfcfcf;
	border-radius: 0;
	background: #ffffff;
	color: #000000;
	font-size: 14px;
	line-height: 1.2;
	cursor: pointer;
}

.wc-sp-option.is-active {
	border-color: #000000;
	background: #000000;
	color: #ffffff;
}

.wc-sp-option:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.wc-sp-variation-select,
.wc-sp-form .reset_variations {
	display: none !important;
}

.wc-sp-quantity-row {
	align-items: center;
}

/* 数量器：使用高优先级样式防止主题 WooCommerce 样式覆盖。
   注意：width / border / border-radius 不加 !important，以保留 Elementor 样式控制。 */
.wc-sp-wrap .wc-sp-quantity {
	display: grid !important;
	grid-template-columns: 40px 1fr 40px !important;
	align-items: center !important;
	width: 140px;
	min-height: 38px !important;
	border: 1px solid #d3d3d3;
	border-radius: 4px;
	overflow: hidden !important;
	margin-left: auto !important;
	background: transparent !important;
	box-sizing: border-box !important;
	float: none !important;
}

.wc-sp-wrap .wc-sp-quantity .quantity {
	display: block !important;
	width: auto !important;
	min-width: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	float: none !important;
	box-sizing: border-box !important;
}

.wc-sp-wrap .wc-sp-quantity .quantity input.qty,
.wc-sp-wrap .wc-sp-quantity .quantity input[type="number"] {
	width: 100% !important;
	min-height: 36px !important;
	height: 36px !important;
	padding: 0 !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	background: transparent !important;
	text-align: center !important;
	font-size: 14px !important;
	line-height: 1 !important;
	appearance: textfield !important;
	-moz-appearance: textfield !important;
	-webkit-appearance: none !important;
	box-sizing: border-box !important;
}

.wc-sp-wrap .wc-sp-quantity .quantity input.qty::-webkit-outer-spin-button,
.wc-sp-wrap .wc-sp-quantity .quantity input.qty::-webkit-inner-spin-button {
	margin: 0 !important;
	-webkit-appearance: none !important;
}

.wc-sp-wrap .wc-sp-qty-button {
	min-height: 36px !important;
	height: 36px !important;
	padding: 0 !important;
	border: 0 !important;
	background: transparent !important;
	color: #222222 !important;
	font-size: 16px !important;
	line-height: 1 !important;
	cursor: pointer !important;
	box-shadow: none !important;
	box-sizing: border-box !important;
}

.wc-sp-wrap .wc-sp-qty-minus {
	order: -1 !important;
}

.wc-sp-wrap .wc-sp-qty-button:focus,
.wc-sp-wrap .wc-sp-qty-button:active {
	outline: none !important;
	box-shadow: none !important;
}

.wc-sp-form .wc-sp-button {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 100%;
	height: auto;
	min-height: 39px;
	padding: 10px 20px;
	border: 1px solid #000000;
	border-radius: 4px;
	appearance: none;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
}

.wc-sp-add-button {
	background: #ffffff;
	color: #000000;
}

.wc-sp-buy-button,
.wc-sp-detail-button {
	background: #000000;
	color: #ffffff;
}

.wc-sp-detail-button {
	text-decoration: none;
}

.wc-sp-form .single_variation {
	display: none !important;
	margin: 0;
}

.wc-sp-form .woocommerce-variation-add-to-cart {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.wc-sp-editor-text {
	margin-top: 18px;
	font-size: 14px;
	line-height: 1.7;
	color: #333333;
}

.wc-sp-editor-text p {
	margin: 0 0 10px;
}

@media ( max-width: 1024px ) {
	.wc-pd-grid {
		grid-template-columns: repeat( 2, 1fr );
	}

	.wc-pd-category-grid {
		--wc-pd-columns: 2;
	}

	.wc-sp-wrap {
		grid-template-columns: 1fr 1fr;
		gap: 32px;
	}
}

@media ( max-width: 767px ) {
	.wc-pd-grid {
		grid-template-columns: 1fr;
	}

	.wc-pd-category-grid {
		--wc-pd-columns: 1;
	}

	.wc-pd-category-card {
		width: 100%;
	}

	.wc-sp-wrap {
		display: block;
	}

	.wc-sp-image {
		height: 290px;
		margin-bottom: 18px;
	}

	.wc-sp-summary {
		padding: 0 18px;
	}

	.wc-sp-title {
		font-size: 22px;
	}

	.wc-sp-attribute,
	.wc-sp-row {
		grid-template-columns: 64px minmax( 0, 1fr );
		column-gap: 0;
	}

	.wc-sp-options {
		justify-content: flex-end;
	}

	.wc-sp-option {
		min-height: 36px;
		padding-left: 12px;
		padding-right: 12px;
		font-size: 13px;
	}
}
