/**
 * LTanDev WooCommerce Catalog Block Styles
 *
 * @package LtanDev\WC_Customizations
 */

/* Block Wrapper */
.ltandev-catalog-block {
	margin: 2rem 0;
	clear: both;
}

.ltandev-catalog-block.alignwide {
	max-width: var(--wp--style--global--wide-size, 1280px);
}

.ltandev-catalog-block.alignfull {
	max-width: 100%;
}

/* Products Grid */
.ltandev-catalog-products {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 2rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.ltandev-catalog-products.columns-1 {
	grid-template-columns: repeat(1, 1fr);
}

.ltandev-catalog-products.columns-2 {
	grid-template-columns: repeat(2, 1fr);
}

.ltandev-catalog-products.columns-3 {
	grid-template-columns: repeat(3, 1fr);
}

.ltandev-catalog-products.columns-4 {
	grid-template-columns: repeat(4, 1fr);
}

.ltandev-catalog-products.columns-5 {
	grid-template-columns: repeat(5, 1fr);
}

.ltandev-catalog-products.columns-6 {
	grid-template-columns: repeat(6, 1fr);
}

/* Product Card */
.ltandev-catalog-product {
	position: relative;
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	overflow: hidden;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ltandev-catalog-product:hover {
	transform: translateY(-4px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Product Link */
.ltandev-product-link {
	display: flex;
	flex-direction: column;
	flex: 1;
	text-decoration: none;
	color: inherit;
}

.ltandev-product-link:hover {
	color: inherit;
}

/* Product Image */
.ltandev-product-image {
	position: relative;
	width: 100%;
	overflow: hidden;
	background: #f5f5f5;
}

.ltandev-product-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: transform 0.3s ease;
}

.ltandev-catalog-product:hover .ltandev-product-image img {
	transform: scale(1.05);
}

/* Sale Badge */
.ltandev-product-image .onsale {
	position: absolute;
	top: 10px;
	left: 10px;
	background: #ff4444;
	color: #fff;
	padding: 4px 12px;
	font-size: 12px;
	font-weight: 600;
	border-radius: 3px;
	text-transform: uppercase;
	z-index: 1;
}

/* Out of Stock Badge */
.ltandev-product-image .out-of-stock-badge {
	position: absolute;
	top: 10px;
	right: 10px;
	background: #666;
	color: #fff;
	padding: 4px 12px;
	font-size: 12px;
	font-weight: 600;
	border-radius: 3px;
	z-index: 1;
}

/* Product Details */
.ltandev-product-details {
	padding: 1rem;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.ltandev-product-title {
	margin: 0 0 0.5rem;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.4;
	color: #333;
}

.ltandev-catalog-product:hover .ltandev-product-title {
	color: #0073aa;
}

/* Product Rating */
.ltandev-product-rating {
	margin-bottom: 0.5rem;
	font-size: 14px;
}

.ltandev-product-rating .star-rating {
	font-size: 14px;
}

/* Product Price */
.ltandev-product-price {
	margin-top: auto;
	font-size: 18px;
	font-weight: 700;
	color: #333;
}

.ltandev-product-price del {
	opacity: 0.6;
	font-weight: 400;
	font-size: 16px;
}

.ltandev-product-price ins {
	text-decoration: none;
	color: #ff4444;
}

/* Product Actions */
.ltandev-product-actions {
	padding: 0 1rem 1rem;
}

.ltandev-product-actions .button {
	width: 100%;
	text-align: center;
	padding: 10px;
	font-weight: 600;
}

.ltandev-product-actions .out-of-stock {
	background: #ccc;
	cursor: not-allowed;
}

/* Pagination */
.ltandev-catalog-pagination {
	margin-top: 3rem;
	text-align: center;
}

.ltandev-catalog-pagination .page-numbers {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 0.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
	flex-wrap: wrap;
}

.ltandev-catalog-pagination .page-numbers li {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ltandev-catalog-pagination .page-numbers a,
.ltandev-catalog-pagination .page-numbers span {
	display: inline-block;
	min-width: 40px;
	height: 40px;
	padding: 8px 12px;
	line-height: 24px;
	text-align: center;
	text-decoration: none;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #fff;
	color: #333;
	transition: all 0.2s ease;
}

.ltandev-catalog-pagination .page-numbers a:hover {
	background: #0073aa;
	color: #fff;
	border-color: #0073aa;
}

.ltandev-catalog-pagination .page-numbers .current {
	background: #0073aa;
	color: #fff;
	border-color: #0073aa;
	font-weight: 600;
}

.ltandev-catalog-pagination .page-numbers .dots {
	border: none;
	background: transparent;
	cursor: default;
}

.ltandev-catalog-pagination .page-numbers .prev,
.ltandev-catalog-pagination .page-numbers .next {
	padding: 8px 16px;
	font-weight: 600;
}

.ltandev-catalog-pagination .page-numbers.disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Pagination Loading */
.ltandev-pagination-loading {
	margin-top: 1rem;
	text-align: center;
	padding: 1rem;
}

.ltandev-pagination-loading .spinner {
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 3px solid #f3f3f3;
	border-top: 3px solid #0073aa;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* Empty State */
.ltandev-catalog-empty {
	padding: 3rem;
	text-align: center;
	background: #f9f9f9;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	color: #666;
	font-size: 16px;
}

/* Error Message */
.ltandev-catalog-block .woocommerce-error {
	margin-bottom: 1rem;
	padding: 1rem;
	background: #ffe6e6;
	border-left: 4px solid #d63638;
	color: #333;
}

/* Responsive Breakpoints */
@media screen and (max-width: 1024px) {
	.ltandev-catalog-products.columns-6,
	.ltandev-catalog-products.columns-5 {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media screen and (max-width: 768px) {
	.ltandev-catalog-products.columns-6,
	.ltandev-catalog-products.columns-5,
	.ltandev-catalog-products.columns-4 {
		grid-template-columns: repeat(3, 1fr);
	}

	.ltandev-catalog-products {
		gap: 1.5rem;
	}

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

	.ltandev-product-price {
		font-size: 16px;
	}
}

@media screen and (max-width: 600px) {
	.ltandev-catalog-products.columns-6,
	.ltandev-catalog-products.columns-5,
	.ltandev-catalog-products.columns-4,
	.ltandev-catalog-products.columns-3 {
		grid-template-columns: repeat(2, 1fr);
	}

	.ltandev-catalog-products {
		gap: 1rem;
	}

	.ltandev-product-details {
		padding: 0.75rem;
	}

	.ltandev-pagination .page-numbers a,
	.ltandev-pagination .page-numbers span {
		min-width: 36px;
		height: 36px;
		padding: 6px 10px;
		font-size: 14px;
	}
}

@media screen and (max-width: 480px) {
	.ltandev-catalog-products.columns-6,
	.ltandev-catalog-products.columns-5,
	.ltandev-catalog-products.columns-4,
	.ltandev-catalog-products.columns-3,
	.ltandev-catalog-products.columns-2 {
		grid-template-columns: repeat(1, 1fr);
	}

	.ltandev-catalog-block {
		margin: 1rem 0;
	}

	.ltandev-pagination .page-numbers {
		gap: 0.25rem;
	}

	.ltandev-pagination .page-numbers a,
	.ltandev-pagination .page-numbers span {
		min-width: 32px;
		height: 32px;
		padding: 4px 8px;
		font-size: 13px;
	}
}

/* Accessibility */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

/* Focus Styles for Accessibility */
.ltandev-catalog-product:focus-within {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

.ltandev-pagination .page-numbers a:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
	.ltandev-catalog-product {
		border-width: 2px;
	}

	.ltandev-product-link:hover {
		text-decoration: underline;
	}
}

/* Loading State */
.ltandev-catalog-products.loading {
	opacity: 0.5;
	pointer-events: none;
}
