/**
 * SP Shop Filters - front-end styles.
 * Inherits theme font; colours from CSS variables injected inline.
 */

.spsf-wrapper {
	width: 100%;
	font-family: inherit;
	position: relative;
}

.spsf-layout {
	display: grid;
	grid-template-columns: 280px 1fr;
	gap: 32px;
	align-items: start;
}

/* ============ Sidebar ============ */
.spsf-sidebar {
	position: relative;
}

.spsf-sidebar-head {
	display: none; /* visible only in mobile drawer */
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
}

.spsf-sidebar-title {
	font-family: inherit;
	font-size: 22px;
	font-weight: 800;
	margin: 0;
}

.spsf-sidebar-close {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: 1px solid rgba(0,0,0,0.15);
	background: #fff;
	font-size: 22px;
	cursor: pointer;
	line-height: 1;
}

.spsf-filter-group {
	padding: 20px 0;
	border-bottom: 1px solid rgba(0,0,0,0.10);
}
.spsf-filter-group:first-child { padding-top: 4px; }

.spsf-group-title {
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
	margin-bottom: 14px;
}

/* In-stock switch */
.spsf-switch {
	display: flex;
	align-items: center;
	gap: 12px;
	cursor: pointer;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
}

.spsf-switch input { display: none; }

.spsf-switch-track {
	position: relative;
	width: 44px;
	height: 24px;
	background: #ccc;
	border-radius: 999px;
	transition: background 0.2s ease;
	flex: 0 0 auto;
	order: 2;
	margin-left: auto;
}

.spsf-switch-track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	background: #fff;
	border-radius: 50%;
	transition: transform 0.2s ease;
}

.spsf-switch input:checked + .spsf-switch-track {
	background: var(--spsf-primary, #3C0008);
}
.spsf-switch input:checked + .spsf-switch-track::after {
	transform: translateX(20px);
}
.spsf-switch-label { order: 1; }

/* ============ Price range slider ============ */
.spsf-price-group { padding-top: 20px; }

.spsf-range {
	position: relative;
	margin: 16px 8px 28px;
	height: 18px;
}

.spsf-range-track {
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	transform: translateY(-50%);
	height: 3px;
	background: rgba(0,0,0,0.14);
	border-radius: 3px;
}

.spsf-range-fill {
	position: absolute;
	height: 100%;
	background: var(--spsf-primary, #3C0008);
	border-radius: 3px;
}

.spsf-wrapper .spsf-range-input {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 18px;
	margin: 0;
	padding: 0 !important;
	background: transparent !important;
	background-color: transparent !important;
	background-image: none !important;
	border: none !important;
	border-radius: 0 !important;
	pointer-events: none;
	-webkit-appearance: none !important;
	-moz-appearance: none !important;
	appearance: none !important;
	box-shadow: none !important;
	outline: none !important;
}

/* Hide native WebKit track entirely so only our custom track shows */
.spsf-wrapper .spsf-range-input::-webkit-slider-runnable-track {
	-webkit-appearance: none;
	appearance: none;
	background: transparent !important;
	border: none !important;
	height: 18px;
	box-shadow: none !important;
}

.spsf-wrapper .spsf-range-input::-webkit-slider-thumb {
	-webkit-appearance: none !important;
	appearance: none !important;
	pointer-events: auto;
	width: 16px !important;
	height: 16px !important;
	border-radius: 50% !important;
	background: #fff !important;
	border: 4px solid var(--spsf-primary, #3C0008) !important;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0,0,0,0.2) !important;
	transition: transform 0.15s ease;
	margin-top: 1px;
}
.spsf-wrapper .spsf-range-input::-webkit-slider-thumb:hover { transform: scale(1.12); }
.spsf-wrapper .spsf-range-input::-webkit-slider-thumb:active { transform: scale(1.12); }

.spsf-wrapper .spsf-range-input::-moz-range-track {
	background: transparent !important;
	border: none !important;
	height: 18px;
}
.spsf-wrapper .spsf-range-input::-moz-range-thumb {
	pointer-events: auto;
	width: 16px !important;
	height: 16px !important;
	border-radius: 50% !important;
	background: #fff !important;
	border: 4px solid var(--spsf-primary, #3C0008) !important;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0,0,0,0.2) !important;
}
.spsf-wrapper .spsf-range-input::-moz-range-progress { background: transparent !important; }

/* Number boxes */
.spsf-price-inputs {
	display: flex;
	align-items: center;
	gap: 10px;
}

.spsf-price-box {
	display: flex;
	align-items: center;
	gap: 6px;
	flex: 1;
	min-width: 0;
	background: #fafafa;
	border: 1px solid rgba(0,0,0,0.12);
	border-radius: 10px;
	padding: 11px 14px;
	transition: border-color 0.2s ease, background 0.2s ease;
}
.spsf-price-box:focus-within {
	border-color: var(--spsf-primary, #3C0008);
	background: #fff;
}

.spsf-cur { opacity: 0.5; font-size: 13px; flex: 0 0 auto; }

.spsf-wrapper .spsf-price-box input {
	width: 100%;
	min-width: 0;
	border: none !important;
	background: transparent !important;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	text-align: left;
	color: inherit;
	-moz-appearance: textfield;
	box-shadow: none !important;
	padding: 0 !important;
	margin: 0 !important;
	height: auto !important;
	outline: none;
}
.spsf-price-box input::-webkit-outer-spin-button,
.spsf-price-box input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.spsf-price-to { font-size: 13px; opacity: 0.5; flex: 0 0 auto; font-weight: 500; }

/* ============ Attribute checks ============ */
.spsf-attr-options {
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-height: 220px;
	overflow: auto;
}

.spsf-check {
	display: flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	font-family: inherit;
	font-size: 14px;
}

.spsf-check input { width: 16px; height: 16px; accent-color: var(--spsf-primary, #3C0008); }

.spsf-filter-actions { padding-top: 16px; }

.spsf-clear {
	background: none;
	border: none;
	color: var(--spsf-primary, #3C0008);
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: underline;
	padding: 0;
}

.spsf-mobile-apply { display: none; }

/* ============ Main / toolbar ============ */
.spsf-main { position: relative; min-height: 200px; }

.spsf-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 26px;
	padding-bottom: 18px;
	border-bottom: 1px solid rgba(0,0,0,0.08);
	flex-wrap: wrap;
}

.spsf-result-count {
	font-family: inherit;
	font-size: 14px;
	opacity: 0.6;
}

.spsf-sort {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-left: auto;
}

.spsf-sort-label { font-family: inherit; font-size: 14px; opacity: 0.65; }

.spsf-wrapper .spsf-orderby {
	font-family: inherit;
	font-size: 14px;
	font-weight: 500;
	color: inherit;
	height: auto;
	line-height: 1.4;
	padding: 11px 40px 11px 20px !important;
	border-radius: 999px !important;
	border: 1px solid rgba(0,0,0,0.2) !important;
	background-color: #fff !important;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%233C0008' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
	background-repeat: no-repeat !important;
	background-position: right 16px center !important;
	cursor: pointer;
	-webkit-appearance: none !important;
	-moz-appearance: none !important;
	appearance: none !important;
	box-shadow: none !important;
	transition: border-color 0.2s ease;
	width: auto;
	max-width: 260px;
}
.spsf-wrapper .spsf-orderby:hover { border-color: var(--spsf-primary, #3C0008) !important; }
.spsf-wrapper .spsf-orderby:focus { outline: none; border-color: var(--spsf-primary, #3C0008) !important; }

/* ============ Product grid ============ */
.spsf-grid {
	display: grid;
	gap: 28px 20px;
	/* columns injected inline */
}

.spsf-empty {
	grid-column: 1 / -1;
	text-align: center;
	padding: 40px 0;
	opacity: 0.7;
}

/* Card (mirrors trending cards) */
.spsf-card { display: flex; flex-direction: column; text-align: center; }

.spsf-card-media { position: relative; margin-bottom: 12px; }

.spsf-section .spsf-card-img,
.spsf-card-img {
	display: block;
	position: relative;
	border-radius: 12px;
	overflow: hidden;
	background: #f3f3f3;
	aspect-ratio: auto !important;
}

.spsf-section .spsf-card-img img,
.spsf-card-img img {
	width: 100% !important;
	height: auto !important;
	max-width: 100% !important;
	object-fit: fill !important;
	display: block;
	transition: transform 0.3s ease, opacity 0.4s ease;
}

.spsf-card-img .spsf-img-main { position: relative; z-index: 1; }

.spsf-card-img .spsf-img-hover {
	position: absolute !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	opacity: 0;
	z-index: 2;
}
.spsf-card-img.has-hover:hover .spsf-img-hover { opacity: 1; }
.spsf-card-img.has-hover:hover .spsf-img-main { opacity: 0; }
.spsf-card-img:not(.has-hover):hover img { transform: scale(1.04); }

.spsf-addcart {
	position: absolute;
	left: 50%;
	bottom: 14px;
	transform: translate(-50%, 10px);
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	padding: 11px 22px;
	border-radius: 999px;
	background: var(--spsf-primary, #3C0008);
	color: var(--spsf-accent, #F5F5DC);
	text-decoration: none !important;
	box-shadow: 0 3px 12px rgba(0,0,0,0.22);
	opacity: 0;
	transition: opacity 0.25s ease, transform 0.25s ease;
	pointer-events: none;
}

.spsf-card-media:hover .spsf-addcart {
	opacity: 1;
	transform: translate(-50%, 0);
	pointer-events: auto;
}

.spsf-addcart:hover { opacity: 0.92; }
.spsf-addcart.is-loading { opacity: 0.75; }
.spsf-addcart.is-added { background: #2e7d32 !important; color: #fff !important; }

/* Hide any WooCommerce-appended "View cart" link inside cards. */
.spsf-section .added_to_cart,
.spsf-card .added_to_cart,
.spsf-card-media .added_to_cart {
	display: none !important;
}

.spsf-card-title {
	font-family: inherit;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.35;
	color: inherit;
	text-decoration: none !important;
	margin-bottom: 6px;
}
.spsf-card-title:hover { opacity: 0.8; }

.spsf-card-price {
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	opacity: 0.85;
}
.spsf-card-price del { opacity: 0.5; font-weight: 400; margin-right: 6px; }
.spsf-card-price ins { text-decoration: none; }

/* Load more */
.spsf-loadmore-wrap { display: flex; justify-content: center; margin-top: 32px; }
.spsf-loadmore {
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	padding: 13px 34px;
	border-radius: 999px;
	border: 1.5px solid var(--spsf-primary, #3C0008);
	background: transparent;
	color: var(--spsf-primary, #3C0008);
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}
.spsf-loadmore:hover { background: var(--spsf-primary, #3C0008); color: var(--spsf-accent, #F5F5DC); }

/* Loading overlay */
.spsf-loading-overlay {
	position: absolute;
	inset: 0;
	display: none;
	align-items: flex-start;
	justify-content: center;
	background: rgba(255,255,255,0.6);
	z-index: 5;
	padding-top: 80px;
}
.spsf-loading-overlay.is-on { display: flex; }
.spsf-spinner {
	width: 38px; height: 38px;
	border: 3px solid rgba(0,0,0,0.15);
	border-top-color: var(--spsf-primary, #3C0008);
	border-radius: 50%;
	animation: spsf-spin 0.8s linear infinite;
}
@keyframes spsf-spin { to { transform: rotate(360deg); } }

/* Mobile filter toggle (hidden on desktop) */
.spsf-filter-toggle { display: none; }

/* ============ Responsive ============ */
@media (max-width: 1024px) {
	.spsf-layout { grid-template-columns: 240px 1fr; gap: 24px; }
}

@media (max-width: 768px) {
	.spsf-filter-toggle {
		display: inline-flex !important;
		align-items: center;
		gap: 8px;
		font-family: inherit;
		font-size: 15px;
		font-weight: 600;
		color: inherit;
		padding: 10px 20px;
		border-radius: 999px;
		border: 1px solid rgba(0,0,0,0.25);
		background: #fff;
		cursor: pointer;
		margin-bottom: 16px;
	}
	.spsf-filter-toggle svg { display: block; }

	.spsf-layout { grid-template-columns: 1fr; }

	/* Toolbar: stack count and sort on small screens */
	.spsf-toolbar {
		gap: 12px;
	}
	.spsf-sort { margin-left: 0; }
	.spsf-wrapper .spsf-orderby { max-width: 100%; }

	/* Product cards: hide hover quick-view, contain add-to-cart in each card */
	.spsf-card-media { display: flex; flex-direction: column; }
	.spsf-quickview { display: none !important; }
	.spsf-card-media .spsf-addcart {
		position: static !important;
		left: auto !important;
		right: auto !important;
		top: auto !important;
		bottom: auto !important;
		transform: none !important;
		opacity: 1 !important;
		visibility: visible !important;
		pointer-events: auto !important;
		margin: 10px 0 0 !important;
		width: 100% !important;
		max-width: 100% !important;
		box-sizing: border-box !important;
		box-shadow: none !important;
		font-size: 13px;
		padding: 10px 12px;
	}

	/* Sidebar becomes a slide-in drawer */
	.spsf-sidebar {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		width: 86%;
		max-width: 360px;
		background: #fff;
		z-index: 100000;
		padding: 20px;
		overflow-y: auto;
		transform: translateX(-100%);
		transition: transform 0.3s ease;
		box-shadow: 4px 0 24px rgba(0,0,0,0.18);
	}
	.spsf-sidebar-open .spsf-sidebar { transform: translateX(0); }
	.spsf-sidebar-head { display: flex; }

	body.spsf-lock { overflow: hidden; }

	.spsf-mobile-apply {
		display: block;
		position: sticky;
		bottom: 0;
		padding-top: 14px;
		background: #fff;
	}
	.spsf-view-results {
		width: 100%;
		font-family: inherit;
		font-size: 16px;
		font-weight: 700;
		padding: 16px;
		border-radius: 999px;
		border: none;
		background: var(--spsf-primary, #3C0008);
		color: var(--spsf-accent, #F5F5DC);
		cursor: pointer;
	}

	/* Dim backdrop when drawer open */
	.spsf-sidebar-open::before {
		content: "";
		position: fixed;
		inset: 0;
		background: rgba(0,0,0,0.45);
		z-index: 99999;
	}
}

/* ============ Quick view icon ============ */
.spsf-quickview {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 4;
	width: 42px;
	height: 42px;
	min-width: 42px;
	padding: 0;
	margin: 0;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	border-radius: 50% !important;
	border: none;
	background: #fff !important;
	color: var(--spsf-primary, #3C0008) !important;
	box-shadow: 0 2px 12px rgba(0,0,0,0.25);
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transform: scale(0.85);
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease, background 0.2s ease, color 0.2s ease;
	pointer-events: none;
	line-height: 0;
}
.spsf-quickview svg {
	display: block;
	width: 20px;
	height: 20px;
	stroke: currentColor;
}
.spsf-card-media:hover .spsf-quickview {
	opacity: 1;
	visibility: visible;
	transform: scale(1);
	pointer-events: auto;
}
.spsf-quickview:hover {
	background: var(--spsf-primary, #3C0008) !important;
	color: #fff !important;
	transform: scale(1.08);
}

@media (hover: none) {
	/* No hover on touch: hide quick-view icon, contain add-to-cart in its card. */
	.spsf-card-media {
		display: flex;
		flex-direction: column;
	}
	.spsf-quickview { display: none !important; }
	.spsf-card-media .spsf-addcart {
		position: static !important;
		left: auto !important;
		right: auto !important;
		top: auto !important;
		bottom: auto !important;
		transform: none !important;
		opacity: 1 !important;
		visibility: visible !important;
		pointer-events: auto !important;
		margin: 10px 0 0 !important;
		width: 100% !important;
		max-width: 100% !important;
		box-sizing: border-box !important;
		box-shadow: none !important;
	}
}

/* ============ Quick view modal ============ */
.spsf-modal { position: fixed; inset: 0; z-index: 100001; display: none; }
.spsf-modal.is-open { display: block; }
.spsf-modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(2px); }
.spsf-modal-dialog {
	position: relative;
	z-index: 1;
	max-width: 920px;
	width: calc(100% - 40px);
	max-height: calc(100vh - 60px);
	margin: 30px auto;
	background: #fff;
	border-radius: 16px;
	overflow: auto;
	box-shadow: 0 20px 60px rgba(0,0,0,0.3);
	animation: spsf-modal-in 0.25s ease;
}
@keyframes spsf-modal-in { from { opacity: 0; transform: translateY(16px);} to { opacity: 1; transform: translateY(0);} }
.spsf-modal-close {
	position: absolute; top: 14px; right: 14px; z-index: 3;
	width: 40px; height: 40px; border-radius: 50%;
	border: 1px solid rgba(0,0,0,0.15); background: #fff;
	font-size: 24px; line-height: 1; cursor: pointer; color: #333;
}
.spsf-modal-close:hover { background: #f2f2f2; }
.spsf-modal-loading { padding: 60px 20px; text-align: center; color: #777; font-family: inherit; }

.spsf-qv { display: grid; grid-template-columns: 1fr 1fr; }
.spsf-qv-gallery { background: #f7f7f7; }
.spsf-qv-gallery img { width: 100%; height: 100%; object-fit: cover; display: block; aspect-ratio: 1 / 1; }
.spsf-qv-info { padding: 36px 32px; font-family: inherit; display: flex; flex-direction: column; gap: 16px; }
.spsf-qv-title { font-family: inherit; font-size: 26px; font-weight: 800; line-height: 1.15; margin: 0; }
.spsf-qv-price { font-family: inherit; font-size: 20px; font-weight: 600; }
.spsf-qv-price del { opacity: 0.5; font-weight: 400; margin-right: 8px; }
.spsf-qv-price ins { text-decoration: none; }
.spsf-qv-desc { font-family: inherit; font-size: 15px; line-height: 1.6; }
.spsf-qv-desc p { margin: 0 0 8px; }
.spsf-qv-addcart {
	display: inline-flex; align-items: center; justify-content: center;
	font-family: inherit; font-size: 15px; font-weight: 600;
	padding: 13px 26px; border-radius: 999px;
	background: var(--spsf-primary, #3C0008); color: var(--spsf-accent, #F5F5DC);
	border: 1.5px solid var(--spsf-primary, #3C0008);
	text-decoration: none !important; cursor: pointer;
}
.spsf-qv-addcart:hover { opacity: 0.92; }
.spsf-qv-details {
	display: inline-flex; align-items: center; justify-content: space-between; gap: 10px;
	margin-top: 4px; padding-top: 16px; border-top: 1px solid rgba(0,0,0,0.12);
	font-family: inherit; font-size: 15px; color: inherit; text-decoration: none !important;
}
.spsf-qv-details:hover { opacity: 0.8; }

@media (max-width: 768px) {
	.spsf-qv { grid-template-columns: 1fr; }
	.spsf-qv-info { padding: 22px 18px; }
	.spsf-qv-title { font-size: 22px; }
	.spsf-modal-dialog { margin: 16px auto; width: calc(100% - 24px); }
}
