/* Mega Menu Styles */
.mega-menu-container {
    /* Container for the button - should always be visible */
    display: block;
}

/* Base styles for mega menu */
.mega-menu {
    background-color: #f8f9fa;
    border: none;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    margin-top: 0;
    z-index: 1050;
}

/* Show mega menu when collapsed is shown */
.mega-menu.show {
    display: block !important;
}

.mega-menu .card {
    border: none;
    box-shadow: none;
    background-color: #f8f9fa;
}

.mega-menu .card-body {
    padding: 2rem;
}

.mega-menu h5 {
    color: #343a40;
    font-weight: 600;
    margin-bottom: 10px;
}

.mega-menu h5 a {
    color: #343a40;
    transition: color 0.3s;
    text-decoration: none;
}

.mega-menu h5 a:hover {
    color: #007bff;
}

.mega-menu ul li {
    margin-bottom: 5px;
}

.mega-menu ul li a {
    color: #6c757d;
    font-size: 0.9rem;
    transition: color 0.3s;
    text-decoration: none;
}

.mega-menu ul li a:hover {
    color: #007bff;
}

/* Mega menu button styles */
.mega-menu-btn {
    border: 1px solid #495057;
    transition: all 0.3s ease;
}

.mega-menu-btn:hover {
    background-color: #495057 !important;
    border-color: #495057;
}

.mega-menu-btn[aria-expanded="true"] {
    background-color: #495057 !important;
    border-color: #495057;
}

/* Featured product section in mega menu */
.mega-menu-featured {
    text-align: center;
    padding: 1rem;
    background-color: #fff;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.mega-menu-featured img {
    border-radius: 0.375rem;
    max-height: 120px;
    object-fit: cover;
}

.mega-menu-trigger:hover .mega-menu-container,
.mega-menu-container:hover {
    display: block;
}

/* Mobile adjustments */
@media (max-width: 992px) {
    .mega-menu-container {
        position: static;
        box-shadow: none;
        padding: 0;
    }
    
    .mega-menu-trigger:hover .mega-menu-container {
        display: none;
    }
    
    .mega-menu-container.show {
        display: block;
    }
    
    /* Mega menu mobile scroll fix */
    .mega-menu {
        max-height: 70vh;
        overflow-y: auto;
        overflow-x: hidden;
        position: relative;
        z-index: 1050;
    }
    
    .mega-menu-card {
        max-height: none;
        overflow: visible;
        margin-bottom: 0;
    }
    
    /* Improve scrolling experience */
    .mega-menu::-webkit-scrollbar {
        width: 6px;
    }
    
    .mega-menu::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }
    
    .mega-menu::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 3px;
    }
    
    .mega-menu::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }
    
    /* Ensure body can still scroll when mega menu is open */
    body.mega-menu-open {
        overflow: auto;
        position: relative;
    }
}

/* Mega Menu Styles */
.mega-menu-bar {
    border-bottom: 1px solid #e9ecef;
}

.mega-menu-bar .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: color 0.3s;
}

.mega-menu-bar .nav-link:hover {
    color: #007bff !important;
}

.mega-menu-bar .dropdown-menu {
    border-radius: 0;
    margin-top: 0;
    border-top: 3px solid #007bff;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.mega-menu-bar .dropdown-item {
    padding: 0.5rem 1.5rem;
    transition: background-color 0.3s, color 0.3s;
}

.mega-menu-bar .dropdown-item:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

/* Mobile adjustments */
@media (max-width: 992px) {
    .mega-menu-bar {
        display: none;
    }
    
    .navbar-collapse.show + .mega-menu-bar {
        display: block;
    }
    
    .mega-menu-bar .nav {
        flex-direction: column;
    }
    
    .mega-menu-bar .dropdown-menu {
        position: static;
        float: none;
        width: auto;
        margin-top: 0;
        background-color: transparent;
        border: 0;
        box-shadow: none;
        padding-left: 1.5rem;
    }
    
    .mega-menu-bar .dropdown-item {
        padding: 0.25rem 1rem;
        color: rgba(0,0,0,.7);
    }
}
