/* ==========================================================================
   Retail-style Responsive PLP (Product Listing Pages / Category Archives)
   Phase B — loaded as `tetron-mobile-plp` (dep: child-theme).
   Scope: shop archives, product categories, /vehicle-search/, and related
   product grids across Mobile (<=767px) and Desktop (>=768px).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Active-vehicle filter banner (All Viewports)
   -------------------------------------------------------------------------- */
.tetron-plp-vehicle-banner {
	margin: 0 0 14px;
}
.tetron-plp-vehicle-banner[hidden] {
	display: none !important;
}
.tetron-plp-vehicle-banner__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 10px;
	padding: 10px 14px;
	border: 1px solid #d8dde2;
	border-left: 4px solid var(--global-palette1, #073b6d);
	border-radius: 6px;
	background: #f0f6fc;
	font-size: 14px;
	line-height: 1.3;
	color: #111827;
}
.tetron-plp-vehicle-banner__icon {
	flex: 0 0 28px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 6px;
	background: #dcfce7;
	color: #15803d;
}
.tetron-plp-vehicle-banner__icon svg {
	width: 18px;
	height: 18px;
	display: block;
}
.tetron-plp-vehicle-banner__label {
	font-weight: 600;
	color: var(--global-palette1, #073b6d);
}
.tetron-plp-vehicle-banner__vehicle {
	font-weight: 700;
	min-width: 0;
}
.tetron-plp-vehicle-banner__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
}
.tetron-plp-vehicle-banner__change,
.tetron-plp-vehicle-banner__filter {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 6px 12px;
	border: 1px solid var(--global-palette1, #073b6d);
	border-radius: 4px;
	background: #fff;
	color: var(--global-palette1, #073b6d);
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	white-space: nowrap;
}
.tetron-plp-vehicle-banner__change svg,
.tetron-plp-vehicle-banner__filter svg {
	width: 15px;
	height: 15px;
	display: block;
}
.tetron-plp-vehicle-banner__filter {
	background: var(--global-palette1, #073b6d);
	color: #fff;
}
.tetron-plp-vehicle-banner__filter[aria-pressed="true"] {
	background: #fff;
	color: var(--global-palette1, #073b6d);
}
/* The results are already filtered server-side on /vehicle-search/. */
.tetron-plp-vehicle-banner.is-vehicle-search .tetron-plp-vehicle-banner__filter {
	display: none;
}

/* Cards hidden by the client-side "Filter Matching Parts" toggle. */
.woocommerce ul.products li.product.tetron-plp-filtered-out {
	display: none !important;
}

/* --------------------------------------------------------------------------
   2. Part # & Fitment Strip inside Product Cards (All Viewports)
   -------------------------------------------------------------------------- */
/* Hide duplicate legacy CMV badge inside product cards when part strip is present */
.woocommerce ul.products li.product:has(.tetron-plp-part-strip) .cmv-badge {
	display: none !important;
}

.tetron-plp-part-strip {
	padding: 6px 0 8px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
}

.tetron-plp-part-meta {
	display: flex;
	align-items: center;
	min-width: 0;
}

.tetron-plp-sku {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12px;
	font-weight: 600;
	color: #374151;
	background: #f3f4f6;
	border: 1px solid #e5e7eb;
	padding: 2px 6px;
	border-radius: 3px;
	overflow-wrap: anywhere;
}

.tetron-plp-sku svg {
	width: 13px;
	height: 13px;
	color: #073b6d;
	flex: 0 0 auto;
}

.tetron-plp-fitment {
	gap: 4px;
	width: 100%;
}

.tetron-plp-fitment.is-fits,
.tetron-plp-fitment.is-not-fits,
.tetron-plp-fitment.is-check {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 3px 5px;
	width: 100%;
	padding: 5px 8px;
	border-radius: 4px;
	font-size: 12px;
	font-weight: 600;
	box-sizing: border-box;
}

.tetron-plp-fitment.is-fits {
	color: #15803d;
	background: #f0fdf4;
	border: 1px solid #86efac;
}

.tetron-plp-fitment.is-not-fits {
	color: #b91c1c;
	background: #fef2f2;
	border: 1px solid #fca5a5;
}

.tetron-plp-fitment.is-check {
	padding: 0;
	background: transparent;
	border: 0;
}

.tetron-plp-fitment__text {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	min-width: 0;
}

.tetron-plp-fitment__text svg {
	width: 15px;
	height: 15px;
	flex: 0 0 auto;
}

.tetron-plp-fitment__note {
	display: block;
	width: 100%;
	font-size: 11px;
	font-weight: 500;
	opacity: 0.85;
}

.tetron-plp-fitment__btn,
.tetron-plp-fitment__change {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: flex-start !important;
	gap: 6px !important;
	color: var(--global-palette1, #073b6d) !important;
	font-size: 12px !important;
	font-weight: 600 !important;
	background: #f0f6fc !important;
	border: 1px dashed #93c5fd !important;
	border-radius: 4px !important;
	padding: 6px 10px !important;
	width: 100%;
	text-align: left;
	cursor: pointer;
	line-height: 1.3;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.tetron-plp-fitment__btn svg {
	width: 16px;
	height: 16px;
	flex: 0 0 auto;
}

@media (hover: hover) and (pointer: fine) {
	.tetron-plp-fitment__btn:hover,
	.tetron-plp-fitment__change:hover {
		background: #e0effe !important;
		border-color: #073b6d !important;
	}
}

.tetron-plp-fitment__change {
	margin-top: 4px;
}

/* --------------------------------------------------------------------------
   3. Desktop & Tablet Product Grid Cards (>= 768px) — Technical Cards
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
	.woocommerce ul.products li.product {
		display: flex !important;
		flex-direction: column !important;
		background: #ffffff !important;
		border: 1px solid #d8dde2 !important;
		border-radius: 6px !important;
		padding: 16px !important;
		box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
		transition: border-color 0.15s ease, box-shadow 0.15s ease;
	}

	@media (hover: hover) and (pointer: fine) {
		.woocommerce ul.products li.product:hover {
			border-color: #073b6d !important;
			box-shadow: 0 6px 18px rgba(7, 59, 109, 0.08) !important;
		}
	}

	.woocommerce ul.products li.product > .woocommerce-loop-image-link,
	.woocommerce ul.products li.product > a.woocommerce-LoopProduct-link:first-child {
		position: relative !important;
		display: flex !important;
		align-items: center;
		justify-content: center;
		width: 100% !important;
		height: 190px !important;
		padding: 8px !important;
		margin-bottom: 12px !important;
		background: #ffffff;
		border-bottom: 1px solid #f1f5f9;
		box-sizing: border-box;
		overflow: hidden;
	}

	.woocommerce ul.products li.product span.onsale {
		top: 10px !important;
		left: 10px !important;
		right: auto !important;
		margin: 0 !important;
		padding: 3px 8px !important;
		min-height: 0 !important;
		min-width: 0 !important;
		border-radius: 3px !important;
		background: #b91c1c !important;
		color: #ffffff !important;
		font-size: 10.5px !important;
		font-weight: 800 !important;
		line-height: 1.3 !important;
		letter-spacing: 0.04em !important;
		z-index: 3 !important;
	}

	.woocommerce ul.products li.product img.attachment-woocommerce_thumbnail,
	.woocommerce ul.products li.product .product-thumbnail img,
	.woocommerce ul.products li.product .kadence-woo-loop-thumbnail img {
		position: static !important;
		display: block !important;
		max-width: 100% !important;
		max-height: 170px !important;
		width: auto !important;
		height: auto !important;
		object-fit: contain !important;
		margin: 0 auto !important;
		opacity: 1 !important;
	}

	.woocommerce ul.products li.product .product-details.entry-content-wrap {
		flex: 1 1 auto !important;
		display: flex !important;
		flex-direction: column !important;
		padding: 0 !important;
		margin: 0 !important;
	}

	.woocommerce ul.products li.product .woocommerce-loop-product__title,
	.woocommerce ul.products li.product h2.entry-title {
		font-size: 14.5px !important;
		font-weight: 600 !important;
		line-height: 1.4 !important;
		color: #111827 !important;
		margin: 0 0 6px !important;
		padding: 0 !important;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
		min-height: 2.8em;
	}

	.woocommerce ul.products li.product .price {
		font-size: 18px !important;
		font-weight: 800 !important;
		color: #073b6d !important;
		margin: 4px 0 10px !important;
	}

	.woocommerce ul.products li.product .product-action-wrap {
		margin-top: auto !important;
		padding: 0 !important;
		position: static !important;
		opacity: 1 !important;
		visibility: visible !important;
		transform: none !important;
	}

	.woocommerce ul.products li.product .product-action-wrap .button {
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		width: 100% !important;
		min-height: 40px !important;
		padding: 8px 14px !important;
		border-radius: 4px !important;
		background: #073b6d !important;
		color: #ffffff !important;
		font-size: 13px !important;
		font-weight: 700 !important;
		text-align: center;
	}

	@media (hover: hover) and (pointer: fine) {
		.woocommerce ul.products li.product .product-action-wrap .button:hover {
			background: #0a4f8f !important;
		}
	}

	/* Desktop Shop Sidebar */
	.tetron-plp-desktop-sidebar {
		display: flex;
		flex-direction: column;
		gap: 18px;
	}

	.tetron-plp-sidebar-card {
		background: #ffffff;
		border: 1px solid #d8dde2;
		border-radius: 6px;
		padding: 16px;
	}

	.tetron-plp-sidebar-card--garage {
		background: #f0f6fc;
		border-top: 3px solid #073b6d;
	}

	.tetron-plp-sidebar-card__title {
		display: flex;
		align-items: center;
		gap: 8px;
		margin: 0 0 8px;
		font-size: 15px;
		font-weight: 800;
		color: #111827;
	}

	.tetron-plp-sidebar-card__title svg {
		width: 18px;
		height: 18px;
		color: #073b6d;
		flex: 0 0 auto;
	}

	.tetron-plp-sidebar-card__desc {
		margin: 0 0 12px;
		font-size: 12.5px;
		line-height: 1.4;
		color: #4b5563;
	}

	.tetron-plp-sidebar-card__btn {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: 7px;
		width: 100%;
		min-height: 38px;
		padding: 8px 12px !important;
		border: 1px solid #073b6d !important;
		border-radius: 4px !important;
		background: #073b6d !important;
		color: #ffffff !important;
		font-size: 12.5px !important;
		font-weight: 700 !important;
		cursor: pointer;
	}

	.tetron-plp-sidebar-card__btn svg {
		width: 17px;
		height: 17px;
		flex: 0 0 auto;
	}

	@media (hover: hover) and (pointer: fine) {
		.tetron-plp-sidebar-card__btn:hover {
			background: #0a4f8f !important;
		}
	}

	.tetron-plp-sidebar-list {
		list-style: none;
		margin: 0;
		padding: 0;
		border-top: 1px solid #e5e7eb;
	}

	.tetron-plp-sidebar-list li {
		border-bottom: 1px solid #e5e7eb;
	}

	.tetron-plp-sidebar-list li:last-child {
		border-bottom: 0;
	}

	.tetron-plp-sidebar-list a {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 8px 4px;
		font-size: 13.5px;
		font-weight: 600;
		color: #1f2937;
		text-decoration: none;
	}

	@media (hover: hover) and (pointer: fine) {
		.tetron-plp-sidebar-list a:hover {
			color: #073b6d;
		}
	}

	.tetron-plp-sidebar-makes {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 6px;
	}

	.tetron-plp-sidebar-makes a {
		padding: 6px 8px;
		border: 1px solid #d8dde2;
		border-radius: 4px;
		background: #f8fafc;
		color: #073b6d;
		font-size: 12.5px;
		font-weight: 700;
		text-align: center;
		text-decoration: none;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	@media (hover: hover) and (pointer: fine) {
		.tetron-plp-sidebar-makes a:hover {
			border-color: #073b6d;
			background: #e6eff8;
		}
	}
}

@media (max-width: 767px) {
	.tetron-plp-desktop-sidebar {
		display: none !important;
	}
}

/* --------------------------------------------------------------------------
   4. Shop toolbar (results count / filters / sort) — tablet & below
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
	.archive.woocommerce .kadence-shop-top-row {
		display: grid !important;
		grid-template-columns: 1fr 1fr;
		gap: 10px !important;
		align-items: stretch !important;
		margin: 0 0 12px 0 !important;
		padding: 0 !important;
		flex-direction: initial !important;
	}
	.archive.woocommerce .kadence-woo-results-count {
		display: block !important;
		grid-column: 1 / -1;
		text-align: left !important;
		font-size: 13px;
		color: #4b5563;
		margin: 0;
	}
	.archive.woocommerce .kadence-woo-results-count .woocommerce-result-count {
		margin: 0;
	}
	.archive.woocommerce .fibofilters-filter-button,
	.archive.woocommerce .woocommerce-ordering,
	.archive.woocommerce .kadence-shop-top-item {
		width: 100%;
		min-width: 0;
	}
	.archive.woocommerce .fibofilters-filter-button,
	.archive.woocommerce .woocommerce-ordering select.orderby {
		display: block;
		width: 100% !important;
		height: 42px !important;
		box-sizing: border-box;
		border: 1px solid var(--global-palette1, #073b6d) !important;
		border-radius: 4px !important;
		background: #fff !important;
		color: var(--global-palette1, #073b6d) !important;
		font-weight: 600 !important;
		font-size: 14px !important;
		line-height: 40px;
		text-align: center;
	}
	.archive.woocommerce .woocommerce-ordering select.orderby {
		line-height: normal;
		font-size: 16px !important;
	}
	.archive.woocommerce form.woocommerce-ordering {
		margin: 0;
		width: 100%;
	}
	.archive.woocommerce form.woocommerce-ordering::before {
		content: none !important;
	}
}

/* --------------------------------------------------------------------------
   5. Mobile card list — horizontal technical look (≤ 767px)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {

	/* 1. Banner compaction */
	.tetron-plp-vehicle-banner__inner {
		font-size: 13px;
	}
	.tetron-plp-vehicle-banner__actions {
		width: 100%;
		margin-left: 0;
	}
	.tetron-plp-vehicle-banner__change,
	.tetron-plp-vehicle-banner__filter {
		flex: 1 1 auto;
	}

	/* 2. One card per row */
	/* Full specifications and warranty remain available on the product page. */
	.woocommerce ul.products li.product .tetron-card-extra {
		display: none;
	}

	.woocommerce ul.products li.product .product-action-wrap .button {
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		width: 100%;
		min-height: 44px;
		padding: 8px 12px !important;
		border-radius: 4px;
		background: #073b6d !important;
		color: #ffffff !important;
		font-size: 14px;
		font-weight: 700;
	}

	.woocommerce ul.products,
	.woocommerce ul.products.grid-cols {
		display: grid !important;
		grid-template-columns: minmax(0, 1fr) !important;
		gap: 12px !important;
		margin: 0 !important;
	}

	.woocommerce ul.products li.product {
		background: #fff !important;
		border: 1px solid #d8dde2 !important;
		border-radius: 6px !important;
		padding: 12px !important;
		margin: 0 !important;
		box-shadow: 0 1px 3px rgba(17, 24, 39, 0.05);
	}

	/* 3. Horizontal thumbnail + content layout (Kadence wootemplate loop) */
	.woocommerce ul.products li.product .kt-row-column-wrap.kt-has-2-columns,
	.woocommerce ul.products li.product .custom-loop-grid .loop-entry:has(> .wp-block-kadence-column) {
		display: grid !important;
		grid-template-columns: 96px minmax(0, 1fr) !important;
		column-gap: 12px !important;
		align-items: start !important;
	}
	.woocommerce ul.products li.product .kt-row-column-wrap.kt-has-2-columns > .wp-block-kadence-column,
	.woocommerce ul.products li.product .custom-loop-grid .loop-entry > .wp-block-kadence-column {
		min-width: 0;
	}
	.woocommerce ul.products li.product .kt-row-column-wrap.kt-has-2-columns > .wp-block-kadence-column:first-child,
	.woocommerce ul.products li.product .custom-loop-grid .loop-entry > .wp-block-kadence-column:first-child {
		grid-column: 1;
		grid-row: 1;
	}
	.woocommerce ul.products li.product .kt-row-column-wrap.kt-has-2-columns > .wp-block-kadence-column:not(:first-child),
	.woocommerce ul.products li.product .custom-loop-grid .loop-entry > .wp-block-kadence-column:not(:first-child) {
		grid-column: 2;
	}

	/* 3b. Horizontal layout for the standard WooCommerce / Kadence loop as well */
	.woocommerce ul.products li.product:has(> .woocommerce-loop-image-link):has(> .product-details),
	.woocommerce ul.products li.product a.woocommerce-LoopProduct-link:has(> .woocommerce-loop-product__title) {
		display: grid !important;
		grid-template-columns: 96px minmax(0, 1fr) !important;
		column-gap: 12px !important;
		align-items: start !important;
	}
	.woocommerce ul.products li.product:has(> .woocommerce-loop-image-link):has(> .product-details) > .woocommerce-loop-image-link,
	.woocommerce ul.products li.product a.woocommerce-LoopProduct-link:has(> .woocommerce-loop-product__title) > img {
		position: relative !important;
		grid-column: 1 !important;
		grid-row: 1 !important;
		width: 96px !important;
		height: 96px !important;
		padding: 0 !important;
		margin: 0 !important;
	}
	.woocommerce ul.products li.product span.onsale {
		top: 6px !important;
		left: 6px !important;
		right: auto !important;
		margin: 0 !important;
		padding: 2px 6px !important;
		min-height: 0 !important;
		min-width: 0 !important;
		border-radius: 3px !important;
		background: #b91c1c !important;
		color: #ffffff !important;
		font-size: 9.5px !important;
		font-weight: 800 !important;
		line-height: 1.2 !important;
		z-index: 3 !important;
	}
	.woocommerce ul.products li.product:has(> .woocommerce-loop-image-link):has(> .product-details) > .product-details.entry-content-wrap,
	.woocommerce ul.products li.product a.woocommerce-LoopProduct-link:has(> .woocommerce-loop-product__title) > *:not(img) {
		grid-column: 2 !important;
		grid-row: 1 !important;
		min-width: 0 !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	/* 4. Constrain thumbnails so they never take the full card width */
	.woocommerce ul.products li.product img.attachment-woocommerce_thumbnail,
	.woocommerce ul.products li.product .product-thumbnail img,
	.woocommerce ul.products li.product .kadence-woo-loop-thumbnail img,
	.woocommerce ul.products li.product .kwt-image-wrap img {
		position: static !important;
		display: block !important;
		width: 96px !important;
		height: 96px !important;
		max-width: 96px !important;
		object-fit: contain !important;
		background: #fff;
		border: 1px solid #eef0f2;
		border-radius: 4px;
		padding: 4px;
		box-sizing: border-box;
		opacity: 1 !important;
	}

	/* 5. Compact title / price inside the content column */
	.woocommerce ul.products li.product .woocommerce-loop-product__title,
	.woocommerce ul.products li.product h2.entry-title {
		font-size: 14px !important;
		line-height: 1.35 !important;
		margin: 0 0 4px !important;
		padding: 0 !important;
		display: -webkit-box;
		-webkit-line-clamp: 3;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}
	.woocommerce ul.products li.product .price {
		font-size: 16px !important;
		font-weight: 700 !important;
		color: var(--global-palette1, #073b6d);
		margin: 0 0 6px;
	}
}
