/* ==========================================================================

   DD Product Filter Styles (Premium Modern UI)

   Desktop First Approach

   ========================================================================== */

:root {

	/* Default primary colors if not overridden by inline settings */

	--dd-primary: #2563eb;

	--dd-primary-hover: #1d4ed8;

	--dd-primary-bg: #eff6ff;

	--dd-primary-border: #93c5fd;

	--dd-primary-light-shadow: rgba(37, 99, 235, 0.1);

}

.dd-product-filter-wrapper {

	font-family: 'Inter', 'Roboto', sans-serif;

	margin-bottom: 20px;

	color: #1a1a1a;

}

.dd-filter-title {

	font-size: 18px;

	font-weight: 700;

	margin-bottom: 16px;

	color: #111827;

	letter-spacing: -0.02em;

}

/* --- Featured Filters (Brands / Needs) --- */

.dd-featured-group {

	margin-bottom: 30px;

}

.dd-featured-grid {

	display: flex;

	flex-wrap: wrap;

	gap: 12px;

}

.dd-featured-item {

	display: flex;

	flex-direction: column;

	align-items: center;

	justify-content: center;

	border: 1px solid #e5e7eb;

	border-radius: 12px;

	padding: 10px 12px;

	background: #ffffff;

	text-decoration: none;

	color: #4b5563;

	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

	min-width: 100px;

	max-width: 140px;

	flex: 1;

	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);

}

.dd-featured-item:hover {

	border-color: var(--dd-primary);

	box-shadow: 0 4px 12px var(--dd-primary-light-shadow);

	transform: translateY(-2px);

	color: var(--dd-primary);

}

.dd-featured-item.active {

	border-color: var(--dd-primary);

	color: var(--dd-primary-hover);

	background-color: var(--dd-primary-bg);

	box-shadow: 0 0 0 1px var(--dd-primary);

}

/* Image Wrapper để cố định kích thước ảnh, tránh bị to nhỏ */

.dd-img-wrapper {

	height: 45px;

	width: 100%;

	display: flex;

	align-items: center;

	justify-content: center;

	margin-bottom: 8px;

}

.dd-featured-item img {

	max-height: 100%;

	max-width: 100%;

	object-fit: contain;

	transition: transform 0.25s ease;

}

.dd-featured-item:hover img {

	transform: scale(1.05);

}

.dd-term-name {

	font-size: 13px;

	font-weight: 500;

	text-align: center;

	line-height: 1.3;

	overflow: hidden;

	text-overflow: ellipsis;

	display: -webkit-box;

	-webkit-line-clamp: 2;
	/* Giới hạn 2 dòng */

	-webkit-box-orient: vertical;

}

/* --- Dropdown Filter Bar --- */

.dd-filter-bar-container {

	margin-top: 25px;

	background: #ffffff;

	padding: 15px 0;

	border-top: 1px solid #f3f4f6;

}

.dd-filter-bar-wrapper {

	display: flex;

	gap: 12px;

	align-items: center;

	flex-wrap: wrap;

}

.dd-filter-bar {

	display: flex;

	flex: 1;

	min-width: 0;
	/* Cho phép con bên trong cuộn ngang */

	flex-wrap: wrap;

	gap: 12px;

	align-items: center;

}

.dd-dropdown-item {

	position: relative;

}

.dd-dropdown-label {

	display: flex;

	align-items: center;

	gap: 6px;

	padding: 8px 16px;

	background: #f9fafb;

	border: 1px solid #e5e7eb;

	border-radius: 8px;

	cursor: pointer;

	font-size: 14px;

	font-weight: 500;

	user-select: none;

	color: #374151;

	transition: all 0.2s ease;

}

.dd-dropdown-label:hover {

	background: #f3f4f6;

	border-color: #d1d5db;

}

.dd-dropdown-item.has-active-filter .dd-dropdown-label {

	background: var(--dd-primary-bg);

	border-color: var(--dd-primary);

	color: var(--dd-primary);

}

.dd-dropdown-item.has-active-filter .dd-dropdown-label svg {

	color: var(--dd-primary);

}

.dd-dropdown-content {

	visibility: hidden;

	pointer-events: none;

	position: absolute;

	top: 100%;

	left: 0;

	margin-top: 8px;

	background: #ffffff;

	border: 1px solid #e5e7eb;

	box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

	border-radius: 12px;

	min-width: 340px;
	/* Cập nhật theo yêu cầu user */

	z-index: 99999;

	padding: 16px;

	opacity: 0;

	transform: translateY(10px);

	transition: opacity 0.2s ease, transform 0.2s ease;

}

.dd-dropdown-item.show {

	z-index: 99999;

}

.dd-dropdown-item.show .dd-dropdown-content {

	visibility: visible;

	pointer-events: auto;

	opacity: 1;

	transform: translateY(0);

}

.dd-dropdown-list {

	display: flex;

	flex-wrap: wrap;

	gap: 8px;

	margin-bottom: 16px;

	max-height: 250px;

	overflow-y: auto;

	padding-right: 4px;

}

/* Custom Scrollbar for Dropdown List */

.dd-dropdown-list::-webkit-scrollbar {

	width: 4px;

}

.dd-dropdown-list::-webkit-scrollbar-track {

	background: #f1f1f1;

	border-radius: 4px;

}

.dd-dropdown-list::-webkit-scrollbar-thumb {

	background: #c1c1c1;

	border-radius: 4px;

}

.dd-dropdown-term {

	padding: 6px 12px;

	border: 1px solid #e5e7eb;

	border-radius: 6px;

	font-size: 13px;

	text-decoration: none;

	color: #4b5563;

	transition: all 0.2s ease;

	background: #fff;

}

.dd-dropdown-term:hover {

	border-color: #9ca3af;

	color: #111827;

}

.dd-dropdown-term.active {

	border-color: var(--dd-primary);

	color: var(--dd-primary-hover);

	background-color: var(--dd-primary-bg);

	font-weight: 500;

}

.dd-dropdown-actions {

	display: flex;

	justify-content: space-between;

	border-top: 1px solid #f3f4f6;

	padding-top: 12px;

	gap: 10px;

}

.dd-btn-close,
.dd-btn-reset-mega {

	background: #ffffff;

	border: 1px solid #d1d5db;

	color: #374151;

	padding: 0 8px;
	/* Cập nhật theo yêu cầu user */

	border-radius: 6px;

	cursor: pointer;

	font-size: 13px;

	font-weight: 600;

	flex: 1;

	transition: all 0.2s;

	display: flex;

	align-items: center;

	justify-content: center;

	min-height: 40px;

}

.dd-btn-close:hover,
.dd-btn-reset-mega:hover {

	background: #f9fafb;

	color: #111827;

}

.dd-btn-apply {

	background: var(--dd-primary);

	color: #ffffff;

	border: 1px solid var(--dd-primary);

	padding: 0 16px;

	border-radius: 6px;

	cursor: pointer;

	font-size: 13px;

	font-weight: 600;

	flex: 1;

	transition: all 0.2s;

	display: flex;

	align-items: center;

	justify-content: center;

	min-height: 40px;

}

.dd-btn-apply:hover {

	background: var(--dd-primary-hover);

	border-color: var(--dd-primary-hover);

	box-shadow: 0 2px 4px var(--dd-primary-light-shadow);

}

/* --- Active Filters Bar (Đang lọc theo) --- */

.dd-active-filters-container {

	margin-top: 15px;

	margin-bottom: 25px;

}

.dd-active-title {

	font-size: 16px;

	font-weight: bold;

	margin-bottom: 10px;

	color: #111;

}

.dd-active-groups {

	display: flex;

	flex-wrap: wrap;

	gap: 10px;

	align-items: center;

}

.dd-active-group {

	border: 1px solid #d1d5db;

	border-radius: 8px;

	padding: 6px 12px;

	display: flex;

	align-items: center;

	font-size: 14px;

	background: #f9fafb;

}

.dd-ag-label {

	color: #4b5563;

	margin-right: 5px;

}

.dd-ag-terms {

	color: var(--dd-primary);

	font-weight: 500;

}

.dd-ag-remove {

	margin-left: 8px;

	cursor: pointer;

	color: #9ca3af;

	background: #e5e7eb;

	border-radius: 50%;

	width: 20px;

	height: 20px;

	display: inline-flex;

	align-items: center;

	justify-content: center;

	transition: all 0.2s ease;

}

.dd-ag-remove:hover {

	color: #fff;

	background: #ef4444;

}

.dd-clear-all {

	color: var(--dd-primary);

	font-size: 14px;

	text-decoration: none;

	margin-left: 5px;

}

.dd-clear-all:hover {

	text-decoration: underline;

}

/* --- Mega Filter Dropdown --- */

.dd-mega-label {

	color: #ef4444 !important;

	border-color: #ef4444 !important;

	font-weight: 600 !important;

	background: #ffffff !important;

}

.dd-mega-label svg {

	color: #ef4444 !important;

}

.dd-mega-content {

	width: 850px;

	max-width: 95vw;

	left: 0;

	padding: 24px 24px 16px 24px;

	cursor: default;

}

.dd-mega-columns {

	display: flex;

	flex-wrap: wrap;

	gap: 30px;

	margin-bottom: 24px;

}

.dd-mega-column {

	flex: 1;

	min-width: 200px;

}

.dd-mega-column-title {

	font-size: 14px;

	font-weight: bold;

	color: #374151;

	margin-bottom: 12px;

	display: flex;

	align-items: center;

	gap: 6px;

}

.dd-mega-column-list {

	display: flex;

	flex-wrap: wrap;

	gap: 8px;

}

.dd-mega-actions {

	border-top: 1px solid #e5e7eb;

	padding-top: 16px;

	display: flex;

	justify-content: flex-end;

	gap: 12px;

}

.dd-mega-actions .dd-btn-close-mega {

	background: #ffffff;

	border: 1px solid #d1d5db;

	color: #374151;

	padding: 0 8px;

	border-radius: 6px;

	cursor: pointer;

	font-size: 13px;

	font-weight: 600;

	flex: 1;

	transition: all 0.2s;

	display: flex;

	align-items: center;

	justify-content: center;

	min-height: 36px;

}

.dd-mega-actions .dd-btn-close-mega:hover {

	background: #f9fafb;

	color: #111827;

}

/* --- Custom Sorting Bar --- */

.dd-custom-sorting-wrapper {

	display: flex;

	align-items: center;

	margin-top: 15px;

	margin-bottom: 25px;

	gap: 12px;

	flex-direction: row;

	justify-content: space-between;

}

.dd-custom-sorting-wrapper .dd-filter-title {

	font-size: 16px;

	color: #111;

	width: fit-content;

}

.dd-custom-sorting-buttons {

	display: flex;

	flex-wrap: wrap;

	gap: 10px;

}

.dd-sort-btn {

	display: inline-flex;

	align-items: center;

	gap: 6px;

	padding: 8px 16px;

	background: #f9fafb;

	border: 1px solid #e5e7eb;

	border-radius: 20px;

	color: #374151;

	text-decoration: none;

	font-size: 14px;

	font-weight: 500;

	transition: all 0.2s;

}

.dd-sort-btn:hover {

	background: #f3f4f6;

	border-color: #d1d5db;

}

.dd-sort-btn svg {

	width: 18px;

	height: 18px;

}

.dd-sort-btn.active {
	background: var(--dd-primary-bg);
	border-color: var(--dd-primary);
	color: var(--dd-primary);
}

.dd-sort-btn.active svg *[stroke="#1D1D20"] {
	stroke: currentColor;
}

.dd-sort-btn.active svg *[fill="#1D1D20"] {
	fill: currentColor;
}

/* --- Subcategories Pills --- */
.dd-subcategories-filters {
	margin-bottom: 15px;
}

.dd-subcats-slider-container {
	position: relative;
	display: flex;
	align-items: center;
	width: 100%;
}

.dd-slider-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 32px;
	height: 32px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 50%;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 2;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
	color: #4b5563;
	transition: all 0.2s;
	display: none;
	/* JS will toggle flex */
	padding: 0;
	margin: 0;
	min-height: unset;
}

.dd-slider-btn:hover {
	background: #f9fafb;
	color: #111827;
}

.dd-slider-prev {
	left: -15px;
}

.dd-slider-next {
	right: -15px;
}

.dd-subcats-pill-list {
	display: flex;
	flex-wrap: nowrap;
	gap: 10px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	padding: 5px 0;
	scroll-behavior: smooth;
	-ms-overflow-style: none;
	scrollbar-width: none;
	width: 100%;
}

.dd-subcats-pill-list::-webkit-scrollbar {
	display: none;
}

.dd-subcat-pill {
	flex: 0 0 auto;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 6px 16px;
	background: #f3f4f6;
	color: #111827;
	border: 1px solid #e5e7eb;
	border-radius: 20px;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	transition: all 0.2s ease;
}

.dd-subcat-pill:hover {
	background: #e5e7eb;
	color: #000;
}

.dd-subcat-pill.active {
	background: #2563eb;
	color: #fff;
	border-color: #2563eb;
}

.dd-custom-sorting-wrapper {
	display: none !important;
}

/* --- Utilities --- */
.hide-on-desktop {

	display: none !important;

}

.dd-mobile-sort-bar {

	display: flex;

	align-items: stretch;

	justify-content: space-between;

	border-top: 1px solid #e5e7eb;

	border-bottom: 1px solid #e5e7eb;

	padding: 0;

	background: #fff;

	margin-bottom: 20px;

}



.dd-ms-item {

	flex: 1;

	text-align: center;

	padding: 12px 0;

	font-size: 14px;

	color: #6b7280;

	text-decoration: none;

	border-right: 1px solid #e5e7eb;

	display: flex;

	align-items: center;

	justify-content: center;

	gap: 4px;

	position: relative;

}



.dd-ms-item:last-child {

	border-right: none;

}



.dd-ms-item.active {

	color: var(--dd-primary);

	border-bottom: 2px solid var(--dd-primary);

	font-weight: 600;

}



.dd-ms-arrow {

	display: inline-flex;

	flex-direction: column;

	justify-content: center;

}



.dd-ms-arrow svg {

	margin: -2px 0;

}

.dd-ms-filter-btn {

	cursor: pointer;

}



.dd-filter-dot {

	position: absolute;

	top: 8px;

	right: 15px;

	width: 8px;

	height: 8px;

	background-color: #f97316;

	border-radius: 50%;

}


@media only screen and (max-width: 48em) {
	.hide-on-desktop {
		display: flex !important;
	}

	.dd-featured-grid {

		flex-wrap: nowrap;

		overflow-x: auto;

		-webkit-overflow-scrolling: touch;

		padding-bottom: 12px;

		scroll-snap-type: x mandatory;

	}



	.dd-featured-item {

		flex: 0 0 auto;

		min-width: 90px;

		scroll-snap-align: start;

	}

	.dd-featured-grid::-webkit-scrollbar {

		height: 4px;

	}

	.dd-featured-grid::-webkit-scrollbar-thumb {

		background: #d1d5db;

		border-radius: 4px;

	}



	.dd-filter-bar {

		flex-wrap: nowrap;

		overflow-x: auto;

		-webkit-overflow-scrolling: touch;

		padding-bottom: 12px;

	}



	.dd-filter-bar::-webkit-scrollbar {

		display: none;

	}

	.dd-filter-bar-container {

		display: none;

	}



	/* CSS bắt buộc khi DOM bị detach ra body để tránh transform cha */

	.dd-dropdown-content.show-on-mobile {

		visibility: visible !important;

		pointer-events: auto !important;

		opacity: 1 !important;

		transform: translateY(-100%) !important;

		z-index: 99999 !important;

	}

	.dd-dropdown-content {

		position: fixed;

		top: 100%;

		bottom: auto;

		left: 0;

		width: 100%;

		max-width: 100%;

		max-height: 90vh;

		display: flex;

		flex-direction: column;

		border-radius: 20px 20px 0 0;

		margin: 0;

		padding: 0;

		box-sizing: border-box;

		box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);

		border: none;

		z-index: 99999;

		transform: translateY(0);

		opacity: 0;

		transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;

	}



	.dd-mobile-header {

		display: flex;

		justify-content: space-between;

		align-items: center;

		padding: 16px 20px;

		border-bottom: 1px solid #e5e7eb;

		flex-shrink: 0;

	}

	.dd-mobile-title {

		font-weight: 600;

		font-size: 16px;

		color: #111827;

		flex: 1;

		text-align: center;

		margin-left: 24px;
		/* offset for close button to center title */

	}

	.dd-btn-close-mega-top {

		background: none;

		border: none;

		color: #4b5563;

		padding: 4px;

		margin: 0;

		cursor: pointer;

		display: flex;

		align-items: center;

		justify-content: center;

	}

	.dd-mega-columns,
	.dd-dropdown-list {

		flex: 1;

		overflow-y: auto;

		padding: 20px;

		-webkit-overflow-scrolling: touch;

		max-height: none;
		/* override desktop */

	}

	.dd-dropdown-actions {

		flex-shrink: 0;

		padding: 16px 20px;

		border-top: 1px solid #e5e7eb;

		background: #fff;

		margin-top: 0;

	}



	/* Lớp phủ màn hình khi mở dropdown mobile */

	.dd-backdrop {

		position: fixed;

		top: 0;

		left: 0;

		right: 0;

		bottom: 0;

		background: rgba(17, 24, 39, 0.6);

		backdrop-filter: blur(2px);

		z-index: 99998;

		visibility: hidden;

		pointer-events: none;

		opacity: 0;

		transition: opacity 0.3s ease, visibility 0.3s;

	}

	.dd-backdrop.show {

		visibility: visible;

		pointer-events: auto;

		opacity: 1;

	}

}

.dd-filter-icon {
	margin-left: 2px;
}