/* NG15 attribute filters — see inc/attribute-filters.php / ng15-filters.js.
   Sidebar on desktop, collapsible "Filters" panel under 1025px. */

/* Brand colours for the filter UI (selected boxes, chips, links, badge).
   Client forks of the theme override these two values to match their
   buttons — nothing else in this file needs touching. */
:root {
	--ng15-filter-accent: #0d3e66;
	--ng15-filter-accent-hover: #5c0c05;
}

.ng15-category-layout.has-filters {
	display: grid;
	grid-template-columns: 260px minmax(0, 1fr);
	gap: 32px;
	align-items: start;
}

/* The sidebar takes a column's worth of width, so the grid goes from 4 to 3
   across. At 1024px and below the sidebar collapses and ng15-category.css's
   own 3/2/1-column rules apply. */
@media (min-width: 1025px) {
	.ng15-category-layout.has-filters .ng15-product-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

.ng15-category-layout.has-filters .ng15-filter-results {
	min-width: 0;
}

.ng15-filter-results {
	transition: opacity 0.15s ease;
}

.ng15-filters[hidden] {
	display: none;
}

.ng15-filters__toggle {
	display: none;
}

.ng15-filters__panel {
	border: 1px solid #e5e5e5;
	border-radius: 4px;
	background: #fafafa;
	padding: 4px 18px 8px;
}

/* Active filters */
.ng15-filters__active {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	padding: 14px 0 12px;
	border-bottom: 1px solid #e5e5e5;
}

.ng15-filters__chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	border-radius: 999px;
	background: var(--ng15-filter-accent);
	color: #fff;
	font-size: 12px;
	line-height: 1.3;
	text-decoration: none;
}

.ng15-filters__chip:hover {
	background: var(--ng15-filter-accent-hover);
	color: #fff;
}

.ng15-filters__chip-x {
	font-size: 15px;
	line-height: 1;
}

.ng15-filters__clear {
	font-size: 13px;
	color: var(--ng15-filter-accent);
	text-decoration: underline;
}

.ng15-filters__clear:hover {
	color: var(--ng15-filter-accent-hover);
}

/* One attribute */
.ng15-filter-group {
	border-bottom: 1px solid #e5e5e5;
	padding: 12px 0;
}

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

.ng15-filter-group__title {
	cursor: pointer;
	font-size: 14px;
	font-weight: 700;
	color: #333;
	list-style: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.ng15-filter-group__title::-webkit-details-marker {
	display: none;
}

.ng15-filter-group__title::after {
	content: '';
	width: 7px;
	height: 7px;
	border-right: 2px solid #777;
	border-bottom: 2px solid #777;
	transform: rotate(45deg);
	margin: -3px 2px 0 0;
	transition: transform 0.15s ease;
}

.ng15-filter-group[open] > .ng15-filter-group__title::after {
	transform: rotate(-135deg);
	margin-top: 3px;
}

.ng15-filter-group__list {
	list-style: none;
	margin: 10px 0 0;
	padding: 0;
}

.ng15-filter-group__list li {
	margin: 0;
	padding: 0;
}

/* One value: custom checkbox + name + count, the whole row is the link. */
.ng15-filter-option {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 5px 0;
	font-size: 14px;
	color: #333;
	text-decoration: none;
	cursor: pointer;
}

.ng15-filter-option:hover .ng15-filter-option__name {
	text-decoration: underline;
}

.ng15-filter-option:focus-visible {
	outline: 2px solid var(--ng15-filter-accent);
	outline-offset: 2px;
}

.ng15-filter-option__box {
	flex: 0 0 16px;
	width: 16px;
	height: 16px;
	border: 2px solid #999;
	border-radius: 2px;
	background: #fff;
	position: relative;
	box-sizing: border-box;
}

.ng15-filter-option.is-selected .ng15-filter-option__box {
	background: var(--ng15-filter-accent);
	border-color: var(--ng15-filter-accent);
}

.ng15-filter-option.is-selected .ng15-filter-option__box::after {
	content: '';
	position: absolute;
	left: 3px;
	top: 0;
	width: 4px;
	height: 8px;
	border-right: 2px solid #fff;
	border-bottom: 2px solid #fff;
	transform: rotate(45deg);
}

.ng15-filter-option__name {
	flex: 1 1 auto;
	min-width: 0;
	overflow-wrap: anywhere;
}

.ng15-filter-option__count {
	flex: 0 0 auto;
	font-size: 12px;
	color: #777;
}

.ng15-filter-more {
	display: none;
	margin-top: 6px;
	padding: 0;
	border: 0;
	background: none;
	font-size: 13px;
	color: var(--ng15-filter-accent);
	text-decoration: underline;
	cursor: pointer;
}

/* With JS: long lists show the first ten, the rest behind "Show all". */
.ng15-filters--collapsible .ng15-filter-more {
	display: inline-block;
}

.ng15-filters--collapsible .ng15-filter-option-extra {
	display: none;
}

.ng15-filters--collapsible .ng15-filter-group.is-expanded .ng15-filter-option-extra {
	display: block;
}

@media (max-width: 1024px) {
	.ng15-category-layout.has-filters {
		display: block;
	}

	.ng15-filters {
		margin-bottom: 20px;
	}

	/* Collapsible only once JS is there to open it again. */
	.ng15-filters--collapsible .ng15-filters__toggle {
		display: flex;
		align-items: center;
		justify-content: flex-start;
		width: 100%;
		padding: 12px 16px;
		border: 1px solid #ccc;
		border-radius: 3px;
		background: #fff;
		color: #333;
		font-size: 15px;
		font-weight: 600;
		cursor: pointer;
	}

	.ng15-filters--collapsible .ng15-filters__toggle::after {
		content: '';
		width: 8px;
		height: 8px;
		border-right: 2px solid #777;
		border-bottom: 2px solid #777;
		transform: rotate(45deg);
		transition: transform 0.15s ease;
	}

	.ng15-filters--collapsible.is-open .ng15-filters__toggle::after {
		transform: rotate(-135deg);
	}

	.ng15-filters__badge {
		margin-left: 8px;
		min-width: 20px;
		padding: 1px 6px;
		border-radius: 999px;
		background: var(--ng15-filter-accent);
		color: #fff;
		font-size: 12px;
		text-align: center;
	}

	.ng15-filters__badge[hidden] {
		display: none;
	}

	/* Label and badge sit together, chevron pushed right. */
	.ng15-filters--collapsible .ng15-filters__toggle::after {
		margin-left: auto;
	}

	.ng15-filters--collapsible .ng15-filters__panel {
		display: none;
		margin-top: 8px;
	}

	.ng15-filters--collapsible.is-open .ng15-filters__panel {
		display: block;
	}
}

/* "Clear filters" link inside the no-results message. */
.ng15-filter-results .ng15-no-products .ng15-filters__clear {
	margin-left: 6px;
}
