/* ============================================
   NAVBAR
   ============================================ */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    transition: all var(--transition-base);
    border-bottom: 1px solid transparent;
}

.navbar.scrolled {
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom-color: var(--border-glass);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* Logo */
.nav-logo {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-logo .logo-dot {
    width: 8px;
    height: 8px;
    background: var(--cta-gradient);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 12px var(--accent-glow);
}

/* Nav Menu (desktop) */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 40px;
}

/* Nav Links */
.nav-links {
    display: flex;
    align-items: center;
    gap: 36px;
}

.nav-links a {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    position: relative;
    padding: 4px 0;
    transition: color var(--transition-fast);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width var(--transition-base);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

/* CTA Button */
.nav-cta {
    padding: 12px 28px;
    border-radius: var(--radius-xl);
    background: var(--cta-gradient);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 24px var(--cta-glow);
    transition: all var(--transition-base);
    animation: pulseGlow 3s ease-in-out infinite;
    white-space: nowrap;
}

.nav-cta:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 8px 40px var(--cta-glow);
}

/* ============================================
   MEGA MENU
   ============================================ */

/* Wrapper for the Services nav item */
.nav-item-mega {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-mega-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 4px 0;
    transition: color var(--transition-fast);
    cursor: pointer;
}

.nav-mega-trigger svg {
    transition: transform var(--transition-fast);
}

.nav-item-mega:hover .nav-mega-trigger svg {
    transform: rotate(180deg);
}

.nav-mega-trigger:hover,
.nav-mega-trigger.active {
    color: var(--text-primary);
}

/* Mega Menu Dropdown */
.mega-menu {
    position: absolute;
    top: calc(100% + 20px);
    left: 50%;
    transform: translateX(-50%);
    width: 820px;
    background: linear-gradient(135deg, rgba(18, 18, 30, 0.98), rgba(12, 12, 22, 0.98));
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border: 1px solid rgba(108, 92, 231, 0.15);
    border-radius: var(--radius-lg);
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.04),
        0 0 60px -10px rgba(108, 92, 231, 0.15);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-50%) translateY(10px);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1100;
    overflow: hidden;
}

/* Subtle gradient overlay at top */
.mega-menu::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
            transparent,
            rgba(108, 92, 231, 0.5),
            rgba(224, 86, 160, 0.5),
            transparent);
    z-index: 1;
}

/* Invisible bridge to prevent hover gap */
.nav-item-mega::after {
    content: '';
    position: absolute;
    top: 100%;
    left: -40px;
    right: -40px;
    height: 30px;
    display: none;
}

.nav-item-mega:hover::after {
    display: block;
}

.nav-item-mega:hover .mega-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

/* Inner Layout */
.mega-menu-inner {
    display: flex;
    min-height: 340px;
}

/* Left Sidebar */
.mega-sidebar {
    width: 230px;
    min-width: 230px;
    background: rgba(255, 255, 255, 0.015);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mega-cat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    cursor: pointer;
    text-align: left;
    transition: all 0.25s ease;
    width: 100%;
    position: relative;
}

.mega-cat-icon {
    font-size: 1.15rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.mega-cat:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border-left-color: rgba(108, 92, 231, 0.4);
}

.mega-cat:hover .mega-cat-icon {
    transform: scale(1.15);
}

.mega-cat.active {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.15), rgba(224, 86, 160, 0.08));
    color: #fff;
    border-left-color: #6c5ce7;
    box-shadow: 0 2px 16px rgba(108, 92, 231, 0.2);
}

.mega-cat.active .mega-cat-icon {
    transform: scale(1.1);
}

/* Right Content */
.mega-content {
    flex: 1;
    padding: 20px;
    position: relative;
}

.mega-panel {
    display: none;
    animation: megaFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@keyframes megaFadeIn {
    from {
        opacity: 0;
        transform: translateX(8px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Services Grid */
.mega-services-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.mega-service-card {
    display: flex;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    transition: all 0.25s ease;
    text-decoration: none;
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    position: relative;
}

.mega-service-card:hover {
    background: rgba(108, 92, 231, 0.06);
    border-color: rgba(108, 92, 231, 0.12);
    border-left-color: #6c5ce7;
    transform: translateX(4px);
}

.mega-service-icon {
    font-size: 1.3rem;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1), rgba(224, 86, 160, 0.05));
    border: 1px solid rgba(108, 92, 231, 0.12);
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.mega-service-card:hover .mega-service-icon {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.18), rgba(224, 86, 160, 0.1));
    border-color: rgba(108, 92, 231, 0.25);
    box-shadow: 0 0 16px rgba(108, 92, 231, 0.15);
    transform: scale(1.08);
}

.mega-service-title {
    font-family: var(--font-heading);
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
    display: block;
    transition: color 0.2s ease;
}

.mega-service-card:hover .mega-service-title {
    color: #fff;
}

.mega-service-card p {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 6px;
    max-width: none;
}

.mega-link {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-light);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.mega-service-card:hover .mega-link {
    color: #fff;
    gap: 6px;
}

/* Footer CTA */
.mega-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid rgba(108, 92, 231, 0.15);
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.05), rgba(224, 86, 160, 0.03));
    font-size: 0.82rem;
    position: relative;
}

/* Shimmer line on footer top */
.mega-footer::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(108, 92, 231, 0.8), transparent);
    animation: megaShimmer 3s ease-in-out infinite;
}

@keyframes megaShimmer {
    0%,
    100% {
        left: -60px;
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        left: calc(100% + 60px);
        opacity: 0;
    }
}

.mega-footer span {
    color: var(--text-muted);
}

.mega-footer a {
    color: var(--accent-light);
    font-weight: 600;
    transition: all var(--transition-fast);
}

.mega-footer a:hover {
    color: #fff;
    text-shadow: 0 0 12px rgba(108, 92, 231, 0.4);
}

/* Smooth scroll offset for anchored sections */
[id="semantic-seo"],
[id="local-seo"],
[id="ecommerce-seo"],
[id="saas-seo"] {
    scroll-margin-top: 100px;
}

/* Mobile Hamburger */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
    z-index: 1001;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-fast);
}

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

.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}

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

/* Mobile Menu */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background: rgba(10, 10, 15, 0.97);
        backdrop-filter: blur(30px);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 8px;
        transition: right var(--transition-base);
        z-index: 999;
    }

    .nav-menu.open {
        right: 0;
    }

    .nav-links {
        flex-direction: column;
        gap: 24px;
    }

    .nav-links a,
    .nav-mega-trigger {
        font-size: 1.5rem;
        font-weight: 600;
    }

    .nav-cta {
        margin-top: 20px;
        padding: 16px 40px;
        font-size: 1rem;
    }

    /* Mega menu on mobile — hide */
    .mega-menu {
        display: none;
    }

    .nav-mega-trigger svg {
        display: none;
    }
}