/**
 * Frontend styles for vehicle cards, spec tables and the search form.
 * Colors are driven by custom properties that resolve to the brand tokens
 * from the theme's brand.css (see WORDPRESS-DESIGN.md); the literal fallbacks
 * keep the plugin presentable if it runs under a different theme.
 */

:root {
	--cl-color-accent: var(--sw-steel-500, #3D6FB4);
	--cl-color-text: var(--sw-text-heading, #141A33);
	--cl-color-muted: var(--sw-text-muted, #767D8C);
	--cl-color-surface: var(--sw-surface-page, #ffffff);
	--cl-color-border: var(--sw-border-subtle, #E5E7EC);
	--cl-radius: var(--sw-radius-card, 6px);
	--cl-shadow: var(--sw-shadow-xs, 0 1px 1px rgba(11, 14, 28, 0.05));
}

/* --- Grid & Card ------------------------------------------------------- */

.cl-vehicle-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
}

.cl-vehicle-grid--cols-1 {
	grid-template-columns: 1fr;
}

.cl-vehicle-grid--cols-2 {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cl-vehicle-grid--cols-4 {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Whatever the desktop column count is, a tablet gets two and a phone gets one. */
@media (max-width: 1024px) {
	.cl-vehicle-grid,
	.cl-vehicle-grid--cols-3,
	.cl-vehicle-grid--cols-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.cl-vehicle-grid,
	.cl-vehicle-grid--cols-2,
	.cl-vehicle-grid--cols-3,
	.cl-vehicle-grid--cols-4 {
		grid-template-columns: 1fr;
	}
}

.cl-vehicle-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--cl-color-surface);
	border: 1px solid var(--cl-color-border);
	border-radius: var(--cl-radius);
	box-shadow: var(--cl-shadow);
	transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.cl-vehicle-card:hover {
	border-color: var(--sw-band-500, #AFD2E9);
	box-shadow: var(--sw-shadow-lg, 0 8px 24px rgba(11, 14, 28, 0.1));
}

.cl-vehicle-card__media {
	position: relative;
	display: block;
	aspect-ratio: 16 / 10;
	background: #f3f4f6;
}

.cl-vehicle-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Badges share one row so a top offer and a status never sit on top of each other. */
.cl-badges {
	position: absolute;
	top: 12px;
	left: 12px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.cl-badge {
	padding: 4px 8px;
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: var(--sw-grey-700, #3A404E);
	background: var(--sw-grey-100, #F0F1F4);
	border-radius: var(--sw-radius-badge, 2px);
}

/* Top-Angebot is the brand badge; the rest carry status colours. */
.cl-badge--featured {
	color: #fff;
	background: var(--sw-navy-800, #141A33);
}

.cl-badge--available {
	color: var(--sw-green-500, #1E7A4B);
	background: var(--sw-green-100, #E6F2EB);
}

.cl-badge--reserved {
	color: var(--sw-amber-500, #B8720E);
	background: var(--sw-amber-100, #FBF1E1);
}

.cl-badge--sold {
	color: var(--sw-red-500, #B4232A);
	background: var(--sw-red-100, #FAEAEA);
}

.cl-badge--incoming {
	color: var(--sw-navy-800, #141A33);
	background: var(--sw-band-300, #DFF1FB);
}

.cl-vehicle-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 8px;
	padding: 18px 20px 22px;
}

.cl-vehicle-card__title {
	margin: 0;
	font-size: 1.15rem;
	line-height: 1.3;
}

.cl-vehicle-card__title a {
	color: var(--cl-color-text);
	text-decoration: none;
}

.cl-vehicle-card__specs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.875rem;
	color: var(--cl-color-muted);
}

.cl-vehicle-card__specs li + li::before {
	content: "·";
	margin-right: 14px;
	color: var(--cl-color-border);
}

.cl-vehicle-card__excerpt {
	margin: 0;
	font-size: 0.9rem;
	color: var(--cl-color-muted);
}

.cl-vehicle-card__price {
	margin: 4px 0 0;
	font-size: 1.35rem;
	font-weight: 700;
	color: var(--cl-color-accent);
}

.cl-vehicle-card__financing {
	margin: 0;
	font-size: 0.8rem;
	color: var(--cl-color-muted);
}

.cl-vehicle-card__cta {
	margin-top: auto;
}

.cl-button {
	display: inline-block;
	padding: 11px 20px;
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: #fff;
	text-align: center;
	text-decoration: none;
	background: var(--cl-color-accent);
	border: 1px solid var(--cl-color-accent);
	border-radius: var(--sw-radius-control, 3px);
	cursor: pointer;
	transition: background-color 0.14s ease, border-color 0.14s ease;
}

.cl-button:hover {
	background: var(--sw-steel-600, #31598F);
	border-color: var(--sw-steel-600, #31598F);
	color: #fff;
}

.cl-button:focus-visible {
	outline: none;
	box-shadow: var(--sw-focus-ring, 0 0 0 3px rgba(61, 111, 180, 0.35));
}

/* --- Suche ------------------------------------------------------------- */

.cl-search {
	padding: 22px;
	background: var(--cl-color-surface);
	border: 1px solid var(--cl-color-border);
	border-radius: var(--cl-radius);
}

.cl-search__fields {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
}

@media (max-width: 782px) {
	.cl-search__fields {
		grid-template-columns: 1fr;
	}
}

.cl-search__field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0;
}

.cl-search__field label {
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--cl-color-muted);
}

.cl-search__field select,
.cl-search__field input {
	width: 100%;
	padding: 9px 12px;
	border: 1px solid var(--sw-border-default, #CFD3DC);
	border-radius: var(--sw-radius-control, 3px);
	background: #fff;
}

.cl-search__field select:focus,
.cl-search__field input:focus {
	outline: none;
	border-color: var(--sw-border-focus, #3D6FB4);
	box-shadow: var(--sw-focus-ring, 0 0 0 3px rgba(61, 111, 180, 0.35));
}

.cl-search__actions {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-top: 18px;
}

.cl-search__reset {
	font-size: 0.85rem;
	color: var(--cl-color-muted);
}

.cl-search__results:not([hidden]) {
	margin-top: 24px;
}

/* --- Datenblatt -------------------------------------------------------- */

.cl-specs__heading {
	margin: 28px 0 10px;
	font-size: 1.1rem;
}

.cl-specs__list {
	margin: 0;
	border: 1px solid var(--cl-color-border);
	border-radius: var(--cl-radius);
	overflow: hidden;
}

.cl-specs__row {
	display: grid;
	grid-template-columns: minmax(140px, 40%) 1fr;
	gap: 12px;
	padding: 10px 16px;
}

.cl-specs__row:nth-child(odd) {
	background: #f9fafb;
}

.cl-specs__label {
	margin: 0;
	font-weight: 600;
	color: var(--cl-color-muted);
}

.cl-specs__value {
	margin: 0;
}

.cl-empty {
	padding: 32px;
	text-align: center;
	color: var(--cl-color-muted);
	border: 1px dashed var(--cl-color-border);
	border-radius: var(--cl-radius);
}

/* --- Verkaufsbeschränkung ---------------------------------------------- */

/*
 * Trade- and export-only sales have to be obvious before anyone gets in touch,
 * so the card carries a full width bar across the bottom of the photo instead
 * of another small corner badge.
 */
.cl-restriction-bar {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	padding: 7px 12px;
	background: var(--sw-navy-800, #141A33);
	color: #fff;
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-align: center;
}

.cl-restriction-notice {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 10px;
	margin: 0 0 24px;
	padding: 14px 16px;
	max-width: none;
	background: var(--sw-amber-100, #FBF1E1);
	border-inline-start: 4px solid var(--sw-amber-500, #B8720E);
	border-radius: var(--sw-radius-control, 3px);
	color: var(--sw-grey-700, #3A404E);
	font-size: 0.9375rem;
	line-height: 1.5;
}

.cl-restriction-notice strong {
	color: var(--sw-amber-500, #B8720E);
	text-transform: uppercase;
	letter-spacing: 0.02em;
	font-size: 0.75rem;
	align-self: center;
}

/* --- Galerie ----------------------------------------------------------- */

.cl-gallery {
	margin: 0 0 24px;
}

.cl-gallery__stage {
	margin: 0;
	border-radius: var(--sw-radius-image, 4px);
	overflow: hidden;
	background: var(--sw-band-200, #E6F3FB);
}

.cl-gallery__stage img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 10;
	object-fit: cover;
}

.cl-gallery__thumbs {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
	gap: 8px;
	margin: 8px 0 0;
	padding: 0;
	list-style: none;
}

.cl-gallery .cl-gallery__thumb {
	display: block;
	width: 100%;
	padding: 0;
	background: none;
	border: 2px solid transparent;
	border-radius: var(--sw-radius-image, 4px);
	overflow: hidden;
	cursor: pointer;
	line-height: 0;
}

.cl-gallery .cl-gallery__thumb img {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 10;
	object-fit: cover;
}

.cl-gallery .cl-gallery__thumb.is-active {
	border-color: var(--sw-steel-500, #3D6FB4);
}

.cl-gallery .cl-gallery__thumb:focus-visible {
	outline: none;
	box-shadow: var(--sw-focus-ring, 0 0 0 3px rgba(61, 111, 180, 0.35));
}

/* --- Video -------------------------------------------------------------- */

.cl-video {
	margin: 0 0 24px;
}

.cl-video video,
.cl-video iframe {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	border: 0;
	border-radius: var(--sw-radius-image, 4px);
	background: #000;
}

.cl-video .cl-video__start {
	position: relative;
	display: grid;
	place-items: center;
	gap: 8px;
	width: 100%;
	aspect-ratio: 16 / 9;
	padding: 0;
	background-color: var(--sw-navy-800, #141A33);
	background-position: center;
	background-size: cover;
	border: 0;
	border-radius: var(--sw-radius-image, 4px);
	color: #fff;
	cursor: pointer;
}

.cl-video .cl-video__start::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(11, 14, 28, 0.55);
	border-radius: inherit;
}

.cl-video__icon,
.cl-video__label {
	position: relative;
	z-index: 1;
}

.cl-video__icon {
	display: grid;
	place-items: center;
	width: 64px;
	height: 64px;
	background: rgba(255, 255, 255, 0.15);
	border: 2px solid #fff;
	border-radius: 50%;
	font-size: 22px;
}

.cl-video__label {
	font-weight: 600;
	font-size: 0.875rem;
	letter-spacing: 0.02em;
}

.cl-video__note {
	margin-top: 6px;
	font-size: 0.8125rem;
	color: var(--cl-color-muted, #767D8C);
}

/* --- Seitennavigation --------------------------------------------------- */

/*
 * Groß genug für den Daumen (48 px), mittig, mit einer Statuszeile in der
 * Datenschrift der Marke. Die Trennlinie darüber setzt die Navigation vom
 * Raster ab, ohne einen weiteren Block zu bauen.
 */
.cl-pagination {
	margin-top: 48px;
	padding-top: 32px;
	border-top: 1px solid var(--cl-color-border);
	text-align: center;
}

.cl-pagination__status {
	/* Absätze erben eine Lesebreite aus brand.css — hier stört sie die Mitte. */
	max-width: none;
	margin: 0 0 16px;
	font-family: var(--sw-font-mono, monospace);
	font-size: 0.8125rem;
	letter-spacing: 0.02em;
	color: var(--cl-color-muted);
}

.cl-pagination__list {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cl-pagination__list > li {
	margin: 0;
}

.cl-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 48px;
	height: 48px;
	padding-inline: 14px;
	border: 1px solid var(--cl-color-border);
	border-radius: var(--sw-radius-control, 3px);
	background: var(--cl-color-surface);
	color: var(--sw-navy-800, #141A33);
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.cl-pagination a.page-numbers:hover {
	border-color: var(--sw-navy-800, #141A33);
	background: var(--sw-band-200, #E6F3FB);
}

.cl-pagination .page-numbers.current {
	background: var(--sw-navy-800, #141A33);
	border-color: var(--sw-navy-800, #141A33);
	color: #fff;
}

.cl-pagination .page-numbers.dots {
	min-width: 32px;
	padding-inline: 0;
	border-color: transparent;
	background: none;
	color: var(--cl-color-muted);
}

.cl-pagination .prev,
.cl-pagination .next {
	padding-inline: 20px;
}

.cl-pagination__arrow {
	font-size: 1.05rem;
	line-height: 1;
}

.cl-pagination .page-numbers:focus-visible {
	outline: none;
	box-shadow: var(--sw-focus-ring, 0 0 0 3px rgba(61, 111, 180, 0.35));
}

@media (max-width: 640px) {
	/* Auf dem Telefon zählen die Ziffern; die Wörter kosten nur Platz. */
	.cl-pagination__word {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.cl-pagination .prev,
	.cl-pagination .next {
		padding-inline: 14px;
	}
}
