/* ================================
   ANIMATIONS - BLUESTONE AI
   ================================ */

/* ================================
   KEYFRAME ANIMATIONS
   ================================ */

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

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

@keyframes flow {
    0% {
        stroke-dasharray: 0 20;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 10 10;
        stroke-dashoffset: -5;
    }
    100% {
        stroke-dasharray: 0 20;
        stroke-dashoffset: -20;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    33% {
        transform: translateY(-10px) rotate(1deg);
    }
    66% {
        transform: translateY(5px) rotate(-1deg);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(29, 185, 84, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(29, 185, 84, 0.6);
    }
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

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

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }
    70% {
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ================================
   SCROLL ANIMATIONS
   ================================ */

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

.animate-fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.8s ease-out forwards;
}

.animate-fade-in-right {
    animation: fadeInRight 0.8s ease-out forwards;
}

.animate-scale-in {
    animation: scaleIn 0.6s ease-out forwards;
}

.animate-slide-in-top {
    animation: slideInFromTop 0.8s ease-out forwards;
}

.animate-slide-in-bottom {
    animation: slideInFromBottom 0.8s ease-out forwards;
}

.animate-bounce {
    animation: bounce 1s ease-out forwards;
}

/* ================================
   HERO ANIMATIONS
   ================================ */

.hero-title {
    animation: fadeInUp 1s ease-out 0.3s backwards;
}

.hero-subtitle {
    animation: fadeInUp 1s ease-out 0.5s backwards;
}

.hero-actions {
    animation: fadeInUp 1s ease-out 0.7s backwards;
}

.brain-visualization {
    animation: fadeIn 1.5s ease-out 0.9s backwards;
}

/* Particle Animation */
.particle {
    position: absolute;
    background: linear-gradient(45deg, var(--primary-green), var(--teal));
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
    opacity: 0.6;
}

.particle:nth-child(1) {
    width: 8px;
    height: 8px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
    animation-duration: 8s;
}

.particle:nth-child(2) {
    width: 12px;
    height: 12px;
    top: 60%;
    left: 20%;
    animation-delay: 2s;
    animation-duration: 6s;
}

.particle:nth-child(3) {
    width: 6px;
    height: 6px;
    top: 40%;
    left: 80%;
    animation-delay: 4s;
    animation-duration: 10s;
}

.particle:nth-child(4) {
    width: 10px;
    height: 10px;
    top: 80%;
    left: 70%;
    animation-delay: 1s;
    animation-duration: 7s;
}

.particle:nth-child(5) {
    width: 14px;
    height: 14px;
    top: 30%;
    left: 60%;
    animation-delay: 3s;
    animation-duration: 9s;
}

/* ================================
   BUTTON ANIMATIONS
   ================================ */

.btn {
    position: relative;
    overflow: hidden;
}

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

.btn:hover::before {
    left: 100%;
}

.btn-primary:hover {
    animation: glow 1s ease-in-out;
}

/* ================================
   CARD ANIMATIONS
   ================================ */

.feature-card {
    transition: all var(--transition-normal);
}

.feature-card:hover .feature-icon svg {
    animation: bounce 0.6s ease;
}

.step:hover .step-number {
    animation: pulse 1s ease-in-out;
}

/* ================================
   LOADING ANIMATIONS
   ================================ */

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(29, 185, 84, 0.1);
    border-left-color: var(--primary-green);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

.loading-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.loading-dots::before,
.loading-dots::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary-green);
    animation: pulse 1.4s ease-in-out infinite;
}

.loading-dots::before {
    animation-delay: 0s;
}

.loading-dots::after {
    animation-delay: 0.7s;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-text {
    height: 1em;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-text:last-child {
    width: 60%;
}

/* ================================
   FORM ANIMATIONS
   ================================ */

.form-group {
    position: relative;
}

.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label {
    transform: translateY(-25px) scale(0.8);
    color: var(--primary-green);
}

.form-success {
    animation: fadeInUp 0.5s ease-out forwards;
}

.form-error {
    animation: fadeInUp 0.5s ease-out forwards;
    color: var(--soft-red);
}

/* ================================
   CAROUSEL ANIMATIONS
   ================================ */

.testimonial-card {
    transition: all var(--transition-slow);
}

.testimonial-card.slide-in-right {
    animation: slideInFromRight 0.8s ease-out forwards;
}

.testimonial-card.slide-in-left {
    animation: slideInFromLeft 0.8s ease-out forwards;
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ================================
   NAVIGATION ANIMATIONS
   ================================ */

.navbar {
    animation: slideInFromTop 0.8s ease-out;
}

.nav-menu.active {
    animation: slideInFromTop 0.4s ease-out;
}

.nav-link {
    position: relative;
    transition: all var(--transition-normal);
}

.nav-link:hover {
    transform: translateY(-2px);
}

/* ================================
   SCROLL TO TOP ANIMATION
   ================================ */

.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-green);
    color: var(--pure-white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--transition-normal);
    z-index: 1000;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    background-color: var(--bright-green);
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 8px 24px rgba(29, 185, 84, 0.4);
}

/* ================================
   STAGGER ANIMATIONS
   ================================ */

.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease-out;
}

.stagger-children.animated > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-children.animated > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-children.animated > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-children.animated > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-children.animated > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-children.animated > *:nth-child(6) { animation-delay: 0.6s; }

.stagger-children.animated > * {
    opacity: 1;
    transform: translateY(0);
}

/* ================================
   REDUCED MOTION
   ================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .particle {
        display: none;
    }

    .brain-svg .node,
    .brain-svg .connection {
        animation: none;
    }
}

/* ================================
   PERFORMANCE OPTIMIZATIONS
   ================================ */

.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Force hardware acceleration for smooth animations */
.hero-background,
.particles,
.testimonials-carousel,
.navbar {
    transform: translateZ(0);
    backface-visibility: hidden;
}