/* Mega Menu Styles */

/* Mega menu container */
.nav-links .mega-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: rgba(13, 13, 43, 0.98);
    min-width: 700px;
    max-width: 900px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border-radius: 12px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    padding: 2rem;
    margin-top: 0.5rem;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

/* Adjust position for edge items */
.nav-links li:first-child .mega-menu {
    left: 0;
    transform: translateX(0) translateY(-10px);
}

.nav-links li:nth-last-child(2) .mega-menu,
.nav-links li:last-child .mega-menu {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(-10px);
}

/* Show mega menu on hover */
.nav-links li:hover .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.nav-links li:first-child:hover .mega-menu,
.nav-links li:nth-last-child(2):hover .mega-menu,
.nav-links li:last-child:hover .mega-menu {
    transform: translateX(0) translateY(0);
}

/* Scrolled navbar mega menu */
.navbar.scrolled .mega-menu {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Mega menu items */
.mega-menu li {
    display: block;
    margin: 0;
}

.mega-menu a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    padding-left: 3rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.navbar.scrolled .mega-menu a {
    color: #2d2d5f;
}

/* Hover effects */
.mega-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateX(5px);
}

.navbar.scrolled .mega-menu a:hover {
    background: #f0f4ff;
    color: #0066ff;
}

/* Menu icons */
.mega-menu .menu-icon {
    font-size: 1.3em;
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.5em;
    text-align: center;
    transition: transform 0.2s ease;
}

.mega-menu a:hover .menu-icon {
    transform: translateY(-50%) scale(1.1);
}

/* Menu text */
.mega-menu .menu-text {
    flex: 1;
    font-weight: 500;
}

/* Add gradient overlay on hover */
.mega-menu a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.mega-menu a:hover::before {
    left: 100%;
}

/* Parent menu indicator */
.nav-links li:has(.mega-menu) > a {
    position: relative;
}

.nav-links li:has(.mega-menu) > a::after {
    content: '▼';
    font-size: 0.7em;
    margin-left: 0.5rem;
    opacity: 0.7;
    transition: transform 0.2s ease;
    display: inline-block;
    vertical-align: middle;
}

.nav-links li:has(.mega-menu):hover > a::after {
    transform: rotate(180deg);
}

/* Special styling for Services mega menu (has many items) */
.nav-links li:nth-child(2) .mega-menu {
    grid-template-columns: repeat(3, 1fr);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .mega-menu {
        display: none !important;
    }
}
