/**
 * Frontend CSS for Jaelectrical / Nexostdio AJAX WooCommerce Filter
 * Namespaced cleanly to prevent any style leakage into Elementor cards or themes.
 */

:root {
	--nexostdio-primary: #0073aa;
	--nexostdio-primary-hover: #005177;
	--nexostdio-text: #2c3338;
	--nexostdio-text-muted: #646970;
	--nexostdio-bg-hover: #f0f6fc;
	--nexostdio-bg-active: #e7f3fa;
	--nexostdio-border: #e2e4e7;
	--nexostdio-radius: 6px;
	--nexostdio-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   General Widget Styles & Headings
   ========================================================================== */
.nexostdio-filter-widget,
.jaelectrical-filter-widget {
	box-sizing: border-box;
	margin-bottom: 24px;
	font-family: inherit;
	contain: layout style;
}

.nexostdio-filter-widget:last-child,
.jaelectrical-filter-widget:last-child {
	margin-bottom: 0;
}

.nexostdio-filter-widget.is-empty,
.jaelectrical-filter-widget.is-empty,
.nexostdio-filter-widget:empty,
.jaelectrical-filter-widget:empty {
	display: none !important;
	margin: 0 !important;
	padding: 0 !important;
	height: 0 !important;
	min-height: 0 !important;
}

.nexostdio-filter-widget *,
.nexostdio-filter-widget *::before,
.nexostdio-filter-widget *::after,
.jaelectrical-filter-widget *,
.jaelectrical-filter-widget *::before,
.jaelectrical-filter-widget *::after {
	box-sizing: border-box;
}

.nexostdio-filter-heading,
.jaelectrical-filter-heading {
	font-size: 16px;
	font-weight: 700;
	color: var(--nexostdio-text);
	margin: 0 0 14px 0;
	padding-bottom: 8px;
	border-bottom: 2px solid var(--nexostdio-border);
	letter-spacing: -0.01em;
}

/* ==========================================================================
   Hierarchical Category Tree Filter
   ========================================================================== */
.nexostdio-filter-category-tree-container {
	position: relative;
	width: 100%;
}

.nexostdio-filter-category-list,
.jaelectrical-filter-category-list {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.nexostdio-filter-category-sub {
	padding-left: 16px !important;
	margin-top: 6px !important;
	position: relative;
}

.nexostdio-filter-category-sub::before {
	content: "";
	position: absolute;
	left: 6px;
	top: 4px;
	bottom: 8px;
	width: 1.5px;
	background-color: #e5e7eb;
}

.nexostdio-filter-category-item,
.jaelectrical-filter-category-item {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
}

.nexostdio-filter-category-row,
.jaelectrical-filter-category-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 10px;
	border-radius: var(--nexostdio-radius);
	transition: background-color var(--nexostdio-transition), color var(--nexostdio-transition), border-color var(--nexostdio-transition);
	cursor: pointer;
	user-select: none;
	width: 100%;
	box-sizing: border-box;
	text-decoration: none;
}

.nexostdio-filter-category-row:hover {
	background-color: var(--nexostdio-bg-hover);
}

.nexostdio-filter-category-item.nexostdio-active > .nexostdio-filter-category-row {
	background-color: var(--nexostdio-bg-active);
}

/* Force strip any theme or browser default button styles from children */
.nexostdio-filter-category-row button,
.nexostdio-filter-category-row .nexostdio-filter-category-link,
.nexostdio-filter-category-row .nexostdio-filter-category-toggle {
	border: 0 !important;
	border-width: 0 !important;
	border-style: none !important;
	border-color: transparent !important;
	background: transparent !important;
	background-color: transparent !important;
	box-shadow: none !important;
	outline: none !important;
	padding: 0 !important;
	margin: 0 !important;
	min-height: 0 !important;
	min-width: 0 !important;
	line-height: inherit !important;
	font-family: inherit !important;
}

.nexostdio-filter-category-link,
.jaelectrical-filter-category-link {
	display: flex;
	align-items: center;
	gap: 6px;
	flex: 1 1 auto;
	min-width: 0;
	color: var(--nexostdio-text);
	font-size: 14px;
	font-weight: 500;
	text-align: left;
	cursor: pointer;
	text-decoration: none;
	outline: none;
}

.nexostdio-filter-category-row:focus-visible {
	outline: 2px solid var(--nexostdio-primary);
	outline-offset: 2px;
	border-radius: 4px;
}

.nexostdio-filter-category-item.nexostdio-active > .nexostdio-filter-category-row .nexostdio-filter-category-link {
	color: var(--nexostdio-primary);
	font-weight: 600;
}

.nexostdio-filter-category-name {
	flex: 1 1 auto;
	word-break: break-word;
}

.nexostdio-filter-category-count {
	font-size: 12px;
	color: var(--nexostdio-text-muted);
	font-weight: 400;
	margin-left: 4px;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: color var(--nexostdio-transition), background-color var(--nexostdio-transition), border-color var(--nexostdio-transition);
}

/* Category Toggle Arrow */
.nexostdio-filter-category-toggle,
.jaelectrical-filter-category-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	margin-left: 6px;
	cursor: pointer;
	color: var(--nexostdio-text-muted);
	border-radius: 4px;
	transition: transform var(--nexostdio-transition), color var(--nexostdio-transition), background-color var(--nexostdio-transition);
	flex-shrink: 0;
}

.nexostdio-filter-category-toggle:hover {
	color: var(--nexostdio-primary);
}

.nexostdio-filter-category-toggle:focus-visible {
	outline: 2px solid var(--nexostdio-primary);
}

.nexostdio-arrow-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	transition: transform var(--nexostdio-transition);
}

.nexostdio-arrow-icon svg {
	width: 100%;
	height: 100%;
	stroke: currentColor;
}

/* Expanded state: Rotate arrow down */
.nexostdio-filter-category-item.nexostdio-expanded > .nexostdio-filter-category-row .nexostdio-arrow-icon {
	transform: rotate(90deg);
}

/* ==========================================================================
   Dynamic Dual-Handle Price Range Slider
   ========================================================================== */
.nexostdio-filter-price-slider-wrapper,
.jaelectrical-filter-price-slider-wrapper {
	padding: 10px 4px 6px 4px;
}

.nexostdio-filter-price-slider-track-wrap {
	position: relative;
	height: 24px;
	display: flex;
	align-items: center;
	margin-bottom: 12px;
}

.nexostdio-filter-price-slider-track {
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	height: 6px;
	background-color: #e5e7eb;
	border-radius: 3px;
	z-index: 1;
}

.nexostdio-filter-price-slider-fill {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	height: 6px;
	background: linear-gradient(90deg, #0073aa, #00a0d2);
	border-radius: 3px;
	z-index: 2;
	pointer-events: none;
	left: 0;
	width: 100%;
	transition: width 0.05s ease, left 0.05s ease;
}

.nexostdio-slider-input {
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 100%;
	height: 18px;
	background: none;
	pointer-events: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	z-index: 3;
	margin: 0;
	padding: 0;
	border: none;
	outline: none;
	box-sizing: border-box;
}

/* WebKit Thumb */
.nexostdio-slider-input::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	pointer-events: auto;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background-color: #ffffff;
	border: 2px solid var(--nexostdio-primary);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.nexostdio-slider-input::-webkit-slider-thumb:hover {
	transform: scale(1.15);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.nexostdio-slider-input::-webkit-slider-thumb:active {
	transform: scale(1.2);
	background-color: var(--nexostdio-primary);
}

/* Firefox Thumb */
.nexostdio-slider-input::-moz-range-thumb {
	pointer-events: auto;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background-color: #ffffff;
	border: 2px solid var(--nexostdio-primary);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.nexostdio-slider-input::-moz-range-thumb:hover {
	transform: scale(1.15);
}

.nexostdio-slider-input:focus-visible::-webkit-slider-thumb {
	box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.35);
}

.nexostdio-slider-input:focus-visible::-moz-range-thumb {
	box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.35);
}

.nexostdio-filter-price-values-wrap {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 13px;
	color: var(--nexostdio-text);
	font-weight: 500;
}

.nexostdio-filter-price-display {
	display: flex;
	align-items: center;
	gap: 6px;
}

.nexostdio-filter-price-label {
	color: var(--nexostdio-text-muted);
}

.nexostdio-filter-price-min-formatted,
.nexostdio-filter-price-max-formatted {
	font-weight: 600;
	color: var(--nexostdio-text);
}

.nexostdio-filter-price-separator {
	color: var(--nexostdio-text-muted);
}

/* ==========================================================================
   Active Filters Tags
   ========================================================================== */
.nexostdio-active-filters-wrap,
.jaelectrical-active-filters-wrap {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-bottom: 16px;
}

/* Hide empty active filters containers so they don't create extra space */
.nexostdio-active-filters-wrap:empty,
.jaelectrical-active-filters-wrap:empty,
.nexostdio-active-filters-container:empty,
.nexostdio-active-filters-container:has(.nexostdio-active-filters-wrap:empty) {
	display: none !important;
	margin: 0 !important;
	padding: 0 !important;
	height: 0 !important;
}

/* Hide the widget wrapper when active filters container is empty */
.nexostdio-active-filters-widget:has(.nexostdio-active-filters-container:empty),
.jaelectrical-active-filters-widget:has(.nexostdio-active-filters-container:empty),
.nexostdio-active-filters-widget.is-empty,
.jaelectrical-active-filters-widget.is-empty {
	display: none !important;
	margin: 0 !important;
	padding: 0 !important;
	height: 0 !important;
}

.nexostdio-active-filters-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: center;
}

.nexostdio-filter-tag,
.jaelectrical-filter-tag {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background-color: #f1f5f9;
	color: #334155;
	border: 1px solid #e2e8f0;
	padding: 4px 10px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 500;
	transition: background-color var(--nexostdio-transition);
}

.nexostdio-filter-tag:hover {
	background-color: #e2e8f0;
}

.nexostdio-tag-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 14px;
	height: 14px;
	background: transparent;
	border: none;
	padding: 0;
	margin: 0;
	cursor: pointer;
	color: #64748b;
	transition: color 0.15s ease, transform 0.15s ease;
}

.nexostdio-tag-remove:hover {
	color: #ef4444;
	transform: scale(1.15);
}

.nexostdio-tag-remove svg {
	width: 12px;
	height: 12px;
	stroke: currentColor;
}

.nexostdio-clear-all-filters-btn,
.jaelectrical-clear-all-filters-btn {
	background: none;
	border: none;
	padding: 4px 8px;
	font-size: 12px;
	font-weight: 600;
	color: #ef4444;
	cursor: pointer;
	text-decoration: underline;
	transition: color 0.15s ease;
}

.nexostdio-clear-all-filters-btn:hover {
	color: #dc2626;
}

/* ==========================================================================
   Results Count Widget
   ========================================================================== */
.nexostdio-results-count-widget,
.jaelectrical-results-count-widget {
	font-size: 14px;
	color: var(--nexostdio-text-muted);
	font-weight: 500;
	margin-bottom: 12px;
}

.nexostdio-results-count-widget:empty,
.jaelectrical-results-count-widget:empty {
	display: none;
	margin: 0;
	padding: 0;
}

/* ==========================================================================
   Loading State Overlay & Animation
   ========================================================================== */
.nexostdio-loading-container {
	position: relative !important;
	pointer-events: none !important;
	user-select: none !important;
}

.nexostdio-loading-overlay {
	position: absolute;
	inset: 0;
	background-color: rgba(255, 255, 255, 0.75);
	backdrop-filter: blur(2px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 50;
	border-radius: inherit;
	opacity: 0;
	animation: nexostdioFadeIn 0.2s forwards;
}

.nexostdio-spinner {
	width: 40px;
	height: 40px;
	animation: nexostdioRotate 1s linear infinite;
	color: var(--nexostdio-primary);
}

.nexostdio-spinner svg {
	width: 100%;
	height: 100%;
	stroke: currentColor;
}

@keyframes nexostdioRotate {
	100% {
		transform: rotate(360deg);
	}
}

@keyframes nexostdioFadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

/* Skeleton shimmer */
.nexostdio-shimmer-active {
	opacity: 0.6;
	filter: grayscale(20%);
	transition: opacity 0.2s ease;
}

/* ==========================================================================
   Empty Results State
   ========================================================================== */
.nexostdio-filter-empty-results,
.jaelectrical-filter-empty-results {
	text-align: center;
	padding: 50px 20px;
	background: #ffffff;
	border: 1px dashed var(--nexostdio-border);
	border-radius: 8px;
	margin: 20px 0;
	width: 100%;
}

.nexostdio-empty-icon {
	width: 54px;
	height: 54px;
	margin: 0 auto 16px auto;
	color: #94a3b8;
	display: flex;
	align-items: center;
	justify-content: center;
}

.nexostdio-empty-icon svg {
	width: 44px;
	height: 44px;
	stroke: currentColor;
}

.nexostdio-empty-title {
	font-size: 20px;
	font-weight: 700;
	color: var(--nexostdio-text);
	margin: 0 0 8px 0;
}

.nexostdio-empty-desc {
	font-size: 14px;
	color: var(--nexostdio-text-muted);
	max-width: 420px;
	margin: 0 auto 20px auto;
	line-height: 1.5;
}

.nexostdio-filter-reset-btn,
.jaelectrical-filter-reset-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background-color: var(--nexostdio-primary);
	color: #ffffff;
	border: none;
	padding: 10px 22px;
	border-radius: var(--nexostdio-radius);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color var(--nexostdio-transition), transform 0.15s ease;
}

.nexostdio-filter-reset-btn:hover {
	background-color: var(--nexostdio-primary-hover);
	transform: translateY(-1px);
}

.nexostdio-reset-icon {
	width: 16px;
	height: 16px;
}

.nexostdio-reset-icon svg {
	width: 100%;
	height: 100%;
	stroke: currentColor;
}

/* ==========================================================================
   Non-blocking Toast / Notification
   ========================================================================== */
.nexostdio-toast {
	position: fixed;
	bottom: 24px;
	right: 24px;
	background: #1e293b;
	color: #ffffff;
	padding: 12px 20px;
	border-radius: 8px;
	font-size: 14px;
	box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
	z-index: 999999;
	display: flex;
	align-items: center;
	gap: 10px;
	animation: nexostdioSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nexostdio-toast-error {
	background: #ef4444;
}

@keyframes nexostdioSlideUp {
	from {
		transform: translateY(20px);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

/* ==========================================================================
   Brand Filter Widget Styles
   ========================================================================== */
.nexostdio-brand-filter-container {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.nexostdio-brand-search-wrap {
	position: relative;
	display: flex;
	align-items: center;
	margin-bottom: 4px;
}

.nexostdio-brand-search-icon {
	position: absolute;
	left: 10px;
	font-size: 13px;
	color: #94a3b8;
	pointer-events: none;
}

.nexostdio-brand-search-input {
	width: 100%;
	padding: 7px 28px 7px 30px;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	font-size: 13px;
	background-color: #f8fafc;
	color: var(--nexostdio-text);
	transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
	outline: none;
}

.nexostdio-brand-search-input:focus {
	background-color: #ffffff;
	border-color: var(--nexostdio-primary);
	box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.12);
}

.nexostdio-brand-search-clear {
	position: absolute;
	right: 8px;
	background: none;
	border: none;
	color: #94a3b8;
	font-size: 16px;
	cursor: pointer;
	padding: 2px 6px;
	line-height: 1;
	border-radius: 50%;
}

.nexostdio-brand-search-clear:hover {
	color: #475569;
}

.nexostdio-brand-list,
.jaelectrical-brand-list {
	position: relative;
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	display: flex;
	flex-direction: column;
	gap: 4px;
	max-height: 260px;
	overflow-y: auto !important;
	overflow-x: hidden !important;
	scrollbar-width: thin;
	scrollbar-color: #cbd5e1 transparent;
	contain: layout style paint;
}

.nexostdio-brand-list::-webkit-scrollbar {
	width: 5px;
}

.nexostdio-brand-list::-webkit-scrollbar-track {
	background: transparent;
}

.nexostdio-brand-list::-webkit-scrollbar-thumb {
	background-color: #cbd5e1;
	border-radius: 4px;
}

.nexostdio-brand-item {
	position: relative;
	margin: 0;
	padding: 0;
	border-radius: 4px;
	transition: background-color 0.15s ease;
}

.nexostdio-brand-item:hover {
	background-color: #f8fafc;
}

.nexostdio-brand-label {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 5px 6px;
	cursor: pointer;
	font-size: 14px;
	user-select: none;
	width: 100%;
	box-sizing: border-box;
}

.nexostdio-brand-input {
	position: absolute;
	top: 0;
	left: 0;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
	margin: 0;
}

.nexostdio-brand-custom-control {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	border: 1.5px solid #cbd5e1;
	border-radius: 4px;
	background-color: #ffffff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: all 0.15s ease;
	position: relative;
}

/* Radio button style if single select */
[data-display-type="radio"] .nexostdio-brand-custom-control {
	border-radius: 50%;
}

.nexostdio-brand-input:checked + .nexostdio-brand-custom-control {
	background-color: var(--nexostdio-primary);
	border-color: var(--nexostdio-primary);
}

/* Checkmark */
.nexostdio-brand-input:checked + .nexostdio-brand-custom-control::after {
	content: '';
	display: block;
	width: 4px;
	height: 8px;
	border: solid #ffffff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg) translate(-0.5px, -1px);
}

[data-display-type="radio"] .nexostdio-brand-input:checked + .nexostdio-brand-custom-control::after {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background-color: #ffffff;
	border: none;
	transform: none;
}

.nexostdio-brand-thumb-wrap {
	width: 22px;
	height: 22px;
	flex-shrink: 0;
	border-radius: 3px;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f1f5f9;
}

.nexostdio-brand-thumb {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.nexostdio-brand-name {
	flex: 1;
	color: var(--nexostdio-text);
	transition: color 0.15s ease;
}

.nexostdio-brand-item.is-active .nexostdio-brand-name {
	color: var(--nexostdio-primary);
	font-weight: 600;
}

.nexostdio-brand-count {
	font-size: 12px;
	color: #64748b;
	background-color: #f1f5f9;
	padding: 1px 7px;
	border-radius: 10px;
	font-weight: 500;
	margin-left: auto;
}

.nexostdio-brand-no-results,
.nexostdio-brand-empty {
	padding: 10px 4px;
	font-size: 13px;
	color: #94a3b8;
	font-style: italic;
}

