/**
 * Mega Menu "Tất cả danh mục" – style
 * Cột trái: danh mục cấp 1. Vùng phải: danh mục con (3–4 cột).
 */

/* Tắt outline/box-shadow focus cho nút + toàn bộ dropdown */
.vdc-mega-menu-wrap .vdc-mega-menu-trigger:focus,
.vdc-mega-menu-wrap .vdc-mega-menu-trigger:focus-visible,
.vdc-mega-menu-wrap .vdc-mega-menu-panel:focus,
.vdc-mega-menu-wrap .vdc-mega-menu-panel:focus-visible,
.vdc-mega-menu-wrap .vdc-mega-menu-panel *:focus,
.vdc-mega-menu-wrap .vdc-mega-menu-panel *:focus-visible {
	outline: none;
	box-shadow: none;
}

/* ---- Trigger (nút "TẤT CẢ DANH MỤC") ---- */
.vdc-mega-menu-wrap {
	position: relative;
	display: inline-block;
}

.vdc-mega-menu-trigger {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 12px 10px 12px 20px;
	background: #2563eb;
	color: #fff !important;
	border: none;
	font-size: 14px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	cursor: pointer;
	white-space: nowrap;
	transition: background-color 0.2s ease;
}

.vdc-mega-menu-trigger:hover,
.vdc-mega-menu-wrap.is-open .vdc-mega-menu-trigger {
	background: #1d4ed8;
	color: #fff !important;
}

/* Luôn trắng: chữ + icon + mũi tên trên nút (tránh theme/Elementor ghi đè) */
.vdc-mega-menu-trigger *,
.vdc-mega-menu-trigger .vdc-mega-menu-trigger-icon,
.vdc-mega-menu-trigger .vdc-mega-menu-trigger-arrow,
.vdc-mega-menu-trigger svg,
.vdc-mega-menu-trigger i {
	color: #fff !important;
	fill: #fff !important;
}
.vdc-mega-menu-trigger:hover *,
.vdc-mega-menu-wrap.is-open .vdc-mega-menu-trigger * {
	color: #fff !important;
	fill: #fff !important;
}

/* Hamburger icon (3 gạch ngang) – chỉ khi không dùng icon tùy chỉnh, scale theo font-size */
.vdc-mega-menu-trigger-icon:not(.vdc-mega-menu-trigger-icon-custom) {
	width: 1em;
	height: 0.7em;
	position: relative;
	box-shadow: 0 0.375em 0 currentColor;
}

.vdc-mega-menu-trigger-icon:not(.vdc-mega-menu-trigger-icon-custom)::before,
.vdc-mega-menu-trigger-icon:not(.vdc-mega-menu-trigger-icon-custom)::after {
	content: "";
	position: absolute;
	left: 0;
	width: 100%;
	height: 0.125em;
	background: currentColor;
}

.vdc-mega-menu-trigger-icon:not(.vdc-mega-menu-trigger-icon-custom)::before {
	top: 0;
}

.vdc-mega-menu-trigger-icon:not(.vdc-mega-menu-trigger-icon-custom)::after {
	bottom: 0;
}

/* Icon tùy chỉnh (Elementor) */
.vdc-mega-menu-trigger-icon-custom {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.vdc-mega-menu-trigger-icon-custom svg {
	width: 1em;
	height: 1em;
}

.vdc-mega-menu-trigger-icon-custom i {
	font-size: 1em;
}

/* Mũi tên xuống bên phải nút – đẩy sát mép phải */
.vdc-mega-menu-trigger .vdc-mega-menu-trigger-arrow {
	margin-left: auto;
}

.vdc-mega-menu-trigger-arrow:not(.vdc-mega-menu-trigger-arrow-custom) {
	width: 0;
	height: 0;
	border-left: 0.3em solid transparent;
	border-right: 0.3em solid transparent;
	border-top: 0.3em solid currentColor;
}

.vdc-mega-menu-trigger-arrow-custom {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.vdc-mega-menu-trigger-arrow-custom svg {
	width: 1em;
	height: 1em;
}

.vdc-mega-menu-trigger-arrow-custom i {
	font-size: 1em;
}

/* ---- Panel (mega menu): cấp 1 = chiều rộng nút, cấp 2+3 hiện khi hover L1 ---- */
.vdc-mega-menu-panel {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 1000;
	background: #fff;
	min-height: 500px;
	border: none;
}

.vdc-mega-menu-panel[hidden] {
	display: none !important;
}

.vdc-mega-menu-wrap.is-open .vdc-mega-menu-panel[hidden] {
	display: block !important;
}

.vdc-mega-menu-inner {
	display: flex;
	min-height: 500px;
}

/* ---- Cột trái: danh mục cấp 1 (chiều rộng = nút, set bởi widget) ---- */
.vdc-mega-menu-left {
	background: #fafafa;
}

.vdc-mega-menu-parent-list {
	list-style: none;
	margin: 0;
	padding: 8px 0;
}

.vdc-mega-menu-parent-item {
	margin: 0;
}

.vdc-mega-menu-parent-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 10px 16px;
	color: #374151;
	text-decoration: none;
	font-size: 14px;
	font-weight: 600;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.vdc-mega-menu-parent-link:hover,
.vdc-mega-menu-parent-item.is-active .vdc-mega-menu-parent-link {
	background: #2563eb;
	color: #fff;
}

/* Mũi tên phải cho item cột trái (mặc định CSS hoặc icon tùy chỉnh) */
.vdc-mega-menu-parent-arrow:not(.vdc-mega-menu-parent-arrow-custom) {
	flex-shrink: 0;
	width: 0;
	height: 0;
	border-top: 0.25em solid transparent;
	border-bottom: 0.25em solid transparent;
	border-left: 0.35em solid #9ca3af;
	transition: border-color 0.15s ease;
}

.vdc-mega-menu-parent-link:hover .vdc-mega-menu-parent-arrow:not(.vdc-mega-menu-parent-arrow-custom),
.vdc-mega-menu-parent-item.is-active .vdc-mega-menu-parent-arrow:not(.vdc-mega-menu-parent-arrow-custom) {
	border-left-color: #fff;
}

.vdc-mega-menu-parent-arrow-custom {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: inherit;
}

.vdc-mega-menu-parent-arrow-custom svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.vdc-mega-menu-parent-arrow-custom i {
	font-size: 1em;
}

/* ---- Vùng phải: chỉ hiện khi hover danh mục cấp 1 ---- */
.vdc-mega-menu-right {
	flex: 0 0 0;
	min-width: 0;
	width: 0;
	overflow: hidden;
	padding: 0;
	position: relative;
	opacity: 0;
	visibility: hidden;
	transition: flex 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
}

.vdc-mega-menu-wrap.has-hovered-parent .vdc-mega-menu-right {
	flex: 0 0 1040px;
	width: 1040px;
	height: 500px;
	min-width: 1040px;
	min-height: 500px;
	background: #fff;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 20px 24px;
	opacity: 1;
	visibility: visible;
	border: none;
	outline: none;
	/* Scrollbar nhạt, tránh lộ vẻ “viền đen” */
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.vdc-mega-menu-wrap.has-hovered-parent .vdc-mega-menu-right::-webkit-scrollbar {
	display: none;
	width: 0;
	height: 0;
}


.vdc-mega-menu-sub-panel {
	position: absolute;
	inset: 0;
	min-height: 500px;
	background: #fff;
	padding: 20px 24px;
	overflow-y: auto;
	overflow-x: hidden;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
	border: none;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.vdc-mega-menu-sub-panel::-webkit-scrollbar {
	display: none;
	width: 0;
	height: 0;
}

.vdc-mega-menu-sub-panel.is-visible {
	position: relative;
	opacity: 1;
	visibility: visible;
}

/* Cấp 2 + cấp 3: nhiều cột, nội dung rớt sang cột mới thay vì tràn chiều cao */
.vdc-mega-menu-sub-grid {
	column-count: 2;
	column-gap: 24px;
	column-fill: balance;
}

.vdc-mega-menu-sub-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
	break-inside: avoid;
	page-break-inside: avoid;
	margin-bottom: 16px;
}

.vdc-mega-menu-sub-group:last-child {
	margin-bottom: 0;
}

.vdc-mega-menu-sub-group-title {
	font-weight: 600;
	font-size: 14px;
	color: #111827;
	text-decoration: none;
	padding-bottom: 4px;
	border-bottom: 1px solid #e5e7eb;
	transition: color 0.15s ease;
}

.vdc-mega-menu-sub-group-title:hover {
	color: #2563eb;
}

.vdc-mega-menu-sub-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.vdc-mega-menu-sub-list li {
	margin: 0;
}

.vdc-mega-menu-sub-link {
	display: block;
	padding: 4px 0;
	color: #374151;
	text-decoration: none;
	font-size: 13px;
	line-height: 1.4;
	transition: color 0.15s ease;
}

.vdc-mega-menu-sub-link:hover {
	color: #2563eb;
}

.vdc-mega-menu-sub-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 120px;
}

.vdc-mega-menu-sub-view-all {
	color: #2563eb;
	font-size: 14px;
	text-decoration: none;
}

.vdc-mega-menu-sub-view-all:hover {
	text-decoration: underline;
}

/* Trạng thái khi chỉ dùng hover (không click) */
@media (hover: hover) {
	.vdc-mega-menu-wrap[data-behavior="hover"] .vdc-mega-menu-panel {
		display: block;
	}
	.vdc-mega-menu-wrap[data-behavior="hover"] .vdc-mega-menu-panel[hidden] {
		display: none !important;
	}
	.vdc-mega-menu-wrap[data-behavior="hover"]:hover .vdc-mega-menu-panel[hidden] {
		display: block !important;
	}
}

.vdc-mega-menu-empty {
	margin: 0;
	padding: 8px 0;
	font-size: 14px;
	color: #6b7280;
}

/* Mobile: panel full width, nổi trên nội dung, tap mở/đóng */
@media (max-width: 991px) {
	.vdc-mega-menu-panel {
		left: 0;
		right: 0;
		width: 100%;
		min-height: 0;
		max-height: 85vh;
		overflow-y: auto;
		z-index: 999999;
		box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
	}
	.vdc-mega-menu-inner {
		flex-direction: column;
		min-height: 0;
	}
	.vdc-mega-menu-left {
		flex-shrink: 0;
	}
	.vdc-mega-menu-wrap.has-hovered-parent .vdc-mega-menu-right {
		flex: 1 1 auto;
		width: 100%;
		min-width: 0;
		min-height: 200px;
		max-height: 60vh;
		height: auto;
	}
}

/* Mobile nhỏ: panel dạng bottom drawer – hiệu ứng trượt từ dưới lên khi mở/đóng */
@media (max-width: 767px) {
	.vdc-mega-menu-panel {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		top: auto;
		width: 100%;
		max-height: 80vh;
		border-radius: 16px 16px 0 0;
		overflow-y: auto;
		box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
		transform: translateY(100%);
		transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
		pointer-events: none;
	}
	.vdc-mega-menu-wrap.is-open .vdc-mega-menu-panel {
		transform: translateY(0);
		pointer-events: auto;
	}
	.vdc-mega-menu-panel:focus {
		outline: none;
	}

	/* Danh mục cấp 1 full width trên mobile */
	.vdc-mega-menu-left {
		width: 100%;
		flex: 1 1 100%;
		min-width: 0;
		max-width: 100% !important;
	}
	.vdc-mega-menu-parent-list {
		padding: 0;
	}
	.vdc-mega-menu-parent-item {
		width: 100%;
	}
	.vdc-mega-menu-parent-link {
		width: 100%;
		box-sizing: border-box;
		padding: 14px 16px;
	}

	/* Two-step mobile: View B = only sub panel + back bar. No hover-to-open sub. */
	.vdc-mega-menu-back {
		display: none;
		flex-shrink: 0;
		padding: 12px 16px;
		border-bottom: 1px solid #e5e7eb;
		background: #fafafa;
	}
	.vdc-mega-menu-back.vdc-mega-menu-back--visible {
		display: block;
	}
	.vdc-mega-menu-back-btn {
		display: inline-flex;
		align-items: center;
		padding: 8px 0;
		border: 0;
		background: none !important;
		color: #2563eb !important;
		font-size: 14px;
		font-weight: 600;
		cursor: pointer;
	}
	.vdc-mega-menu-back-btn:hover {
		text-decoration: underline;
	}

	/* View B: hide level-1 list, show only the active sub panel */
	.vdc-mega-menu-panel.vdc-mega-menu-panel--view-sub .vdc-mega-menu-left {
		display: none !important;
	}
	.vdc-mega-menu-panel.vdc-mega-menu-panel--view-sub .vdc-mega-menu-right {
		flex: 1 1 auto;
		width: 100%;
		min-width: 0;
		display: block;
		visibility: visible;
		opacity: 1;
		overflow-y: auto;
		max-height: none;
		height: auto;
		padding: 16px;
	}
	.vdc-mega-menu-panel.vdc-mega-menu-panel--view-sub .vdc-mega-menu-sub-panel {
		position: relative;
		display: none;
		opacity: 0;
		visibility: hidden;
		min-height: 0;
		padding: 0;
	}
	.vdc-mega-menu-panel.vdc-mega-menu-panel--view-sub .vdc-mega-menu-sub-panel.is-visible {
		display: block;
		opacity: 1;
		visibility: visible;
	}
}
