/* ============================================
   ENTERPRISE MEGA MENU - Premium SaaS Navigation
   ============================================ */

/* Header Base */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.main-header.scrolled {
    background: rgba(10, 10, 15, 0.95);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-primary);
    transition: opacity 0.2s ease;
}

.logo:hover {
    opacity: 0.8;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.logo-icon::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: var(--gradient-primary);
    border-radius: 12px;
    opacity: 0.5;
    filter: blur(8px);
    z-index: -1;
}

.logo-text {
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navigation */
.main-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.75rem 1rem;
    padding-bottom: 1.25rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9375rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link:hover::after {
    width: 60%;
}

.nav-link.active {
    color: var(--text-primary);
}

.nav-link.active::after {
    width: 60%;
}

.nav-chevron {
    width: 14px;
    height: 14px;
    opacity: 0.6;
    transition: transform 0.3s ease;
}

.nav-link.active .nav-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-login {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: color 0.2s ease;
}

.btn-login:hover {
    color: var(--text-primary);
}

.btn-primary-glow {
    position: relative;
    padding: 0.75rem 1.5rem;
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
}

.btn-primary-glow::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: var(--gradient-primary);
    border-radius: 0.875rem;
    opacity: 0;
    filter: blur(8px);
    z-index: -1;
    transition: opacity 0.3s ease;
}

.btn-primary-glow:hover {
    transform: translateY(-2px);
}

.btn-primary-glow:hover::before {
    opacity: 0.6;
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 0.5rem;
    cursor: pointer;
    z-index: 1001;
}

.mobile-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mega Menu Overlay */
.mega-overlay {
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 998;
}

.mega-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mega Menu Container */
.mega-menu-wrapper {
    position: fixed;
    top: 75px;
    left: 0;
    right: 0;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    padding-top: 10px;
}

.mega-menu-wrapper.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.mega-menu {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.mega-menu-inner {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 60px rgba(102, 126, 234, 0.1);
    overflow: hidden;
    position: relative;
}

.mega-menu-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1.5rem;
    padding: 1px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.5), rgba(236, 72, 153, 0.3), rgba(6, 182, 212, 0.4));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Mega Menu Panels */
.mega-panel {
    display: none;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.mega-panel.active {
    display: block;
}

.mega-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.mega-column {
    min-width: 0;
}

.mega-column-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mega-column-icon {
    width: 36px;
    height: 36px;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mega-column-icon svg {
    width: 18px;
    height: 18px;
    color: var(--color-primary-light);
}

.mega-column-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: linear-gradient(
        90deg,
        #6366f1,
        #ec4899,
        #06b6d4,
        #8b5cf6,
        #6366f1
    );
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-text-shift 4s ease infinite;
}

.mega-links {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mega-link {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.mega-link::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 0.75rem;
    padding: 1px;
    background: linear-gradient(45deg, 
        #6366f1, 
        #ec4899, 
        #06b6d4, 
        #8b5cf6, 
        #6366f1
    );
    background-size: 300% 300%;
    animation: gradient-rotate 3s ease infinite;
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mega-link:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.mega-link:hover::before {
    opacity: 1;
}

.mega-link > * {
    position: relative;
    z-index: 1;
}

.mega-link-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.mega-link:hover .mega-link-icon {
    background: rgba(102, 126, 234, 0.2);
}

.mega-link-icon svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.mega-link:hover .mega-link-icon svg {
    color: var(--color-primary-light);
}

.mega-link-content {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.mega-link-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.mega-link:hover .mega-link-title {
    color: var(--color-primary-light);
}

.mega-link-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Mega Menu Footer */
.mega-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 2rem;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mega-footer-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.mega-footer-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-primary-light);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: gap 0.2s ease;
}

.mega-footer-link:hover {
    gap: 0.75rem;
}

/* Mobile Mega Menu */
@media (max-width: 992px) {
    .mobile-toggle {
        display: flex;
    }
    
    .main-nav {
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-dark);
        flex-direction: column;
        padding: 1.5rem;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }
    
    .main-nav.active {
        transform: translateX(0);
    }
    
    .nav-list {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }
    
    .nav-item {
        width: 100%;
    }
    
    .nav-link {
        justify-content: space-between;
        padding: 1rem;
        font-size: 1.125rem;
    }
    
    .mega-menu-wrapper {
        display: none;
    }
    
    .mobile-mega-panel {
        display: none;
        padding: 1rem 0 1rem 1rem;
        border-left: 2px solid rgba(102, 126, 234, 0.3);
        margin-left: 1rem;
    }
    
    .mobile-mega-panel.active {
        display: block;
    }
    
    .header-actions .btn-primary-glow {
        display: none;
    }
}

@media (max-width: 768px) {
    .header-container {
        height: 70px;
        padding: 0 1rem;
    }
    
    .logo-text {
        font-size: 1.25rem;
    }
}

/* Gradient Animations */
@keyframes gradient-rotate {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes gradient-text-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ============================================
   ENHANCED MENU HOVER EFFECTS
   ============================================ */

/* Mega Menu Inner Enhanced Border */
.mega-menu-inner {
    position: relative;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 60px rgba(102, 126, 234, 0.1);
    overflow: hidden;
}

.mega-menu-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1.5rem;
    padding: 2px;
    background: linear-gradient(135deg, 
        rgba(99, 102, 241, 0.8), 
        rgba(236, 72, 153, 0.6), 
        rgba(6, 182, 212, 0.8),
        rgba(139, 92, 246, 0.6),
        rgba(99, 102, 241, 0.8)
    );
    background-size: 300% 300%;
    animation: gradient-rotate 4s ease infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Mega Column Header Enhanced */
.mega-column-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.mega-column-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #ec4899);
    transition: width 0.4s ease;
}

.mega-column:hover .mega-column-header::after {
    width: 100%;
}

/* Mega Column Icon Enhanced */
.mega-column-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.15));
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mega-column:hover .mega-column-icon {
    transform: scale(1.15) rotate(10deg);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(236, 72, 153, 0.25));
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

/* Mega Link Enhanced Hover Effects */
.mega-link {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem;
    border-radius: 0.875rem;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.mega-link::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 0.875rem;
    padding: 2px;
    background-size: 300% 300%;
    animation: gradient-rotate 3s ease infinite;
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Different gradient colors for different links */
.mega-link:nth-child(1)::before {
    background: linear-gradient(45deg, #6366f1, #8b5cf6, #a855f7, #6366f1);
}

.mega-link:nth-child(2)::before {
    background: linear-gradient(45deg, #ec4899, #f472b6, #fb7185, #ec4899);
}

.mega-link:nth-child(3)::before {
    background: linear-gradient(45deg, #f59e0b, #f97316, #ef4444, #f59e0b);
}

.mega-link:nth-child(4)::before {
    background: linear-gradient(45deg, #22c55e, #10b981, #06b6d4, #22c55e);
}

.mega-link:nth-child(5)::before {
    background: linear-gradient(45deg, #3b82f6, #06b6d4, #14b8a6, #3b82f6);
}

.mega-link:nth-child(6)::before {
    background: linear-gradient(45deg, #8b5cf6, #ec4899, #f472b6, #8b5cf6);
}

.mega-link:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(12px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.mega-link:hover::before {
    opacity: 1;
    animation: gradient-rotate 1.5s ease infinite;
}

/* Shine effect on mega link hover */
.mega-link::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255, 255, 255, 0.08) 50%,
        transparent 60%
    );
    transform: translateX(-100%) rotate(45deg);
    transition: transform 0.6s ease;
    pointer-events: none;
    z-index: 1;
}

.mega-link:hover::after {
    transform: translateX(100%) rotate(45deg);
}

/* Mega Link Icon Enhanced */
.mega-link-icon {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 2;
}

.mega-link:hover .mega-link-icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.2));
    transform: scale(1.15) rotate(-5deg);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

/* Mega Link Content Enhanced */
.mega-link-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: relative;
    z-index: 2;
}

.mega-link-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.mega-link:hover .mega-link-title {
    color: #818cf8;
}

.mega-link-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.4;
    transition: color 0.3s ease;
}

.mega-link:hover .mega-link-desc {
    color: var(--text-secondary);
}

/* Mega Footer Enhanced */
.mega-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 2rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(236, 72, 153, 0.05));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.mega-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: left 0.5s ease;
}

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

.mega-footer-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #818cf8;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.mega-footer-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #ec4899);
    transition: width 0.3s ease;
}

.mega-footer-link:hover {
    gap: 0.75rem;
    color: #a78bfa;
}

.mega-footer-link:hover::after {
    width: 100%;
}

/* Nav Link Enhanced */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9375rem;
    border-radius: 0.5rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.15));
    border-radius: 0.5rem;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    z-index: -1;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #ec4899);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.nav-link:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
}

.nav-link:hover::before {
    opacity: 1;
    transform: scale(1);
}

.nav-link:hover::after {
    width: 60%;
}

.nav-link.active {
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
}

/* Button Glow Effects */
.btn-primary-glow {
    position: relative;
    padding: 0.75rem 1.5rem;
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    border-radius: 0.75rem;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.btn-primary-glow::before {
    content: '';
    position: absolute;
    inset: -3px;
    background: var(--gradient-primary);
    border-radius: 0.875rem;
    opacity: 0;
    filter: blur(15px);
    z-index: -1;
    transition: opacity 0.3s ease;
}

.btn-primary-glow:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 35px rgba(99, 102, 241, 0.4);
}

.btn-primary-glow:hover::before {
    opacity: 0.6;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* Mobile Toggle Enhanced */
.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 0.75rem;
    cursor: pointer;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    transition: all 0.3s ease;
}

.mobile-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.mobile-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}
