/**
 * Flatsome Lite - Mega Menu & Header Bottom Hot Categories Styles
 * Chuẩn eCommerce (Điện Máy Xanh / FPT Shop / dientu.thompbui.com)
 * Tối ưu hiệu năng, Flat Design, hoàn toàn không giật lag.
 */

/* ==========================================================================
   1. MEGA MENU TRIGGER BUTTON & DROPDOWN CONTAINER (DESKTOP)
   ========================================================================== */

li.header-category-mega-item {
	position: relative;
	list-style: none;
	display: inline-flex;
	align-items: center;
	align-self: center;
	margin: 0;
	padding: 0;
}

/* Nút Trigger "☰ Danh mục" */
.header-category-mega-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 40px;
	padding: 0 16px;
	border-radius: 8px;
	font-weight: 700;
	font-size: 14px;
	line-height: 1;
	color: #ffffff !important;
	background: var(--primary-color, #0284c7);
	border: 1px solid transparent;
	cursor: pointer;
	text-decoration: none !important;
	transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	user-select: none;
}

.header-category-mega-btn:hover {
	background: #0369a1;
	filter: brightness(0.95);
	color: #ffffff !important;
	box-shadow: 0 4px 12px rgba(2, 132, 199, 0.28);
}

.mega-btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.mega-btn-text {
	display: inline-block;
	white-space: nowrap;
}

.mega-btn-arrow {
	display: inline-flex;
	align-items: center;
	transition: transform 0.2s ease;
}

.header-category-mega-item.is-open .mega-btn-arrow {
	transform: rotate(180deg);
}

/* Style variants */
li.header-category-mega-item.style-outline .header-category-mega-btn {
	background: transparent;
	border-color: currentColor;
	color: inherit !important;
	box-shadow: none;
}
li.header-category-mega-item.style-outline .header-category-mega-btn:hover {
	background: rgba(2, 132, 199, 0.08);
	color: #0284c7 !important;
	border-color: #0284c7;
}

li.header-category-mega-item.style-flat .header-category-mega-btn {
	background: rgba(0, 0, 0, 0.04);
	color: inherit !important;
	box-shadow: none;
}
li.header-category-mega-item.style-flat .header-category-mega-btn:hover {
	background: rgba(2, 132, 199, 0.1);
	color: #0284c7 !important;
}

/* ==========================================================================
   2. KHUNG MEGA DROPDOWN (FLYOUT 2 CỘT)
   ========================================================================== */

.category-mega-flyout {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	width: 960px;
	max-width: 94vw;
	background: #ffffff;
	border-radius: 12px;
	border: 1px solid #e2e8f0;
	box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.15), 0 0 1px 1px rgba(0, 0, 0, 0.04);
	z-index: 9999;
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s;
	pointer-events: none;
	overflow: hidden;
}

/* Khi mở menu */
.header-category-mega-item.is-open .category-mega-flyout {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	pointer-events: auto;
}

/* Khi cấu hình Hover */
.header-category-mega-item.trigger-hover:hover .category-mega-flyout {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	pointer-events: auto;
}
.header-category-mega-item.trigger-hover:hover .mega-btn-arrow {
	transform: rotate(180deg);
}

.category-mega-flyout-inner {
	display: flex;
	min-height: 440px;
	max-height: 580px;
	overflow: hidden;
}

/* CỘT TRÁI: Rail (~230px) */
.category-mega-rail {
	width: 230px;
	flex-shrink: 0;
	background: #f8fafc;
	border-right: 1px solid #e2e8f0;
	overflow-y: auto;
	padding: 10px 0;
	box-sizing: border-box;
}

.category-mega-rail-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 18px;
	color: #334155;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.15s ease-in-out;
	border-left: 3.5px solid transparent;
	text-decoration: none !important;
	user-select: none;
}

.category-mega-rail-item .rail-title-link {
	color: inherit;
	text-decoration: none !important;
	flex-grow: 1;
}

.category-mega-rail-item:hover,
.category-mega-rail-item.is-active {
	background: #ffffff;
	color: #0284c7;
	border-left-color: #0284c7;
}

.category-mega-rail-item .rail-chevron {
	color: #94a3b8;
	display: inline-flex;
	align-items: center;
	transition: transform 0.15s ease;
}

.category-mega-rail-item:hover .rail-chevron,
.category-mega-rail-item.is-active .rail-chevron {
	color: #0284c7;
	transform: translateX(3px);
}

/* CỘT PHẢI: Content (~730px) */
.category-mega-content {
	flex: 1 1 auto;
	background: #ffffff;
	overflow-y: auto;
	padding: 22px 26px;
	box-sizing: border-box;
}

.category-mega-pane {
	display: none;
	animation: megaPaneFadeIn 0.2s ease;
}

@keyframes megaPaneFadeIn {
	from { opacity: 0; transform: translateY(4px); }
	to   { opacity: 1; transform: translateY(0); }
}

.category-mega-pane.is-active {
	display: block;
}

.category-mega-pane-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-bottom: 12px;
	margin-bottom: 18px;
	border-bottom: 1px solid #f1f5f9;
}

.pane-header-title {
	font-size: 16px;
	font-weight: 700;
	color: #0f172a;
	text-decoration: none !important;
}

.pane-header-title:hover {
	color: #0284c7;
}

.pane-view-all {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 12.5px;
	font-weight: 600;
	color: #0284c7;
	text-decoration: none !important;
	transition: gap 0.15s ease;
}

.pane-view-all:hover {
	color: #0369a1;
	gap: 8px;
}

/* Nhóm & Lưới thẻ con */
.category-mega-group {
	margin-bottom: 22px;
}
.category-mega-group:last-child {
	margin-bottom: 0;
}

.category-mega-group-title {
	font-size: 13px;
	font-weight: 700;
	color: #64748b;
	margin-bottom: 12px;
	text-transform: uppercase;
	letter-spacing: 0.4px;
}
.category-mega-group-title a {
	color: inherit;
	text-decoration: none;
}
.category-mega-group-title a:hover {
	color: #0284c7;
}

.category-mega-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
}

@media (max-width: 1200px) {
	.category-mega-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

.category-mega-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 12px 10px;
	background: #ffffff;
	border: 1px solid #f1f5f9;
	border-radius: 10px;
	text-decoration: none !important;
	transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
	box-sizing: border-box;
}

.category-mega-card:hover {
	border-color: #cbd5e1;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
	transform: translateY(-2px);
}

.category-mega-card .mega-card-thumb {
	width: 76px;
	height: 76px;
	margin-bottom: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	border-radius: 8px;
	background: #f8fafc;
	flex-shrink: 0;
}

.category-mega-card .mega-card-thumb img {
	max-width: 100%;
	max-height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.category-mega-card:hover .mega-card-thumb img {
	transform: scale(1.08);
}

.category-mega-card .mega-card-title {
	font-size: 13px;
	font-weight: 600;
	color: #334155;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
	min-height: 2.7em;
	transition: color 0.15s ease;
}

.category-mega-card:hover .mega-card-title {
	color: #0284c7;
}

/* ==========================================================================
   3. HEADER BOTTOM - HOT CATEGORIES MENU (CHUẨN ĐIỆN MÁY XANH / DIENTU)
   ========================================================================== */

.header-bottom {
	background: #ffffff;
	border-top: 1px solid #eef2f6;
	border-bottom: 1px solid #e2e8f0;
}

.header-bottom .header-bottom-nav {
	display: flex !important;
	align-items: center !important;
	flex-wrap: nowrap !important;
	gap: 6px !important;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
	overflow-x: auto !important;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none; /* Firefox */
}
.header-bottom .header-bottom-nav::-webkit-scrollbar {
	display: none; /* Chrome/Safari */
}

.header-bottom .header-bottom-nav > li {
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
	flex-shrink: 0 !important;
}

.header-bottom .header-bottom-nav > li > a {
	display: inline-flex !important;
	align-items: center !important;
	gap: 6px !important;
	padding: 8px 14px !important;
	font-size: 13.5px !important;
	font-weight: 600 !important;
	color: #334155 !important;
	border-radius: 6px !important;
	text-decoration: none !important;
	line-height: 1.25 !important;
	transition: all 0.16s ease-in-out !important;
	white-space: nowrap !important;
}

.header-bottom .header-bottom-nav > li > a:hover {
	background: #f1f5f9 !important;
	color: #0284c7 !important;
}

/* Hỗ trợ icon hoặc emoji trong menu item */
.header-bottom .header-bottom-nav > li > a img,
.header-bottom .header-bottom-nav > li > a svg {
	width: 16px !important;
	height: 16px !important;
	object-fit: contain !important;
	flex-shrink: 0 !important;
}

/* Dropdown của menu cấp dưới */
.header-bottom .header-bottom-nav > li.menu-item-has-children {
	position: relative !important;
}

.header-bottom .header-bottom-nav > li.menu-item-has-children > a::after {
	content: '' !important;
	display: inline-block !important;
	width: 5px !important;
	height: 5px !important;
	border-right: 1.5px solid currentColor !important;
	border-bottom: 1.5px solid currentColor !important;
	transform: rotate(45deg) !important;
	margin-left: 2px !important;
	margin-bottom: 2px !important;
	transition: transform 0.2s ease !important;
}

.header-bottom .header-bottom-nav > li.menu-item-has-children:hover > a::after {
	transform: rotate(-135deg) !important;
}

.header-bottom .header-bottom-nav .nav-dropdown {
	min-width: 200px !important;
	padding: 6px 0 !important;
	background: #ffffff !important;
	border-radius: 10px !important;
	border: 1px solid #e2e8f0 !important;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08) !important;
	border-top: none !important;
}

.header-bottom .header-bottom-nav .nav-dropdown li a {
	display: block !important;
	padding: 8px 16px !important;
	font-size: 13.5px !important;
	font-weight: 500 !important;
	color: #334155 !important;
	text-decoration: none !important;
	transition: all 0.15s ease !important;
}

.header-bottom .header-bottom-nav .nav-dropdown li a:hover {
	background: #f0f9ff !important;
	color: #0284c7 !important;
	padding-left: 20px !important;
}
