/**
 * Unica Product Filters — Dark theme styling.
 * Uses Unica theme CSS variables.
 */

/* ==================== Toggle Button (mobile) ==================== */

.upf-filters-toggle {
	margin-bottom: 16px;
}

#upf-filters-toggle-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 20px;
	background: var(--bg-card, #111520);
	border: 1px solid var(--border, #1E2436);
	border-radius: 8px;
	color: var(--text-primary, #fff);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: border-color 0.2s;
}

#upf-filters-toggle-btn:hover {
	border-color: var(--cyan, #00F0FF);
}

#upf-filters-toggle-btn svg {
	color: var(--cyan, #00F0FF);
}

/* Desktop: hide toggle, show sidebar */
@media (min-width: 992px) {
	.upf-filters-toggle {
		display: none;
	}

	.upf-filters-panel {
		position: static !important;
		transform: none !important;
		width: auto !important;
		max-width: none !important;
		box-shadow: none !important;
		border-radius: 12px;
		background: var(--bg-card, #111520);
		border: 1px solid var(--border, #1E2436);
		padding: 20px;
	}

	.upf-filters-header {
		display: none;
	}

	.upf-filters-overlay {
		display: none !important;
	}

	.upf-filters-actions {
		padding-top: 16px;
		border-top: 1px solid var(--border, #1E2436);
	}
}

/* ==================== Slide-in Panel (mobile/tablet) ==================== */

@media (max-width: 991px) {
	.upf-filters-panel {
		position: fixed;
		top: 0;
		left: 0;
		width: 320px;
		max-width: 85vw;
		height: 100vh;
		background: var(--bg-elevated, #181D2B);
		z-index: 100000;
		transform: translateX(-100%);
		transition: transform 0.3s ease;
		display: flex;
		flex-direction: column;
		overflow-y: auto;
	}

	.upf-filters-panel.active {
		transform: translateX(0);
	}

	.upf-filters-overlay {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: rgba(0, 0, 0, 0.6);
		z-index: 99999;
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.3s, visibility 0.3s;
	}

	.upf-filters-overlay.active {
		opacity: 1;
		visibility: visible;
	}
}

/* ==================== Panel Header ==================== */

.upf-filters-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid var(--border, #1E2436);
}

.upf-filters-header h3 {
	font-family: var(--font-heading, 'Rajdhani', sans-serif);
	font-size: 18px;
	font-weight: 700;
	color: var(--text-primary, #fff);
	margin: 0;
}

.upf-filters-close {
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	color: var(--text-muted, #6B7280);
	font-size: 24px;
	cursor: pointer;
	border-radius: 6px;
	transition: background 0.15s, color 0.15s;
}

.upf-filters-close:hover {
	background: rgba(255, 255, 255, 0.05);
	color: var(--text-primary, #fff);
}

/* ==================== Filter Content ==================== */

.upf-filters-content {
	padding: 20px;
	flex: 1;
}

.upf-filter-group {
	margin-bottom: 24px;
}

.upf-filter-group h4 {
	font-family: var(--font-heading, 'Rajdhani', sans-serif);
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--text-primary, #fff);
	margin: 0 0 12px;
}

/* ── Price slider ── */

.upf-price-slider-container {
	padding: 8px 4px;
}

/* noUiSlider overrides */
.upf-filter-price .noUi-target {
	background: var(--border, #1E2436);
	border: none;
	height: 6px;
	border-radius: 3px;
	box-shadow: none;
}

.upf-filter-price .noUi-connect {
	background: linear-gradient(90deg, var(--cyan, #00F0FF), var(--green, #00FF88));
	border-radius: 3px;
}

.upf-filter-price .noUi-handle {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--cyan, #00F0FF);
	border: 2px solid var(--bg-primary, #0A0E17);
	box-shadow: 0 0 8px var(--cyan-glow, rgba(0,240,255,0.3));
	cursor: grab;
	top: -8px;
	right: -10px;
}

.upf-filter-price .noUi-handle::before,
.upf-filter-price .noUi-handle::after {
	display: none;
}

.upf-price-values {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-top: 12px;
	font-size: 14px;
	color: var(--text-body, #B8BCC8);
}

.upf-price-values #upf-price-min,
.upf-price-values #upf-price-max {
	font-family: var(--font-mono, 'JetBrains Mono', monospace);
	font-weight: 600;
	color: var(--cyan, #00F0FF);
}

.upf-price-separator {
	margin: 0 4px;
	color: var(--text-muted, #6B7280);
}

/* ── Checkboxes ── */

.upf-filter-list,
.upf-stock-options {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.upf-checkbox {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border-radius: 6px;
	cursor: pointer;
	transition: background 0.15s;
}

.upf-checkbox:hover {
	background: rgba(255, 255, 255, 0.03);
}

.upf-checkbox input[type="checkbox"] {
	display: none;
}

.upf-checkbox-mark {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	border: 2px solid var(--border-hover, #2A3148);
	border-radius: 4px;
	position: relative;
	transition: background 0.15s, border-color 0.15s;
}

.upf-checkbox input:checked + .upf-checkbox-mark {
	background: var(--cyan, #00F0FF);
	border-color: var(--cyan, #00F0FF);
}

.upf-checkbox input:checked + .upf-checkbox-mark::after {
	content: '';
	position: absolute;
	left: 4px;
	top: 1px;
	width: 6px;
	height: 10px;
	border: solid var(--bg-primary, #0A0E17);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.upf-checkbox-label {
	font-size: 14px;
	color: var(--text-body, #B8BCC8);
	flex: 1;
}

.upf-checkbox-count {
	font-size: 12px;
	color: var(--text-muted, #6B7280);
}

/* ── Actions ── */

.upf-filters-actions {
	display: flex;
	gap: 8px;
	padding: 16px 20px;
}

.upf-btn {
	flex: 1;
	padding: 10px 16px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	border: none;
	transition: opacity 0.15s;
}

.upf-btn:hover {
	opacity: 0.85;
}

.upf-btn-primary {
	background: var(--cyan, #00F0FF);
	color: var(--bg-primary, #0A0E17);
}

.upf-btn-secondary {
	background: var(--bg-card, #111520);
	border: 1px solid var(--border, #1E2436);
	color: var(--text-body, #B8BCC8);
}

/* ==================== Loading / Messages ==================== */

.upf-loading-more {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 24px;
	color: var(--text-muted, #6B7280);
	font-size: 14px;
}

.upf-spinner {
	width: 24px;
	height: 24px;
	border: 3px solid var(--border, #1E2436);
	border-top-color: var(--cyan, #00F0FF);
	border-radius: 50%;
	animation: upf-spin 0.8s linear infinite;
}

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

.upf-end-message {
	text-align: center;
	padding: 24px;
	color: var(--text-muted, #6B7280);
	font-size: 14px;
}

.upf-no-products {
	text-align: center;
	padding: 48px 20px;
	color: var(--text-body, #B8BCC8);
}

/* ==================== Products container loading state ==================== */

.products-grid.is-loading,
.woocommerce.is-loading {
	opacity: 0.5;
	pointer-events: none;
	transition: opacity 0.2s;
}

/* ==================== Bestsellers Carousel ==================== */

.upf-bestsellers-carousel {
	margin: 40px 0;
}

.products-carousel__title {
	font-family: var(--font-heading, 'Rajdhani', sans-serif);
	font-size: 24px;
	font-weight: 700;
	color: var(--text-primary, #fff);
	margin: 0 0 20px;
}

.products-carousel__swiper .swiper-button-prev,
.products-carousel__swiper .swiper-button-next {
	color: var(--cyan, #00F0FF);
	width: 36px;
	height: 36px;
	background: var(--bg-card, #111520);
	border: 1px solid var(--border, #1E2436);
	border-radius: 50%;
}

.products-carousel__swiper .swiper-button-prev::after,
.products-carousel__swiper .swiper-button-next::after {
	font-size: 14px;
}

.products-carousel__swiper .swiper-pagination-bullet {
	background: var(--text-muted, #6B7280);
	opacity: 0.5;
}

.products-carousel__swiper .swiper-pagination-bullet-active {
	background: var(--cyan, #00F0FF);
	opacity: 1;
}

/* Carousel product cards */
.upf-product-card {
	background: var(--bg-card, #111520);
	border: 1px solid var(--border, #1E2436);
	border-radius: 8px;
	overflow: hidden;
}

.upf-product-link {
	display: block;
	text-decoration: none;
}

.upf-product-image {
	position: relative;
	aspect-ratio: 1;
	overflow: hidden;
	background: var(--bg-card-top, #151A28);
}

.upf-product-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.upf-badge-sale {
	position: absolute;
	top: 8px;
	left: 8px;
	background: var(--red, #FF3B5C);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 4px;
}

.upf-product-info {
	padding: 12px;
}

.upf-product-title {
	font-size: 13px;
	font-weight: 500;
	color: var(--text-body, #B8BCC8);
	margin: 0 0 6px;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.upf-product-price {
	font-family: var(--font-heading, 'Rajdhani', sans-serif);
	font-size: 16px;
	font-weight: 700;
	color: var(--cyan, #00F0FF);
}

.upf-product-price del {
	color: var(--text-muted, #6B7280);
	font-size: 13px;
}

.upf-product-price ins {
	text-decoration: none;
	color: var(--cyan, #00F0FF);
}

.upf-product-actions {
	padding: 0 12px 12px;
}

.upf-product-actions .button {
	width: 100%;
	padding: 8px;
	background: var(--cyan, #00F0FF);
	color: var(--bg-primary, #0A0E17);
	border: none;
	border-radius: 6px;
	font-weight: 600;
	font-size: 13px;
	cursor: pointer;
	transition: opacity 0.15s;
}

.upf-product-actions .button:hover {
	opacity: 0.85;
}
