/**
 * 主导航 Mega Menu 下拉菜单样式
 * 用于显示商品分类筛选
 */

/* Mega Menu 下拉容器 */
.mega-menu-dropdown .mega-menu-content {
    min-width: 900px;
    max-width: 1200px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0;
    border: 1px solid #e5e5e5;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    background: #fff;
}

/* Mega Menu 主容器 */
.mega-menu-container {
    display: flex;
    min-height: 400px;
    max-height: 600px;
}

/* 左侧分类列表 */
.mega-menu-left {
    width: 280px;
    background: #f8f9fa;
    border-right: 1px solid #e5e5e5;
    overflow-y: auto;
    flex-shrink: 0;
}

.mega-menu-title {
    padding: 20px 20px 15px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e5e5e5;
}

.mega-menu-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-category-item {
    border-bottom: 1px solid #e9ecef;
}

.mega-category-item a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #555;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.mega-category-item a:hover,
.mega-category-item.active a {
    background: #fff;
    color: #0e90d2;
    border-left: 3px solid #0e90d2;
    padding-left: 17px;
}

.mega-category-item .category-icon {
    width: 24px;
    height: 24px;
    margin-right: 10px;
    object-fit: contain;
}

.mega-category-item a span {
    flex: 1;
    font-size: 14px;
}

.mega-category-item a i {
    color: #999;
    font-size: 12px;
}

/* 右侧子分类面板 */
.mega-menu-right {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    position: relative;
}

.mega-menu-subcategory-panel {
    display: none;
}

.mega-menu-subcategory-panel.active {
    display: block;
}

/* 子分类网格布局 */
.subcategory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 10px 0;
}

.subcategory-column {
    min-height: 100px;
}

.subcategory-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.subcategory-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: #0e90d2;
}

.subcategory-item a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    width: 100%;
}

.subcategory-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    margin-bottom: 10px;
    border-radius: 4px;
}

.subcategory-name {
    font-size: 13px;
    color: #555;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.subcategory-item:hover .subcategory-name {
    color: #0e90d2;
}

/* 查看全部项 */
.view-all-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #fff;
}

.view-all-item a {
    color: #fff;
}

.view-all-item .subcategory-name {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.view-all-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* 空状态 */
.subcategory-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.subcategory-empty p {
    font-size: 14px;
    margin: 0;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .mega-menu-dropdown .mega-menu-content {
        min-width: 700px;
    }
    
    .mega-menu-left {
        width: 220px;
    }
    
    .subcategory-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
}

@media (max-width: 768px) {
    /* 移动端隐藏 mega menu，使用标准下拉 */
    .mega-menu-dropdown .mega-menu-content {
        display: none !important;
    }
    
    /* 移动端使用标准导航 */
    .mega-menu-dropdown .am-dropdown-toggle {
        pointer-events: none;
    }
}

/* 滚动条样式 */
.mega-menu-left::-webkit-scrollbar,
.mega-menu-right::-webkit-scrollbar {
    width: 6px;
}

.mega-menu-left::-webkit-scrollbar-track,
.mega-menu-right::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.mega-menu-left::-webkit-scrollbar-thumb,
.mega-menu-right::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.mega-menu-left::-webkit-scrollbar-thumb:hover,
.mega-menu-right::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 鼠标悬停交互效果 */
.mega-category-item {
    cursor: pointer;
}

/* 动画效果 */
.mega-menu-content {
    animation: megaMenuFadeIn 0.3s ease-in-out;
}

@keyframes megaMenuFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 确保下拉菜单不会被截断 */
.shop-navigation .mega-menu-dropdown {
    position: static;
}

