/* ==============================
   Baijia Product Card
   ============================== */

/* --- Grid Container --- */
.bjpc-grid {
	display: grid;
	gap: 20px;
}

.bjpc-grid.bjpc-cols-2 {
	grid-template-columns: repeat(2, 1fr);
}

.bjpc-grid.bjpc-cols-3 {
	grid-template-columns: repeat(3, 1fr);
}

.bjpc-grid.bjpc-cols-4 {
	grid-template-columns: repeat(4, 1fr);
}

/* --- Card --- */
.bjpc-card {
	background: #fff;
	border: 1px solid #eee;
	border-radius: 4px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: box-shadow 0.3s ease;
}

.bjpc-card:hover {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* --- Image --- */
.bjpc-image-wrap {
	position: relative;
	overflow: hidden;
	background: #f8f8f8;
}

.bjpc-image-link {
	display: block;
	position: relative;
}

.bjpc-img {
	width: 100%;
	height: auto;
	display: block;
	object-fit: contain;
	transition: opacity 0.35s ease;
}

.bjpc-img-hover {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	opacity: 0;
}

.bjpc-image-wrap:hover .bjpc-img-main {
	opacity: 0;
}

.bjpc-image-wrap:hover .bjpc-img-hover {
	opacity: 1;
}

/* --- Info Area --- */
.bjpc-info {
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	flex: 1;
}

/* --- Title --- */
.bjpc-title {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.35;
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.bjpc-title a {
	color: #222;
	text-decoration: none;
}

.bjpc-title a:hover {
	color: #000;
	text-decoration: none;
}

/* --- Price + Rating Row --- */
.bjpc-price-rating {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	flex-wrap: wrap;
}

.bjpc-price {
	font-size: 14px;
	font-weight: 600;
	color: #222;
	line-height: 1.4;
}

.bjpc-price del {
	color: #999;
	font-weight: 400;
	margin-right: 4px;
	font-size: 13px;
}

.bjpc-price ins {
	text-decoration: none;
	font-weight: 700;
	color: #c00;
}

/* --- Rating --- */
.bjpc-rating {
	display: flex;
	align-items: center;
	gap: 3px;
}

.bjpc-stars {
	display: flex;
	align-items: center;
	gap: 1px;
	line-height: 1;
}

.bjpc-star {
	font-size: 16px;
	color: #f5a623;
}

.bjpc-star-empty {
	color: #ccc;
}

.bjpc-star-half {
	position: relative;
	color: #ccc;
}

.bjpc-star-half::before {
	content: '\2605';
	position: absolute;
	left: 0;
	top: 0;
	width: 50%;
	overflow: hidden;
	color: #f5a623;
}

.bjpc-rating-count {
	font-size: 13px;
	color: #666;
}

/* --- Specs Row --- */
.bjpc-specs {
	display: flex;
	align-items: flex-start;
	gap: 0;
	border-top: 1px solid #eee;
	padding-top: 10px;
}

.bjpc-spec-item {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	padding: 0 8px;
	border-right: 1px solid #eee;
}

.bjpc-spec-item:first-child {
	padding-left: 0;
}

.bjpc-spec-item:last-child {
	border-right: none;
	padding-right: 0;
}

.bjpc-spec-label {
	font-size: 11px;
	color: #888;
	line-height: 1.3;
	white-space: nowrap;
}

.bjpc-spec-value {
	font-size: 13px;
	font-weight: 700;
	color: #222;
	line-height: 1.3;
}

/* --- Actions Row --- */
.bjpc-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	border-top: 1px solid #eee;
	padding-top: 12px;
	margin-top: auto;
}

/* --- Compare Toggle --- */
.bjpc-compare-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	user-select: none;
}

.bjpc-compare-checkbox {
	width: 16px;
	height: 16px;
	margin: 0;
	cursor: pointer;
	accent-color: #222;
	flex-shrink: 0;
}

.bjpc-compare-label {
	font-size: 11px;
	font-weight: 600;
	color: #555;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	line-height: 1;
}

.bjpc-compare-btn.is-active .bjpc-compare-label {
	color: #c00;
}

/* Spinner: replaces checkbox while loading */
.bjpc-compare-spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid #ccc;
	border-top-color: #333;
	border-radius: 50%;
	animation: bjpcSpin 0.6s linear infinite;
	flex-shrink: 0;
}

.bjpc-compare-btn.is-loading .bjpc-compare-spinner {
	display: inline-block;
}

.bjpc-compare-btn.is-loading .bjpc-compare-checkbox {
	display: none;
}

.bjpc-compare-btn.is-loading .bjpc-compare-label {
	display: none;
}

@keyframes bjpcSpin {
	to { transform: rotate(360deg); }
}

/* --- Buy Now Button (in actions row) --- */
.bjpc-buy-now {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 20px;
	font-size: 12px;
	font-weight: 600;
	color: #fff;
	background: #222;
	border: none;
	border-radius: 3px;
	cursor: pointer;
	text-decoration: none;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	line-height: 1;
	white-space: nowrap;
	transition: background 0.2s;
	flex-shrink: 0;
}

.bjpc-buy-now:hover {
	background: #000;
	color: #fff;
	text-decoration: none;
}

.bjpc-buy-now.bjpc-loading {
	opacity: 0.6;
	pointer-events: none;
}

.bjpc-buy-now.bjpc-added {
	background: #27ae60;
}

/* --- Add to Cart Wrap (detail page) --- */
.bjpc-atc-wrap {
	border-top: 1px solid #eee;
	padding-top: 12px;
	margin-top: auto;
}

/* --- Variation attribute groups --- */
.bjpc-var-group {
	margin-bottom: 12px;
}

.bjpc-var-label {
	display: block;
	font-size: 11px;
	font-weight: 700;
	color: #222;
	text-transform: uppercase;
	letter-spacing: 1px;
	margin-bottom: 8px;
}

.bjpc-var-options {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.bjpc-var-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 6px 14px;
	font-size: 13px;
	font-weight: 600;
	color: #333;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 2px;
	cursor: pointer;
	transition: border-color 0.2s, color 0.2s;
	user-select: none;
	line-height: 1.3;
}

.bjpc-var-btn:hover {
	border-color: #999;
}

.bjpc-var-btn.is-selected {
	border: 2px solid #222;
	color: #000;
}

.bjpc-var-btn.is-unavailable {
	opacity: 0.35;
	cursor: not-allowed;
	text-decoration: line-through;
}

/* --- Notice text above Add to Cart --- */
.bjpc-notice {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 0;
	font-size: 14px;
	color: #555;
	line-height: 1.5;
}

.bjpc-notice-dot {
	position: relative;
	width: 10px;
	height: 10px;
	flex-shrink: 0;
}

.bjpc-notice-dot::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 10px;
	height: 10px;
	background: #27ae60;
	border-radius: 50%;
}

.bjpc-notice-dot::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 10px;
	background: rgba(39, 174, 96, 0.4);
	border-radius: 50%;
	transform: translate(-50%, -50%);
	animation: bjpcPulse 1.5s ease-out infinite;
}

@keyframes bjpcPulse {
	0% {
		width: 10px;
		height: 10px;
		opacity: 0.6;
	}
	100% {
		width: 26px;
		height: 26px;
		opacity: 0;
	}
}

/* --- Add to Cart Button --- */
.bjpc-add-to-cart {
	display: block;
	width: 100%;
	padding: 12px 20px;
	background: #222;
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
	text-align: center;
	border: none;
	border-radius: 0;
	cursor: pointer;
	transition: background 0.2s ease;
	line-height: 1.3;
	box-sizing: border-box;
}

.bjpc-add-to-cart:hover {
	background: #000;
	color: #fff;
	text-decoration: none;
}

.bjpc-add-to-cart:disabled {
	background: #ccc;
	cursor: not-allowed;
}

.bjpc-add-to-cart.bjpc-loading {
	opacity: 0.6;
	pointer-events: none;
}

.bjpc-add-to-cart.bjpc-added {
	background: #27ae60;
}

/* --- Detail page: Add to Cart widget --- */
.bjpc-atc-detail {
	border-top: none;
	padding-top: 0;
}

.bjpc-atc-detail .bjpc-var-group {
	margin-bottom: 16px;
}

.bjpc-atc-detail .bjpc-var-label {
	font-size: 12px;
	letter-spacing: 1.5px;
	margin-bottom: 10px;
}

.bjpc-atc-detail .bjpc-var-btn {
	padding: 8px 18px;
	font-size: 14px;
}

.bjpc-atc-qty-row {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 8px;
}

.bjpc-qty-wrap {
	display: inline-flex;
	align-items: center;
	border: 1px solid #ddd;
	border-radius: 0;
	overflow: hidden;
	flex-shrink: 0;
}

.bjpc-qty-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 44px;
	background: #fff;
	border: none;
	font-size: 18px;
	font-weight: 400;
	color: #333;
	cursor: pointer;
	transition: background 0.2s;
	line-height: 1;
	padding: 0;
}

.bjpc-qty-btn:hover {
	background: #f5f5f5;
}

.bjpc-qty-input {
	width: 48px;
	height: 44px;
	text-align: center;
	font-size: 15px;
	font-weight: 600;
	color: #222;
	border: none;
	border-left: 1px solid #ddd;
	border-right: 1px solid #ddd;
	outline: none;
	appearance: textfield;
	-moz-appearance: textfield;
	padding: 0;
	margin: 0;
}

.bjpc-qty-input::-webkit-outer-spin-button,
.bjpc-qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.bjpc-atc-qty-row .bjpc-add-to-cart {
	flex: 1;
	padding: 12px 20px;
	min-height: 48px;
}

/* --- Responsive: Tablet --- */
@media (max-width: 1024px) {
	.bjpc-spec-label {
		font-size: 10px;
	}

	.bjpc-spec-value {
		font-size: 12px;
	}
}

/* --- Responsive: Mobile — horizontal scroll --- */
@media (max-width: 767px) {
	.bjpc-info {
		padding: 12px;
		gap: 8px;
	}

	.bjpc-title {
		font-size: 14px;
	}

	.bjpc-price-rating {
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
	}

	.bjpc-specs {
		flex-wrap: wrap;
	}

	.bjpc-spec-item {
		flex: 0 0 50%;
		padding: 4px 8px 4px 0;
		border-right: none;
		box-sizing: border-box;
	}

	.bjpc-spec-item:nth-child(even) {
		padding-left: 8px;
		padding-right: 0;
	}

	.bjpc-actions {
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
	}

	/* --- Scrollbar: black thin style --- */
	.bjpc-grid {
		scrollbar-width: thin;
		scrollbar-color: #222 #e0e0e0;
	}

	.bjpc-grid::-webkit-scrollbar {
		height: 6px;
	}

	.bjpc-grid::-webkit-scrollbar-track {
		background: #e0e0e0;
		border-radius: 3px;
	}

	.bjpc-grid::-webkit-scrollbar-thumb {
		background: #222;
		border-radius: 3px;
	}

	.bjpc-grid::-webkit-scrollbar-thumb:hover {
		background: #000;
	}

	.bjpc-grid::-webkit-scrollbar-button {
		display: none;
		width: 0;
		height: 0;
	}
}
