/*
 * lpfs-front.css
 * Structural layout CSS for the LPFS front-end shortcodes.
 * Layout only — no colors, fonts, or visual opinions.
 * Theme / Elementor handles all visual styling on top of this.
 */

/* ==========================================================================
   1. Filter sidebar
   ========================================================================== */

.lpfs-filters {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

/* Inner wrapper holds the actual filter widgets. On desktop it's just a
   pass-through (flex column for natural stacking). On mobile it becomes a
   single-row CSS grid whose row height animates from 0fr to 1fr so the
   expand reveals at the content's natural height with a smooth transition. */
.lpfs-filters__list {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

/* Mobile filter toggle — desktop hides the button entirely; the filters are
   always visible. Below 768px the button shows and the rest of the sidebar
   collapses until the user expands it. */
.lpfs-filters__mobile-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	background: none;
	border: 1px solid currentColor;
	cursor: pointer;
	padding: 0.6rem 1rem;
	width: 100%;
}

@media (max-width: 767px) {
	.lpfs-filters__mobile-toggle {
		display: inline-flex;
	}

	/* Animating grid row from 0fr to 1fr smoothly reveals the content at its
	   natural height (no need to guess a max-height). Supported in all
	   current major browsers (Chrome 117+, Safari 16+, Firefox 124+).
	   The inner list needs overflow:hidden + min-height:0 so it's actually
	   clipped at the row boundary while collapsed. */
	.lpfs-filters__inner {
		display: grid;
		grid-template-rows: 0fr;
		transition: grid-template-rows 0.25s ease;
	}

	.lpfs-filters__list {
		overflow: hidden;
		min-height: 0;
	}

	.lpfs-filters--open .lpfs-filters__inner {
		grid-template-rows: 1fr;
	}
}

.lpfs-filter__label {
	display: block;
	font-weight: bold;
}

.lpfs-filter__range-pair {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.5rem;
}

/* Multi-select Tom Select fields (brand, model): allow chips to wrap onto
   multiple lines instead of overflowing horizontally. Tom Select uses a
   flex .ts-control with default flex-wrap:nowrap. */
.lpfs-filter--select .ts-wrapper.multi .ts-control {
	flex-wrap: wrap;
}

/* ==========================================================================
   2. Collapsible checkbox groups
   ========================================================================== */

.lpfs-filter__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	text-align: left;
}

.lpfs-filter__arrow {
	flex-shrink: 0;
	transition: transform 0.2s ease;
}

.lpfs-filter--collapsed .lpfs-filter__arrow {
	transform: rotate(180deg);
}

.lpfs-filter__options {
	display: flex;
	flex-direction: column;
}

.lpfs-filter__options[hidden] {
	display: none;
}

.lpfs-checkbox-item {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 0.5rem;
}

/* ==========================================================================
   3. Results header
   ========================================================================== */

.lpfs-results-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.lpfs-results-header__left {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.lpfs-results-header__right {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

/* ==========================================================================
   4. Badges
   ========================================================================== */

.lpfs-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem;
}

.lpfs-badges[hidden] {
	display: none;
}

.lpfs-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.2em 0.55em;
	border-radius: 2em;
}

.lpfs-badge__dismiss {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	line-height: 1;
}

.lpfs-clear-all {
	font-size: 0.8em;
	cursor: pointer;
}

.lpfs-result-count:empty {
	display: none;
}

.lpfs-filters-active {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-bottom: 1rem;
}

.lpfs-filters-active__heading {
	margin: 0;
}

/* ==========================================================================
   5. View switcher
   ========================================================================== */

.lpfs-view-switcher {
	display: flex;
}

.lpfs-view-btn {
	width: 2rem;
	height: 2rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid currentColor;
	background: none;
	cursor: pointer;
	opacity: 0.4;
	padding: 0;
}

.lpfs-view-btn.is-active {
	opacity: 1;
}

/* ==========================================================================
   6. Results grid
   ========================================================================== */

.lpfs-results--list {
	display: flex;
	flex-direction: column;
}

.lpfs-results--grid {
	display: grid;
	gap: 1rem;
}

.lpfs-results--grid > * {
	min-width: 0;
}

.lpfs-results--grid[data-lpfs-columns="2"] {
	grid-template-columns: repeat(2, 1fr);
}

.lpfs-results--grid[data-lpfs-columns="3"] {
	grid-template-columns: repeat(3, 1fr);
}

.lpfs-results--grid[data-lpfs-columns="4"] {
	grid-template-columns: repeat(4, 1fr);
}

/* Responsive grid overrides. At <= 1024px the JS forces list view, so
   grid breakpoints below that are unreachable. Above 1200px the per-value
   [data-lpfs-columns] rules above apply (default 3). Between 1025 and
   1200 we squeeze to 2 columns because the filters sidebar still
   occupies real estate at that width.
   The [data-lpfs-columns] (no value) selector has the same specificity
   as the per-value rules, so source order wins. */
@media (min-width: 1025px) and (max-width: 1200px) {
	.lpfs-results--grid[data-lpfs-columns] {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* Below 1025px the view switcher is hidden — JS forces list view so the
   toggle has nothing useful to do. */
@media (max-width: 1024px) {
	.lpfs-view-switcher {
		display: none;
	}

	/* Pre-empty the grid layout to a single column while JS is debouncing
	   the resize event (~100ms). Without this, dragging from 1200px down
	   briefly shows 3-col grid before the JS swaps the class to list view.
	   Once JS runs the class is swapped to .lpfs-results--list and the
	   grid rules no longer apply at all. */
	.lpfs-results--grid[data-lpfs-columns] {
		grid-template-columns: 1fr;
	}
}

/* ==========================================================================
   7. Card — shared
   ========================================================================== */

.lpfs-card {
	display: block;
	text-decoration: none;
}

.lpfs-card__image {
	background-size: cover;
	background-position: center;
}

.lpfs-card__uitvoering {
	font-size: 0.85em;
	opacity: 0.65;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

/* ==========================================================================
   8. Lease calculator
   ========================================================================== */

.lpfs-lease-calculator {
	display: grid;
	gap: 1rem;
	margin: 1.5rem 0;
}

.lpfs-lease-calculator__title,
.lpfs-lease-calculator__intro,
.lpfs-lease-calculator__disclaimer {
	margin: 0;
}

.lpfs-lease-calculator__rows {
	display: grid;
	gap: 0.875rem;
}

.lpfs-lease-calculator__row {
	display: grid;
	gap: 0.35rem;
}

.lpfs-lease-calculator__row--static {
	gap: 0.15rem;
}

.lpfs-lease-calculator__label {
	display: block;
}

.lpfs-lease-calculator__value,
.lpfs-lease-calculator__result-main {
	font-weight: 600;
}

.lpfs-lease-calculator__input-wrap {
	position: relative;
	display: flex;
	align-items: center;
}

.lpfs-lease-calculator__prefix {
	position: absolute;
	left: 0.75rem;
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
}

.lpfs-lease-calculator__input {
	width: 100%;
	min-height: 2.75rem;
	padding: 0.65rem 0.85rem;
}

.lpfs-lease-calculator__input-wrap--currency .lpfs-lease-calculator__input {
	padding-left: 1.8rem;
}

.lpfs-lease-calculator__result {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1rem;
}

.lpfs-lease-calculator__result-value {
	font-size: 1.5rem;
	font-weight: 700;
}

.lpfs-lease-calculator__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: fit-content;
	text-decoration: none;
	padding: 0.8rem 1.2rem;
	border: 1px solid currentColor;
}

.lpfs-lease-calculator__feedback:empty {
	display: none;
}

.lpfs-lease-calculator.is-loading .lpfs-lease-calculator__result-value {
	opacity: 0.6;
}

.lpfs-offerte-overzicht {
	display: grid;
	gap: 1rem;
	margin: 1.5rem 0;
}

.lpfs-offerte-overzicht__title {
	margin: 0;
}

.lpfs-offerte-overzicht__car {
	display: grid;
	gap: 0.15rem;
}

.lpfs-offerte-overzicht__car-title {
	font-weight: 700;
}

.lpfs-offerte-overzicht__car-subtitle {
	opacity: 0.75;
}

.lpfs-offerte-overzicht__rows {
	display: grid;
	gap: 0.875rem;
}

.lpfs-offerte-overzicht__row {
	display: grid;
	gap: 0.2rem;
}

.lpfs-offerte-overzicht__value {
	font-weight: 600;
}

.lpfs-offerte-overzicht__row--highlight .lpfs-offerte-overzicht__value {
	font-size: 1.25rem;
	font-weight: 700;
}

.lpfs-offerte-overzicht__feedback:empty {
	display: none;
}

.lpfs-card__price {
	font-weight: bold;
}

.lpfs-card__specs {
	display: flex;
	flex-wrap: wrap;
	font-size: 0.85em;
	opacity: 0.7;
}

/* ==========================================================================
   8. Card — list layout
   ========================================================================== */

.lpfs-card--list {
	display: flex;
	flex-direction: row;
}

.lpfs-card--list .lpfs-card__image {
	aspect-ratio: 4 / 3;
	flex-shrink: 0;
}

.lpfs-card--list .lpfs-card__body {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	padding: 1rem;
}

.lpfs-card--list .lpfs-card__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

/* Mobile: stack the image above the body so the title doesn't get pushed
   off-screen by the fixed-width image. Theme/front-end CSS can override. */
@media (max-width: 1024px) {
	.lpfs-card--list {
		flex-direction: column;
	}

	.lpfs-card--list .lpfs-card__image {
		width: 100%;
		min-width: 0;
	}
}

/* Explicit image widths per viewport range. Higher selector specificity
   (.lpfs-results .lpfs-card--list .lpfs-card__image) wins over the base
   rule above. */
.lpfs-results .lpfs-card--list .lpfs-card__image {
	width: 350px;
	max-width: 100%;
}

@media only screen and (min-width: 881px) and (max-width: 1200px) {
	.lpfs-results .lpfs-card--list .lpfs-card__image {
		width: 250px;
	}
}

@media only screen and (max-width: 1024px) {
	.lpfs-results .lpfs-card--list .lpfs-card__image {
		width: 100%;
	}
}

/* ==========================================================================
   9. Card — grid layout
   ========================================================================== */

/* Card is a flex column so the body stretches the full card height.
   That, combined with margin-top:auto on the footer, anchors price + CTA
   to the bottom — so a long title on one card doesn't visually offset
   the price line of its neighbour in the same grid row. */
.lpfs-card--grid {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.lpfs-card--grid .lpfs-card__image {
	width: 100%;
	aspect-ratio: 4 / 3;
}

.lpfs-card--grid .lpfs-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 0.75rem;
}

.lpfs-card--grid .lpfs-card__specs {
	gap: 0.25rem;
	margin-top: 0.4em;
}

.lpfs-card--grid .lpfs-card__price {
	display: block;
	margin-top: 1.1em;
}

/* Grid: stack price and CTA vertically (no room to put them side by side).
   margin-top:auto pushes the footer to the bottom of the body, which is
   in turn stretched to the full card height. */
.lpfs-card--grid .lpfs-card__footer {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.4em;
	margin-top: auto;
	padding-top: 1.1em;
}

.lpfs-card--grid .lpfs-card__footer .lpfs-card__price {
	margin-top: 0;
}

.lpfs-pill {
	display: inline-block;
	padding: 0.15em 0.5em;
	border-radius: 2em;
	font-size: 0.8em;
}

/* ==========================================================================
   10. Empty state
   ========================================================================== */

.lpfs-empty {
	text-align: center;
	padding: 3rem;
}

.lpfs-empty__action {
	margin-top: 1rem;
	cursor: pointer;
}

/* ==========================================================================
   11. Pagination
   ========================================================================== */

.lpfs-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.375rem;
}

.lpfs-pagination[hidden] {
	display: none;
}

.lpfs-page-btn {
	width: 2.25rem;
	height: 2.25rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid currentColor;
	background: none;
	cursor: pointer;
	padding: 0;
}

.lpfs-page-btn.is-active {
	font-weight: bold;
}

.lpfs-page-btn:disabled {
	opacity: 0.3;
	cursor: default;
}

/* ==========================================================================
   12. Search
   ========================================================================== */

.lpfs-search__form {
	display: flex;
	gap: 0.5rem;
}

.lpfs-search__form input[type="search"],
.lpfs-search__form input[type="text"] {
	flex: 1;
}

.lpfs-search__form button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid currentColor;
	background: none;
	cursor: pointer;
}

/* ==========================================================================
   13. Total count
   ========================================================================== */

.lpfs-total-count {
	font-size: 0.9rem;
	opacity: 0.7;
}

/* ==========================================================================
   Single occasion — gallery + detail page structure
   ========================================================================== */

.lpfs-gallery {
	margin-bottom: 1.5rem;
}

.lpfs-gallery__main {
	width: 100%;
	aspect-ratio: 16 / 9;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	border-radius: 0.5rem;
}

.lpfs-gallery__thumbs {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.5rem;
	overflow-x: auto;
}

.lpfs-gallery__thumb {
	width: 80px;
	height: 60px;
	min-width: 80px;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	border-radius: 0.25rem;
	cursor: pointer;
	opacity: 0.6;
	border: 2px solid transparent;
	transition: opacity 0.2s ease;
}

.lpfs-gallery__thumb.is-active,
.lpfs-gallery__thumb:hover {
	opacity: 1;
}

/* --- Single page sections --- */
.lpfs-single__sold-notice {
	padding: 0.75rem 1rem;
	margin-bottom: 1rem;
	font-weight: 600;
}

.lpfs-single__title {
	margin-bottom: 0.25rem;
}

.lpfs-single__uitvoering {
	opacity: 0.65;
	margin-bottom: 1rem;
}

.lpfs-single__price {
	margin-bottom: 1rem;
}

.lpfs-single__price-value {
	font-size: 1.5em;
	font-weight: 700;
}

.lpfs-single__btw-badge {
	font-size: 0.8em;
	margin-left: 0.5rem;
	opacity: 0.7;
}

.lpfs-single__key-specs {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	list-style: none;
	padding: 0;
	margin: 0 0 1.5rem;
	font-size: 0.95em;
	opacity: 0.8;
}

.lpfs-single__specs {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.375rem 1.5rem;
	margin-bottom: 1.5rem;
}

.lpfs-single__specs dt {
	font-weight: 600;
}

.lpfs-single__specs dd {
	margin: 0;
}

.lpfs-single__options-list {
	columns: 2;
	column-gap: 2rem;
	padding-left: 1.25rem;
}

/* --- Breadcrumbs --- */
.lpfs-breadcrumbs {
	margin-bottom: 1rem;
	font-size: 0.85rem;
}

.lpfs-breadcrumbs__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem;
	list-style: none;
	padding: 0;
	margin: 0;
}

.lpfs-breadcrumbs__sep {
	opacity: 0.4;
}

.lpfs-breadcrumbs__current {
	opacity: 0.65;
}

/* ==========================================================================
   Voertuig fotogalerij — [lpfs_voertuig_galerij]
   Hero + thumbs + lightbox. Visual styling is intentionally minimal — the
   theme should override; only structural rules + the hover-arrows pattern
   live here.
   ========================================================================== */

.lpfs-photo-gallery {
	display: block;
	width: 100%;
}

.lpfs-photo-gallery__hero {
	position: relative;
	width: 100%;
	background: #f4f4f4;
	overflow: hidden;
}

.lpfs-photo-gallery__hero .swiper {
	width: 100%;
	/* Placeholder ratio matches the dominant feed dimension (1280x960 = 4:3).
	   JS rewrites --lpfs-gallery-aspect once the first image has loaded so
	   the hero fits the real ratio for that car (saves layout shift in the
	   common case while staying accurate for outliers). */
	aspect-ratio: var(--lpfs-gallery-aspect, 4 / 3);
}

.lpfs-photo-gallery__hero .swiper-slide {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f4f4f4;
}

.lpfs-photo-gallery__hero-link {
	display: block;
	width: 100%;
	height: 100%;
	cursor: zoom-in;
}

.lpfs-photo-gallery__hero-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Hover-only arrow nav over the hero. */
.lpfs-photo-gallery__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.lpfs-photo-gallery__hero:hover .lpfs-photo-gallery__nav:not(.swiper-button-disabled),
.lpfs-photo-gallery__hero:focus-within .lpfs-photo-gallery__nav:not(.swiper-button-disabled) {
	opacity: 1;
}

.lpfs-photo-gallery__nav--prev { left: 12px; }
.lpfs-photo-gallery__nav--next { right: 12px; }

.lpfs-photo-gallery__nav::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 10px;
	border-top: 2px solid #fff;
	border-right: 2px solid #fff;
	transform-origin: center;
}

.lpfs-photo-gallery__nav--prev::before {
	transform: translate(-30%, -50%) rotate(-135deg);
}

.lpfs-photo-gallery__nav--next::before {
	transform: translate(-70%, -50%) rotate(45deg);
}

.lpfs-photo-gallery__nav.swiper-button-disabled {
	opacity: 0;
	pointer-events: none;
}

/* Thumbs strip. */
.lpfs-photo-gallery__thumbs {
	margin-top: 8px;
}

.lpfs-photo-gallery__thumbs .swiper-slide {
	width: 90px;
	height: 60px;
	cursor: pointer;
	opacity: 0.55;
	transition: opacity 0.15s ease, outline-color 0.15s ease;
	outline: 2px solid transparent;
	outline-offset: -2px;
}

.lpfs-photo-gallery__thumbs .swiper-slide:hover {
	opacity: 0.85;
}

.lpfs-photo-gallery__thumbs .swiper-slide-thumb-active {
	opacity: 1;
	outline-color: currentColor;
}

.lpfs-photo-gallery__thumb-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ============================================================
 * KvK bedrijfsnaam autocomplete
 * Anchored to the field-group wrapper around the input. Structural
 * only — no theme opinions, the theme can override sizing/colors.
 * Max-height shows ~10 rows; the remaining ≤15 scroll inside.
 * ============================================================ */

.lpfs-kvk-suggest {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 50;
	max-height: 22.5em;
	overflow-y: auto;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-top: none;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
	margin-top: -1px;
}

.lpfs-kvk-suggest__item {
	display: block;
	width: 100%;
	padding: 0.5em 0.75em;
	background: transparent;
	border: none;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
	text-align: left;
	font: inherit;
	color: inherit;
	cursor: pointer;
	line-height: 1.35;
}

.lpfs-kvk-suggest__item:last-child {
	border-bottom: none;
}

.lpfs-kvk-suggest__item:hover,
.lpfs-kvk-suggest__item.is-active,
.lpfs-kvk-suggest__item:focus {
	background: rgba(0, 0, 0, 0.04);
	outline: none;
}

.lpfs-kvk-suggest__kvk {
	display: inline-block;
	font-variant-numeric: tabular-nums;
	opacity: 0.6;
	margin-right: 0.4em;
}

.lpfs-kvk-suggest__name {
	font-weight: 700;
}

.lpfs-kvk-suggest__address {
	opacity: 0.75;
}

.lpfs-kvk-suggest__loader,
.lpfs-kvk-suggest__empty,
.lpfs-kvk-suggest__error {
	padding: 0.6em 0.75em;
	font-style: italic;
	opacity: 0.7;
}

.lpfs-kvk-suggest__error {
	color: #b00020;
	opacity: 1;
	font-style: normal;
}
