/**
 * Collection / search page (Appendix A.7).
 *
 * Values copied from the reference `collection_style.scss.css` and
 * `search_style.scss.css` (1rem = 10px). The product card, grid, pagination,
 * alerts and the custom checkbox live in nest.css (A.6/A.8); this sheet only
 * adds the page chrome: banner, title lockup, category pills, sort toolbar and
 * the off-canvas filter drawer.
 */

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */
.nest-collection {
	display: block;
	padding-bottom: 0;
}

.nest-collection .woocommerce-notices-wrapper:empty {
	display: none;
}

/* --------------------------------------------------------------------------
   Banner (.layout-collection .col-banner)
   -------------------------------------------------------------------------- */
.nest-collection__banner {
	margin-bottom: 20px;
}

.nest-collection__banner a {
	display: block;
	width: 100%;
	aspect-ratio: 1250 / 306;
	overflow: hidden;
	position: relative;
	transition: filter .3s;
}

.nest-collection__banner a::before {
	content: "";
	position: absolute;
	display: block;
	top: 4px;
	left: 4px;
	right: 4px;
	bottom: 4px;
	border: 1px solid #fff;
	opacity: .5;
	transition: opacity .3s cubic-bezier(.37, .01, 0, .98);
	z-index: 10;
}

.nest-collection__banner a:hover {
	filter: brightness(1.1);
}

.nest-collection__banner img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* --------------------------------------------------------------------------
   Title + separator (.col-title)
   -------------------------------------------------------------------------- */
.nest-collection__head {
	text-align: center;
	margin-bottom: 16px;
}

.nest-collection__title {
	font-size: 30px;
	font-weight: 700;
	margin: 0;
	line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Root category pills (.col-list-cate .menu-list .cate-item)
   -------------------------------------------------------------------------- */
.nest-collection__cates {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	column-gap: 16px;
	row-gap: 10px;
	margin-bottom: 16px;
}

.nest-cate-pill {
	width: auto;
	flex: 0 0 auto;
	padding: 4px 20px;
	text-align: center;
	border: 1px solid var(--mainColor);
	position: relative;
	color: var(--textColor);
	transition: all .3s;
}

.nest-cate-pill::before {
	content: "";
	width: 9px;
	height: 9px;
	border: 1px solid var(--mainColor);
	background: #fff;
	position: absolute;
	top: calc(50% - 3px);
	left: -5px;
	transform: rotate(45deg);
}

.nest-cate-pill__title {
	font-size: 16px;
	font-weight: 600;
	line-height: initial;
	display: block;
}

.nest-cate-pill:hover,
.nest-cate-pill.is-active {
	color: #fff;
	background: var(--mainColor);
}

.nest-cate-pill:hover::before,
.nest-cate-pill.is-active::before {
	background: var(--subColor);
}

/* --------------------------------------------------------------------------
   Description (.col-desc)
   -------------------------------------------------------------------------- */
.nest-collection__desc {
	font-size: 14px;
	color: #666;
	text-align: center;
	margin-bottom: 16px;
}

.nest-collection__desc p:last-child {
	margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Sort + filter toolbar (.sort-cate)
   -------------------------------------------------------------------------- */
.nest-sort {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-bottom: 6px;
	border-bottom: 2px solid var(--mainColor);
	margin-bottom: 20px;
}

.nest-sort__left {
	display: inline-block;
	position: relative;
}

.nest-sort__filter {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 34px;
	padding: 0 15px;
	font-size: 14px;
	font-weight: 600;
	border: 1px solid #ccc;
	color: #333f48;
	background-color: #f8f8f8;
	line-height: inherit;
	position: relative;
	cursor: pointer;
}

.nest-sort__filter svg {
	width: 18px;
	height: 18px;
	margin-right: 5px;
}

.nest-sort__count {
	position: absolute;
	top: -3px;
	left: -3px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background-color: var(--subColor);
	transition: all .3s ease-in-out;
	text-align: center;
	line-height: 16px;
	color: #fff;
	font-size: 9px;
}

.nest-sort__right {
	flex-grow: 1;
	display: flex;
	justify-content: flex-end;
	align-items: center;
	position: relative;
}

.nest-sort__right h3 {
	display: flex;
	align-items: center;
	font-size: 14px;
	color: #000;
	margin: 0 24px 0 0;
	font-weight: 700;
	line-height: 1.4;
	/* Flatsome sets `h1..h6 { width: 100% }`; as a flex item that would eat
	   the whole toolbar and squeeze the sort list. */
	width: auto;
	flex: none;
	white-space: nowrap;
}

.nest-sort__right h3 svg {
	width: 22px;
	height: 22px;
	fill: #333;
	margin-right: 4px;
}

.nest-sort__right ul {
	display: flex;
	gap: 20px;
	margin: 0;
	padding: 0;
	list-style: none;
	flex: none;
}

.nest-sort__item {
	margin: 0;
	list-style: none;
}

.nest-sort__item a {
	display: block;
	padding: 0 0 0 12px;
	font-size: 14px;
	color: #333f48;
	background-color: transparent;
	font-weight: 600;
	text-align: right;
	position: relative;
	white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Grid
   -------------------------------------------------------------------------- */
.nest-collection__grid {
	margin-top: 20px;
	margin-bottom: 20px;
}

/* Search results: 4 / 3 / 2 columns (search_style.scss.css col-*-15 row) */
.nest-search-title {
	font-size: 16px;
	text-transform: uppercase;
	font-weight: 700;
	margin: 15px 0;
}

.nest-search-page .nest-collection__grid {
	margin-top: 0;
}

/* --------------------------------------------------------------------------
   Off-canvas filter drawer (.dqdt-sidebar)
   -------------------------------------------------------------------------- */
.nest-filter {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	width: 340px;
	background-color: #fff;
	z-index: 999999;
	transform: translateX(-100%);
	visibility: hidden;
	transition: transform .5s cubic-bezier(.645, .045, .355, 1), visibility .5s cubic-bezier(.645, .045, .355, 1);
	box-shadow: none;
	touch-action: manipulation;
}

.nest-filter.is-open {
	visibility: visible;
	transform: translateX(0);
}

.nest-filter__close {
	display: flex;
	justify-content: center;
	align-items: center;
	background: var(--mainColor);
	color: #fff;
	position: absolute;
	top: 0;
	left: 100%;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 0;
	cursor: pointer;
	transition: background .3s;
}

.nest-filter__close svg {
	width: 20px;
	height: 20px;
}

.nest-filter__close:hover {
	background: var(--subColor);
}

.nest-filter__scroll {
	overflow: auto;
	height: 100%;
}

.nest-filter__scroll::-webkit-scrollbar {
	width: 5px;
	background-color: #f5f5f5;
}

.nest-filter__scroll::-webkit-scrollbar-track {
	box-shadow: inset 0 0 2px rgba(0, 0, 0, .3);
	border-radius: 5px;
	background-color: #f5f5f5;
}

.nest-filter__scroll::-webkit-scrollbar-thumb {
	border-radius: 5px;
	box-shadow: inset 0 0 2px rgba(0, 0, 0, .3);
	background-color: #e5e5e5;
}

.nest-filter__content {
	padding: 20px 10px;
	height: auto;
	display: inline-block;
	width: 100%;
}

/* "Bạn chọn" — selected facets */
.nest-filter__selected {
	width: 100%;
	border-bottom: 1px dashed #f2f2f2;
	margin-bottom: 15px;
}

.nest-filter__selected-head {
	margin-bottom: 10px;
	overflow: hidden;
}

.nest-filter__selected-title {
	font-size: 15px;
	font-weight: 700;
	color: var(--mainColor);
}

.nest-filter__clear {
	float: right;
	font-size: 14px;
	font-weight: 600;
	color: #bf1e2e;
	margin-top: 0;
}

.nest-filter__clear svg {
	width: 10px;
	height: 10px;
	fill: #bf1e2e;
	margin-left: 3px;
	position: relative;
	bottom: 1px;
}

.nest-filter__clear:hover {
	color: var(--hover);
}

.nest-filter__clear:hover svg {
	fill: var(--hover);
}

.nest-filter__chips {
	padding-left: 0;
	overflow: hidden;
	margin: 0 0 10px;
	list-style: none;
}

.nest-filter__chips li {
	display: inline-block;
	float: left;
	font-size: 14px;
	margin-right: 10px;
	margin-bottom: 5px;
	background: var(--mainColor);
	color: #fff;
	padding: 0 5px;
	list-style: none;
}

.nest-filter__chips a {
	color: #fff;
	display: inline-flex;
	align-items: center;
}

.nest-filter__chips a::before {
	content: "\00d7";
	display: inline-block;
	margin-right: 6px;
	font-size: 15px;
	line-height: 1;
}

.nest-filter__chips li:hover {
	background: var(--hover);
}

/* Facet groups */
.nest-filter__group {
	width: 100%;
	display: block;
	padding-bottom: 15px;
	border-bottom: 1px solid #ddd;
	margin-bottom: 15px;
}

.nest-filter__group:last-child {
	padding-bottom: 0;
	margin-bottom: 0;
	border-bottom: none;
}

.nest-filter__title {
	position: relative;
	margin-bottom: 10px;
}

.nest-filter__title h2 {
	font-size: 16px;
	text-transform: uppercase;
	font-weight: 600;
	margin: 0 0 20px;
	padding-left: 22px;
	position: relative;
	line-height: 1.4;
}

.nest-filter__title h2::before,
.nest-filter__title h2::after {
	content: "";
	display: block;
	width: 8px;
	height: 8px;
	border: 1px solid var(--mainColor);
	position: absolute;
	top: 6px;
	transform: rotate(45deg);
}

.nest-filter__title h2::before {
	left: 0;
}

.nest-filter__title h2::after {
	left: 5px;
}

.nest-filter__list {
	width: 100%;
	display: inline-block;
	list-style: none;
	padding-left: 0;
	margin-bottom: 0;
	max-height: 176px;
	overflow: hidden;
	overflow-y: auto;
}

.nest-filter__list::-webkit-scrollbar {
	width: 5px;
	background-color: #f2f2f2;
}

.nest-filter__list::-webkit-scrollbar-track {
	border-radius: 5px;
	box-shadow: inset 0 0 2px rgba(0, 0, 0, .3);
	background-color: #f2f2f2;
}

.nest-filter__list::-webkit-scrollbar-thumb {
	border-radius: 5px;
	box-shadow: inset 0 0 2px rgba(0, 0, 0, .3);
	background-color: var(--mainColor);
}

.nest-filter__item {
	margin: 0 0 10px;
	list-style: none;
}

.nest-filter__item:last-child {
	margin-bottom: 0;
}

.nest-filter__item .nest-checkbox {
	width: 100%;
}

.nest-filter__item .nest-checkbox label {
	width: 100%;
	font-size: 14px;
	color: #282828;
}

.nest-filter__item .nest-checkbox label::before {
	width: 15px;
	height: 15px;
	margin-right: 5px;
}

.nest-filter__item .nest-checkbox label:hover {
	color: var(--mainColor);
}

.nest-filter-backdrop {
	background: rgba(0, 0, 0, .8);
	position: fixed;
	top: 0;
	left: 0;
	height: 100%;
	width: 100%;
	z-index: 9;
	display: none;
}

.nest-filter-backdrop.is-open {
	display: block;
}

/* --------------------------------------------------------------------------
   ≥1024
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
	.nest-sort__filter:hover,
	.nest-sort__filter.is-active {
		color: #fff;
		border-color: var(--mainColor);
		background-color: var(--mainColor);
	}

	.nest-sort__filter:hover svg,
	.nest-sort__filter.is-active svg {
		fill: #fff;
	}
}

/* --------------------------------------------------------------------------
   ≥992 — sort list is inline with diamond bullets
   -------------------------------------------------------------------------- */
@media (min-width: 992px) {
	.nest-sort__item a::before {
		content: "";
		width: 10px;
		height: 10px;
		border: 1px solid var(--mainColor);
		background: #f8f8f8;
		position: absolute;
		top: calc(50% - 5px);
		left: -5px;
		transform: rotate(45deg);
	}

	.nest-sort__item:hover a,
	.nest-sort__item.is-active a {
		color: var(--mainColor);
	}

	.nest-sort__item:hover a::before,
	.nest-sort__item.is-active a::before {
		background: var(--subColor);
	}
}

/* --------------------------------------------------------------------------
   ≤991 — "Xếp theo" becomes a button opening a dropdown
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
	.nest-sort__right h3 {
		display: flex;
		align-items: center;
		padding: 0 15px;
		height: 34px;
		font-size: 14px;
		border: 1px solid #ccc;
		color: #333f48;
		background-color: #f8f8f8;
		font-weight: 600;
		min-width: 110px;
		text-align: center;
		margin: 0;
		cursor: pointer;
	}

	.nest-sort__right.is-open h3 {
		color: #fff;
		border-color: var(--subColor);
		background-color: var(--subColor);
	}

	.nest-sort__right.is-open h3 svg {
		fill: #fff;
	}

	.nest-sort__right ul {
		display: none;
		position: absolute;
		z-index: 99;
		background-color: #fff;
		top: calc(100% + 5px);
		right: 0;
		min-width: 155px;
		text-align: left;
		box-shadow: 2px 3px 7px 0 rgba(0, 0, 0, .2);
		padding: 10px;
		flex-direction: column;
		gap: 0;
	}

	.nest-sort__right.is-open ul {
		display: flex;
	}

	.nest-sort__item {
		float: none;
		display: block;
		padding-left: 0;
		width: 100%;
		text-align: center;
	}

	.nest-sort__item + .nest-sort__item {
		margin-top: 10px;
	}

	.nest-sort__item a {
		padding: 4px 10px;
		border: 0;
		text-align: center;
	}

	.nest-sort__item:hover a,
	.nest-sort__item.is-active a {
		background: var(--mainColor);
		color: #fff;
	}
}

/* --------------------------------------------------------------------------
   768–991 — search results drop to 3 columns
   -------------------------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 991px) {
	.nest-search-page .nest-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* --------------------------------------------------------------------------
   ≤767
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
	.nest-collection__title {
		font-size: 24px;
	}

	.nest-collection__cates {
		flex-wrap: nowrap;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		width: auto;
		margin-right: -14px;
		margin-left: -14px;
		padding-left: 14px;
		padding-right: 14px;
		justify-content: flex-start;
	}

	.nest-cate-pill {
		scroll-snap-align: start;
	}

	.nest-cate-pill__title {
		font-size: 14px;
	}

	.nest-collection__grid {
		margin-top: 10px;
	}

	.nest-filter {
		width: 256px;
	}
}
