/**
 * Grid / list view for product listings (Zurgle_Listing_View). Loaded
 * wherever product-listing.css is.
 *
 * Grid is the existing card grid, untouched. List lays the same card out as
 * a row with CSS grid -- its media/content wrappers become `display:
 * contents`, so the image, title row, stars and price place themselves next
 * to the list-only details (template-parts/shop/card-list-details.php).
 * List selectors carry both .zpl-view classes so they win over
 * product-listing.css's own `.product-listing .product-card ...` sizes.
 *
 * Rows are flat, divided by a line (no card box):
 *
 *   image (heart, % off) | title                                   | price
 *                        | stars (N Reviews), stock, Brand,        | button
 *                        | Sold by, description (3 lines)          |
 */

:root {
	--zpl-ink: #00113A;
	--zpl-body: #4B5563;
	--zpl-muted: #6B7280;
	--zpl-line: #E3E8EE;
	--zpl-line-hover: #C9E2EF;
	--zpl-tint: #EAF4FA;
	--zpl-blue: #1BA0D7;
	--zpl-blue-dark: #158BBD;
	--zpl-blue-2: #469BC2;
	--zpl-save: #15803D;
	--zpl-save-tint: #E7F7EE;
	--zpl-alert: #B91C1C;
	--zpl-alert-tint: #FDECEC;
}

/* ===========================
   Toggle (toolbar)
=========================== */

.products-filters-wrps {
	display: flex;
	align-items: center;
	gap: 10px;
}

/* As a flex item the sort box wraps WooCommerce's floated sort form (it used
   to collapse to zero height, which style.css's arrow offset makes up for):
   drop the form's margin and that offset so the arrow sits in the box. */
.products-filters-wrps .woocommerce-ordering {
	margin: 0;
}

.products-filters-wrps .select-wrapper::after {
	margin-top: 0;
}

.zpl-toggle {
	display: inline-flex;
	flex: none;
	border: 1px solid #45454ACC;
	background: #fff;
}

.zpl-toggle__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 40px;
	border: 0;
	background: #fff;
	color: #45454A;
	font-size: 16px;
	cursor: pointer;
	transition: background .2s ease, color .2s ease;
}

.zpl-toggle__btn + .zpl-toggle__btn {
	border-left: 1px solid #45454A33;
}

.zpl-toggle__btn:hover {
	background: var(--zpl-tint);
	color: var(--zpl-ink);
}

.zpl-toggle__btn[aria-pressed="true"] {
	background: var(--zpl-ink);
	color: #fff;
}

.zpl-toggle__btn:focus-visible {
	outline: 2px solid var(--zpl-blue);
	outline-offset: -2px;
}

/* Store tabs: no toolbar of their own, just the toggle above the grid. */
.zpl-store-toolbar {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 18px;
}

/* ===========================
   List-only details: hidden unless the listing is in list view
=========================== */

.product-card .zpl-info,
.product-card .zpl-side,
.product-card .zpl-flag {
	display: none;
}

/* Cards fading in as the listing switches view. */
.zpl-view.is-switching .product-card {
	animation: zpl-switch .35s ease both;
}

@keyframes zpl-switch {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* ===========================
   List view
=========================== */

.zpl-view.zpl-view--list .row {
	--bs-gutter-x: 0;
	--bs-gutter-y: 0;
	margin: 0;
	border-top: 1px solid var(--zpl-line);
}

.zpl-view.zpl-view--list .row > [class*="col-"] {
	flex: 0 0 100%;
	width: 100%;
	max-width: 100%;
	padding: 0;
	border-bottom: 1px solid var(--zpl-line);
}

.zpl-view.zpl-view--list .product-card {
	display: grid;
	grid-template-columns: 140px minmax(0, 1fr) 210px;
	grid-template-rows: auto 1fr;
	grid-template-areas:
		"media title price"
		"media info  side";
	column-gap: 28px;
	height: auto;
	padding: 26px 8px;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	overflow: visible;
	transition: background .2s ease;
}

.zpl-view.zpl-view--list .product-card:hover {
	background: #FAFCFD;
	box-shadow: none;
}

.zpl-view.zpl-view--list .product-card:hover img {
	transform: scale(1.04);
}

.zpl-view.zpl-view--list .product-card-media,
.zpl-view.zpl-view--list .product-content,
.zpl-view.zpl-view--list .product-card-title-row {
	display: contents !important; /* The title row carries Bootstrap's .d-flex (!important). */
}

/* Image, with the heart on its bottom-right corner and "% Off" top-right */

.zpl-view.zpl-view--list .product-wrapper {
	grid-area: media;
	align-self: start;
	width: 140px;
	height: 140px;
	overflow: hidden;
}

.zpl-view.zpl-view--list .product-card .product-img {
	width: 140px;
	height: 140px;
	margin: 0;
}

.zpl-view.zpl-view--list .product-card .product-img a {
	height: 100%;
}

.zpl-view.zpl-view--list .product-card .overlay,
.zpl-view.zpl-view--list .product-card .rating,
.zpl-view.zpl-view--list .product-card-title-row span {
	display: none; /* The row has its own button, stars and details. */
}

.zpl-view.zpl-view--list .product-card .wishlist {
	grid-area: media;
	align-self: start;
	justify-self: end;
	z-index: 6;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: 100px 6px 0 0;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 8px rgba(0, 17, 58, .18);
	color: #E11D48;
	font-size: 15px;
	transition: transform .2s ease;
}

.zpl-view.zpl-view--list .product-card .wishlist:hover {
	transform: scale(1.1);
}

.zpl-flag {
	grid-area: media;
	align-self: start;
	justify-self: start;
	z-index: 6;
	margin-top: 112px; /* Bottom-left of the image (the heart has bottom-right). */
	padding: 3px 8px;
	background: #16A34A;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.4;
}

.zpl-view.zpl-view--list .zpl-flag {
	display: block;
}

.zpl-view.zpl-view--list .product-stocks {
	top: 26px;
	left: 8px;
	width: auto;
	max-width: 140px;
	padding: 0;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
}

.zpl-view.zpl-view--list .product-stocks .product-badge {
	padding: 4px 8px;
	border-radius: 0;
	box-shadow: none;
	font-size: 10px;
}

/* An auction's timer, under the image's top edge */
.zpl-view.zpl-view--list .product-wrapper .timer {
	font-size: 11px;
}

/* Title */

.zpl-view.zpl-view--list .product-card-title-row > div {
	grid-area: title;
	align-self: start;
	min-width: 0;
}

.zpl-view.zpl-view--list .product-card-title-row h5 {
	margin: 0;
	line-height: 1.4;
}

.zpl-view.zpl-view--list .product-card-title-row h5 a {
	font-size: 17px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--zpl-blue-dark);
	text-transform: none;
	letter-spacing: 0;
}

.zpl-view.zpl-view--list .product-card-title-row h5 a:hover {
	color: var(--zpl-ink);
	text-decoration: underline;
}

/* Details: stars, stock, brand, seller, description */

.zpl-view.zpl-view--list .zpl-info {
	grid-area: info;
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 8px;
}

.zpl-view.zpl-view--list .zpl-info p {
	margin: 0;
	line-height: 1.5;
}

.zpl-rating {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: var(--zpl-muted);
}

.zpl-stars {
	display: inline-flex;
	gap: 2px;
	font-size: 13px;
	color: #F5A623;
}

.zpl-stock {
	font-size: 13px;
	font-weight: 600;
}

.zpl-stock--in {
	color: var(--zpl-save);
}

.zpl-stock--low {
	color: #C2410C;
}

.zpl-stock--out {
	color: var(--zpl-alert);
}

.zpl-meta {
	font-size: 13px;
	color: var(--zpl-body);
}

.zpl-meta a {
	color: var(--zpl-ink);
	font-weight: 600;
	text-decoration: none;
}

.zpl-meta a:hover {
	color: var(--zpl-blue-dark);
	text-decoration: underline;
}

.zpl-summary {
	max-width: 640px;
	margin-top: 4px !important;
	font-size: 13px;
	line-height: 1.6;
	color: var(--zpl-body);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Price, top right: current price, the original struck out below it */

.zpl-view.zpl-view--list .product-content h4 {
	grid-area: price;
	align-self: start;
	display: flex;
	flex-direction: column-reverse;
	align-items: flex-end;
	gap: 2px;
	margin: 0;
	text-align: right;
	font-size: 22px;
	line-height: 1.25;
}

.zpl-view.zpl-view--list .product-content h4 .woocommerce-Price-amount {
	font-size: 22px;
	font-weight: 700;
	color: var(--zpl-ink);
}

.zpl-view.zpl-view--list .product-content h4 del,
.zpl-view.zpl-view--list .product-content h4 del .woocommerce-Price-amount {
	font-size: 14px;
	font-weight: 500;
	color: var(--zpl-muted);
}

.zpl-view.zpl-view--list .product-content h4 ins {
	text-decoration: none;
}

/* The one button, under the price */

.zpl-view.zpl-view--list .zpl-side {
	grid-area: side;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	margin-top: 12px;
}

.zpl-btn,
.zpl-view.zpl-view--list a.zpl-btn.cart-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 160px;
	min-height: 42px;
	margin: 0;
	padding: 8px 14px;
	border: 1.5px solid var(--zpl-blue-dark);
	border-radius: 6px;
	background: #fff;
	box-shadow: 0 2px 0 rgba(21, 139, 189, .25);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	color: var(--zpl-blue-dark);
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}

/* style.css's global .cart-btn (which WooCommerce's loop button also gets)
   forces black text, a 36px height and its own hover with !important. */
.zpl-view.zpl-view--list a.zpl-btn.cart-btn {
	height: auto;
	color: var(--zpl-blue-dark) !important;
	letter-spacing: 0;
}

.zpl-view.zpl-view--list .zpl-btn span {
	font-size: inherit;
	font-weight: inherit;
	color: inherit !important;
}

.zpl-view.zpl-view--list a.zpl-btn.cart-btn:hover,
.zpl-view.zpl-view--list a.zpl-btn.cart-btn.view-cart-active {
	border: 1.5px solid var(--zpl-blue-dark);
	background: var(--zpl-blue-dark);
	color: #fff !important;
	transform: none;
}

.zpl-btn:hover,
.zpl-btn:focus-visible,
.zpl-view.zpl-view--list a.zpl-btn.cart-btn:hover {
	background: var(--zpl-blue-dark);
	color: #fff;
	box-shadow: 0 6px 14px rgba(21, 139, 189, .3);
}

/* WooCommerce's spinner while adding. */
.zpl-btn.loading {
	opacity: .7;
	pointer-events: none;
}

.zpl-btn.view-cart-active {
	border-color: var(--zpl-ink);
	background: var(--zpl-ink);
	color: #fff;
}

/* WooCommerce adds its own "View cart" link after an AJAX add; the button
   itself turns into "View cart" (product-card-cart.js). */
.zpl-side .added_to_cart {
	display: none;
}

.zpl-unavailable {
	max-width: 180px;
	font-size: 13px;
	font-weight: 600;
	color: #8A6D00;
	text-align: right;
}

/* ===========================
   List view: phones
=========================== */

@media (max-width: 767.98px) {
	.zpl-view.zpl-view--list .product-card {
		grid-template-columns: 104px minmax(0, 1fr);
		grid-template-rows: auto;
		grid-template-areas:
			"media title"
			"media price"
			"media info"
			"media side";
		column-gap: 14px;
		padding: 18px 4px;
	}

	.zpl-view.zpl-view--list .product-wrapper,
	.zpl-view.zpl-view--list .product-card .product-img {
		width: 104px;
		height: 104px;
	}

	.zpl-flag {
		margin-top: 80px;
	}

	.zpl-view.zpl-view--list .product-card .wishlist {
		width: 28px;
		height: 28px;
		margin-top: 70px;
		font-size: 13px;
	}

	.zpl-view.zpl-view--list .product-stocks {
		top: 18px;
		left: 4px;
		max-width: 104px;
	}

	.zpl-view.zpl-view--list .product-card-title-row h5 a {
		font-size: 15px;
	}

	.zpl-view.zpl-view--list .product-content h4 {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: baseline;
		gap: 0 8px;
		margin-top: 6px;
		text-align: left;
	}

	.zpl-view.zpl-view--list .product-content h4 .woocommerce-Price-amount {
		font-size: 18px;
	}

	.zpl-view.zpl-view--list .zpl-info {
		margin-top: 4px;
		gap: 4px;
	}

	.zpl-summary,
	.zpl-meta {
		display: none !important;
	}

	.zpl-view.zpl-view--list .zpl-side {
		align-items: stretch;
		margin-top: 10px;
	}

	.zpl-btn,
	.zpl-view.zpl-view--list a.zpl-btn.cart-btn {
		width: 100%;
		min-height: 38px;
		font-size: 13px;
	}

	.zpl-unavailable {
		max-width: none;
		text-align: left;
	}
}

@media (prefers-reduced-motion: reduce) {
	.zpl-view.is-switching .product-card {
		animation: none;
	}

	.zpl-view.zpl-view--list .product-card,
	.zpl-btn {
		transition: none;
	}
}
