/**
 * Product Carousel Frontend Styles
 */

/* Box sizing for all carousel elements */
.product-carousel-wrapper,
.product-carousel-wrapper *,
.product-carousel-wrapper *:before,
.product-carousel-wrapper *:after {
	box-sizing: border-box;
}

/* Carousel container - prevents page horizontal scroll while allowing carousel peek */
.product-carousel-container,
.wp-block-product-carousel-carousel {
	overflow-x: hidden;
	overflow-y: visible;
	width: 100%;
	max-width: 100%;
	position: relative;
}

/* Shimmer Loading Animation */
@keyframes shimmer {
	0% {
		background-position: -1000px 0;
	}
	100% {
		background-position: 1000px 0;
	}
}

/* Carousel Wrapper */
.product-carousel-wrapper {
	position: relative;
	padding: 0;
	margin: 0 auto;
	margin-left: 20%;
	margin-right: 20%;
	width: auto;
	max-width: none;
	overflow: visible;
}

/* Swiper Container */
.product-carousel-wrapper .swiper {
	width: auto;
	padding: 20px 0 50px;
	overflow: visible;
	max-width: none;
	margin: 0 auto;
	position: relative;
}

/* Swiper Wrapper */
.product-carousel-wrapper .swiper-wrapper {
	display: flex;
	position: relative;
	width: auto;
	height: 100%;
	box-sizing: border-box;
}

/* Swiper Slide - width set dynamically via JavaScript based on viewport */
.product-carousel-wrapper .swiper-slide {
	height: auto;
	display: flex;
	flex-shrink: 0;
	position: relative;
	box-sizing: border-box;
	/* Width is set dynamically via JavaScript based on viewport and columns */
	width: var(--slide-width, auto);
}

/* Product Item */
.product-carousel-item {
	background: #fff;
	border: none;
	border-radius: 0;
	overflow: hidden;
	transition: all 0.3s ease;
	height: 100%;
	display: flex;
	flex-direction: column;
	box-shadow: none;
}

.product-carousel-item:hover {
	box-shadow: none;
	transform: none;
}

/* Product Image */
.product-carousel-image {
	position: relative;
	overflow: hidden;
	background: linear-gradient(to right, #f5f5f0 0%, #e8e8e0 20%, #f5f5f0 40%, #f5f5f0 100%);
	background-size: 1000px 100%;
	animation: shimmer 2s infinite linear;
	aspect-ratio: 1 / 1;
	margin-bottom: 15px;
	max-width: 100%;
}

.product-carousel-image.loaded {
	animation: none;
	background: #f5f5f0;
}

.product-carousel-image a {
	display: block;
	height: 100%;
	width: 100%;
}

.product-carousel-image img {
	width: 100%;
	height: 100%;
	max-width: 100%;
	object-fit: cover;
	transition: opacity 0.3s ease;
	opacity: 0;
	display: block;
}

.product-carousel-image img.loaded {
	opacity: 1;
}

.product-carousel-item:hover .product-carousel-image img.loaded {
	opacity: 0.95;
}

/* Product Content */
.product-carousel-content {
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
	flex: 1;
	text-align: center;
}

/* Product Title */
.product-carousel-title {
	margin: 0;
	font-size: 16px;
	line-height: 1.5;
	font-weight: 400;
	letter-spacing: 0.3px;
}

.product-carousel-title a {
	color: #2c2c2c;
	text-decoration: none;
	transition: color 0.3s ease;
}

.product-carousel-title a:hover {
	color: #666;
}

/* Product Price */
.product-carousel-price {
	font-size: 15px;
	font-weight: 400;
	color: #2c2c2c;
	margin: 0;
	letter-spacing: 0.3px;
}

.product-carousel-price del {
	color: #999;
	font-weight: 400;
	margin-right: 8px;
	font-size: 14px;
}

.product-carousel-price ins {
	text-decoration: none;
	color: #2c2c2c;
	font-weight: 400;
}

/* Product Button */
.product-carousel-button {
	margin-top: auto;
}

.product-carousel-button a.button,
.product-carousel-button button.button {
	width: 100%;
	text-align: center;
	padding: 12px 24px;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 400;
	transition: all 0.3s ease;
	text-decoration: none;
	display: inline-block;
	border: none;
	cursor: pointer;
	background: #c9a882;
	color: #fff;
	letter-spacing: 0.5px;
}

.product-carousel-button a.button:hover,
.product-carousel-button button.button:hover {
	background: #b89670;
	color: #fff;
	transform: translateY(-1px);
}

.product-carousel-button .added_to_cart {
	display: block;
	text-align: center;
	margin-top: 5px;
	font-size: 13px;
}

/* Navigation Arrows */
.product-carousel-wrapper .swiper-button-next,
.product-carousel-wrapper .swiper-button-prev {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	background: rgba(255, 255, 255, 0.9);
	border: 1px solid #ddd;
	border-radius: 50%;
	color: #666;
	transition: all 0.3s ease;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
	z-index: 10;
	margin: 0;
}

.product-carousel-wrapper .swiper-button-next:after,
.product-carousel-wrapper .swiper-button-prev:after {
	font-size: 16px;
	font-weight: 600;
}

.product-carousel-wrapper .swiper-button-next {
	right: 0;
}

.product-carousel-wrapper .swiper-button-prev {
	left: 0;
}

.product-carousel-wrapper .swiper-button-next:hover,
.product-carousel-wrapper .swiper-button-prev:hover {
	background: #c9a882;
	color: #fff;
	border-color: #c9a882;
	box-shadow: 0 4px 12px rgba(201, 168, 130, 0.3);
}

.product-carousel-wrapper .swiper-button-next.swiper-button-disabled,
.product-carousel-wrapper .swiper-button-prev.swiper-button-disabled {
	opacity: 0.25;
	cursor: not-allowed;
}

/* Pagination Dots */
.product-carousel-wrapper .swiper-pagination {
	position: relative;
	bottom: 0;
	margin-top: 25px;
}

.product-carousel-wrapper .swiper-pagination-bullet {
	width: 8px;
	height: 8px;
	background: #d0d0d0;
	opacity: 1;
	transition: all 0.3s ease;
}

.product-carousel-wrapper .swiper-pagination-bullet-active {
	background: #c9a882;
	width: 24px;
	border-radius: 4px;
}

/* Empty State */
.product-carousel-empty {
	text-align: center;
	padding: 40px 20px;
	color: #999;
	font-size: 16px;
	border: 2px dashed #e5e5e5;
	border-radius: 8px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
	.product-carousel-container {
		overflow-x: hidden;
		overflow-y: visible;
	}

	.product-carousel-wrapper {
		overflow: visible;
		max-width: none;
		width: auto;
		margin-left: 10%;
		margin-right: 10%;
	}

	.product-carousel-wrapper .swiper {
		padding: 15px 0 40px;
		overflow: visible;
		max-width: none;
		box-sizing: border-box;
		margin-left: 0;
		margin-right: 0;
		width: auto;
	}

	/* Swiper wrapper allows peek to show */
	.product-carousel-wrapper .swiper-wrapper {
		width: auto;
		box-sizing: border-box;
	}

	.product-carousel-wrapper .swiper-slide {
		box-sizing: border-box;
		max-width: 100%;
	}

	.product-carousel-item {
		box-sizing: border-box;
		max-width: 100%;
		width: 100%;
	}

	/* Ensure images don't exceed container */
	.product-carousel-image,
	.product-carousel-image a,
	.product-carousel-image img {
		max-width: 100%;
	}

	.product-carousel-wrapper .swiper-button-next,
	.product-carousel-wrapper .swiper-button-prev {
		width: 32px;
		height: 32px;
	}

	.product-carousel-wrapper .swiper-button-next:after,
	.product-carousel-wrapper .swiper-button-prev:after {
		font-size: 14px;
	}
	
	.product-carousel-wrapper .swiper-button-next {
		right: 0;
	}

	.product-carousel-wrapper .swiper-button-prev {
		left: 0;
	}

	.product-carousel-title {
		font-size: 14px;
	}

	.product-carousel-price {
		font-size: 14px;
	}
	
	.product-carousel-image {
		margin-bottom: 12px;
	}
	
	.product-carousel-content {
		gap: 10px;
	}
}

@media (max-width: 480px) {
	.product-carousel-container {
		overflow-x: hidden;
		overflow-y: visible;
	}

	.product-carousel-wrapper {
		overflow: visible;
		max-width: none;
		width: auto;
		margin-left: 10%;
		margin-right: 10%;
	}

	.product-carousel-wrapper .swiper {
		padding: 10px 0 30px;
		overflow: visible;
		max-width: none;
		box-sizing: border-box;
		width: auto;
	}

	/* Extra constraint for very small screens */
	.product-carousel-image,
	.product-carousel-image a,
	.product-carousel-image img {
		max-width: 100%;
	}
	
	.product-carousel-button a.button,
	.product-carousel-button button.button {
		padding: 10px 20px;
		font-size: 13px;
		max-width: 100%;
	}
	
	.product-carousel-wrapper .swiper-button-next,
	.product-carousel-wrapper .swiper-button-prev {
		width: 28px;
		height: 28px;
	}
	
	.product-carousel-wrapper .swiper-button-next:after,
	.product-carousel-wrapper .swiper-button-prev:after {
		font-size: 12px;
	}

	.product-carousel-wrapper .swiper-button-next {
		right: 0;
	}

	.product-carousel-wrapper .swiper-button-prev {
		left: 0;
	}
}

/* WooCommerce Compatibility */
.product-carousel-item .onsale {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	background: #c9a882;
	color: #fff;
	padding: 6px 12px;
	border-radius: 4px;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.5px;
	text-transform: uppercase;
}

.product-carousel-item .star-rating {
	font-size: 13px;
	margin: 5px auto;
}

