/* Mega Menu Container */
.ba-mega-menu-container {
    width: 100%;
    max-width: 900px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    overflow: hidden;
    display: block;
}

.ba-mega-menu-wrapper {
    display: flex !important;
    flex-direction: row !important;
    min-height: 450px;
    width: 100%;
    overflow: hidden;
}

/* Left Categories */
.ba-left-categories {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    background: #f8f9fa;
    border-right: 1px solid #e0e0e0;
    padding: 8px 0;
    max-height: 500px;
    overflow-y: auto;
    flex-shrink: 0;
    display: block;
    position: relative;
    z-index: 1;
}

/* Custom scrollbar for left categories */
.ba-left-categories::-webkit-scrollbar {
    width: 4px;
}

.ba-left-categories::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ba-left-categories::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.ba-left-categories::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.ba-category-item {
    cursor: pointer;
    padding: 12px 15px;
    transition: all 0.25s ease;
    border-left: 3px solid transparent;
    position: relative;
    margin-bottom: 2px;
}

.ba-category-item:last-child {
    margin-bottom: 0;
}

.ba-category-item:hover {
    background-color: #e8edf2;
    border-left-color: #0073aa;
}

.ba-category-item.active {
    background-color: #ffffff;
    border-left-color: #0073aa;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.ba-category-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #333333;
    font-size: 14px;
    font-weight: 500;
}

.ba-category-content i:first-child,
.ba-category-content .ba-svg-icon {
    margin-right: 12px;
    color: #0073aa;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.ba-category-content .ba-svg-icon {
    width: 20px;
    height: 20px;
    fill: #0073aa;
    object-fit: contain;
}

.ba-category-content i:first-child {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.ba-category-item:hover .ba-category-content i:first-child {
    transform: scale(1.1);
}

.ba-category-item:hover .ba-category-content .ba-svg-icon {
    transform: scale(1.1);
}

.ba-category-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ba-arrow-icon {
    color: #999999;
    font-size: 12px;
    transition: all 0.3s ease;
    margin-left: 8px;
    flex-shrink: 0;
}

.ba-category-item:hover .ba-arrow-icon {
    transform: translateX(5px);
    color: #0073aa;
}

/* Right Mega Menu */
.ba-right-mega-menu {
    flex: 1;
    padding: 25px 30px;
    background: #ffffff;
    min-height: 400px;
    display: block;
    position: relative;
    overflow: visible;
    width: calc(100% - 280px);
    max-width: calc(100% - 280px);
    box-sizing: border-box;
}

.ba-mega-content {
    animation: fadeIn 0.3s ease;
    height: 100%;
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: visible;
}

.ba-mega-content:not(:first-child) {
    display: none !important;
}

.ba-mega-content[style*="display: block"],
.ba-mega-content[style*="display:block"] {
    display: block !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mega Grid Layout */
.ba-mega-grid {
    display: grid;
    gap: 10px 20px;
    height: 100%;
    align-content: start;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Force column layout */
.ba-mega-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr) !important;
}

.ba-mega-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr) !important;
}

.ba-mega-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr) !important;
}

.ba-mega-grid.columns-5 {
    grid-template-columns: repeat(5, 1fr) !important;
}

/* Column dividers */
.ba-mega-grid.columns-2 .ba-mega-item:not(:nth-child(2n))::after,
.ba-mega-grid.columns-3 .ba-mega-item:not(:nth-child(3n))::after,
.ba-mega-grid.columns-4 .ba-mega-item:not(:nth-child(4n))::after,
.ba-mega-grid.columns-5 .ba-mega-item:not(:nth-child(5n))::after {
    content: '';
    position: absolute;
    right: -10px;
    top: 10%;
    height: 80%;
    width: 1px;
    background-color: #e8e8e8;
}

/* Remove divider from last item in each row */
.ba-mega-grid.columns-2 .ba-mega-item:nth-child(2n)::after,
.ba-mega-grid.columns-3 .ba-mega-item:nth-child(3n)::after,
.ba-mega-grid.columns-4 .ba-mega-item:nth-child(4n)::after,
.ba-mega-grid.columns-5 .ba-mega-item:nth-child(5n)::after {
    display: none;
}

.ba-mega-item {
    position: relative;
    margin-bottom: 0;
    padding: 3px 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
}

/* Mega Items */
.ba-mega-item a {
    display: flex;
    align-items: center;
    padding: 7px 12px;
    color: #333333;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.25s ease;
    font-size: 13px;
    font-weight: 400;
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
}

.ba-mega-item a:hover {
    background-color: #f0f4f8;
    color: #0073aa;
    transform: translateX(5px);
}

.ba-mega-item a i,
.ba-mega-item a .ba-svg-icon {
    margin-right: 10px;
    color: #0073aa;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.ba-mega-item a .ba-svg-icon {
    width: 16px;
    height: 16px;
    fill: #0073aa;
    object-fit: contain;
    min-width: 16px;
}

.ba-mega-item a i {
    font-size: 14px;
    width: 20px;
    min-width: 20px;
    text-align: center;
}

.ba-mega-item a:hover i,
.ba-mega-item a:hover .ba-svg-icon {
    color: #0073aa;
    fill: #0073aa;
    transform: scale(1.1);
}

.ba-mega-item a span {
    flex: 1;
    display: inline;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    line-height: 1.4;
}

/* Active Category Text */
.ba-category-item.active .ba-category-content {
    color: #0073aa;
}

.ba-category-item.active .ba-category-content i:first-child,
.ba-category-item.active .ba-category-content .ba-svg-icon {
    color: #0073aa;
    fill: #0073aa;
}

/* Responsive Design */
@media (max-width: 992px) {
    .ba-right-mega-menu {
        width: calc(100% - 250px);
        max-width: calc(100% - 250px);
        padding: 20px;
    }
    
    .ba-left-categories {
        width: 250px;
        min-width: 250px;
        max-width: 250px;
    }
    
    .ba-mega-grid.columns-4,
    .ba-mega-grid.columns-5 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .ba-mega-menu-wrapper {
        flex-direction: column !important;
    }
    
    .ba-left-categories {
        width: 100% !important;
        min-width: auto !important;
        max-width: 100% !important;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        max-height: 300px;
        flex-shrink: 1;
    }
    
    .ba-right-mega-menu {
        min-height: 250px;
        padding: 20px;
        flex: 1;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .ba-mega-grid.columns-2,
    .ba-mega-grid.columns-3,
    .ba-mega-grid.columns-4,
    .ba-mega-grid.columns-5 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .ba-category-item {
        padding: 10px 12px;
    }
    
    .ba-mega-grid.columns-2 .ba-mega-item:not(:nth-child(2n))::after,
    .ba-mega-grid.columns-3 .ba-mega-item:not(:nth-child(3n))::after,
    .ba-mega-grid.columns-4 .ba-mega-item:not(:nth-child(4n))::after,
    .ba-mega-grid.columns-5 .ba-mega-item:not(:nth-child(5n))::after {
        display: none;
    }
}

@media (max-width: 480px) {
    .ba-mega-grid.columns-2,
    .ba-mega-grid.columns-3,
    .ba-mega-grid.columns-4,
    .ba-mega-grid.columns-5 {
        grid-template-columns: 1fr !important;
    }
    
    .ba-right-mega-menu {
        padding: 15px;
        min-height: 200px;
    }
    
    .ba-mega-item a {
        font-size: 12px;
        padding: 6px 10px;
    }
}