/* HELIX Core v2
   Premium animated AI core with:
   - plasma center
   - rotating double helix
   - orbiting particles
   - interactive state colors
*/

#helix-core {
    --core-primary: #2563eb;
    --core-secondary: #38bdf8;
    --core-highlight: #dbeafe;
    --core-dark: #071426;
    --core-glow: rgba(56, 189, 248, 0.72);
    --core-speed: 3.2s;

    position: relative;
    width: 168px;
    height: 168px;
    margin: 18px auto;
    isolation: isolate;
    user-select: none;
}

#helix-core * {
    box-sizing: border-box;
}

#helix-core .helix-core-shell {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
}

#helix-core .helix-core-aura {
    position: absolute;
    inset: 19px;
    border-radius: 50%;
    background:
        radial-gradient(circle,
            color-mix(in srgb, var(--core-secondary) 36%, transparent) 0%,
            color-mix(in srgb, var(--core-primary) 18%, transparent) 42%,
            transparent 72%);
    filter: blur(8px);
    animation: helixAura var(--core-speed) ease-in-out infinite;
}

#helix-core .helix-core-orbit {
    position: absolute;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--core-secondary) 54%, transparent);
    box-shadow:
        0 0 14px color-mix(in srgb, var(--core-secondary) 35%, transparent),
        inset 0 0 10px color-mix(in srgb, var(--core-primary) 22%, transparent);
}

#helix-core .helix-core-orbit::before,
#helix-core .helix-core-orbit::after {
    content: "";
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--core-highlight);
    box-shadow:
        0 0 8px var(--core-secondary),
        0 0 16px var(--core-primary);
}

#helix-core .helix-core-orbit::before {
    top: -4px;
    left: 50%;
}

#helix-core .helix-core-orbit::after {
    bottom: -4px;
    right: 22%;
}

#helix-core .orbit-one {
    inset: 8px;
    animation: helixSpin 22s linear infinite;
}

#helix-core .orbit-two {
    inset: 22px;
    transform: rotate(58deg);
    animation: helixSpinReverse 15s linear infinite;
}

#helix-core .orbit-three {
    inset: 36px;
    border-style: dashed;
    opacity: 0.72;
    animation: helixSpin 10s linear infinite;
}

#helix-core .helix-core-sphere {
    position: absolute;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    overflow: hidden;
    background:
        radial-gradient(circle at 34% 28%,
            var(--core-highlight) 0%,
            var(--core-secondary) 18%,
            var(--core-primary) 48%,
            var(--core-dark) 84%);
    box-shadow:
        0 0 18px var(--core-glow),
        0 0 42px color-mix(in srgb, var(--core-primary) 68%, transparent),
        0 0 72px color-mix(in srgb, var(--core-secondary) 36%, transparent),
        inset -12px -14px 28px rgba(0, 0, 0, 0.46),
        inset 8px 8px 18px rgba(255, 255, 255, 0.19);
    animation:
        helixPulse var(--core-speed) ease-in-out infinite,
        helixFloat 7s ease-in-out infinite;
}

#helix-core .helix-core-sphere::before {
    content: "";
    position: absolute;
    inset: -30%;
    border-radius: 50%;
    background:
        conic-gradient(
            from 0deg,
            transparent,
            color-mix(in srgb, var(--core-highlight) 44%, transparent),
            transparent 27%,
            color-mix(in srgb, var(--core-secondary) 34%, transparent),
            transparent 58%,
            color-mix(in srgb, var(--core-highlight) 28%, transparent),
            transparent
        );
    filter: blur(7px);
    animation: helixPlasmaSpin 5.8s linear infinite;
}

#helix-core .helix-core-sphere::after {
    content: "";
    position: absolute;
    inset: 7px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.26);
    box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.12);
}

#helix-core .helix-core-dna {
    position: absolute;
    inset: 17px 26px;
    z-index: 3;
    animation: helixDnaTurn 8s linear infinite;
}

#helix-core .helix-core-dna svg {
    width: 100%;
    height: 100%;
    overflow: visible;
    filter:
        drop-shadow(0 0 4px var(--core-highlight))
        drop-shadow(0 0 8px var(--core-secondary));
}

#helix-core .helix-core-dna path {
    fill: none;
    stroke-width: 3.2;
    stroke-linecap: round;
}

#helix-core .helix-core-dna .dna-a {
    stroke: var(--core-highlight);
}

#helix-core .helix-core-dna .dna-b {
    stroke: color-mix(in srgb, var(--core-secondary) 78%, white);
}

#helix-core .helix-core-dna line {
    stroke: rgba(255, 255, 255, 0.72);
    stroke-width: 1.3;
}

#helix-core .helix-core-status {
    position: absolute;
    left: 50%;
    bottom: -4px;
    transform: translateX(-50%);
    min-width: 92px;
    padding: 4px 9px;
    border-radius: 999px;
    color: #eaf4ff;
    background: rgba(3, 12, 28, 0.76);
    border: 1px solid color-mix(in srgb, var(--core-secondary) 44%, transparent);
    box-shadow: 0 0 12px color-mix(in srgb, var(--core-primary) 24%, transparent);
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    backdrop-filter: blur(7px);
    white-space: nowrap;
}

#helix-core .helix-core-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

#helix-core .particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--core-highlight);
    box-shadow:
        0 0 6px var(--core-secondary),
        0 0 12px var(--core-primary);
    opacity: 0.78;
    animation: helixParticleFloat 4.2s ease-in-out infinite;
}

#helix-core .particle:nth-child(1) { left: 15%; top: 25%; animation-delay: -0.8s; }
#helix-core .particle:nth-child(2) { right: 13%; top: 31%; animation-delay: -2.1s; }
#helix-core .particle:nth-child(3) { left: 24%; bottom: 15%; animation-delay: -1.4s; }
#helix-core .particle:nth-child(4) { right: 25%; bottom: 11%; animation-delay: -3.2s; }
#helix-core .particle:nth-child(5) { left: 49%; top: 4%; animation-delay: -2.6s; }
#helix-core .particle:nth-child(6) { right: 3%; top: 58%; animation-delay: -1.1s; }

/* Interactive states */
#helix-core.idle {
    --core-primary: #2563eb;
    --core-secondary: #38bdf8;
    --core-highlight: #dbeafe;
    --core-dark: #071426;
    --core-glow: rgba(56, 189, 248, 0.72);
    --core-speed: 3.2s;
}

#helix-core.thinking {
    --core-primary: #0891b2;
    --core-secondary: #22d3ee;
    --core-highlight: #cffafe;
    --core-dark: #083344;
    --core-glow: rgba(34, 211, 238, 0.82);
    --core-speed: 1.25s;
}

#helix-core.searching {
    --core-primary: #7c3aed;
    --core-secondary: #c084fc;
    --core-highlight: #f3e8ff;
    --core-dark: #2e1065;
    --core-glow: rgba(192, 132, 252, 0.78);
    --core-speed: 1.7s;
}

#helix-core.complete {
    --core-primary: #16a34a;
    --core-secondary: #4ade80;
    --core-highlight: #dcfce7;
    --core-dark: #052e16;
    --core-glow: rgba(74, 222, 128, 0.82);
    --core-speed: 0.9s;
}

#helix-core.warning {
    --core-primary: #d97706;
    --core-secondary: #fbbf24;
    --core-highlight: #fef3c7;
    --core-dark: #451a03;
    --core-glow: rgba(251, 191, 36, 0.78);
    --core-speed: 1.45s;
}

#helix-core.error {
    --core-primary: #dc2626;
    --core-secondary: #fb7185;
    --core-highlight: #ffe4e6;
    --core-dark: #450a0a;
    --core-glow: rgba(251, 113, 133, 0.84);
    --core-speed: 0.72s;
}

#helix-core.complete .helix-core-sphere {
    animation:
        helixCompleteFlash 0.72s ease-out 1,
        helixPulse 2.7s ease-in-out infinite;
}

#helix-core.error .helix-core-shell {
    animation: helixShake 0.42s ease-in-out 2;
}

/* Optional compact size */
#helix-core.compact {
    transform: scale(0.76);
    transform-origin: center;
    margin-top: -2px;
    margin-bottom: -2px;
}

@keyframes helixPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.085); }
}

@keyframes helixAura {
    0%, 100% { opacity: 0.58; transform: scale(0.93); }
    50% { opacity: 0.98; transform: scale(1.08); }
}

@keyframes helixSpin {
    to { transform: rotate(360deg); }
}

@keyframes helixSpinReverse {
    to { transform: rotate(-360deg); }
}

@keyframes helixPlasmaSpin {
    to { transform: rotate(360deg); }
}

@keyframes helixDnaTurn {
    0% { transform: rotateY(0deg) rotateZ(-2deg); }
    50% { transform: rotateY(180deg) rotateZ(2deg); }
    100% { transform: rotateY(360deg) rotateZ(-2deg); }
}

@keyframes helixFloat {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -3px; }
}

@keyframes helixParticleFloat {
    0%, 100% { transform: translateY(0) scale(0.82); opacity: 0.28; }
    50% { transform: translateY(-8px) scale(1.25); opacity: 0.92; }
}

@keyframes helixCompleteFlash {
    0% { transform: scale(0.92); filter: brightness(1); }
    45% { transform: scale(1.16); filter: brightness(1.9); }
    100% { transform: scale(1); filter: brightness(1); }
}

@keyframes helixShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

@media (prefers-reduced-motion: reduce) {
    #helix-core *,
    #helix-core *::before,
    #helix-core *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
