/**
 * Menu danh mục — cha trái, con (ảnh) phải
 */

.dienmay-cat-menu {
	position: relative;
	display: inline-block;
	vertical-align: middle;
	z-index: 100;
}

.dienmay-cat-menu-empty {
	font-size: 13px;
	color: #666;
	margin: 0;
}

/* Nút mở */
.dienmay-cat-menu__toggle {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 0 18px;
	min-height: 46px;
	border: none;
	border-radius: 4px;
	background: var(--dienmay-primary, #dd3333);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.2s;
}

.dienmay-cat-menu__toggle:hover,
.dienmay-cat-menu.is-open .dienmay-cat-menu__toggle {
	background: var(--dienmay-primary-dark, #c42b2b);
	color: #fff;
}

.dienmay-cat-menu__chevron {
	font-size: 11px;
	transition: transform 0.2s;
}

.dienmay-cat-menu__label--short {
	display: none;
}

.dienmay-cat-menu.is-open .dienmay-cat-menu__chevron {
	transform: rotate(180deg);
}

/* Dropdown panel — width căn theo .container (JS set left + width) */
.dienmay-cat-menu__dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	margin-top: 4px;
	width: 100%;
	min-width: 0;
	max-width: none;
	box-sizing: border-box;
}

.dienmay-cat-menu__dropdown[hidden] {
	display: none !important;
}

.dienmay-cat-menu__panel {
	display: flex;
	min-height: 380px;
	max-height: min(70vh, 520px);
	background: #fff;
	border-radius: 0 0 8px 8px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
	border: 1px solid #e8e8e8;
	overflow: hidden;
}

/* Cột trái — danh mục cha */
.dienmay-cat-menu__parents {
	flex: 0 0 260px;
	max-width: 260px;
	background: #fafafa;
	border-right: 1px solid #eee;
	overflow-y: auto;
}

.dienmay-cat-menu__parent-list {
	list-style: none;
	margin: 0;
	padding: 8px 0;
}

.dienmay-cat-menu__parent-list li {
	margin: 0;
}

.dienmay-cat-menu__parent-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 12px 16px;
	color: #222;
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	border-left: 3px solid transparent;
	transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.dienmay-cat-menu__parent-item i {
	font-size: 10px;
	color: #aaa;
	opacity: 0;
	transition: opacity 0.15s;
}

.dienmay-cat-menu__parent-item:hover,
.dienmay-cat-menu__parent-item.is-active {
	background: #fff;
	color: var(--dienmay-primary, #dd3333);
	border-left-color: var(--dienmay-primary, #dd3333);
}

.dienmay-cat-menu__parent-item:hover i,
.dienmay-cat-menu__parent-item.is-active i {
	opacity: 1;
	color: var(--dienmay-primary, #dd3333);
}

/* Cột phải — danh mục con */
.dienmay-cat-menu__children {
	flex: 1;
	min-width: 0;
	overflow-y: auto;
	padding: 20px 24px;
}

.dienmay-cat-menu__child-panel {
	display: none;
}

.dienmay-cat-menu__child-panel.is-active {
	display: block;
	animation: dienmay-cat-fade 0.2s ease;
}

@keyframes dienmay-cat-fade {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.dienmay-cat-menu__child-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 20px;
	padding-bottom: 12px;
	border-bottom: 1px solid #eee;
}

.dienmay-cat-menu__child-title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	color: #111;
}

.dienmay-cat-menu__view-all {
	font-size: 13px;
	font-weight: 600;
	color: var(--dienmay-primary, #dd3333);
	text-decoration: none;
	white-space: nowrap;
}

.dienmay-cat-menu__view-all:hover {
	text-decoration: underline;
	color: var(--dienmay-primary-dark, #c42b2b);
}

.dienmay-cat-menu__view-all i {
	margin-left: 4px;
	font-size: 11px;
}

.dienmay-cat-menu__child-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	gap: 16px 12px;
}

.dienmay-cat-menu[data-columns="5"] .dienmay-cat-menu__child-grid {
	grid-template-columns: repeat(5, 1fr);
}

.dienmay-cat-menu[data-columns="4"] .dienmay-cat-menu__child-grid {
	grid-template-columns: repeat(4, 1fr);
}

.dienmay-cat-menu[data-columns="3"] .dienmay-cat-menu__child-grid {
	grid-template-columns: repeat(3, 1fr);
}

.dienmay-cat-menu__child-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	text-decoration: none;
	color: #333;
	gap: 10px;
	padding: 8px 4px;
	border-radius: 8px;
	transition: background 0.15s;
}

.dienmay-cat-menu__child-card:hover {
	background: #fff5f5;
	color: var(--dienmay-primary, #dd3333);
}

.dienmay-cat-menu__thumb {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 1;
	max-width: 88px;
	margin: 0 auto;
}

.dienmay-cat-menu__thumb-img {
	max-width: 100%;
	max-height: 72px;
	width: auto;
	height: auto;
	object-fit: contain;
}

.dienmay-cat-menu__child-name {
	font-size: 12px;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.dienmay-cat-menu__no-children {
	font-size: 14px;
	color: #666;
	margin: 0;
}

.dienmay-cat-menu__no-children a {
	color: var(--dienmay-primary, #dd3333);
}

/* Trong header Flatsome */
.header-main .dienmay-cat-menu,
.header-bottom .dienmay-cat-menu,
#header .dienmay-cat-menu {
	z-index: 999;
}

.header-nav .html_nav_position .dienmay-cat-menu {
	display: inline-flex;
}

/* Mobile */
@media (max-width: 849px) {
	.dienmay-cat-menu__label--full {
		display: none;
	}

	.dienmay-cat-menu__label--short {
		display: inline;
	}

	/*
	 * Flatsome: .header-main li.html.custom { display: none } trên mobile
	 */
	.header-main li.html.custom.html_topbar_left {
		display: list-item !important;
	}

	.header-main .flex-col.show-for-medium.flex-left {
		flex: 0 1 auto;
		min-width: 0;
		max-width: 46%;
	}

	.header-main .mobile-nav.nav-left {
		display: flex;
		flex-wrap: nowrap;
		align-items: center;
		gap: 2px;
	}

	.header-main .mobile-nav.nav-left > li.nav-icon {
		flex: 0 0 auto;
	}

	.header-main .mobile-nav.nav-left > li.html.custom {
		flex: 1 1 auto;
		min-width: 0;
	}

	/* Nút gọn — đã có icon menu Flatsome, bỏ icon bars trùng */
	.header-main .mobile-nav .dienmay-cat-menu {
		display: block;
		width: 100%;
	}

	.header-main .dienmay-cat-menu__toggle {
		width: 100%;
		max-width: 100%;
		padding: 0 8px;
		min-height: 36px;
		font-size: 10px;
		gap: 4px;
		border-radius: 4px;
	}

	.header-main .dienmay-cat-menu__toggle .fa-bars {
		display: none;
	}

	.header-main .dienmay-cat-menu__label--short {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		line-height: 1.2;
	}

	.header-main .dienmay-cat-menu__chevron {
		font-size: 9px;
		flex-shrink: 0;
	}

	/* Panel full màn — layout dọc 2 cột như desktop */
	.dienmay-cat-menu__dropdown {
		position: fixed;
		left: 0 !important;
		right: 0;
		width: 100% !important;
		margin-top: 0;
		z-index: 100050;
		box-sizing: border-box;
	}

	.dienmay-cat-menu__panel {
		flex-direction: row;
		align-items: stretch;
		min-height: min(72vh, 480px);
		max-height: min(72vh, 480px);
		border-radius: 0;
	}

	/* Cột trái: danh mục cha — scroll dọc */
	.dienmay-cat-menu__parents {
		flex: 0 0 38%;
		max-width: 150px;
		min-width: 108px;
		max-height: none;
		height: auto;
		border-right: 1px solid #eee;
		border-bottom: none;
	}

	.dienmay-cat-menu__parent-list {
		display: block;
		overflow-x: hidden;
		overflow-y: auto;
		padding: 4px 0;
		max-height: min(72vh, 480px);
		-webkit-overflow-scrolling: touch;
	}

	.dienmay-cat-menu__parent-list li {
		flex: none;
	}

	.dienmay-cat-menu__parent-item {
		border-left: 3px solid transparent;
		border-radius: 0;
		padding: 10px 8px 10px 10px;
		white-space: normal;
		font-size: 12px;
		line-height: 1.35;
	}

	.dienmay-cat-menu__parent-item i {
		display: none;
	}

	.dienmay-cat-menu__parent-item.is-active {
		background: #fff;
		color: var(--dienmay-primary, #dd3333);
		border-left-color: var(--dienmay-primary, #dd3333);
	}

	/* Cột phải: danh mục con */
	.dienmay-cat-menu__children {
		flex: 1 1 auto;
		min-width: 0;
		min-height: 0;
		padding: 12px 10px;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	.dienmay-cat-menu__child-header {
		margin-bottom: 10px;
		padding-bottom: 8px;
		gap: 8px;
	}

	.dienmay-cat-menu__child-title {
		font-size: 14px;
	}

	.dienmay-cat-menu__view-all {
		font-size: 11px;
	}

	.dienmay-cat-menu__child-grid {
		grid-template-columns: repeat(2, 1fr) !important;
		gap: 10px 6px;
	}

	.dienmay-cat-menu__thumb {
		max-width: 72px;
	}

	.dienmay-cat-menu__thumb-img {
		max-height: 56px;
	}

	.dienmay-cat-menu__child-name {
		font-size: 11px;
		-webkit-line-clamp: 2;
		line-clamp: 2;
	}
}

