/**
 * Product Grid Styles
 *
 * @package MyBestClinicShop
 */

/* WooCommerce Reset - Override theme styles */
.mbcs-shop-wrapper * {
	box-sizing: border-box;
}

.mbcs-shop-wrapper ul.products,
.mbcs-shop-wrapper .products {
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

.mbcs-shop-wrapper .products li {
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
	float: none !important;
	width: 100% !important;
}

/* Product Archive */
.mbcs-product-archive {
	width: 100%;
	max-width: 100%;
	position: relative;
}

/* Notice Messages */
.mbcs-notice {
	padding: 12px 20px !important;
	margin: 0 0 20px !important;
	border-radius: 4px !important;
	font-size: 14px !important;
	line-height: 1.5 !important;
	animation: slideDown 0.3s ease !important;
}

@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.mbcs-notice-success {
	background: #d4edda !important;
	color: #155724 !important;
	border: 1px solid #c3e6cb !important;
}

.mbcs-notice-error {
	background: #f8d7da !important;
	color: #721c24 !important;
	border: 1px solid #f5c6cb !important;
}

.mbcs-notice-info {
	background: #d1ecf1 !important;
	color: #0c5460 !important;
	border: 1px solid #bee5eb !important;
}

/* Products Grid */
.mbcs-products-grid {
	display: grid !important;
	gap: 24px !important;
	margin: 0 0 40px !important;
	padding: 0 !important;
	list-style: none !important;
	width: 100% !important;
	clear: both !important;
}

/* Grid View (default) - 3 columns ONLY on desktop */
@media (min-width: 993px) {
	.mbcs-products-grid.mbcs-view-grid,
	.mbcs-products-grid:not(.mbcs-view-list) {
		grid-template-columns: repeat(3, 1fr) !important;
	}
}

/* List View */
.mbcs-products-grid.mbcs-view-list {
	grid-template-columns: 1fr !important;
}

.mbcs-products-grid.mbcs-view-list .mbcs-product-card {
	flex-direction: row !important;
	max-width: 100% !important;
}

.mbcs-products-grid.mbcs-view-list .mbcs-product-image {
	padding-top: 0 !important;
	width: 200px !important;
	height: 200px !important;
	flex-shrink: 0 !important;
}

.mbcs-products-grid.mbcs-view-list .mbcs-product-info {
	flex: 1 !important;
	display: flex !important;
	flex-direction: column !important;
}

.mbcs-products-grid.mbcs-view-list .mbcs-product-excerpt {
	display: block !important;
	max-height: none !important;
}

.mbcs-products-grid.mbcs-view-list .mbcs-product-actions {
	margin-top: auto !important;
	max-width: 200px !important;
}

/* Product Card */
.mbcs-product-card {
	position: relative !important;
	display: flex !important;
	flex-direction: column !important;
	background: #ffffff !important;
	border: 1px solid #e0e0e0 !important;
	border-radius: 8px !important;
	overflow: hidden !important;
	transition: all 0.3s ease !important;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
	width: 100% !important;
	float: none !important;
}

.mbcs-product-card:hover {
	border-color: #0073aa;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	transform: translateY(-4px);
}

/* Product Image */
.mbcs-product-image {
	position: relative;
	width: 100%;
	padding-top: 100%; /* 1:1 aspect ratio */
	overflow: hidden;
	background: #f9f9f9;
}

.mbcs-product-image a {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.mbcs-product-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
	image-rendering: -webkit-optimize-contrast; /* Better quality on WebKit */
	image-rendering: crisp-edges; /* Prevent blur on upscale */
}

.mbcs-product-card:hover .mbcs-product-image img {
	transform: scale(1.05);
}

/* Product Badge */
.mbcs-product-badge {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	padding: 6px 12px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	color: #ffffff;
	background: #d63638;
	border-radius: 4px;
}

.mbcs-badge-sale {
	background: #d63638;
}

/* Product Info */
.mbcs-product-info {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 20px;
}

/* Product Title */
.mbcs-product-title {
	margin: 0 0 12px;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.4;
}

.mbcs-product-title a {
	color: #333;
	text-decoration: none;
	transition: color 0.3s ease;
}

.mbcs-product-title a:hover {
	color: #0073aa;
}

/* Product Excerpt */
.mbcs-product-excerpt {
	margin: 0 0 12px;
	font-size: 14px;
	line-height: 1.6;
	color: #666;
}

/* Product Price */
.mbcs-product-price {
	margin: 0 0 16px;
	font-size: 18px;
	font-weight: 700;
	color: #333;
}

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

.mbcs-product-price ins {
	text-decoration: none;
	color: #d63638;
}

/* Product Actions */
.mbcs-product-actions {
	margin-top: auto;
}

.mbcs-add-to-cart,
.mbcs-out-of-stock {
	display: block;
	width: 100%;
	padding: 12px 20px;
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.3s ease;
}

.mbcs-add-to-cart {
	color: #ffffff;
	background: #0073aa;
}

.mbcs-add-to-cart:hover {
	background: #005a87;
	color: #ffffff;
}

.mbcs-add-to-cart.loading {
	opacity: 0.7;
	cursor: wait;
	pointer-events: none;
	position: relative;
}

.mbcs-add-to-cart.loading::after {
	content: '';
	position: absolute;
	top: 50%;
	right: 15px;
	width: 14px;
	height: 14px;
	margin-top: -7px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: spin 0.6s linear infinite;
}

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

.mbcs-out-of-stock {
	color: #999;
	background: #f0f0f0;
	cursor: not-allowed;
}

/* No Products */
.mbcs-no-products {
	grid-column: 1 / -1;
	padding: 40px;
	text-align: center;
	font-size: 16px;
	color: #666;
	background: #f9f9f9;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
}

/* Responsive - Tablet and Mobile: ALWAYS 2 columns */
@media (max-width: 992px) {
	.mbcs-products-grid,
	.mbcs-products-grid.mbcs-view-grid,
	.mbcs-products-grid:not(.mbcs-view-list),
	.mbcs-shop-wrapper .mbcs-products-grid,
	.mbcs-shop-content .mbcs-products-grid {
		grid-template-columns: repeat(2, 1fr) !important;
		gap: 16px !important;
	}
}

/* Responsive - Mobile (2-column grid like Salient) */
@media (max-width: 768px) {
	.mbcs-product-archive {
		width: 100% !important;
		max-width: 100% !important;
		padding: 0 !important;
		margin: 0 !important;
	}
	
	.mbcs-products-grid {
		display: grid !important;
		grid-template-columns: repeat(2, 1fr) !important;
		gap: 16px !important;
		width: 100% !important;
		max-width: 100% !important;
		padding: 0 !important;
		margin: 0 0 24px !important;
	}
	
	.mbcs-product-card {
		width: 100% !important;
		max-width: 100% !important;
		margin: 0 !important;
		border: none !important;
		border-radius: 12px !important;
		background: #f8f8f8 !important;
		overflow: hidden !important;
	}
	
	.mbcs-product-card:hover {
		transform: none;
		box-shadow: none;
	}
	
	.mbcs-product-image {
		border-radius: 12px;
		overflow: hidden;
		background: #f0f0f0;
	}
	
	.mbcs-product-info {
		padding: 12px 4px;
		background: transparent;
		text-align: center;
	}
	
	.mbcs-product-title {
		font-size: 14px;
		font-weight: 500;
		margin-bottom: 6px;
		line-height: 1.3;
	}
	
	.mbcs-product-excerpt {
		display: none !important;
	}
	
	.mbcs-product-price {
		font-size: 14px;
		font-weight: 400;
		color: #666;
		margin-bottom: 0;
	}
	
	/* Hide Add to Cart button on mobile grid - cleaner look */
	.mbcs-product-actions {
		display: none !important;
	}
	
	/* Sale badge styling */
	.mbcs-product-badge {
		top: 10px;
		left: 10px;
		right: auto;
		padding: 4px 10px;
		font-size: 11px;
		border-radius: 4px;
	}
}

/* Responsive - Mobile Small (single column on very small screens) */
@media (max-width: 400px) {
	.mbcs-products-grid {
		grid-template-columns: 1fr !important;
		gap: 16px !important;
	}

	.mbcs-product-card {
		max-width: 100% !important;
	}

	.mbcs-product-info {
		padding: 16px;
	}

	.mbcs-product-title {
		font-size: 15px;
	}

	.mbcs-product-excerpt {
		display: block;
		font-size: 13px;
	}

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

/* WooCommerce Compatibility */
.woocommerce .mbcs-product-price .amount {
	font-weight: 700;
}

.woocommerce .mbcs-product-price del .amount {
	font-weight: 400;
}

.woocommerce .mbcs-product-price ins .amount {
	font-weight: 700;
	color: #d63638;
}

