/* PC端样式 - 默认隐藏 */
.mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0; /* 添加right: 0 */
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    width: 100vw;
    margin-left: calc(-35vw + 50%); /* 让菜单突破父容器居中显示 */
}

/* 一级菜单悬停时显示mega-menu */
.menu-item-has-children:hover .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-menu-container {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding: 0;
    overflow: hidden;
    display: block;
    margin: 0 auto; /* 容器居中 */
}

/* 手机端原有格式 - 默认隐藏 */
.mobile-menu {
    display: none;
}

/* 顶部横向菜单 - 灰色背景通长 */
.mega-menu-top {
    width: 100%;
    background: #f5f5f5;
    padding: 0;
    display: flex;
    justify-content: center; /* 整个顶部区域居中 */
}

.mega-menu-nav {
    /* display: flex; */
    justify-content: center;
    /* max-width: 1200px; */
    width: auto;
    padding: 0 5%;
    float: left;
}

.mega-menu-item {
    padding: 0 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    float: left;
}

.mega-menu-item a {
    display: block;
    padding: 12px 0;
    text-decoration: none;
    color: #000000;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.mega-menu-item:hover a,
.mega-menu-item.active a {
    color: #007bff;
}

/* 活跃状态下划线 */
.mega-menu-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: #007bff;
}

/* 底部产品展示区 - 全宽显示但内容居中 */
.mega-menu-bottom {
    width: 100%;
    background: #fff;
    padding: 30px 0;
    display: flex;
    justify-content: center; /* 整个底部区域居中 */
}

.product-display {
    display: none !important;
    max-width: 1200px;
    width: 100%;
    padding: 0 20px;
}

.product-display.active {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
    grid-auto-rows: max-content;
}

.product-item {
    text-align: center;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.product-item:hover {
    transform: translateY(-5px);
}

.product-item img {
    width: 95%;
    /* height: 120px; */
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.product-item:hover img {
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.product-item h5 {
    margin: 0;
    font-size: 13px;
    color: #333;
    font-weight: 500;
    line-height: 1.4;
}

/* 确保mega-menu容器在悬停时保持显示 */
.menu-item-has-children:hover .mega-menu,
.mega-menu:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 手机端样式 - 768px以下显示原有格式 */
@media (max-width: 768px) {
    /* 重置PC端样式 */
    .mega-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
        width: auto;
        margin-left: 0;
    }
    
    /* 隐藏PC端大菜单 */
    .mega-menu-container {
        display: none;
    }
    
    /* 显示手机端原有格式 */
    .mobile-menu {
        display: block;
    }
    
    .mobile-menu li {
        list-style: none;
        margin: 0;
    }
    
    .mobile-menu li a {
        display: block;
        padding: 10px 15px;
        text-decoration: none;
        color: #333;
        border-bottom: 1px solid #eee;
        transition: all 0.3s ease;
    }
    
    .mobile-menu li a:hover {
        background-color: #f5f5f5;
        color: #007bff;
    }
    
    .mobile-menu li:last-child a {
        border-bottom: none;
    }
}

/* 平板端适配 */
@media (min-width: 769px) and (max-width: 1200px) {
    .product-display.active {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .mega-menu-nav {
        max-width: 900px;
    }
    
    .mega-menu-item {
        padding: 0 15px;
        float: left;
    }
}

/* 确保一级菜单项有相对定位 */
.menu-item-has-children {
    position: relative;
}

/* 确保导航栏容器不限制mega-menu */
.navbar-collapse,
.navigation-holder {
    overflow: visible !important;
}

/* 如果还有其他容器限制，添加这个 */
.container,
.container-fluid {
    overflow: visible !important;
}
