/**
 * Shop Filters — AJAX sidebar + off-canvas mobile drawer.
 *
 * @package CyberCanvas
 * @since   1.1.0
 */

/* ============================================================
   Layout wrapper — sidebar + products grid
   ============================================================ */
.cc-shop-layout {
	display: grid;
	gap: 32px;
	max-width: var(--cc-container, 1280px);
	margin: 0 auto;
	padding: 0 20px;
}
.cc-shop-layout--sidebar-left {
	grid-template-columns: 260px 1fr;
	grid-template-areas: "toggle toggle" "sidebar products";
}
.cc-shop-layout--sidebar-right {
	grid-template-columns: 1fr 260px;
	grid-template-areas: "toggle toggle" "products sidebar";
}

.cc-shop-filters__toggle { grid-area: toggle; }
.cc-shop-filters         { grid-area: sidebar; }
.cc-shop-products        { grid-area: products; }

/* ============================================================
   Mobile toggle button (visible < 768px only)
   ============================================================ */
.cc-shop-filters__toggle {
	display: none;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border: 1px solid var(--cc-border);
	border-radius: 10px;
	background: var(--cc-surface);
	color: var(--cc-text);
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
	width: fit-content;
	margin-bottom: 8px;
	transition: background 0.2s, border-color 0.2s;
}
.cc-shop-filters__toggle:hover {
	border-color: var(--cc-primary);
}

/* ============================================================
   Overlay (mobile)
   ============================================================ */
.cc-shop-filters__overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	z-index: 1000;
	opacity: 0;
	transition: opacity 0.25s;
}
.cc-shop-filters__overlay--visible {
	display: block;
	opacity: 1;
}

/* ============================================================
   Sidebar panel
   ============================================================ */
.cc-shop-filters {
	position: sticky;
	top: 100px;
	align-self: start;
	border-radius: 14px;
	background: var(--cc-surface);
	border: 1px solid var(--cc-border);
	padding: 20px;
	max-height: calc(100vh - 120px);
	overflow-y: auto;
}
[data-theme="dark"] .cc-shop-filters {
	background: var(--cc-surface);
}

/* Header (visible on mobile close btn) */
.cc-shop-filters__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
}
.cc-shop-filters__header h3 {
	font-family: var(--cc-font-heading);
	font-weight: var(--cc-font-heading-weight, 700);
	font-size: 1.1rem;
	color: var(--cc-heading);
	margin: 0;
}
.cc-shop-filters__close {
	display: none; /* visible on mobile only */
	background: none;
	border: none;
	font-size: 1.5rem;
	color: var(--cc-muted);
	cursor: pointer;
	padding: 0 4px;
}

/* ============================================================
   Filter sections
   ============================================================ */
.cc-shop-filters__section {
	margin-bottom: 20px;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--cc-border);
}
.cc-shop-filters__section:last-of-type {
	margin-bottom: 0;
	padding-bottom: 0;
	border-bottom: none;
}
.cc-shop-filters__section-title {
	font-family: var(--cc-font-heading);
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--cc-heading);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin: 0 0 10px;
}
.cc-shop-filters__section-body {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

/* Checkbox rows */
.cc-shop-filters__checkbox {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.88rem;
	color: var(--cc-text);
	cursor: pointer;
	padding: 4px 0;
	transition: color 0.15s;
}
.cc-shop-filters__checkbox:hover {
	color: var(--cc-primary);
}
.cc-shop-filters__checkbox input[type="checkbox"] {
	width: 16px;
	height: 16px;
	border-radius: 4px;
	accent-color: var(--cc-primary);
	cursor: pointer;
	flex-shrink: 0;
}
.cc-shop-filters__count {
	margin-left: auto;
	font-size: 0.78rem;
	color: var(--cc-muted);
}

/* ============================================================
   Price slider
   ============================================================ */
.cc-shop-filters__price-slider {
	position: relative;
	height: 30px;
	margin: 10px 0 4px;
}
.cc-price-range {
	-webkit-appearance: none;
	appearance: none;
	position: absolute;
	width: 100%;
	height: 4px;
	background: transparent;
	pointer-events: none;
	top: 50%;
	transform: translateY(-50%);
}
.cc-price-range::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--cc-primary);
	border: 2px solid #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
	cursor: pointer;
	pointer-events: auto;
	position: relative;
	z-index: 2;
}
.cc-price-range::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--cc-primary);
	border: 2px solid #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
	cursor: pointer;
	pointer-events: auto;
}
/* Track (behind both thumbs) */
.cc-price-range--min::-webkit-slider-runnable-track {
	height: 4px;
	background: var(--cc-border);
	border-radius: 2px;
}
.cc-price-range--max::-webkit-slider-runnable-track {
	height: 4px;
	background: transparent;
}

.cc-shop-filters__price-labels {
	display: flex;
	justify-content: space-between;
	font-size: 0.82rem;
	color: var(--cc-muted);
	font-weight: 600;
}

/* ============================================================
   Action buttons
   ============================================================ */
.cc-shop-filters__actions {
	display: flex;
	gap: 8px;
	margin-top: 20px;
}
.cc-shop-filters__apply {
	flex: 1;
	padding: 10px 16px;
	border: none;
	border-radius: 8px;
	background: var(--cc-primary);
	color: #fff;
	font-size: 0.88rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s;
}
.cc-shop-filters__apply:hover {
	filter: brightness(1.1);
}
.cc-shop-filters__clear {
	padding: 10px 16px;
	border: 1px solid var(--cc-border);
	border-radius: 8px;
	background: transparent;
	color: var(--cc-muted);
	font-size: 0.88rem;
	font-weight: 500;
	cursor: pointer;
	transition: color 0.2s, border-color 0.2s;
}
.cc-shop-filters__clear:hover {
	color: var(--cc-text);
	border-color: var(--cc-text);
}

/* Instant mode: hide Apply button */
.cc-shop-filters__form[data-behaviour="instant"] .cc-shop-filters__apply {
	display: none;
}

/* ============================================================
   No results
   ============================================================ */
.cc-shop-filters__no-results {
	text-align: center;
	padding: 48px 20px;
	color: var(--cc-muted);
}

/* ============================================================
   Loading overlay on products container
   ============================================================ */
.cc-shop-products--loading {
	position: relative;
	pointer-events: none;
}
.cc-shop-products--loading::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.6);
	z-index: 5;
	border-radius: 8px;
}
[data-theme="dark"] .cc-shop-products--loading::after {
	background: rgba(0, 0, 0, 0.4);
}

/* ============================================================
   Mobile: Off-canvas drawer
   ============================================================ */
@media (max-width: 767px) {
	.cc-shop-layout {
		display: block;
	}

	.cc-shop-filters__toggle {
		display: flex;
	}

	.cc-shop-filters {
		position: fixed;
		top: 0;
		left: -300px;
		width: 280px;
		height: 100%;
		max-height: 100vh;
		border-radius: 0;
		z-index: 1001;
		transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
		padding: 20px;
	}
	.cc-shop-filters--open {
		left: 0;
	}

	.cc-shop-filters__close {
		display: block;
	}
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
	.cc-shop-filters,
	.cc-shop-filters__overlay {
		transition: none !important;
	}
}
