/**
 * Mega Menu Styles - Hover to Reveal
 *
 * Creates FPT AI Factory style mega menu
 * - Column 1 (Blue): Parent categories
 * - Column 2 (Blue): Children (shown on hover)
 * - Column 3 (White): Additional links
 *
 * CHỈ ÁP DỤNG TRÊN DESKTOP (>= 850px)
 * Mobile được xử lý bởi mobile-menu.css
 */

/* ==========================================================================
   DESKTOP ONLY - Mega Menu Styles
   ========================================================================== */

@media (min-width: 850px) {

/* Reset & Base */
.mega-menu-item {
    position: static !important;
}

.mega-menu-item > a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dropdown-arrow {
    transition: transform 0.3s ease;
}

.mega-menu-item:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown arrow animation for regular menu items */
.menu-item-has-children:not(.mega-menu-item):hover > a .dropdown-arrow {
    transform: rotate(180deg);
}

/* ==========================================================================
   Mega Dropdown Container
   ========================================================================== */

.mega-dropdown {
    position: absolute;
    top: 64px;
    left: 0;
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 9999;
    overflow: visible;
    width: 257px;
    padding: 8px;
}

/* Show on hover */
.mega-menu-item:hover > .mega-dropdown {
    opacity: 1;
    visibility: visible;
}

/* Invisible bridge to prevent menu closing */
.mega-menu-item::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 20px;
}

/* ==========================================================================
   Columns Layout
   ========================================================================== */

.mega-columns-wrapper {
    display: flex;
    position: relative;
    /* min-height: 200px; */
}

/* Left Column - Full width by default */
.mega-col-left {
    background: #fff;
    width: 100%;
    flex-shrink: 0;
    border-radius: 16px;
    position: static;
    display: flex;
    flex-direction: column;
}

/* Center Column - placeholder, hidden */
.mega-col-center {
    display: none;
}

/* Right Column - for additional content if needed */
.mega-col-right {
    background: #ffffff;
    width: 0;
    overflow: hidden;
    flex-shrink: 0;
    padding: 0;
    border-radius: 0 16px 16px 0;
    border-left: 1px solid rgba(0,0,0,0.05);
}

/* ==========================================================================
   Parent List (Left Column)
   ========================================================================== */

.mega-parent-list {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.mega-parent-list .mega-child-list:after{
    content: "";
    border-right: 1px solid #dedede;
    position: absolute;
    height: calc(100%);
    width: 2px;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.mega-parent-item {
    /* position: relative; */ /* Need relative for absolute child positioning */
    margin: 0;
    padding: 0;
}

.mega-parent-item > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    line-height: 24px;
    font-weight: 500;
    color: #1C2024;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mega-parent-item > a:hover,
.mega-parent-item:hover > a {
    background: #203BDC1A;
    color: var(--color-primary);
    opacity: 1;
}

/* Arrow icon - SVG */
.mega-arrow {
    width: 6px;
    height: 10px;
    color: #1C2024;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.mega-parent-item:hover .mega-arrow {
    transform: translateX(3px);
}

/* Toggle button - Ẩn trên desktop (chỉ dùng cho mobile) */
.mega-parent-item > .toggle {
    display: none;
}

/* ==========================================================================
   Child List (Hidden by default, shown on hover)
   ========================================================================== */

.mega-child-list {
    display: none;
    position: absolute;
    left: 100%;
    top: -8px;
    height: calc(100% + 16px);
    width: 257px;
    list-style: none;
    background: #fff;
    padding: 8px!important;
    margin: 0;
    z-index: 11;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

/* Ensure mega-columns-wrapper is the positioning context for expansion */
.mega-columns-wrapper {
    position: relative;
}

/* Position child list relative to its parent item */
.mega-col-left {
    overflow: visible;
}

.mega-parent-list {
    overflow: visible;
    position: relative;
}

/* Show child list ONLY when hovering over the specific parent item */
.mega-parent-item.has-mega-children:hover > .mega-child-list {
    display: block;
}

/* Child items */
.mega-child-item {
    margin: 0;
    padding: 0;
}

.mega-child-item > a {
    display: block;
    padding: 8px 12px;
    font-size: 16px;
    line-height: 24px;
    color: #1C2024;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mega-child-item > a:hover {
    color: var(--color-primary);
    opacity: 1;
}

/* ==========================================================================
   Right Column Items (Optional - for 3 column layout)
   ========================================================================== */

/* If you want a 3rd column, add class mega-col-right to a menu item */
.mega-parent-list > .mega-col-right {
    display: none; /* Hidden by default in 2-column layout */
}

.mega-right-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-right-submenu li a {
    display: block;
    padding: 10px 20px;
    font-size: 14px;
    color: #4b5563;
    text-decoration: none;
    transition: color 0.2s ease;
}

.mega-right-submenu li a:hover {
    color: #2563eb;
}


/* ==========================================================================
   Flatsome Theme Overrides
   ========================================================================== */

/* Fix positioning */
.header-main .nav > li.mega-menu-item {
    position: static !important;
}

.header-wrapper {
    position: relative;
}

/* Override default dropdown styles */
.header-main .nav > li.mega-menu-item > .mega-dropdown {
    display: block;
}

.header-main .nav > li.mega-menu-item:hover > .mega-dropdown {
    display: block;
}

/* Hide default sub-menu styles */
.mega-menu-item .mega-dropdown .sub-menu {
    position: static;
    background: transparent;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    display: block;
}

/* ==========================================================================
   Animation & Polish
   ========================================================================== */

/* Active state indicator */
.mega-parent-item > a {
    position: relative;
}

.mega-parent-item:hover > a::before {
}

.mega-parent-item {
    /* position: relative; */
}

/* ==========================================================================
   Regular Dropdown Submenu (Non-Mega Menu Items)
   Only applies to TOP LEVEL menu items that are NOT mega menus
   Styles match mega-parent-list for consistency
   ========================================================================== */

/* Regular menu items should have relative positioning for dropdown */
.header-main .nav > li.menu-item-has-children:not(.mega-menu-item) {
    position: relative;
}

/* Regular submenu styling - ONLY for direct children of nav */
.header-main .nav > li.menu-item-has-children:not(.mega-menu-item) > .sub-menu {
    position: absolute;
    top: 64px;
    left: 0;
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    min-width: 220px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 9999;
    list-style: none;
    margin: 0;
}

/* Show submenu on hover */
.header-main .nav > li.menu-item-has-children:not(.mega-menu-item):hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Submenu items - match mega-parent-item styles */
.header-main .nav > li.menu-item-has-children:not(.mega-menu-item) > .sub-menu > li {
    margin: 0;
    padding: 0;
}

.header-main .nav > li.menu-item-has-children:not(.mega-menu-item) > .sub-menu > li > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 16px;
    line-height: 24px;
    font-weight: 500;
    color: #1C2024;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.header-main .nav > li.menu-item-has-children:not(.mega-menu-item) > .sub-menu > li > a:hover {
    background: #203BDC1A;
    color: var(--color-primary);
    opacity: 1;
}

/* Nested submenus (level 2+) for regular menus */
.header-main .nav > li.menu-item-has-children:not(.mega-menu-item) .sub-menu .sub-menu {
    position: absolute;
    top: 0;
    left: 100%;
    margin-left: 0;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    min-width: 220px;
    padding: 20px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
}

.header-main .nav > li.menu-item-has-children:not(.mega-menu-item) .sub-menu li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Arrow for items with children in regular submenu - match mega-arrow */
.header-main .nav > li.menu-item-has-children:not(.mega-menu-item) .sub-menu > li.menu-item-has-children > a::after {
    content: '›';
    font-size: 18px;
    color: #1C2024;
    margin-left: 10px;
    transition: transform 0.2s ease;
}

.header-main .nav > li.menu-item-has-children:not(.mega-menu-item) .sub-menu > li.menu-item-has-children:hover > a::after {
    transform: translateX(3px);
}

/* Bridge to prevent menu closing */
.header-main .nav > li.menu-item-has-children:not(.mega-menu-item)::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 10px;
}

} /* END @media (min-width: 850px) - Desktop Only */
