/* ═══════════════════════════════════════════════════════════════
   SENTINEL AI — Elite Command Deck Navbar
   ═══════════════════════════════════════════════════════════════
   Floating island nav with holographic borders, magnetic hover,
   and cinematic animations. Out of this world.
   ═══════════════════════════════════════════════════════════════ */

/* ── Override base nav ── */
.nav {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 900px;
    min-width: min(92vw, 880px);
    height: 58px;
    padding: 0;
    background: rgba(8, 8, 26, 0.6);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    border: none;
    border-bottom: none;
    border-radius: 999px;
    z-index: 9999;
    transition: all 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow:
        0 0 0 1px rgba(124, 58, 237, 0.15),
        0 4px 30px rgba(0, 0, 0, 0.4),
        0 0 60px -20px rgba(124, 58, 237, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: navDrop 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Holographic animated border */
.nav::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 999px;
    padding: 1px;
    background: conic-gradient(
        from var(--nav-border-angle, 0deg),
        transparent 0%,
        #7c3aed 10%,
        #EC4899 20%,
        #06b6d4 30%,
        transparent 40%,
        transparent 60%,
        #3b82f6 70%,
        #8b5cf6 80%,
        transparent 90%
    );
    -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;
    animation: navBorderSpin 6s linear infinite;
    opacity: 0.5;
    transition: opacity 0.4s ease;
}

.nav:hover::before {
    opacity: 1;
}

/* Subtle noise texture overlay */
.nav::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* Scrolled state — tighter, more solid */
.nav.scrolled {
    top: 10px;
    height: 52px;
    background: rgba(5, 5, 16, 0.85);
    box-shadow:
        0 0 0 1px rgba(124, 58, 237, 0.25),
        0 8px 40px rgba(0, 0, 0, 0.6),
        0 0 80px -20px rgba(124, 58, 237, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    min-width: min(88vw, 840px);
}

.nav.scrolled::before {
    opacity: 0.7;
}

/* ── Container ── */
.nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 28px;
    position: relative;
    z-index: 1;
    height: 100%;
}

/* ── Brand / Logo ── */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display, 'Space Grotesk', sans-serif);
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    letter-spacing: 0.06em;
    text-decoration: none;
    position: relative;
    white-space: nowrap;
}

.nav-brand svg {
    width: 26px;
    height: 26px;
    filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.5));
    animation: logoPulse 3s ease-in-out infinite;
}

/* Pulse ring behind logo */
.nav-brand::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.2) 0%, transparent 70%);
    animation: logoPulseRing 3s ease-in-out infinite;
}

/* ── Nav Links ── */
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

/* Active indicator track */
.nav-links::before {
    display: none; /* Will be managed by JS if desired */
}

.nav-link {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    padding: 8px 16px;
    border-radius: 999px;
    text-decoration: none;
    letter-spacing: 0.02em;
    overflow: hidden;
}

/* Hover glow background */
.nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: radial-gradient(ellipse at center, rgba(124, 58, 237, 0.12) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Underline indicator */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, #8b5cf6, #EC4899);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
}

.nav-link:hover {
    color: #fff;
}

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

.nav-link:hover::after {
    transform: translateX(-50%) scaleX(1);
}

/* Active link */
.nav-link.active {
    color: #fff;
    background: rgba(124, 58, 237, 0.1);
}

.nav-link.active::after {
    transform: translateX(-50%) scaleX(1);
    width: 20px;
    background: linear-gradient(90deg, #7c3aed, #3b82f6);
}

/* ── CTA Button ── */
.nav-cta {
    padding: 9px 22px;
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 50%, #6366f1 100%);
    color: #fff !important;
    border-radius: 999px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    letter-spacing: 0.02em;
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow:
        0 0 20px rgba(124, 58, 237, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Scan line effect on CTA */
.nav-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    transition: none;
    animation: ctaScan 4s ease-in-out infinite;
}

.nav-cta::after {
    display: none !important;
}

.nav-cta:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow:
        0 0 30px rgba(124, 58, 237, 0.4),
        0 4px 20px rgba(124, 58, 237, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
}

/* ── Hamburger Button ── */
.nav-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 8px;
    position: relative;
    z-index: 2;
}

.nav-menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 999px;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    transform-origin: center;
}

.nav-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
    background: #8b5cf6;
}
.nav-menu-btn.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.nav-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
    background: #8b5cf6;
}

/* ═══ KEYFRAMES ═══ */

@property --nav-border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes navBorderSpin {
    to { --nav-border-angle: 360deg; }
}

@keyframes navDrop {
    from {
        opacity: 0;
        top: -20px;
        transform: translateX(-50%) scale(0.95);
    }
    to {
        opacity: 1;
        top: 16px;
        transform: translateX(-50%) scale(1);
    }
}

@keyframes logoPulse {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 14px rgba(139, 92, 246, 0.7)) drop-shadow(0 0 4px rgba(236, 72, 153, 0.3));
    }
}

@keyframes logoPulseRing {
    0%, 100% {
        transform: translateY(-50%) scale(1);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-50%) scale(1.4);
        opacity: 0;
    }
}

@keyframes ctaScan {
    0%, 100% { left: -100%; }
    40% { left: 150%; }
    41%, 99% { left: -100%; }
}

/* ═══ MOBILE ═══ */
@media (max-width: 768px) {
    .nav {
        top: 10px;
        min-width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        height: 52px;
        padding: 0;
    }

    .nav .container {
        padding: 0 20px;
    }

    .nav-brand {
        font-size: 14px;
    }

    .nav-brand svg {
        width: 22px;
        height: 22px;
    }

    .nav-links {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(5, 5, 12, 0.97);
        backdrop-filter: blur(30px);
        -webkit-backdrop-filter: blur(30px);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 8px;
        z-index: 9998;
        padding: 80px 40px;
    }

    .nav-links.open {
        display: flex;
        animation: mobileMenuIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }

    .nav-link {
        font-size: 22px;
        font-weight: 600;
        padding: 14px 32px;
        color: rgba(255, 255, 255, 0.6);
        opacity: 0;
        animation: mobileItemIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }

    .nav-links.open .nav-link:nth-child(1) { animation-delay: 0.05s; }
    .nav-links.open .nav-link:nth-child(2) { animation-delay: 0.1s; }
    .nav-links.open .nav-link:nth-child(3) { animation-delay: 0.15s; }
    .nav-links.open .nav-link:nth-child(4) { animation-delay: 0.2s; }

    .nav-link::after {
        bottom: 8px;
    }

    .nav-cta {
        margin-top: 16px;
        padding: 14px 36px;
        font-size: 16px;
        opacity: 0;
        animation: mobileItemIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
        animation-delay: 0.25s;
    }

    .nav-menu-btn {
        display: flex;
    }

    /* Decorative mobile background elements */
    .nav-links::before {
        content: '';
        display: block;
        position: absolute;
        width: 300px;
        height: 300px;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(124, 58, 237, 0.08) 0%, transparent 70%);
        top: 20%;
        left: 50%;
        transform: translateX(-50%);
        pointer-events: none;
    }

    .nav-links::after {
        content: '';
        position: absolute;
        width: 200px;
        height: 200px;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(236, 72, 153, 0.06) 0%, transparent 70%);
        bottom: 20%;
        right: 10%;
        pointer-events: none;
    }
}

@keyframes mobileMenuIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(30px);
    }
}

@keyframes mobileItemIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══ Small tweaks for larger screens ═══ */
@media (min-width: 1200px) {
    .nav {
        max-width: 960px;
    }

    .nav-links {
        gap: 6px;
    }

    .nav-link {
        font-size: 13.5px;
        padding: 8px 18px;
    }
}

/* ═══ Respect reduced motion ═══ */
@media (prefers-reduced-motion: reduce) {
    .nav, .nav::before, .nav-brand svg,
    .nav-brand::before, .nav-cta::before {
        animation: none;
    }
    .nav { top: 16px; opacity: 1; transform: translateX(-50%) scale(1); }
}
