@charset "utf-8";

/*
    Vehicle comparison - the Compare toggles, the tray and the /compare page.

    ? The pack runs under any theme, so colours come from the DealerPro dark scheme's tokens when it is
    ? loaded (themes/dealerpro/css/themes/dark.css defines them on :root) and fall back to the light
    ? values everywhere else. Nothing here needs a dark-mode rule of its own.
*/

/* ---------------------------------------------------------------------------------------------
   Toggles
   --------------------------------------------------------------------------------------------- */

/* Over a result tile's photo, top left - the ribbon has the top right. A sibling of the card's link,
   not inside it, so ticking it never opens the vehicle. 15px is the column's gutter */
.result_container {
	position: relative;
}

.compare-toggle-tile {
	position: absolute;
	top: 8px;
	left: 23px;
	z-index: 3;
	padding: 4px 9px;
	border: 1px solid rgba(0,0,0,0.12);
	border-radius: 4px;
	background-color: rgba(255,255,255,0.94);
	color: #333;
	font-size: 13px;
	line-height: 1.4;
	box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.compare-toggle-tile:hover,
.compare-toggle-tile:focus-visible {
	background-color: #fff;
}

/* A carousel card - the same pill, its gutter is 10px rather than 15px */
.vehicle-carousel-card {
	position: relative;
}

.compare-toggle-carousel {
	left: 18px;
}

.compare-toggle-tile.is-on {
	background-color: rgba(17,17,17,0.88);
	border-color: transparent;
	color: #fff;
}

/* The results table's first column - the box alone */
.results-table > tbody > tr > td.results-table-compare {
	width: 44px;
	text-align: center;
}

.compare-toggle-row {
	padding: 10px;
	border: 0;
	background: none;
	color: inherit;
	font-size: 18px;
	line-height: 1;
}

.compare-toggle-row.is-on {
	color: var(--dp-text, #111);
}

.compare-toggle-button {
	margin-top: 4px;
}

.compare-toggle-button.is-on {
	font-weight: 600;
}

/* The model-year page: above the build and price panel */
.catalogue-compare-action {
	margin-bottom: 12px;
	text-align: right;
}

.catalogue-compare-action .compare-toggle-button {
	margin-top: 0;
}

/* Under the trim cards */
.catalogue-compare-trims {
	display: inline-block;
	margin-top: 10px;
	font-weight: 600;
}

/* ---------------------------------------------------------------------------------------------
   Tray
   ? Bottom left, leaving the right edge to the chat launcher and the back-to-top button that both
   ? sit there. Below the modals (1040) and above the vehicle page's sticky actions (1020)
   --------------------------------------------------------------------------------------------- */

.compare-tray {
	position: fixed;
	left: 20px;
	right: 100px;
	bottom: 20px;
	bottom: calc(20px + env(safe-area-inset-bottom));
	z-index: 1030;
	max-width: 980px;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	background-color: var(--dp-surface, #fff);
	color: var(--dp-text, #333);
	border: 1px solid var(--dp-border, #ddd);
	border-radius: 8px;
	box-shadow: 0 6px 24px rgba(0,0,0,0.18);
}

.compare-tray[hidden] {
	display: none;
}

/* The footer's last lines stay reachable above the tray */
body.has-compare-tray {
	padding-bottom: 110px;
}

.compare-tray-items {
	display: flex;
	gap: 8px;
	flex: 1;
	min-width: 0;
	overflow-x: auto;
}

.compare-tray-item {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
	width: 190px;
	padding: 4px 28px 4px 4px;
	border: 1px solid var(--dp-border, #e5e5e5);
	border-radius: 6px;
	background-color: var(--dp-surface-raised, #fafafa);
}

.compare-tray-item img {
	width: 56px;
	height: 40px;
	flex: 0 0 auto;
	border-radius: 4px;
	object-fit: cover;
	background-color: var(--dp-photo, #f0f0f0);
}

.compare-tray-item-title {
	font-size: 12px;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.compare-tray-remove {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--dp-text-muted, #777);
	line-height: 24px;
}

.compare-tray-remove:hover,
.compare-tray-remove:focus-visible {
	color: var(--dp-text, #111);
}

.compare-tray-side {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
	flex: 0 0 auto;
}

.compare-tray-notice {
	max-width: 260px;
	font-size: 12px;
	color: var(--dp-text-muted, #777);
	text-align: right;
}

.compare-tray-notice:empty {
	display: none;
}

.compare-tray-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	white-space: nowrap;
}

.compare-tray-clear {
	color: var(--dp-text-muted, #777);
}

/* A phone: the photos alone - there is no room for titles, the notice or Clear all beside them */
@media (max-width: 767px) {

	.compare-tray {
		left: 10px;
		right: 84px;
		bottom: 10px;
		bottom: calc(10px + env(safe-area-inset-bottom));
		gap: 8px;
		padding: 8px;
	}

	.compare-tray-item {
		width: auto;
		padding: 3px 22px 3px 3px;
	}

	.compare-tray-item-title {
		display: none;
	}

	.compare-tray-notice {
		display: none;
	}

	.compare-tray-clear {
		display: none;
	}

	body.has-compare-tray {
		padding-bottom: 80px;
	}
}

/* ---------------------------------------------------------------------------------------------
   The compare page
   --------------------------------------------------------------------------------------------- */

.compare-heading {
	font-size: 28px;
	margin: 12px 0 20px;
}

.compare-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 15px;
}

.compare-differences {
	margin: 0;
	font-weight: normal;
	cursor: pointer;
}

.compare-need-two {
	margin: 0;
	color: var(--dp-text-muted, #777);
}

.compare-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border: 1px solid var(--dp-border, #ddd);
	border-radius: 6px;
	background-color: var(--dp-surface, #fff);
}

.compare-table {
	width: 100%;
	table-layout: fixed;
	border-collapse: separate;
	border-spacing: 0;
}

.compare-table th,
.compare-table td {
	padding: 10px 12px;
	border-bottom: 1px solid var(--dp-border, #eee);
	vertical-align: top;
	text-align: left;
	overflow-wrap: anywhere;
}

/* The field names stay put while the vehicles scroll past them */
.compare-table .compare-label-cell {
	position: sticky;
	left: 0;
	z-index: 1;
	width: 180px;
	background-color: var(--dp-surface, #fff);
	color: var(--dp-text-muted, #666);
	font-weight: 600;
	border-right: 1px solid var(--dp-border, #eee);
}

.compare-vehicle {
	position: relative;
	font-weight: normal;
}

.compare-vehicle-photo {
	display: block;
	margin-bottom: 8px;
}

.compare-vehicle-photo img {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: 4px;
	background-color: var(--dp-photo, #f5f5f5);
}

.compare-vehicle-title {
	display: block;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	color: inherit;
}

.compare-vehicle-price {
	margin: 6px 0 0;
}

.compare-vehicle-price-note {
	font-size: 12px;
	color: var(--dp-text-muted, #777);
}

.compare-vehicle-view {
	display: inline-block;
	margin-top: 10px;
}

/* New or used, under the title - only on a comparison that holds both */
.compare-badge {
	display: inline-block;
	margin-top: 6px;
	padding: 1px 8px;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	border: 1px solid currentColor;
}

.compare-badge-new {
	color: #1f7a3d;
	color: color-mix(in srgb, #1f9d55 55%, var(--dp-text, #000));
}

.compare-badge-used {
	color: var(--dp-text-muted, #666);
}

/* Green that reads on either scheme - mixed toward the page's text colour, so darker on a light page and
   lighter on the dark one. The plain value first, for a browser without color-mix() */
.compare-standard {
	color: #1f7a3d;
	color: color-mix(in srgb, #1f9d55 55%, var(--dp-text, #000));
	font-weight: 600;
}

.compare-optional {
	color: var(--dp-text-muted, #666);
}

/* The lead modal's list of what is being asked about */
.compare-lead-intro {
	margin-bottom: 4px;
}

.compare-lead-vehicles {
	margin-bottom: 15px;
	padding-left: 20px;
	font-weight: 600;
}

.compare-add-more {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.compare-remove {
	position: absolute;
	top: 16px;
	right: 18px;
	z-index: 2;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background-color: rgba(255,255,255,0.94);
	color: #333;
	box-shadow: 0 1px 3px rgba(0,0,0,0.2);
	line-height: 30px;
}

.compare-remove:hover,
.compare-remove:focus-visible {
	background-color: #fff;
	color: #000;
}

/* A group's heading spans the table, its words held at the left edge while the row scrolls */
.compare-group-row th {
	padding: 8px 12px;
	background-color: var(--dp-surface-raised, #f5f5f5);
	color: var(--dp-text, #333);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

.compare-group-row th span {
	position: sticky;
	left: 12px;
}

.compare-blank {
	color: var(--dp-text-muted, #aaa);
}

.compare-differences-only tr[data-same="1"] {
	display: none;
}

/* A group with nothing left in it once the matching rows fold away loses its heading too */
.compare-differences-only tbody.compare-group:not(:has(tr.compare-row:not([data-same="1"]))) {
	display: none;
}

/* A phone: two vehicles across, the rest a swipe away */
@media (max-width: 767px) {

	.compare-heading {
		font-size: 22px;
	}

	.compare-table {
		width: auto;
	}

	.compare-table .compare-label-cell {
		width: 110px;
		min-width: 110px;
		padding: 8px;
		font-size: 13px;
	}

	.compare-table .compare-vehicle {
		width: calc((100vw - 32px - 110px) / 2);
		min-width: 130px;
	}

	.compare-table th,
	.compare-table td {
		padding: 8px;
	}

	.compare-vehicle-title {
		font-size: 14px;
	}

	.compare-remove {
		top: 12px;
		right: 12px;
		width: 26px;
		height: 26px;
		line-height: 26px;
	}
}
