/* ==========================================================================
   Woo Product Filters — Frontend Styles
   Horizontal dropdown bar (pill buttons → floating panels)
   ========================================================================== */

:root {
	--ccpf-primary: #5a3a4a;
	--ccpf-primary-hover: #472e3b;
	--ccpf-border: #d5d5d5;
	--ccpf-border-active: var(--ccpf-primary);
	--ccpf-bg: #fff;
	--ccpf-bg-hover: #fafafa;
	--ccpf-text: #333;
	--ccpf-text-muted: #888;
	--ccpf-chip-bg: #f3f3f3;
	--ccpf-radius: 24px;
	--ccpf-radius-panel: 8px;
	--ccpf-gap: 10px;
	--ccpf-shadow: 0 4px 24px rgba(0,0,0,.12);
	--ccpf-transition: .2s ease;
	--ccpf-font: inherit;
}

/* ── Hard reset: override Divi / WooCommerce list styles ─ */
.ccpf-filters ul,
.ccpf-filters ol,
.ccpf-filters li,
.ccpf-mobile-drawer ul,
.ccpf-mobile-drawer ol,
.ccpf-mobile-drawer li {
	list-style: none !important;
	list-style-type: none !important;
	margin-left: 0 !important;
	padding-left: 0 !important;
}

/* Remove ::marker pseudo-element (Divi injects it) */
.ccpf-filters li::marker,
.ccpf-filters li::before,
.ccpf-mobile-drawer li::marker,
.ccpf-mobile-drawer li::before {
	content: none !important;
	display: none !important;
}

/* ── Filter bar ───────────────────────────────────────── */
.ccpf-filters {
	margin-bottom: 20px;
	font-family: var(--ccpf-font);
	position: relative;
	z-index: 100;
}

.ccpf-bar {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ccpf-gap);
	align-items: flex-start;
}

/* ── Dropdown (each filter) ───────────────────────────── */
.ccpf-dropdown {
	position: relative;
}

/* Trigger button (pill) */
.ccpf-dropdown__trigger {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	background: var(--ccpf-bg);
	border: 1px solid var(--ccpf-border);
	border-radius: var(--ccpf-radius);
	font-size: 14px;
	font-family: inherit;
	color: var(--ccpf-text);
	cursor: pointer;
	white-space: nowrap;
	transition: border-color var(--ccpf-transition), box-shadow var(--ccpf-transition);
	line-height: 1.4;
	-webkit-appearance: none;
}

.ccpf-dropdown__trigger:hover,
.ccpf-dropdown__trigger:focus-visible {
	border-color: var(--ccpf-primary);
}

.ccpf-dropdown__trigger--active {
	border-color: var(--ccpf-border-active);
}

.ccpf-dropdown__trigger[aria-expanded="true"] {
	border-color: var(--ccpf-primary);
	box-shadow: 0 0 0 1px var(--ccpf-primary);
}

/* Badge (active selection count) */
.ccpf-dropdown__badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	background: var(--ccpf-primary);
	color: #fff;
	border-radius: 9px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1;
}

/* Chevron */
.ccpf-dropdown__chevron {
	flex-shrink: 0;
	transition: transform var(--ccpf-transition);
}

.ccpf-dropdown__trigger[aria-expanded="true"] .ccpf-dropdown__chevron {
	transform: rotate(180deg);
}

/* ── Dropdown panel (floating) ────────────────────────── */
.ccpf-dropdown__panel {
	display: none;
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	min-width: 280px;
	max-width: 380px;
	background: var(--ccpf-bg);
	border: 1px solid var(--ccpf-border);
	border-radius: var(--ccpf-radius-panel);
	box-shadow: var(--ccpf-shadow);
	z-index: 200;
	animation: ccpfPanelIn .15s ease;
}

.ccpf-dropdown__panel[aria-hidden="false"] {
	display: block;
}

@keyframes ccpfPanelIn {
	from { opacity: 0; transform: translateY(-4px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* Panel body (scrollable content area) */
.ccpf-dropdown__body {
	padding: 16px;
	max-height: 320px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

/* Custom scrollbar */
.ccpf-dropdown__body::-webkit-scrollbar {
	width: 5px;
}
.ccpf-dropdown__body::-webkit-scrollbar-track {
	background: transparent;
}
.ccpf-dropdown__body::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 3px;
}

/* Panel footer with Save button */
.ccpf-dropdown__footer {
	padding: 10px 16px;
	border-top: 1px solid #eee;
	text-align: right;
}

.ccpf-dropdown__save {
	display: inline-block;
	padding: 8px 24px;
	background: var(--ccpf-primary);
	color: #fff;
	border: none;
	border-radius: 4px;
	font-size: 13px;
	font-family: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: background var(--ccpf-transition);
}

.ccpf-dropdown__save:hover {
	background: var(--ccpf-primary-hover);
}

/* ── Checkbox / Radio lists (inside panels) ───────────── */
.ccpf-list {
	list-style: none !important;
	margin: 0;
	padding: 0;
}

.ccpf-list li {
	margin-bottom: 2px;
	list-style: none !important;
}

.ccpf-list label {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 4px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	line-height: 1.3;
	transition: background var(--ccpf-transition);
}

.ccpf-list label:hover {
	background: #f7f7f7;
}

.ccpf-list input[type="checkbox"],
.ccpf-list input[type="radio"] {
	width: 16px;
	height: 16px;
	margin: 0;
	flex-shrink: 0;
	accent-color: var(--ccpf-primary);
}

.ccpf-item-label {
	flex: 1;
}

.ccpf-item-count {
	color: var(--ccpf-text-muted);
	font-size: 12px;
	margin-left: auto;
}

/* ── Dropdown select (taxonomy display=dropdown) ──────── */
.ccpf-select {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid var(--ccpf-border);
	border-radius: 6px;
	font-size: 14px;
	font-family: inherit;
	background: var(--ccpf-bg);
}

/* ── Color swatches ───────────────────────────────────── */
.ccpf-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	list-style: none !important;
	margin: 0;
	padding: 0;
}

.ccpf-swatch {
	position: relative;
	cursor: pointer;
	text-align: center;
	list-style: none !important;
}

.ccpf-swatch__color {
	display: block;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 2px solid transparent;
	outline: 1px solid rgba(0,0,0,.12);
	transition: outline-color var(--ccpf-transition), box-shadow var(--ccpf-transition);
}

.ccpf-swatch--active .ccpf-swatch__color,
.ccpf-swatch:hover .ccpf-swatch__color {
	outline-color: var(--ccpf-primary);
	box-shadow: 0 0 0 2px var(--ccpf-primary);
}

/* Count hidden on colour swatches — name is in title tooltip */
.ccpf-swatches--color .ccpf-swatch__count {
	display: none;
}

.ccpf-swatch__count {
	display: block;
	font-size: 10px;
	color: var(--ccpf-text-muted);
	margin-top: 3px;
	line-height: 1;
}

/* ── Label buttons ────────────────────────────────────── */
.ccpf-labels {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	list-style: none !important;
	margin: 0;
	padding: 0;
}

.ccpf-label {
	cursor: pointer;
	list-style: none !important;
}

.ccpf-label__text {
	display: inline-block;
	padding: 5px 14px;
	border: 1px solid var(--ccpf-border);
	border-radius: var(--ccpf-radius);
	font-size: 13px;
	transition: all var(--ccpf-transition);
}

.ccpf-label--active .ccpf-label__text,
.ccpf-label:hover .ccpf-label__text {
	border-color: var(--ccpf-primary);
	background: var(--ccpf-primary);
	color: #fff;
}

.ccpf-label__count {
	font-size: 11px;
	color: var(--ccpf-text-muted);
	margin-left: 2px;
}

/* ── Price slider ─────────────────────────────────────── */
.ccpf-price-slider {
	padding: 8px 4px 4px;
}

.ccpf-price-slider__values {
	display: flex;
	justify-content: space-between;
	margin-bottom: 14px;
}

.ccpf-price-tag {
	display: inline-block;
	padding: 4px 10px;
	background: var(--ccpf-primary);
	color: #fff;
	border-radius: 4px;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
}

/* noUiSlider overrides */
.ccpf-price-slider .noUi-target {
	height: 6px;
	border: none;
	background: #e0e0e0;
	border-radius: 3px;
	box-shadow: none;
}

.ccpf-price-slider .noUi-connect {
	background: var(--ccpf-primary);
}

.ccpf-price-slider .noUi-handle {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--ccpf-primary);
	border: 3px solid #fff;
	box-shadow: 0 1px 4px rgba(0,0,0,.25);
	cursor: grab;
	top: -8px;
	right: -10px !important;
}

.ccpf-price-slider .noUi-handle::before,
.ccpf-price-slider .noUi-handle::after {
	display: none;
}

.ccpf-price-slider .noUi-handle:active {
	cursor: grabbing;
}

/* ── Star rating ──────────────────────────────────────── */
.ccpf-rating-list .ccpf-stars {
	letter-spacing: 1px;
}

.ccpf-star--filled {
	color: #f0c14b;
}

.ccpf-star--empty {
	color: #ddd;
}

/* ── Order by select ──────────────────────────────────── */
.ccpf-dropdown[data-type="orderby"] .ccpf-dropdown__body {
	padding: 8px;
}

/* ── Active filters (chips) ───────────────────────────── */
.ccpf-active-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 14px;
}

.ccpf-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 12px;
	background: var(--ccpf-chip-bg);
	border: 1px solid var(--ccpf-border);
	border-radius: var(--ccpf-radius);
	font-size: 12px;
	line-height: 1.4;
	color: var(--ccpf-text);
	cursor: pointer;
	transition: background var(--ccpf-transition);
}

.ccpf-chip:hover {
	background: #e8e8e8;
}

.ccpf-chip-remove {
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	color: var(--ccpf-text-muted);
	display: flex;
	transition: color var(--ccpf-transition);
}

.ccpf-chip:hover .ccpf-chip-remove {
	color: var(--ccpf-primary);
}

/* ── Reset button ─────────────────────────────────────── */
.ccpf-reset-wrap {
	display: inline-block;
}

.ccpf-reset-btn {
	display: inline-block;
	padding: 8px 18px;
	background: transparent;
	border: 1px solid var(--ccpf-border);
	border-radius: var(--ccpf-radius);
	font-size: 13px;
	color: var(--ccpf-text);
	cursor: pointer;
	text-decoration: none;
	transition: all var(--ccpf-transition);
}

.ccpf-reset-btn:hover {
	background: var(--ccpf-chip-bg);
	border-color: var(--ccpf-primary);
	color: var(--ccpf-text);
	text-decoration: none;
}

/* ── Loading overlay ──────────────────────────────────── */
.ccpf-loading-overlay {
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.7);
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
}

.ccpf-spinner {
	width: 32px;
	height: 32px;
	border: 3px solid #e0e0e0;
	border-top-color: var(--ccpf-primary);
	border-radius: 50%;
	animation: ccpfSpin 0.6s linear infinite;
}

@keyframes ccpfSpin {
	to { transform: rotate(360deg); }
}

/* ── Mobile trigger button ────────────────────────────── */
.ccpf-mobile-trigger {
	display: none; /* shown via breakpoint */
	align-items: center;
	gap: 8px;
	padding: 10px 20px;
	background: var(--ccpf-bg);
	border: 1px solid var(--ccpf-border);
	border-radius: var(--ccpf-radius);
	font-size: 14px;
	font-family: inherit;
	color: var(--ccpf-text);
	cursor: pointer;
	position: relative;
	z-index: 90;
}

.ccpf-mobile-trigger svg {
	flex-shrink: 0;
}

/* ── Mobile overlay ───────────────────────────────────── */
.ccpf-mobile-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,.45);
	z-index: 99998;
	opacity: 0;
	transition: opacity .3s ease;
}

.ccpf-mobile-overlay--visible {
	opacity: 1;
}

/* ── Mobile drawer ────────────────────────────────────── */
.ccpf-mobile-drawer {
	display: none;
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	width: 340px;
	max-width: 88vw;
	background: var(--ccpf-bg);
	z-index: 99999;
	transform: translateX(100%);
	transition: transform .3s cubic-bezier(.4,0,.2,1);
	box-shadow: -4px 0 24px rgba(0,0,0,.15);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.ccpf-mobile-drawer--open {
	transform: translateX(0);
}

.ccpf-mobile-drawer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid #eee;
	flex-shrink: 0;
}

.ccpf-mobile-drawer__header h3 {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
}

.ccpf-mobile-drawer__close {
	background: none;
	border: none;
	padding: 4px;
	cursor: pointer;
	color: var(--ccpf-text-muted);
	transition: color var(--ccpf-transition);
}

.ccpf-mobile-drawer__close:hover {
	color: var(--ccpf-text);
}

.ccpf-mobile-drawer__body {
	flex: 1;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 0;
}

/* Mobile accordion sections (one per filter) */
.ccpf-mobile-section {
	border-bottom: 1px solid #eee;
}

.ccpf-mobile-section__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 20px;
	cursor: pointer;
	font-weight: 600;
	font-size: 15px;
	user-select: none;
	background: transparent;
	border: none;
	width: 100%;
	text-align: left;
	font-family: inherit;
	color: var(--ccpf-text);
}

.ccpf-mobile-section__header:hover {
	background: #fafafa;
}

.ccpf-mobile-section__chevron {
	transition: transform var(--ccpf-transition);
	flex-shrink: 0;
}

.ccpf-mobile-section--open .ccpf-mobile-section__chevron {
	transform: rotate(180deg);
}

.ccpf-mobile-section__body {
	display: none;
	padding: 0 20px 16px;
}

.ccpf-mobile-section--open .ccpf-mobile-section__body {
	display: block;
}

/* Drawer footer */
.ccpf-mobile-drawer__footer {
	display: flex;
	gap: 10px;
	padding: 14px 20px;
	border-top: 1px solid #eee;
	flex-shrink: 0;
	background: var(--ccpf-bg);
}

.ccpf-mobile-drawer__apply {
	flex: 1;
	padding: 12px 16px;
	background: var(--ccpf-primary);
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: background var(--ccpf-transition);
}

.ccpf-mobile-drawer__apply:hover {
	background: var(--ccpf-primary-hover);
}

.ccpf-mobile-drawer__clear {
	padding: 12px 16px;
	background: transparent;
	border: 1px solid var(--ccpf-border);
	border-radius: 6px;
	font-size: 14px;
	font-family: inherit;
	color: var(--ccpf-text);
	cursor: pointer;
	transition: all var(--ccpf-transition);
}

.ccpf-mobile-drawer__clear:hover {
	border-color: var(--ccpf-primary);
}

/* ── Responsive: Mobile breakpoint ────────────────────── */
/* Default breakpoint overridden dynamically via JS */
@media (max-width: 768px) {
	.ccpf-filters--desktop {
		display: none !important;
	}

	.ccpf-mobile-trigger {
		display: inline-flex !important;
	}
}

/* ── Product container position for loading overlay ───── */
.ccpf-products-container {
	position: relative;
}

/* ── Smooth scroll on panel open (avoid layout jumps) ─── */
html {
	scroll-behavior: smooth;
}
