/* Mega Menu Styles */

/* Mega Menu Parent */
.mega-menu-parent {
    position: static;
}

/* Position mega menu relative to navbar */
.navbar .mega-menu {
    position: absolute;
    top: 100%;
    left: 1rem;
    right: 1rem;
    width: auto;
}

.mega-menu-trigger {
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.dropdown-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.mega-menu-parent:hover .dropdown-icon,
.mega-menu-parent.active .dropdown-icon {
    transform: rotate(180deg);
}

/* Mega Menu Container */
.mega-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 999;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-top: 3px solid #2C5F41;
    margin: 0;
}

/* Visual indicator pointing to Features menu */
.mega-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #2C5F41;
}

/* Position the arrow near the Features menu item */
@media (min-width: 769px) {
    .mega-menu::before {
        left: 20%;
    }
}

.mega-menu-parent:hover .mega-menu,
.mega-menu-parent.active .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-menu-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Mega Menu Sections */
.mega-menu-section {
    display: flex;
    flex-direction: column;
}

.mega-menu-section:not(.mega-menu-cta) {
    flex: 1;
}

.mega-menu-title {
    font-family: 'DegularVariable', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #2C5F41;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #E8F5E8;
}

.mega-menu-items {
    display: flex;
    flex-direction: row;
    gap: 15px;
    flex-wrap: wrap;
}

/* All feature sections in one horizontal row */
.mega-menu-all-features {
    display: flex;
    flex-direction: row;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 0 10px;
}

.mega-menu-all-features .mega-menu-item {
    flex: 1;
    min-width: 200px;
    max-width: 220px;
    margin: 0 5px;
}

/* Mega Menu Items */
.mega-menu-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex-direction: column;
    text-align: center;
    min-height: 120px;
}

.mega-menu-item:hover {
    background: linear-gradient(135deg, #f8fffe 0%, #e8f5e8 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(44, 95, 65, 0.1);
}

.mega-menu-item.coming-soon {
    opacity: 0.6;
    cursor: not-allowed;
}

.mega-menu-item.coming-soon::after {
    content: 'Coming Soon';
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(45deg, #4CAF50, #81C784);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.mega-menu-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #4CAF50, #81C784);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
    margin: 0 auto 10px auto;
}

.mega-menu-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.mega-menu-item:hover .mega-menu-icon {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

.mega-menu-content h4 {
    font-family: 'DegularVariable', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2C5F41;
    margin: 0 0 5px 0;
    transition: color 0.3s ease;
}

.mega-menu-content p {
    font-size: 0.8rem;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

.mega-menu-item:hover .mega-menu-content h4 {
    color: #1B4332;
}

/* Mega Menu CTA */
.mega-menu-cta {
    background: linear-gradient(135deg, #2C5F41 0%, #1B4332 100%);
    border-radius: 12px;
    padding: 20px 25px;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
    margin: 10px auto 0 auto;
    max-width: 400px;
    width: 100%;
}

.mega-menu-cta::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.mega-menu-cta:hover::before {
    opacity: 1;
    transform: rotate(45deg) translate(30%, 30%);
}

.mega-menu-cta h3 {
    font-family: 'DegularVariable', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 10px 0;
    position: relative;
    z-index: 1;
}

.mega-menu-cta p {
    font-size: 0.9rem;
    opacity: 0.9;
    margin: 0 0 20px 0;
    position: relative;
    z-index: 1;
}

.mega-menu-cta .btn {
    background: white;
    color: #2C5F41;
    border: none;
    font-weight: 600;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.mega-menu-cta .btn:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .mega-menu-container {
        max-width: 100%;
        padding: 25px 30px;
    }
    
    .mega-menu-all-features {
        gap: 15px;
        padding: 0 5px;
    }
    
    .mega-menu-all-features .mega-menu-item {
        min-width: 180px;
        max-width: 200px;
        margin: 0 3px;
    }
    
    .mega-menu::before {
        left: 25%;
    }
}

@media (max-width: 768px) {
    .mega-menu {
        position: static;
        width: 100%;
        max-width: none;
        transform: none;
        opacity: 0;
        visibility: hidden;
        border-radius: 0;
        box-shadow: none;
        border: none;
        border-top: none;
        background: #f8f9fa;
        margin: 10px 0;
        max-height: 0;
        overflow: hidden;
        transition: all 0.3s ease;
    }
    
    .mega-menu::before {
        display: none;
    }
    
    .mega-menu-parent.active .mega-menu {
        opacity: 1;
        visibility: visible;
        max-height: 800px;
        transform: none;
    }
    
    .mega-menu-container {
        padding: 20px 25px;
        gap: 20px;
    }
    
    .mega-menu-all-features {
        flex-direction: column;
        padding: 0;
        gap: 10px;
    }
    
    .mega-menu-all-features .mega-menu-item {
        min-width: auto;
        max-width: none;
        flex-direction: row;
        text-align: left;
        min-height: auto;
        margin: 0;
        padding: 15px;
    }
    
    .mega-menu-icon {
        margin: 0 15px 0 0;
    }
    
    .mega-menu-parent:hover .mega-menu {
        transform: none;
        opacity: 0;
        visibility: hidden;
        max-height: 0;
    }
    
    .mega-menu-item {
        padding: 12px;
    }
    
    .mega-menu-icon {
        width: 35px;
        height: 35px;
    }
    
    .mega-menu-icon svg {
        width: 18px;
        height: 18px;
    }
    
    /* Mobile hamburger menu integration */
    .nav-menu[aria-hidden="false"] .mega-menu-parent.active .mega-menu {
        opacity: 1;
        visibility: visible;
        max-height: 800px;
    }
    
    /* Ensure mega menu works with mobile hamburger */
    .nav-menu {
        position: relative;
    }
    
    .mega-menu-trigger {
        width: 100%;
        justify-content: space-between;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .mega-menu-container {
        padding: 15px 20px;
    }
    
    .mega-menu-all-features .mega-menu-item {
        padding: 12px;
    }
    
    .mega-menu-cta {
        margin: 10px 5px 0 5px;
        width: calc(100% - 10px);
        padding: 15px 20px;
    }
}

/* Navigation Integration */
.navbar .mega-menu-parent .nav-link {
    position: relative;
}

.navbar .mega-menu-parent .nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(45deg, #4CAF50, #81C784);
    transition: width 0.3s ease;
}

.navbar .mega-menu-parent:hover .nav-link::after,
.navbar .mega-menu-parent.active .nav-link::after {
    width: 100%;
}

/* Smooth Animation for Mega Menu */
.mega-menu-item {
    animation: fadeInUp 0.3s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.mega-menu-parent:hover .mega-menu-item:nth-child(1) {
    animation-delay: 0.1s;
}

.mega-menu-parent:hover .mega-menu-item:nth-child(2) {
    animation-delay: 0.2s;
}

.mega-menu-parent:hover .mega-menu-item:nth-child(3) {
    animation-delay: 0.3s;
}

.mega-menu-parent:hover .mega-menu-item:nth-child(4) {
    animation-delay: 0.4s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover Effects */
.mega-menu-parent:hover .mega-menu-trigger {
    color: #2C5F41;
}

/* Close Button for Mobile */
@media (max-width: 768px) {
    .mega-menu-close {
        display: block;
        position: absolute;
        top: 15px;
        right: 15px;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: #666;
        cursor: pointer;
        z-index: 1001;
    }
    
    .mega-menu-close:hover {
        color: #2C5F41;
    }
}
