/**
 * Nexus Product Filter Frontend Styles
 *
 * @package Nexus_Product_Filter
 */

.nexus-filter-wrapper {
	position: relative;
	width: 100%;
}

.nexus-filter-heading {
	margin: 0 0 20px 0;
	padding: 0;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.4;
}

.nexus-filter-categories {
	margin-bottom: 20px;
}

.nexus-filter-category {
	margin-bottom: 10px;
}

.nexus-filter-parent-wrapper {
	padding-bottom: 10px;
	margin-bottom: 15px;
}

.nexus-filter-parent-wrapper:last-child {
	margin-bottom: 0;
}

.nexus-filter-parent-category {
	display: flex;
	align-items: center;
	cursor: pointer;
	padding: 10px 0;
	font-weight: 600;
	transition: color 0.3s ease;
	user-select: none;
}

.nexus-filter-parent-category:hover {
	color: #0073aa;
}

.nexus-filter-toggle-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-left: auto;
	font-size: 18px;
	font-weight: 300;
	width: 24px;
	height: 24px;
	line-height: 1;
	transition: all 0.3s ease;
	cursor: pointer;
	user-select: none;
}

.nexus-filter-category-name {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 8px;
}

.nexus-filter-count {
	font-weight: 400;
	font-size: 0.9em;
	opacity: 0.7;
	color: inherit;
}

.nexus-filter-children {
	margin-left: 0px;
	margin-top: 0px;
	padding-left: 15px;
	overflow: hidden;
}

.nexus-filter-child-category {
	display: flex;
	align-items: center;
	justify-content: space-between;
	text-decoration: none;
	cursor: pointer;
	padding: 8px 12px;
	margin-bottom: 5px;
	transition: all 0.3s ease;
	user-select: none;
	position: relative;
	color: inherit;
}

.nexus-filter-child-name {
	flex: 1;
}

.nexus-filter-child-category:hover {
	background-color: #f5f5f5;
	color: #0073aa;
	text-decoration: none;
}

.nexus-filter-child-category.active {
	background-color: #0073aa;
	color: #ffffff;
	font-weight: 500;
	text-decoration: none;
}

.nexus-filter-child-category.active::before {
	content: '✓';
	position: absolute;
	left: 8px;
	font-weight: bold;
}

.nexus-filter-child-category.active {
	padding-left: 28px;
}

.nexus-filter-clear {
	display: inline-block;
	padding: 10px 20px;
	background-color: #0073aa;
	color: #ffffff;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	transition: all 0.3s ease;
	margin-top: 15px;
}

.nexus-filter-clear:hover {
	background-color: #005a87;
	transform: translateY(-1px);
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.nexus-filter-clear:active {
	transform: translateY(0);
}

/* Loading state */
.nexus-filter-wrapper.nexus-filter-loading {
	opacity: 0.7;
	pointer-events: none;
	position: relative;
}

.nexus-filter-wrapper.nexus-filter-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 20px;
	height: 20px;
	border-top: 2px solid #0073aa;
	animation: nexus-spin 1s linear infinite;
	z-index: 10;
}

.nexus-filter-no-results {
	padding: 20px;
	text-align: center;
	color: #666;
}

.nexus-filter-wrapper.nexus-filter-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 20px;
	height: 20px;
	border-top: 2px solid #0073aa;
	animation: nexus-spin 1s linear infinite;
}

@keyframes nexus-spin {
	0% { transform: translate(-50%, -50%) rotate(0deg); }
	100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive styles */
@media (max-width: 768px) {
	.nexus-filter-parent-category {
		padding: 12px 0;
		font-size: 16px;
	}

	.nexus-filter-child-category {
		padding: 10px 12px;
		font-size: 15px;
	}

	.nexus-filter-clear {
		width: 100%;
		text-align: center;
	}
}

/* Smooth animations */
.nexus-filter-children {
	transition: max-height 0.3s ease, opacity 0.3s ease;
}

/* Attributes Filter Styles */
.nexus-filter-attributes {
	margin-top: 30px;
}

.nexus-filter-attribute-group {
	margin-bottom: 25px;
}

.nexus-filter-attribute-label {
	font-weight: 600;
	font-size: 16px;
	margin-bottom: 12px;
	color: #333333;
}

.nexus-filter-attribute-terms {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.nexus-filter-attribute-term {
	display: inline-flex;
	align-items: center;
	justify-content: space-between;
	text-decoration: none;
	cursor: pointer;
	padding: 8px 12px;
	transition: all 0.3s ease;
	user-select: none;
	position: relative;
	color: inherit;
	background-color: #f5f5f5;
}

.nexus-filter-attribute-term:hover {
	background-color: #e0e0e0;
	color: #0073aa;
	text-decoration: none;
}

.nexus-filter-attribute-term.active {
	background-color: #0073aa;
	color: #ffffff;
	font-weight: 500;
	text-decoration: none;
}

.nexus-filter-attribute-term-name {
	flex: 1;
}

.nexus-filter-attributes-heading {
	margin-top: 30px;
}

/* Filter Results Grid */
.nexus-filter-results-grid {
	display: grid;
	gap: 20px;
	width: 100%;
}

.nexus-filter-result-item {
	width: 100%;
	/* height: 100%; */
}
.nexus-filter-result-item > .e-loop-item{
	height: 100%;
} 

/* Responsive grid for different items per row */
.nexus-filter-results-grid[data-items-per-row="1"] {
	grid-template-columns: 1fr;
}

.nexus-filter-results-grid[data-items-per-row="2"] {
	grid-template-columns: repeat(2, 1fr);
}

.nexus-filter-results-grid[data-items-per-row="3"] {
	grid-template-columns: repeat(3, 1fr);
}

.nexus-filter-results-grid[data-items-per-row="4"] {
	grid-template-columns: repeat(4, 1fr);
}

.nexus-filter-results-grid[data-items-per-row="5"] {
	grid-template-columns: repeat(5, 1fr);
}

.nexus-filter-results-grid[data-items-per-row="6"] {
	grid-template-columns: repeat(6, 1fr);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
	.nexus-filter-results-grid[data-items-per-row="6"],
	.nexus-filter-results-grid[data-items-per-row="5"] {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media (max-width: 992px) {
	.nexus-filter-results-grid[data-items-per-row="6"],
	.nexus-filter-results-grid[data-items-per-row="5"],
	.nexus-filter-results-grid[data-items-per-row="4"] {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 768px) {
	.nexus-filter-results-grid[data-items-per-row="6"],
	.nexus-filter-results-grid[data-items-per-row="5"],
	.nexus-filter-results-grid[data-items-per-row="4"],
	.nexus-filter-results-grid[data-items-per-row="3"] {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 480px) {
	.nexus-filter-results-grid {
		grid-template-columns: 1fr !important;
	}
}

