/**
 * WooCommerce Enhanced Filter UI
 * Collapsible Groups with Custom Checkboxes
 */

/* Filter Wrapper */
.woo-filters-wrapper {
	
}

@keyframes anf-skeleton-pulse {
	0% {
		opacity: 0.55;
	}
	50% {
		opacity: 1;
	}
	100% {
		opacity: 0.55;
	}
}

.woo-filters-products ul.products.loading {
	position: relative;
	min-height: 680px;
}

/* .woo-filters-products ul.products.loading > li {
	grid-column: 1 / -1;
} */

.product-archive-list__category-header {
	cursor: pointer;
}

.woo-filters-content {
	background: #F6F6F6;
}

.woo-filters-open-btn {
	display: none;
	border-color: #C6C6C6;
}

.woo-filters-close-btn {
	display: none;
	position: absolute;
	top: 10px;
	right: 12px;
	background: transparent;
	border: none;
	font-size: 22px;
	line-height: 1;
	color: #111827;
	cursor: pointer;
}

.woo-filters-backdrop {
	display: none;
}

/* Mobile overlay behavior */
@media (max-width: 1024px) {
	.woo-filters-open-btn {
		display: block;
	}

	.woo-filters-wrapper {
		display: none;
	}

	body.filters-open {
		overflow: hidden;
	}

	body.filters-open .woo-filters-backdrop,
	.woo-filters-backdrop.closing {
		display: block !important;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		height: 100%;
		background: rgba(0,0,0,0.45);
		z-index: 99998;
	}

	body.filters-open .woo-filters-backdrop {
		animation: fadeIn 0.3s ease-in-out;
	}

	body.filters-open .woo-filters-wrapper,
	.woo-filters-wrapper.closing {
		display: block !important;
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		height: 100%;
		max-width: 580px;
		max-height: 100vh;
		background: #fff;
		z-index: 99999;
		margin: 0;
		padding: 0;
		overflow-y: auto;
	}

	body.filters-open .woo-filters-wrapper {
		animation: slideInRight 0.3s ease-in-out;
	}

	/* Exit animations */
	.woo-filters-backdrop.closing {
		animation: fadeOut 0.3s ease-in-out;
	}

	.woo-filters-wrapper.closing {
		animation: slideOutRight 0.3s ease-in-out;
	}

	body.filters-open .woo-filters-wrapper .woo-filters-container,
	.woo-filters-wrapper.closing .woo-filters-container {
		padding: 40px;
		min-height: 100vh;
	}

	body.filters-open .woo-filters-wrapper .woo-filters-close-btn,
	.woo-filters-wrapper.closing .woo-filters-close-btn {
		overflow-y: auto;
		display: flex;
		justify-content: center;
		align-items: center;
		width: 40px;
		height: 40px;
	}

	body.filters-open .woo-filters-wrapper .woo-filters-header,
	.woo-filters-wrapper.closing .woo-filters-header {
		background-color: #f6f6f6;
		padding: 15px 40px;
		display: flex;
		justify-content: space-between;
		align-items: center;
		position: sticky;
		top: 0;
		z-index: 5;
	}

	body.filters-open .woo-filters-wrapper .woo-filters-footer,
	.woo-filters-wrapper.closing .woo-filters-footer {
		background-color: #fff;
		padding: 15px 40px;
		display: flex;
		flex-direction: column;
		gap: 10px;
		position: sticky;
		bottom: 0;
		z-index: 5;
	}

	body.filters-open .woo-filters-close-btn,
	.woo-filters-wrapper.closing .woo-filters-close-btn {
		display: block;
		position: static;
	}
}

/* Filter Group */
.filter-group {
	border-bottom: 1px solid #f1f5f9;
	overflow: hidden;
}

.filter-group:last-child {
	border-bottom: none;
}

/* Filter Group Title (Collapsible Header) */
.filter-group-title {
	width: 100%;
	padding: 20px;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.filter-group-title:hover {
	/* background-color: #f9fafb; */
}

.filter-group-title-wrapper {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	font-weight: 500;
	color: #253746;
	text-align: left;
}

.filter-group-summary {
	text-align: left;
	font-size: 13px;
	color: #5E5E5E;
	font-weight: 400;
	line-height: 20px;
}

.filter-title-text {
	flex: 1;
	text-align: left;
	font-weight: 500;
	color: #253746;
}

.filter-toggle-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	font-size: 14px;
	font-weight: bold;
	color: #637381;
	transition: transform 0.15s ease;
	margin-left: 12px;
}

.filter-group.expanded .filter-toggle-icon {
	transform: rotate(0deg);
}

/* Filter Group Content */
.filter-group-content {
	padding: 0px 20px;
}

/* Custom Checkbox Label */
.filter-checkbox-label {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 0;
	margin-bottom: 2px;
	cursor: pointer;
	user-select: none;
	transition: color 0.15s ease;
}

.filter-checkbox-label:hover {
	/* color: #111827; */
}

.filter-checkbox-label:last-child {
	margin-bottom: 0;
}

/* Hide Default Checkbox */
.filter-checkbox {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	padding: 0;
	border: none;
}

/* Custom Checkbox Styling */
.filter-checkbox-custom {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 25px;
	height: 25px;
	min-width: 25px;
	min-height: 25px;
	border: 1px solid #253746;
	background-color: #fff;
	transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
	margin-right: 0;
	flex-shrink: 0;
}

/* Checkbox Hover State */
.filter-checkbox-label:hover .filter-checkbox-custom {
	/* border-color: #9ca3af;
	background-color: #f9fafb; */
}

/* Checkbox Checked State */
.filter-checkbox:checked ~ .filter-checkbox-custom {
	background-color: #111827;
	border-color: #111827;
	/* box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.08); */
}

/* Checkmark in Custom Checkbox */
.filter-checkbox:checked ~ .filter-checkbox-custom::before {
	content: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHZpZXdCb3g9IjAgMCAxOCAxOCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTE1Ljc1IDQuMTk1NzFMNi41NTM3IDE0LjE0OTdDNi40OTQ4OCAxNC4yMTMzIDYuNDEzNDIgMTQuMjQ5NiA2LjMyODEyIDE0LjI1QzYuMjQyODEgMTQuMjUwNCA2LjE2MTAyIDE0LjIxNSA2LjEwMTYgMTQuMTUxOUwxLjUgOS4yNjczOUwxLjk0OTk4IDguODE3MTVMNi4zMjQzOSAxMy40NjA1TDE1LjI5NTggMy43NUwxNS43NSA0LjE5NTcxWiIgZmlsbD0id2hpdGUiLz48L3N2Zz4=');
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding-left: 2px;
	padding-right: 2px;
}

.filter-checkbox-label:focus-within .filter-checkbox-custom::before,
.filter-checkbox-label:hover .filter-checkbox-custom::before {
	content: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHZpZXdCb3g9IjAgMCAxOCAxOCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS43NSA0LjE5NTcxTDYuNTUzNyAxNC4xNDk3QzYuNDk0ODggMTQuMjEzMyA2LjQxMzQyIDE0LjI0OTYgNi4zMjgxMiAxNC4yNUM2LjI0MjgxIDE0LjI1MDQgNi4xNjEwMiAxNC4yMTUgNi4xMDE2IDE0LjE1MTlMMS41IDkuMjY3MzlMMS45NDk5OCA4LjgxNzE1TDYuMzI0MzkgMTMuNDYwNUwxNS4yOTU4IDMuNzVMMTUuNzUgNC4xOTU3MVoiIGZpbGw9IiNDNkM2QzYiLz4KPC9zdmc+Cg==');
	padding-left: 2px;
	padding-right: 2px;
}

/* Checkbox Focus State */
.filter-checkbox:focus ~ .filter-checkbox-custom {
	outline: 1px dashed #253746;
  	outline-offset: 3px;
}

/* Checkbox Text */
.filter-checkbox-text {
	flex: 1;
	font-size: 13px;
	color:#5E5E5E;
	line-height: 20px;
}

.filter-checkbox:disabled + .filter-checkbox-custom {
	background-color: #f5f6f7;
	border-color: #e0e6ed;
	cursor: not-allowed;
}

.filter-checkbox:disabled ~ .filter-checkbox-text {
	color: #9aa5b1;
	cursor: not-allowed;
}

/* Category Filter Specific */
.category-filter .filter-group-title {
	background: transparent;
	font-weight: 500;
	border-bottom: none;
}

/* Active Filters Panel */
#active-filters-panel,
.woo-active-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 15px;
	margin-bottom: 15px;
}

#active-filters-panel:empty,
.woo-active-filters:empty {
	display: none;
}

/* Filter Chip */
.filter-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background-color: #F6F6F6;
	color: #253746;
	padding: 13px 15px;
	font-size: 13px;
	line-height: 20px;
}

.filter-chip .remove-filter-chip {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	background-color: transparent;
	color: #6b7280;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	font-size: 12px;
	font-weight: 700;
	transition: color 0.15s ease, transform 0.15s ease;
	padding: 0;
	text-decoration: none;
	line-height: 1;
}

.filter-chip .remove-filter-chip:hover {
	color: #253746;
}

/* Clear All Filters Button */
#clear-all-filters {
	padding: 0;
	background: transparent;
	border: none;
	color: #5E5E5E;
	font-size: 12px;
	font-weight: 500;
	cursor: pointer;
	transition: color 0.15s ease;
	text-decoration: underline;
	align-self: center;
}

#clear-all-filters:hover {
	color: #253746;
}

@keyframes slideIn {
	from {
		opacity: 0;
		transform: scale(0.8);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

/* Responsive Design */
@media (max-width: 768px) {
	.woo-filters-wrapper {
		border-radius: 6px;
		margin-bottom: 20px;
	}

	.filter-group-title {
		padding: 14px 16px;
		font-size: 13px;
	}

	.filter-group-content {
		padding: 12px 16px;
	}

	.filter-checkbox-label {
		padding: 6px 0;
		margin-bottom: 2px;
	}

	#active-filters-panel {
		padding: 12px 0;
		gap: 8px;
		margin-bottom: 15px;
	}

	.filter-chip {
		padding: 6px 10px;
		font-size: 11px;
		gap: 6px;
	}

	#clear-all-filters {
		padding: 6px 12px;
		font-size: 11px;
	}
}

@media (max-width: 480px) {
	.woo-filters-wrapper {
		border-radius: 4px;
		border: 1px solid #ddd;
	}

	.filter-group-title {
		padding: 12px 14px;
		font-size: 12px;
	}

	.filter-group-content {
		padding: 10px 14px;
	}

	.filter-checkbox-label {
		padding: 5px 0;
		margin-bottom: 1px;
	}

	.filter-checkbox-custom {
		width: 16px;
		height: 16px;
		min-width: 16px;
		min-height: 16px;
		border-width: 1.5px;
		margin-right: 8px;
	}

	.filter-checkbox-text {
		font-size: 11px;
	}

	#active-filters-panel {
		padding: 10px;
		gap: 6px;
		margin-bottom: 12px;
		flex-direction: column;
	}

	.filter-chip {
		padding: 6px 10px;
		font-size: 10px;
		gap: 6px;
		width: 100%;
		justify-content: space-between;
	}

	#clear-all-filters {
		width: 100%;
		padding: 6px 12px;
		font-size: 10px;
	}
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
	.filter-group-title,
	.filter-checkbox-custom,
	.filter-chip,
	.filter-toggle-icon {
		transition: none;
	}
}

.woo-products-count {
	font-size: 13px;
	line-height: 20px;
	color: #5E5E5E;
}

.woo-products-count.hidden {
	display: none !important;
}

.woo-filters-container .woo-sorting select {
	width: 100%;
}

@media (max-width: 1024px) {
	.woo-sidebar {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 15px;
	}

	.woo-sidebar .product-archive-select {
		width: 100%;
		margin-bottom: 0;
		flex: 1;
	}
}

/* Entrance/Exit Animations */
@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

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

@keyframes slideInRight {
	from {
		transform: translateX(100%);
	}
	to {
		transform: translateX(0);
	}
}

@keyframes slideOutRight {
	from {
		transform: translateX(0);
	}
	to {
		transform: translateX(100%);
	}
}
	.woo-sidebar .woo-filters-open-btn {
		width: 100%;
		flex: 1;
	}
}

@media (max-width: 1024px) {
	.woo-sidebar {
		gap: 5px;
	}
}