/**
 * SMT Product category mega menu
 */

.smt-cat-mega {
	position: relative;
	display: inline-block;
	z-index: 200;
}

.smt-cat-mega__toggle {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 10px 16px;
	border: 0;
	border-radius: 4px;
	background: var(--primary-color, #1e73be);
	color: #fff;
	font-size: 13px;
	font-weight: 800;
	letter-spacing: .03em;
	text-transform: uppercase;
	cursor: pointer;
	line-height: 1.2;
	transition: filter .2s ease, box-shadow .2s ease;
}

.smt-cat-mega__toggle:hover,
.smt-cat-mega.is-open .smt-cat-mega__toggle {
	filter: brightness(1.06);
	box-shadow: 0 8px 20px rgba(30, 115, 190, .28);
}

.smt-cat-mega__toggle-icon svg,
.smt-cat-mega__toggle-caret svg {
	width: 18px;
	height: 18px;
	display: block;
}

.smt-cat-mega__toggle-caret {
	transition: transform .2s ease;
}

.smt-cat-mega.is-open .smt-cat-mega__toggle-caret {
	transform: rotate(180deg);
}

.smt-cat-mega.is-open {
	z-index: 300;
}

.smt-cat-mega__panel {
	position: absolute;
	left: var(--smt-cat-mega-panel-left, 0);
	top: calc(100% + 8px);
	width: var(--smt-cat-mega-panel-width, min(1080px, calc(100vw - 24px)));
	max-width: var(--smt-cat-mega-panel-width, calc(100vw - 24px));
}

.smt-cat-mega__panel[hidden] {
	display: none !important;
}

.smt-cat-mega__inner {
	display: grid;
	grid-template-columns: 260px 1fr;
	grid-template-rows: minmax(0, 1fr);
	height: min(70vh, 520px);
	min-height: 360px;
	max-height: min(70vh, 520px);
	border-radius: 8px;
	overflow: hidden;
	border: 1px solid #e6e9ef;
	background: #fff;
	box-shadow: 0 24px 60px rgba(15, 30, 55, .18);
}

/* Level 1 */
.smt-cat-mega__left,
.smt-cat-mega__right {
	height: 100%;
	min-height: 0;
}

.smt-cat-mega__left {
	max-height: 100%;
	border-right: 1px solid #eef0f4;
	background: #fafbfc;
	overflow-x: hidden;
	overflow-y: scroll;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-gutter: stable;
	scrollbar-width: thin;
	scrollbar-color: #98a3b3 #e4e9f0;
}

.smt-cat-mega__pane-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: scroll;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 16px 20px 22px;
	scrollbar-gutter: stable;
	scrollbar-width: thin;
	scrollbar-color: #98a3b3 #e4e9f0;
}

/* Thanh scroll luôn hiện khi còn nội dung */
.smt-cat-mega__left.is-scrollable,
.smt-cat-mega__pane-body.is-scrollable {
	overflow-y: scroll;
	scrollbar-width: thin;
}

.smt-cat-mega__left::-webkit-scrollbar,
.smt-cat-mega__pane-body::-webkit-scrollbar {
	width: 5px;
	height: 5px;
	-webkit-appearance: none;
}

.smt-cat-mega__left.is-scrollable::-webkit-scrollbar,
.smt-cat-mega__pane-body.is-scrollable::-webkit-scrollbar {
	display: block;
}

.smt-cat-mega__left::-webkit-scrollbar-track,
.smt-cat-mega__pane-body::-webkit-scrollbar-track {
	background: #dde3eb;
	border-radius: 999px;
}

.smt-cat-mega__left.is-scrollable::-webkit-scrollbar-track,
.smt-cat-mega__pane-body.is-scrollable::-webkit-scrollbar-track {
	background: #d2dae4;
	box-shadow: inset 0 0 0 1px #bcc6d2;
}

.smt-cat-mega__left::-webkit-scrollbar-thumb,
.smt-cat-mega__pane-body::-webkit-scrollbar-thumb {
	background: #8f9bab;
	border-radius: 999px;
	border: 1px solid #dde3eb;
	min-height: 32px;
}

.smt-cat-mega__left.is-scrollable::-webkit-scrollbar-thumb,
.smt-cat-mega__pane-body.is-scrollable::-webkit-scrollbar-thumb {
	background: #7b8798;
	border-color: #d2dae4;
}

.smt-cat-mega__left::-webkit-scrollbar-thumb:hover,
.smt-cat-mega__pane-body::-webkit-scrollbar-thumb:hover {
	background: #667283;
}

/* Gợi ý còn nội dung phía dưới (hỗ trợ iOS không hiện scrollbar cố định) */
.smt-cat-mega__left.has-more-below,
.smt-cat-mega__pane-body.has-more-below {
	box-shadow: inset 0 -20px 16px -12px rgba(35, 45, 60, .16);
}

.smt-cat-mega__l1 {
	list-style: none;
	margin: 0;
	padding: 8px 0;
}

.smt-cat-mega__l1 li {
	margin: 0 0 3px;
}

.smt-cat-mega__l1-btn {
	width: calc(100% - 12px);
	margin: 0 6px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 13px 14px 13px 12px;
	border: 0;
	border-left: 4px solid transparent;
	border-radius: 0 10px 10px 0;
	background: transparent;
	color: #333;
	font-size: 13.5px;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
	transition:
		background 0.25s ease,
		color 0.25s ease,
		border-color 0.25s ease,
		border-left-width 0.25s ease,
		box-shadow 0.25s ease,
		transform 0.25s ease,
		font-weight 0.15s ease;
}

.smt-cat-mega__l1-btn:hover {
	background: linear-gradient(
		90deg,
		color-mix(in srgb, var(--primary-color, #1e73be) 14%, #fff) 0%,
		#fff 72%
	);
	color: var(--primary-color, #1e73be);
	border-left-color: var(--primary-color, #1e73be);
	border-left-width: 5px;
	padding-left: 11px;
	box-shadow: 0 6px 18px rgba(15, 30, 55, 0.1);
	transform: translateX(5px);
	font-weight: 700;
}

.smt-cat-mega__l1-btn.is-active {
	background: linear-gradient(
		90deg,
		color-mix(in srgb, var(--primary-color, #1e73be) 18%, #fff) 0%,
		#fff 78%
	);
	color: var(--primary-color, #1e73be);
	border-left-color: var(--primary-color, #1e73be);
	border-left-width: 5px;
	padding-left: 11px;
	box-shadow: 0 6px 20px rgba(15, 30, 55, 0.12);
	transform: translateX(5px);
	font-weight: 800;
}

.smt-cat-mega__l1-btn:hover .smt-cat-mega__l1-arrow,
.smt-cat-mega__l1-btn.is-active .smt-cat-mega__l1-arrow {
	color: var(--primary-color, #1e73be);
	transform: translateX(6px) scale(1.15);
	font-weight: 700;
}

.smt-cat-mega__l1-arrow {
	color: #bbb;
	font-size: 20px;
	line-height: 1;
	transition: transform 0.25s ease, color 0.25s ease;
}

/* Level 2 */
.smt-cat-mega__right {
	position: relative;
	display: flex;
	flex-direction: column;
	max-height: 100%;
	overflow: hidden;
}

.smt-cat-mega__panel-pane {
	display: none;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	height: 100%;
	overflow: hidden;
}

.smt-cat-mega__panel-pane.is-active {
	display: flex;
}

.smt-cat-mega__pane-head {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 0;
	padding: 18px 20px 12px;
	border-bottom: 1px solid #eef0f4;
	background: #fff;
}

.smt-cat-mega__pane-title {
	margin: 0;
	font-size: 18px;
	font-weight: 900;
	color: #222;
}

.smt-cat-mega__pane-all {
	font-size: 13px;
	font-weight: 800;
	color: var(--primary-color, #1e73be);
	text-decoration: none;
	white-space: nowrap;
	transition: color 0.2s ease, transform 0.2s ease;
}

.smt-cat-mega__pane-all:hover {
	color: var(--primary-color, #1e73be);
	text-decoration: none;
	transform: translateX(3px);
	filter: brightness(0.92);
}

.smt-cat-mega__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
	align-items: start;
}

.smt-cat-mega__cell {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	min-width: 0;
}

.smt-cat-mega__cell--has-l3 .smt-cat-mega__item {
	margin-bottom: 0;
}

@media (min-width: 700px) {
	.smt-cat-mega__grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@media (min-width: 960px) {
	.smt-cat-mega__grid {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}
}

.smt-cat-mega__item {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	text-decoration: none;
	color: inherit;
	padding: 10px 8px;
	border-radius: 12px;
	border: 1px solid transparent;
	transition:
		border-color 0.22s ease,
		background 0.22s ease,
		transform 0.22s ease,
		box-shadow 0.22s ease;
}

.smt-cat-mega__item:hover {
	border-color: color-mix(in srgb, var(--primary-color, #1e73be) 35%, #fff);
	background: color-mix(in srgb, var(--primary-color, #1e73be) 8%, #fff);
	transform: translateY(-4px);
	box-shadow: 0 10px 24px rgba(15, 30, 55, 0.12);
	color: inherit;
}

.smt-cat-mega__thumb {
	width: 100%;
	aspect-ratio: 1 / 1;
	border-radius: 10px;
	overflow: hidden;
	background: linear-gradient(180deg, #f7f8fa, #fff);
	border: 1px solid #eef0f4;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 8px;
	transition:
		border-color 0.22s ease,
		box-shadow 0.22s ease,
		transform 0.22s ease;
}

.smt-cat-mega__item:hover .smt-cat-mega__thumb {
	border-color: color-mix(in srgb, var(--primary-color, #1e73be) 45%, #eef0f4);
	box-shadow: 0 6px 16px rgba(15, 30, 55, 0.1);
	transform: scale(1.04);
}

.smt-cat-mega__thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	padding: 8px;
	display: block;
	transition: transform 0.22s ease;
}

.smt-cat-mega__item:hover .smt-cat-mega__thumb img {
	transform: scale(1.06);
}

.smt-cat-mega__thumb--empty svg {
	width: 32px;
	height: 32px;
	color: #c5ccd6;
}

.smt-cat-mega__name {
	font-size: 12px;
	line-height: 1.35;
	font-weight: 700;
	color: #333;
	transition: color 0.22s ease;
}

.smt-cat-mega__item:hover .smt-cat-mega__name {
	color: var(--primary-color, #1e73be);
}

/* Level 3 links under L2 card – ẩn, hiện khi hover/focus cell */
.smt-cat-mega__l3 {
	list-style: none;
	margin: 0;
	padding: 0 8px;
	border-top: 1px dashed transparent;
	display: flex;
	flex-direction: column;
	gap: 6px;
	max-height: 0;
	opacity: 0;
	overflow: hidden;
	transition:
		max-height 0.28s ease,
		opacity 0.22s ease,
		margin 0.22s ease,
		padding 0.22s ease,
		border-color 0.22s ease;
}

.smt-cat-mega__cell--has-l3:hover .smt-cat-mega__l3,
.smt-cat-mega__cell--has-l3:focus-within .smt-cat-mega__l3 {
	max-height: 260px;
	opacity: 1;
	margin-top: 6px;
	padding: 8px 8px 4px;
	border-top-color: color-mix(in srgb, var(--primary-color, #1e73be) 22%, #e8ebf0);
}

.smt-cat-mega__cell--has-l3:hover .smt-cat-mega__item,
.smt-cat-mega__cell--has-l3:focus-within .smt-cat-mega__item {
	border-color: color-mix(in srgb, var(--primary-color, #1e73be) 35%, #fff);
	background: color-mix(in srgb, var(--primary-color, #1e73be) 8%, #fff);
	transform: translateY(-4px);
	box-shadow: 0 10px 24px rgba(15, 30, 55, 0.12);
}

.smt-cat-mega__cell--has-l3:hover .smt-cat-mega__thumb,
.smt-cat-mega__cell--has-l3:focus-within .smt-cat-mega__thumb {
	border-color: color-mix(in srgb, var(--primary-color, #1e73be) 45%, #eef0f4);
	box-shadow: 0 6px 16px rgba(15, 30, 55, 0.1);
	transform: scale(1.04);
}

.smt-cat-mega__cell--has-l3:hover .smt-cat-mega__name,
.smt-cat-mega__cell--has-l3:focus-within .smt-cat-mega__name {
	color: var(--primary-color, #1e73be);
}

.smt-cat-mega__l3-link {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 8px 10px;
	border: 1px solid #d5dbe3;
	border-radius: 8px;
	background: #fff;
	font-size: 11.5px;
	line-height: 1.35;
	font-weight: 600;
	color: #444;
	text-align: center;
	text-decoration: none;
	box-shadow: 0 1px 2px rgba(15, 30, 55, 0.04);
	transition:
		background 0.2s ease,
		color 0.2s ease,
		border-color 0.2s ease,
		box-shadow 0.2s ease,
		transform 0.2s ease;
}

.smt-cat-mega__l3-link:hover {
	background: color-mix(in srgb, var(--primary-color, #1e73be) 8%, #fff);
	border-color: var(--primary-color, #1e73be);
	color: var(--primary-color, #1e73be);
	box-shadow: 0 4px 12px rgba(15, 30, 55, 0.08);
	transform: translateY(-1px);
}

.smt-cat-mega__empty {
	padding: 24px 8px;
	text-align: center;
	color: #666;
}

.smt-cat-mega__empty p {
	margin: 0 0 14px;
}

.smt-cat-mega__empty-btn {
	border-radius: 999px !important;
	font-weight: 800 !important;
}

/* Mobile */
@media (max-width: 849px) {
	/* Flatsome header: cho phép nút + dropdown hiện trong mobile-nav */
	.header-main .flex-col.show-for-medium,
	.header-main .flex-col.show-for-medium .mobile-nav,
	.header-main .mobile-nav > li.html.custom {
		overflow: visible;
	}

	.header-main .mobile-nav > li.html.custom {
		display: block !important;
		width: auto;
		max-width: 46vw;
		position: relative;
		z-index: 30;
	}

	#masthead,
	.header-main .header-inner {
		overflow: visible;
	}

	body.smt-cat-mega-lock {
		overflow: hidden;
	}

	.smt-cat-mega {
		display: block;
		width: auto;
		max-width: 100%;
		position: relative;
		z-index: 40;
	}

	.smt-cat-mega__toggle {
		width: auto;
		max-width: 100%;
		justify-content: center;
		padding: 8px 10px;
		font-size: 10px;
		letter-spacing: .02em;
		white-space: nowrap;
	}

	.smt-cat-mega__toggle-label {
		overflow: hidden;
		text-overflow: ellipsis;
		max-width: 34vw;
	}

	.smt-cat-mega__panel {
		position: fixed;
		left: 0;
		right: 0;
		top: var(--smt-cat-mega-top, 60px);
		width: 100%;
		max-width: 100%;
		margin: 0;
		padding: 0;
		z-index: 10050;
		box-sizing: border-box;
		max-height: min(70dvh, 500px);
	}

	.smt-cat-mega__panel[hidden] {
		display: none !important;
	}

	/* Mobile: 2 cột — cấp 1 trái, cấp 2 phải; chiều cao giới hạn + scroll */
	.smt-cat-mega__inner {
		display: grid;
		grid-template-columns: minmax(108px, 36%) 1fr;
		grid-template-rows: minmax(0, 1fr);
		height: min(70dvh, 500px);
		max-height: min(70dvh, 500px);
		min-height: 300px;
		border-radius: 0;
		border-left: 0;
		border-right: 0;
		border-bottom: 1px solid #e6e9ef;
		box-shadow: 0 10px 28px rgba(15, 30, 55, .12);
		overflow: hidden;
	}

	.smt-cat-mega__left {
		border-right: 1px solid #e8ebf0;
		border-bottom: 0;
		background: #f4f5f7;
		height: 100%;
		max-height: 100%;
		min-height: 0;
		overflow-x: hidden;
		overflow-y: scroll;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
		scrollbar-gutter: stable;
		scrollbar-width: thin;
		scrollbar-color: #8f9bab #dde3eb;
	}

	.smt-cat-mega__left.is-scrollable::-webkit-scrollbar,
	.smt-cat-mega__pane-body.is-scrollable::-webkit-scrollbar {
		width: 5px;
		display: block;
	}

	.smt-cat-mega__left::-webkit-scrollbar,
	.smt-cat-mega__pane-body::-webkit-scrollbar {
		width: 5px;
	}

	.smt-cat-mega__left::-webkit-scrollbar-track,
	.smt-cat-mega__pane-body::-webkit-scrollbar-track {
		background: #dde3eb;
	}

	.smt-cat-mega__left::-webkit-scrollbar-thumb,
	.smt-cat-mega__pane-body::-webkit-scrollbar-thumb {
		background: #8f9bab;
		border: 1px solid #dde3eb;
		min-height: 32px;
	}

	.smt-cat-mega__l1 {
		display: block;
		margin: 0;
		padding: 0;
		overflow: visible;
	}

	.smt-cat-mega__l1 li {
		flex: none;
		margin: 0;
	}

	.smt-cat-mega__l1-btn {
		width: 100%;
		margin: 0;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 14px 10px 14px 11px;
		border: 0;
		border-left: 4px solid transparent;
		border-radius: 0;
		background: transparent;
		color: #444;
		font-size: 12px;
		line-height: 1.35;
		font-weight: 600;
		text-align: left;
		white-space: normal;
	}

	.smt-cat-mega__l1-text {
		display: block;
	}

	.smt-cat-mega__l1-btn:hover {
		background: linear-gradient(
			90deg,
			color-mix(in srgb, var(--primary-color, #82d13d) 16%, #fff) 0%,
			#fff 75%
		);
		color: var(--primary-color, #82d13d);
		border-left-color: var(--primary-color, #82d13d);
		border-left-width: 5px;
		padding-left: 10px;
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
		transform: translateX(3px);
		font-weight: 800;
	}

	.smt-cat-mega__l1-btn.is-active {
		background: linear-gradient(
			90deg,
			color-mix(in srgb, var(--primary-color, #82d13d) 20%, #fff) 0%,
			#fff 78%
		);
		color: var(--primary-color, #82d13d);
		border-left-color: var(--primary-color, #82d13d);
		border-left-width: 5px;
		padding-left: 10px;
		font-weight: 800;
		box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
		transform: translateX(3px);
	}

	.smt-cat-mega__l1-arrow {
		display: none;
	}

	.smt-cat-mega__right {
		background: #fff;
		height: 100%;
		min-height: 0;
		max-height: 100%;
		flex: 1 1 auto;
		overflow: hidden;
	}

	.smt-cat-mega__panel-pane {
		height: 100%;
		min-height: 0;
	}

	.smt-cat-mega__pane-head {
		padding: 12px 12px 10px;
		border-bottom: 1px solid #eef0f4;
	}

	.smt-cat-mega__pane-title {
		font-size: 14px;
		line-height: 1.3;
	}

	.smt-cat-mega__pane-all {
		font-size: 12px;
	}

	.smt-cat-mega__pane-body {
		padding: 10px 8px 14px 10px;
		flex: 1 1 auto;
		min-height: 0;
		overflow-x: hidden;
		overflow-y: scroll;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
		scrollbar-gutter: stable;
		scrollbar-width: thin;
		scrollbar-color: #8f9bab #dde3eb;
	}

	.smt-cat-mega__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 10px;
	}

	.smt-cat-mega__item {
		padding: 6px 4px;
	}

	.smt-cat-mega__thumb {
		margin-bottom: 6px;
	}

	.smt-cat-mega__name {
		font-size: 11px;
		line-height: 1.3;
	}

	.smt-cat-mega__l3 {
		max-height: none;
		opacity: 1;
		margin-top: 4px;
		padding: 6px 4px 2px;
		border-top-color: #e8ebf0;
		overflow: visible;
	}

	.smt-cat-mega__l3-link {
		padding: 7px 8px;
		font-size: 10.5px;
		border-radius: 7px;
	}

	.smt-cat-mega__backdrop {
		position: fixed;
		inset: 0;
		background: rgba(10, 20, 35, .35);
		z-index: 10040;
	}

	.smt-cat-mega__backdrop[hidden] {
		display: none !important;
	}

	/* Rất nhỏ: chỉ hiện icon hamburger */
	@media (max-width: 549px) {
		.smt-cat-mega__toggle-label,
		.smt-cat-mega__toggle-caret {
			display: none;
		}

		.smt-cat-mega__toggle {
			padding: 8px 9px;
		}

		.header-main .mobile-nav > li.html.custom {
			max-width: none;
		}
	}
}

/* Mobile bottom bar (full width) */
@media (max-width: 849px) {
	.header-bottom .mobile-nav > li.html.custom {
		display: block !important;
		width: 100%;
		max-width: none;
	}

	.header-bottom .mobile-nav > li.html.custom .smt-cat-mega {
		width: 100%;
	}

	.header-bottom .mobile-nav > li.html.custom .smt-cat-mega__toggle {
		width: 100%;
		font-size: 12px;
	}

	.header-bottom .mobile-nav > li.html.custom .smt-cat-mega__toggle-label {
		max-width: none;
	}
}
