/*
 * Product listing grid for the products/all, brand, category and search result pages
 * (neo_site/products.php, neo_site/searchx.php). Scoped to .plist, which those pages put on
 * their .shop-page wrapper, so the shared .product-grid / .product-item rules in
 * neo_site/assets/css/style.css stay as they are for the home page carousels.
 *
 * The shared rules keep titles on one line (white-space: nowrap), so each grid column grows
 * to the width of its longest title and the page scrolls sideways on phones.
 */

.plist .product-grid {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr)); /* minmax(0, …): columns never grow past their share */
	gap: 20px;
}

.plist .product-grid .product-item {
	display: flex;
	flex-direction: column;
	min-width: 0;
	width: auto !important; /* shared rule forces width: 100% !important on top of a 10px margin */
	margin: 0;
	overflow: hidden;
	background: #fff;
	border: 1px solid #e9ecef;
	border-radius: 8px;
}

.plist .product-grid .product-item > hr {
	display: none; /* the card border separates items */
}

.plist .product-grid .product-item .product-item-header {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	margin: 0;
	padding: 12px;
	border-radius: 0;
}

.plist .product-grid .product-item .product-item-header > a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

.plist .product-grid .product-item .product-item-header img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	transform: none !important; /* shared rule nudges images with translate(0, 20%) !important */
}

.plist .product-grid .product-item .product-item-body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	margin-top: 0 !important;
	padding: 10px 12px 12px;
}

.plist .product-grid .product-item .product-item-body .product-name2 {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	white-space: normal;
	overflow-wrap: anywhere;
	text-align: left;
	font-size: 14px;
	line-height: 1.35;
	min-height: 2.7em; /* keep prices aligned when a title fits on one line */
}

.plist .product-grid .product-item .product-item-body .product-name2 span {
	font-size: inherit;
}

.plist .product-grid .product-item .product-item-body .product-price2 {
	margin-top: auto !important;
	padding-top: 6px;
	text-align: left;
	font-size: 15px;
	color: #252b61;
}

@media (max-width: 991.98px) {
	.plist .product-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* Phones: two columns, tighter spacing */
@media (max-width: 575.98px) {
	.plist.shop-page .product {
		margin-left: 0;
		margin-right: 0;
		box-shadow: none;
	}

	.plist .product-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}

	.plist .product-grid .product-item .product-item-header {
		padding: 8px;
	}

	.plist .product-grid .product-item .product-item-header .wishlist {
		top: 6px;
		right: 6px;
		width: 26px;
		height: 26px;
	}

	.plist .product-grid .product-item .product-item-body {
		padding: 8px 10px 10px;
	}

	.plist .product-grid .product-item .product-item-body .product-name2 {
		font-size: 13px;
	}

	.plist .product-grid .product-item .product-item-body .product-price2 {
		font-size: 14px;
	}

	/* Pagination: let the page links wrap instead of running off screen */
	.plist .product-pagination ul {
		flex-wrap: wrap;
		gap: 4px;
	}
}
