/**
 * Product Slider Component CSS
 * Responsive product carousel with mobile-first design
 * IE11+ Compatible
 */

/* ========================================
   SLIDER CONTAINER & TRACK
   ======================================== */

.product-slider-wrapper {
	position: relative;
	width: 100%;
	overflow: hidden;
}

.product-slider-container {
	position: relative;
	width: 100%;
	background: #fff;
	border-radius: 8px;
}

.product-slider-track {
	display: flex;
	gap: 1.5rem;
	padding: 1rem;
	overflow: hidden;
	scroll-behavior: smooth;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	/* Allow overflow hidden but still visible content */
	width: 100%;
	box-sizing: border-box;
}

/* IE11 Fallback - disable scroll snapping */
@supports not (scroll-snap-type: x mandatory) {
	.product-slider-track {
		scroll-behavior: auto;
	}
}

/* ========================================
   PRODUCT CARD ITEM
   ======================================== */

.product-card-item {
	flex: 0 0 calc(100% - 1.5rem);
	min-width: 280px;
	scroll-snap-align: start;
	scroll-snap-stop: always;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card-item:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* Desktop: 4 items per view */
@media (min-width: 1400px) {
	.product-card-item {
		flex: 0 0 calc(25% - 1.5rem);
		min-width: 220px;
	}
}

/* Desktop: 3 items per view */
@media (min-width: 1024px) and (max-width: 1399px) {
	.product-card-item {
		flex: 0 0 calc(33.333% - 1.5rem);
		min-width: 200px;
	}
}

/* Tablet: 2 items per view */
@media (min-width: 768px) and (max-width: 1023px) {
	.product-card-item {
		flex: 0 0 calc(50% - 1.5rem);
		min-width: 200px;
	}
}

/* Mobile: 1 item per view */
@media (max-width: 767px) {
	.product-card-item {
		flex: 0 0 calc(100% - 1.5rem);
		min-width: 280px;
	}
}

/* ========================================
   PRODUCT CARD STYLING
   ======================================== */

.product-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	overflow: hidden;
	transition: all 0.3s ease;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.product-card:hover {
	border-color: #007bff;
	box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.product-card-image {
	width: 100%;
	height: 200px;
	object-fit: cover;
	background: #f5f5f5;
	display: block;
}

.product-card-body {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
	padding: 1rem;
	gap: 0.75rem;
}

.product-card-title {
	font-size: 1.1rem;
	font-weight: 600;
	color: #222;
	margin: 0;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.product-card-text {
	font-size: 0.95rem;
	color: #666;
	margin: 0;
	line-height: 1.4;
	flex-grow: 1;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.product-card-link {
	display: inline-block;
	margin-top: auto;
	padding: 0.5rem 1rem;
	background: #007bff;
	color: #fff;
	text-decoration: none;
	border-radius: 4px;
	font-size: 0.9rem;
	font-weight: 500;
	transition: all 0.3s ease;
	text-align: center;
	border: 2px solid #007bff;
	cursor: pointer;
}

.product-card-link:hover {
	background: #0056b3;
	border-color: #0056b3;
	text-decoration: none;
}

.product-card-link:focus {
	outline: 2px solid #007bff;
	outline-offset: 2px;
}

/* ========================================
   NAVIGATION CONTROLS
   ======================================== */

.product-slider-controls {
	position: absolute;
	top: 50%;
	width: 100%;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 0.5rem;
	transform: translateY(-50%);
	pointer-events: none;
	z-index: 10;
}

.product-slider-btn {
	pointer-events: auto;
	width: 44px;
	height: 44px;
	background: rgba(255, 255, 255, 0.9);
	border: 2px solid #ddd;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #333;
	font-size: 1.2rem;
	transition: all 0.3s ease;
	flex-shrink: 0;
}

.product-slider-btn:hover {
	background: #fff;
	border-color: #007bff;
	color: #007bff;
	transform: scale(1.1);
}

.product-slider-btn:focus {
	outline: 2px solid #007bff;
	outline-offset: -2px;
}

.product-slider-btn:active {
	transform: scale(0.95);
}

.product-slider-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Hide controls on mobile */
@media (max-width: 767px) {
	.product-slider-controls {
		display: none;
	}
}

/* ========================================
   PAGINATION DOTS
   ======================================== */

.product-slider-pagination {
	display: flex;
	justify-content: center;
	gap: 0.5rem;
	padding: 1rem 0 0;
	margin-top: 0;
	flex-wrap: wrap;
}

.product-slider-dot {
	width: 10px;
	height: 10px;
	background: #ddd;
	border: 2px solid #ddd;
	border-radius: 50%;
	cursor: pointer;
	transition: all 0.3s ease;
	padding: 0;
	margin: 0;
	flex-shrink: 0;
}

.product-slider-dot:hover {
	background: #999;
	border-color: #999;
}

.product-slider-dot.active {
	background: #007bff;
	border-color: #007bff;
	transform: scale(1.2);
}

.product-slider-dot:focus {
	outline: 2px solid #007bff;
	outline-offset: 2px;
}

/* Hide pagination on mobile (not useful with 1 item per view) */
@media (max-width: 767px) {
	.product-slider-pagination {
		display: none;
	}
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.product-slider-track:focus {
	outline: 2px solid #007bff;
	outline-offset: 2px;
}

/* Hide visually hidden content but keep accessible */
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 576px) {
	.product-slider-track {
		padding: 0.75rem;
		gap: 1rem;
	}

	.product-card-image {
		height: 150px;
	}

	.product-card-body {
		padding: 0.75rem;
		gap: 0.5rem;
	}

	.product-card-title {
		font-size: 1rem;
	}

	.product-card-text {
		font-size: 0.9rem;
	}
}

/* ========================================
   SCROLL BEHAVIOR OPTIMIZATION
   ======================================== */

/* Smooth scroll for browsers that support it */
@supports (scroll-behavior: smooth) {
	.product-slider-track {
		scroll-behavior: smooth;
	}
}

/* Touch scrolling optimization for iOS */
.product-slider-track {
	-webkit-overflow-scrolling: touch;
}

/* ========================================
   LOADING & ERROR STATES
   ======================================== */

.product-card.loading {
	opacity: 0.6;
	pointer-events: none;
}

.product-card-image.placeholder {
	background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
	background-size: 200% 100%;
	animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

/* ========================================
   REDUCED MOTION SUPPORT
   ======================================== */

@media (prefers-reduced-motion: reduce) {
	.product-card,
	.product-card-item,
	.product-slider-btn,
	.product-slider-dot,
	.product-slider-track {
		transition: none;
		animation: none;
		scroll-behavior: auto;
	}

	.product-card:hover {
		transform: none;
	}
}
