/* 
 * Frontend CSS for Woo Category Showcase Pro
 */

.wcsp-container {
	display: block !important;
	width: 100% !important;
	min-width: 100% !important;
	max-width: 100% !important;
	box-sizing: border-box;
	clear: both;
}

.wcsp-grid {
	display: grid !important;
	gap: 20px;
	width: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

/* Default Equal Style is overridden by dynamic CSS based on columns, but let's set a fallback */
.wcsp-grid.wcsp-style-equal {
	grid-template-columns: repeat(3, 1fr);
}

/* Mixed / Featured Style (like reference image) */
.wcsp-grid.wcsp-style-masonry {
	grid-template-columns: repeat(6, 1fr);
}

/* Row 1 (3 items): span 2 each */
.wcsp-grid.wcsp-style-masonry .wcsp-card:nth-child(8n+1),
.wcsp-grid.wcsp-style-masonry .wcsp-card:nth-child(8n+2),
.wcsp-grid.wcsp-style-masonry .wcsp-card:nth-child(8n+3) {
	grid-column: span 2;
}

/* Row 2 (2 items): span 3 each */
.wcsp-grid.wcsp-style-masonry .wcsp-card:nth-child(8n+4),
.wcsp-grid.wcsp-style-masonry .wcsp-card:nth-child(8n+5) {
	grid-column: span 3;
}

/* Row 3 (3 items): span 2 each */
.wcsp-grid.wcsp-style-masonry .wcsp-card:nth-child(8n+6),
.wcsp-grid.wcsp-style-masonry .wcsp-card:nth-child(8n+7),
.wcsp-grid.wcsp-style-masonry .wcsp-card:nth-child(8n+8) {
	grid-column: span 2;
}

.wcsp-card {
	position: relative;
	overflow: hidden;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	border-radius: 12px;
	min-height: 250px; /* changed from height to min-height */
	background-color: #2b2dc0; /* Fallback */
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	display: flex !important;
	flex-direction: column;
	width: 100% !important;
	box-sizing: border-box;
	text-decoration: none !important;
	margin: 0 !important;
	padding: 0 !important;
}

.wcsp-card:hover {
	transform: translateY(-5px) scale(1.02);
	box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.wcsp-card-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	transition: background-color 0.3s ease, background 0.3s ease, opacity 0.3s ease;
	z-index: 1;
	pointer-events: none;
}

.wcsp-card-content {
	position: relative;
	z-index: 2;
	display: flex !important;
	flex-direction: column;
	justify-content: center;
	align-items: flex-start;
	padding: 30px !important;
	flex-grow: 1;
	width: 100% !important;
	box-sizing: border-box;
}

/* Mobile Carousel Implementation */
@media (max-width: 767px) {
	.wcsp-mobile-layout-carousel .wcsp-grid {
		display: flex !important;
		flex-wrap: nowrap;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none; /* Firefox */
		-ms-overflow-style: none; /* IE/Edge */
		padding-bottom: 20px !important; /* Space for hover box-shadow */
		scroll-padding-left: 20px; /* Aligns the snap neatly if gap exists */
	}
	
	.wcsp-mobile-layout-carousel .wcsp-grid::-webkit-scrollbar {
		display: none; /* Chrome/Safari/Webkit */
	}

	.wcsp-mobile-layout-carousel .wcsp-card {
		flex: 0 0 85% !important; /* Forces the card to be 85% of screen width, leaving 15% to peek the next card */
		min-width: 85% !important;
		scroll-snap-align: start; /* Snaps firmly to the left side */
	}
}

.wcsp-card-content-inner {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

.wcsp-card-title {
	margin: 0 0 5px 0 !important;
	padding: 0;
	color: #ffffff;
	font-size: 24px;
	font-weight: 700;
	line-height: 1.2;
}

.wcsp-card-count {
	color: #ffffff;
	font-size: 14px;
	margin-bottom: 15px;
	opacity: 0.9;
}

.wcsp-card-btn {
	display: inline-block;
	background-color: #ffffff;
	color: #2b2dc0;
	padding: 8px 20px;
	border-radius: 20px;
	font-size: 14px;
	font-weight: 600;
	transition: background-color 0.3s ease, color 0.3s ease;
}

.wcsp-card:hover .wcsp-card-btn {
	background-color: #f0f0f0;
}

/* Responsive defaults for masonry */
@media (max-width: 900px) {
	.wcsp-grid.wcsp-style-masonry {
		grid-template-columns: repeat(2, 1fr);
	}
	.wcsp-grid.wcsp-style-masonry .wcsp-card:nth-child(n) {
		grid-column: span 1;
	}
}

@media (max-width: 600px) {
	.wcsp-grid.wcsp-style-masonry {
		grid-template-columns: 1fr;
	}
}
