/* Mega Menu Styles */
.megamenu {
    background: linear-gradient(135deg, #0a0e27 0%, #1a1d35 50%, #1a1a2e 100%);
    position: relative;
    z-index: 1000;
}

.megamenu::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 217, 255, 0.03) 0px,
        transparent 2px,
        transparent 4px,
        rgba(0, 217, 255, 0.03) 6px
    );
    pointer-events: none;
    z-index: 1;
}

.megamenu-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
}

.megamenu-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    position: relative;
    z-index: 2;
}

.megamenu-logo {
    display: inline-block;
    transition: none;
    position: relative;
    width: fit-content;
}

.megamenu-logo svg {
    transition: all 0.3s ease;
    display: block;
    width: auto;
    max-width: 100%;
}

.megamenu-logo:hover svg {
    animation: hackerGlitch 0.6s infinite;
}

.megamenu-logo::before,
.megamenu-logo::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    opacity: 0;
    pointer-events: none;
}

.megamenu-logo:hover::before {
    animation: glitchSlice1 0.4s infinite;
    background: linear-gradient(90deg, #ff00ff 0%, transparent 100%);
    mix-blend-mode: screen;
}

.megamenu-logo:hover::after {
    animation: glitchSlice2 0.5s infinite;
    background: linear-gradient(90deg, transparent 0%, #00ffff 100%);
    mix-blend-mode: screen;
}

@keyframes hackerGlitch {
    0%, 100% {
        transform: translate(0, 0) skew(0deg);
        filter: hue-rotate(0deg) contrast(1);
    }
    5% {
        transform: translate(-3px, 2px) skew(-2deg);
        filter: hue-rotate(90deg) contrast(1.5);
    }
    10% {
        transform: translate(3px, -2px) skew(2deg);
        filter: hue-rotate(180deg) contrast(0.8);
    }
    15% {
        transform: translate(-2px, -3px) skew(-1deg);
        filter: hue-rotate(270deg) contrast(1.2);
    }
    20% {
        transform: translate(2px, 3px) skew(1deg);
        filter: hue-rotate(45deg) contrast(1.8);
    }
    25% {
        transform: translate(-4px, 1px) skew(-3deg);
        filter: hue-rotate(135deg) brightness(1.5);
    }
    30% {
        transform: translate(0, 0) skew(0deg);
        filter: hue-rotate(0deg) saturate(2);
    }
    35% {
        transform: translate(5px, -1px) skew(2deg);
        filter: hue-rotate(225deg) invert(0.2);
    }
    40% {
        transform: translate(-5px, 2px) skew(-2deg);
        filter: hue-rotate(315deg) contrast(2);
    }
    50% {
        transform: translate(3px, -3px) skew(1deg);
        filter: hue-rotate(180deg) brightness(2);
    }
    60% {
        transform: translate(-3px, 3px) skew(-1deg);
        filter: hue-rotate(90deg) saturate(0.5);
    }
    70% {
        transform: translate(2px, -2px) skew(0deg);
        filter: hue-rotate(270deg) contrast(1.5);
    }
    80% {
        transform: translate(-2px, 2px) skew(1deg);
        filter: hue-rotate(45deg) brightness(1.3);
    }
    90% {
        transform: translate(4px, -4px) skew(-2deg);
        filter: hue-rotate(135deg) invert(0.1);
    }
}

@keyframes glitchSlice1 {
    0%, 100% {
        opacity: 0;
        transform: translateX(0) scaleX(1);
    }
    10% {
        opacity: 0.8;
        transform: translateX(-10px) scaleX(1.05);
        clip-path: polygon(0 20%, 100% 20%, 100% 40%, 0 40%);
    }
    20% {
        opacity: 0;
        transform: translateX(5px) scaleX(0.95);
    }
    30% {
        opacity: 0.7;
        transform: translateX(-8px) scaleX(1.02);
        clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%);
    }
    40% {
        opacity: 0;
    }
}

@keyframes glitchSlice2 {
    0%, 100% {
        opacity: 0;
        transform: translateX(0) scaleX(1);
    }
    15% {
        opacity: 0.6;
        transform: translateX(12px) scaleX(1.03);
        clip-path: polygon(0 0%, 100% 0%, 100% 25%, 0 25%);
    }
    25% {
        opacity: 0;
        transform: translateX(-6px) scaleX(0.97);
    }
    35% {
        opacity: 0.8;
        transform: translateX(10px) scaleX(1.04);
        clip-path: polygon(0 75%, 100% 75%, 100% 100%, 0 100%);
    }
    50% {
        opacity: 0;
    }
}

.megamenu-logo svg {
    height: 60px;
    width: auto;
}

.megamenu-nav {
    display: flex;
    gap: 40px;
    align-items: center;
}

.megamenu-item {
    position: relative;
}

.megamenu-link {
    color: #00d9ff;
    text-decoration: none;
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 12px 20px;
    display: block;
    position: relative;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-family: 'Electrolize', 'Courier New', monospace;
    background: transparent;
    text-shadow: 0 0 5px rgba(0, 217, 255, 0.3);
}

.megamenu-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #00ff41;
    transition: all 0.3s ease;
    transform: translateX(-50%);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.6);
}

.megamenu-link:hover {
    color: #00ff41;
    border: 2px solid rgba(0, 255, 65, 0.3);
    transform: translateY(-2px);
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.6);
}

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

#logout_form {
    margin: 0;
    padding: 0;
}

#logout_form .megamenu-link {
    cursor: pointer;
}

/* Download Button Styling */
.megamenu-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: #00ff41;
    border: 2px solid #00ff41;
    border-radius: 0;
    color: #1a1a2e;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.5);
    font-family: 'Electrolize', 'Courier New', monospace;
    margin-left: 1rem;
}

.megamenu-download-btn:hover {
    background: #00d9ff;
    border-color: #00d9ff;
    color: #1a1a2e;
    box-shadow: 0 0 25px rgba(0, 217, 255, 0.8);
    transform: translateY(-2px);
}

.megamenu-download-btn i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.megamenu-download-btn:hover i {
    transform: scale(1.15);
}

.download-text-container {
    position: relative;
    display: inline-block;
    width: 180px;
    height: 1.2em;
}

.download-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    text-align: center;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.download-text[data-text="4"] {
    opacity: 1;
}

.megamenu-download-btn:hover .download-text[data-text="2"] {
    animation: textCycle2 2.25s forwards;
}

.megamenu-download-btn:hover .download-text[data-text="3"] {
    animation: textCycle3 2.25s forwards;
}

.megamenu-download-btn:hover .download-text[data-text="4"] {
    animation: textCycle4 2.25s forwards;
}

@keyframes textCycle2 {
    0% { opacity: 0; }
    5% { opacity: 1; }
    30% { opacity: 1; }
    35% { opacity: 0; }
    100% { opacity: 0; }
}

@keyframes textCycle3 {
    0% { opacity: 0; }
    35% { opacity: 0; }
    40% { opacity: 1; }
    65% { opacity: 1; }
    70% { opacity: 0; }
    100% { opacity: 0; }
}

@keyframes textCycle4 {
    0% { opacity: 1; }
    5% { opacity: 0; }
    70% { opacity: 0; }
    75% { opacity: 1; }
    100% { opacity: 1; }
}

.megamenu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 50%, #16213e 100%);
    border: 2px solid #00d9ff;
    box-shadow: 
        0 0 20px rgba(0, 217, 255, 0.4),
        inset 0 0 40px rgba(0, 217, 255, 0.05);
    width: 95vw;
    max-width: 675px;
    padding: 30px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    margin-top: 20px;
    z-index: 100;
}

.megamenu-item:hover .megamenu-dropdown {
    opacity: 1;
    visibility: visible;
    margin-top: 10px;
}

/* Adjust for larger screens */
@media (min-width: 940px) {
    .megamenu-dropdown {
        width: 675px;
    }
}

.dropdown-grid {
    display: grid;
    grid-template-columns: auto auto;
    gap: 30px;
}

.dropdown-column h4 {
    color: #00d9ff;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    font-family: 'Electrolize', 'Courier New', monospace;
    position: relative;
    border-bottom: none;
    text-shadow: 0 0 8px rgba(0, 217, 255, 0.6);
}

.dropdown-column h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: #00ff41;
    opacity: 0.6;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.6);
}

.dropdown-column h4::before {
    content: '>';
    position: absolute;
    left: -20px;
    color: #ff00ff;
    font-size: 18px;
    font-weight: bold;
    opacity: 0;
}

.dropdown-column:hover h4::before {
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.dropdown-column ul {
    list-style: none;
}

.dropdown-column ul li {
    margin-bottom: 0px;
}

.dropdown-column ul li a {
    color: #00d9ff;
    text-decoration: none;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    transition: all 0.3s ease;
    font-family: 'Electrolize', 'Courier New', monospace;
    background: transparent;
    position: relative;
    border-left: 2px solid transparent;
}

.dropdown-column ul li a:hover {
    color: #00ff41;
    padding-left: 16px;
    text-shadow: 0 0 8px rgba(0, 255, 65, 0.6);
    border-left: 2px solid #00ff41;
    background: rgba(0, 255, 65, 0.05);
}

.menu-link-title {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.menu-link-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: 0.3px;
}

.dropdown-column ul li a:hover .menu-link-desc {
    color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 1024px) {
    .dropdown-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .megamenu-nav {
        gap: 20px;
    }
    
    .megamenu-link {
        font-size: 16px;
        padding: 10px 15px;
    }

    .megamenu-download-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 768px) {
    .megamenu-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .megamenu-nav {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .dropdown-grid {
        grid-template-columns: 1fr;
    }
    
    .megamenu-dropdown {
        min-width: 90vw;
        left: 5vw;
        transform: none;
    }

    .megamenu-download-btn {
        width: 100%;
        justify-content: center;
        margin-left: 0;
        margin-top: 0.5rem;
    }
}