/**
 * Custom AJAX Product Filter — base styles.
 * All classes are namespaced with `capf-` to avoid theme conflicts.
 * Intentionally lightweight/unopinionated — easy to override per site.
 */

/* ------------------------------------------------------------------ */
/* Filter bar                                                          */
/* ------------------------------------------------------------------ */

.capf-filters {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
	padding: 14px 20px;
	background: #fdf1e7;
	border-radius: 4px;
}

.capf-filters__field {
	display: flex;
	align-items: center;
}

.capf-filters__count {
	font-weight: 700;
	padding: 0 6px;
	min-width: 24px;
	text-align: center;
}

.capf-select {
	appearance: none;
	-webkit-appearance: none;
	background: transparent;
	border: none;
	font: inherit;
	padding: 6px 22px 6px 4px;
	cursor: pointer;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23333'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 4px center;
}

.capf-select:focus-visible {
	outline: 2px solid #1a56db;
	outline-offset: 2px;
}

.capf-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	user-select: none;
}

.capf-toggle input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.capf-toggle__switch {
	width: 34px;
	height: 18px;
	border-radius: 999px;
	background: #ccc;
	position: relative;
	transition: background-color 0.15s ease;
	flex-shrink: 0;
}

.capf-toggle__switch::after {
	content: '';
	position: absolute;
	top: 2px;
	left: 2px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #fff;
	transition: transform 0.15s ease;
}

.capf-toggle input:checked + .capf-toggle__switch {
	background: #1a56db;
}

.capf-toggle input:checked + .capf-toggle__switch::after {
	transform: translateX(16px);
}

.capf-toggle input:focus-visible + .capf-toggle__switch {
	outline: 2px solid #1a56db;
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Products wrapper / meta                                             */
/* ------------------------------------------------------------------ */

.capf-products-wrapper {
	position: relative;
}

.capf-products-wrapper.is-loading .capf-products-grid {
	opacity: 0.5;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

.capf-products-wrapper.is-loading::after {
	content: '';
	position: absolute;
	top: 40px;
	left: 50%;
	width: 28px;
	height: 28px;
	margin-left: -14px;
	border: 3px solid rgba(0, 0, 0, 0.15);
	border-top-color: #1a56db;
	border-radius: 50%;
	animation: capf-spin 0.7s linear infinite;
}

@keyframes capf-spin {
	to {
		transform: rotate(360deg);
	}
}

.capf-products-meta {
	margin: 12px 0;
	font-size: 14px;
	color: #555;
}

.capf-error-notice {
	background: #fdecea;
	color: #b3261e;
	padding: 10px 14px;
	border-radius: 4px;
	margin-bottom: 12px;
	font-size: 14px;
}

/* ------------------------------------------------------------------ */
/* Grid                                                                 */
/* ------------------------------------------------------------------ */

.capf-products-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
}

@media (max-width: 992px) {
	.capf-products-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 600px) {
	.capf-products-grid {
		grid-template-columns: 1fr;
	}

	.capf-filters {
		flex-direction: column;
		align-items: stretch;
	}
}

.capf-product-item {
	min-width: 0;
}

.capf-alternative-block {
	grid-column: 1 / -1;
	width: 100%;
}

.capf-no-products {
	grid-column: 1 / -1;
	padding: 40px 0;
	text-align: center;
	color: #666;
}

/* ------------------------------------------------------------------ */
/* Fallback card (used only when Elementor / the Loop Item template   */
/* is unavailable)                                                     */
/* ------------------------------------------------------------------ */

.capf-fallback-card {
	border: 1px solid #eee;
	border-radius: 6px;
	overflow: hidden;
}

.capf-fallback-card__link {
	display: block;
	color: inherit;
	text-decoration: none;
	padding: 12px;
}

.capf-fallback-card__image img {
	width: 100%;
	height: auto;
	display: block;
}

.capf-fallback-card__title {
	font-size: 15px;
	margin: 10px 0 4px;
}

.capf-fallback-card__price {
	font-weight: 700;
}

/* ------------------------------------------------------------------ */
/* Pagination                                                           */
/* ------------------------------------------------------------------ */

.capf-pagination {
	margin: 28px 0;
	display: flex;
	justify-content: center;
}

.capf-pagination__list {
	display: flex;
	list-style: none;
	gap: 6px;
	margin: 0;
	padding: 0;
}

.capf-pagination__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 34px;
	height: 34px;
	padding: 0 8px;
	border-radius: 4px;
	text-decoration: none;
	color: #333;
	border: 1px solid #ddd;
}

.capf-pagination__link.is-current {
	background: #1a56db;
	border-color: #1a56db;
	color: #fff;
}


/* =========================================================
   CAPF — EXACT COMPACT FILTER BAR
   ========================================================= */

.capf-filter-bar {
	width: 100%;
	padding: 0 !important;
	box-sizing: border-box;
	display: flex;
	align-items: stretch;
}

.capf-filters {
	width: 100%;
	height: 46px;
	padding: 0 !important;
	margin: 0 !important;

	display: flex !important;
	align-items: stretch !important;
	flex-wrap: nowrap !important;
	gap: 10px !important;

	background: transparent !important;
	border-radius: 0 !important;
	box-sizing: border-box;
}

/* ---------------------------------------------------------
   ALL FILTER ITEMS
--------------------------------------------------------- */

.capf-filters__field,
.capf-filters__count {
	height: 46px !important;
	box-sizing: border-box;
	display: flex;
	align-items: center;
}

/* ---------------------------------------------------------
   SELECT WRAPPERS
--------------------------------------------------------- */

.capf-filters__field--brand {
	width: 150px !important;
	flex: 0 0 150px !important;
}
.capf-filters__field.capf-filters__field--price {
    width: 130px;
}

.capf-filters__field--motor {
	width: 190px !important;
	flex: 0 0 190px !important;
}

.capf-filters__field--frame {
	width: 155px !important;
	flex: 0 0 155px !important;
}

.capf-filters__field--sort {
    width: 140px !important;
    flex: 0 0 140px !important;
    margin-left: 0 !important;
}

.capf-select {
	width: 100% !important;
	height: 42px !important;

	margin: 0 !important;
	padding: 0 28px 0 12px !important;

	border: 0 !important;
	border: 1px solid #1C537B !important;
	border-radius: 0 !important;

	background-color: transparent !important;
	color: #ffffff !important;

	font-family: inherit !important;
	font-size: 15px !important;
	font-weight: 400 !important;
	line-height: 210% !important;

	appearance: none !important;
	-webkit-appearance: none !important;
	-moz-appearance: none !important;

	background-image:
		linear-gradient(
			45deg,
			transparent 50%,
			#ffffff 50%
		),
		linear-gradient(
			135deg,
			#ffffff 50%,
			transparent 50%
		) !important;

	background-position:
		calc(100% - 14px) 20px,
		calc(100% - 10px) 20px !important;

	background-size:
		5px 5px,
		5px 5px !important;

	background-repeat: no-repeat !important;

	cursor: pointer;
}

.capf-select:hover,
.capf-select:focus {
	background-color: rgba(255,255,255,.06) !important;
	color: #ffffff !important;
	outline: none !important;
	box-shadow: none !important;
}

/* ---------------------------------------------------------
   COUNT
--------------------------------------------------------- */

.capf-filters__count {
    min-width: auto !important;
    width: 106px !important;
    flex: 0 0 106px !important;
    padding: 0 10px !important;
    background: transparent !important;
    border: 0 !important;
    color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    justify-content: center !important;
}

/* ---------------------------------------------------------
   SPACER
--------------------------------------------------------- */

.capf-filters__spacer {
	display: block !important;
	flex: 1 1 auto !important;
	min-width: 0 !important;
}

/* ---------------------------------------------------------
   DIRECT LEVERBAAR
--------------------------------------------------------- */

.capf-filters__field--stock {
	height: 46px !important;

	margin: 0 14px 0 12px !important;

	display: flex !important;
	align-items: center !important;
	flex: 0 0 auto !important;
}

.capf-toggle {
	height: 46px !important;

	display: inline-flex !important;
	align-items: center !important;

	gap: 8px !important;

	color: #ffffff !important;

	font-size: 15px !important;
	font-weight: 400 !important;

	white-space: nowrap !important;
}

.capf-toggle__switch {
	width: 28px !important;
	height: 16px !important;

	flex: 0 0 28px !important;

	background: rgba(255,255,255,.25) !important;
	border-radius: 20px !important;
}

.capf-toggle__switch::after {
	width: 12px !important;
	height: 12px !important;

	top: 2px !important;
	left: 2px !important;

	background: #ffffff !important;
	box-shadow: none !important;
}

.capf-toggle input:checked + .capf-toggle__switch {
	background: #ffffff !important;
}

.capf-toggle input:checked + .capf-toggle__switch::after {
	background: #12476b !important;
	transform: translateX(12px) !important;
}

/* ---------------------------------------------------------
   SORT
--------------------------------------------------------- */

.capf-filters__field--sort .capf-select {
	border: 1px solid #1C537B !important;
	border-radius: 6px;
}
.capf-select option {
    color: #123F60 !important;
}
.capf-load-more-wrapper {
    text-align: center;
    margin-top: 50px;
}
button.capf-load-more {
    border-radius: 3px;
    background: #F28C0B !important;
    display: inline-flex;
    gap: 10px;
    align-items: center;
}

/* ---------------------------------------------------------
   LOADING
--------------------------------------------------------- */

.capf-products-wrapper.is-loading {
	opacity: .65;
}

/* ---------------------------------------------------------
   DESKTOP — DO NOT WRAP
--------------------------------------------------------- */

@media (min-width: 769px) {

	.capf-filter-bar,
	.capf-filters {
		overflow: hidden !important;
	}

	.capf-filters__field {
		flex-shrink: 0 !important;
	}
}

/* ---------------------------------------------------------
   TABLET / MOBILE
--------------------------------------------------------- */

@media (max-width: 768px) {

	.capf-filter-bar {
		height: auto !important;
		min-height: 46px;
		overflow-x: auto !important;
		-webkit-overflow-scrolling: touch;
	}

	.capf-filters {
		width: max-content !important;
		min-width: 100% !important;
		height: 46px !important;
		flex-wrap: nowrap !important;
	}

	.capf-filters__spacer {
		min-width: 20px !important;
	}

	.capf-filters__field--brand {
		width: 130px !important;
		flex-basis: 130px !important;
	}

	.capf-filters__field--motor {
		width: 145px !important;
		flex-basis: 145px !important;
	}

	.capf-filters__field--frame {
		width: 135px !important;
		flex-basis: 135px !important;
	}

	.capf-filters__field--sort {
		width: 110px !important;
		flex-basis: 110px !important;
	}
}

/* Brand selector shortcode */
.capf-brand-list {
	width: 100%;
}
.capf-brand-list__items a, .capf-brand-list__back {
    display: inline-block;
    color: #123F60;
    font-size: 13px;
    font-weight: 400;
    border-radius: 6px;
    border: 1px solid #E8D9C8;
    padding: 5px 10px;
    margin: 0 5px 5px 0;
}
.capf-brand-list__back {
	cursor: pointer;
}
.capf-brand-list__back:hover, button.capf-brand-list__back:focus{
	background-color: transparent !important;
	color: #123F60;
}
