/* =========================================
   SheraAI - Animations CSS
   Premium Animation Library
   ========================================= */

/* =========================================
   Keyframe Animations
   ========================================= */

/* Fade Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    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);
    }
}

/* Scale Animations */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide Animations */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(1deg);
    }
    50% {
        transform: translateY(-20px) rotate(0deg);
    }
    75% {
        transform: translateY(-10px) rotate(-1deg);
    }
}

@keyframes floatSlow {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

@keyframes floatDelayed {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    33% {
        transform: translateY(-12px) translateX(5px);
    }
    66% {
        transform: translateY(-8px) translateX(-5px);
    }
}

/* Pulse Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

@keyframes pulseSoft {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(124, 77, 255, 0.4);
    }
    50% {
        box-shadow: 0 0 40px rgba(124, 77, 255, 0.6), 0 0 60px rgba(124, 77, 255, 0.3);
    }
}

@keyframes ripple {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(2.4);
        opacity: 0;
    }
}

/* Rotate Animations */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes rotateReverse {
    from {
        transform: rotate(360deg);
    }
    to {
        transform: rotate(0deg);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Shake Animation */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

@keyframes wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(5deg);
    }
    75% {
        transform: rotate(-5deg);
    }
}

/* Bounce Animation */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

@keyframes bounceSoft {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Glow Animations */
@keyframes glow {
    0%, 100% {
        filter: brightness(1) drop-shadow(0 0 20px rgba(124, 77, 255, 0.5));
    }
    50% {
        filter: brightness(1.2) drop-shadow(0 0 40px rgba(124, 77, 255, 0.8));
    }
}

@keyframes glowPrimary {
    0%, 100% {
        box-shadow: 0 0 10px var(--primary-glow), 0 0 20px var(--primary-glow);
    }
    50% {
        box-shadow: 0 0 20px var(--primary-glow), 0 0 40px var(--primary-glow), 0 0 60px var(--primary-glow);
    }
}

@keyframes glowSecondary {
    0%, 100% {
        box-shadow: 0 0 10px var(--secondary-glow), 0 0 20px var(--secondary-glow);
    }
    50% {
        box-shadow: 0 0 20px var(--secondary-glow), 0 0 40px var(--secondary-glow), 0 0 60px var(--secondary-glow);
    }
}

/* Text Animations */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

@keyframes textGradient {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Background Animations */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes moveBackground {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 100% 100%;
    }
}

/* Particle Animations */
@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0.6;
    }
    25% {
        transform: translateY(-50px) translateX(20px) scale(1.1);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-100px) translateX(-10px) scale(0.9);
        opacity: 0.5;
    }
    75% {
        transform: translateY(-150px) translateX(30px) scale(1.05);
        opacity: 0.3;
    }
}

@keyframes particleRise {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) scale(1);
        opacity: 0;
    }
}

/* Morph Animations */
@keyframes morphBlob {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    25% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    50% {
        border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%;
    }
    75% {
        border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%;
    }
}

/* Loading Animations */
@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

@keyframes loadingBar {
    0% {
        width: 0%;
    }
    100% {
        width: 100%;
    }
}

@keyframes loadingSpinner {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Counter Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   Animation Utility Classes
   ========================================= */

/* Base Reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Reveal Variants */
.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* Stagger Delays */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }
.delay-6 { transition-delay: 0.6s; }
.delay-7 { transition-delay: 0.7s; }
.delay-8 { transition-delay: 0.8s; }

/* Animation Durations */
.duration-fast { animation-duration: 0.3s; }
.duration-normal { animation-duration: 0.6s; }
.duration-slow { animation-duration: 1s; }
.duration-slower { animation-duration: 2s; }

/* Animation Fill Modes */
.fill-forwards { animation-fill-mode: forwards; }
.fill-backwards { animation-fill-mode: backwards; }
.fill-both { animation-fill-mode: both; }

/* Animation Play States */
.paused { animation-play-state: paused; }
.running { animation-play-state: running; }

/* Infinite Animations */
.animate-float { animation: floatSlow 6s ease-in-out infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-pulse-soft { animation: pulseSoft 2s ease-in-out infinite; }
.animate-glow { animation: pulseGlow 2s ease-in-out infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-bounce { animation: bounceSoft 2s ease-in-out infinite; }
.animate-wiggle { animation: wiggle 1s ease-in-out infinite; }

/* One-time Animations */
.animate-fade-in { animation: fadeIn 0.6s ease-out forwards; }
.animate-fade-in-up { animation: fadeInUp 0.6s ease-out forwards; }
.animate-fade-in-down { animation: fadeInDown 0.6s ease-out forwards; }
.animate-fade-in-left { animation: fadeInLeft 0.6s ease-out forwards; }
.animate-fade-in-right { animation: fadeInRight 0.6s ease-out forwards; }
.animate-scale-in { animation: scaleIn 0.6s ease-out forwards; }
.animate-zoom-in { animation: zoomIn 0.6s ease-out forwards; }
.animate-bounce-in { animation: bounceIn 0.8s ease-out forwards; }

/* Hover Animations */
.hover-float:hover {
    transform: translateY(-8px);
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px var(--primary-glow);
    transition: box-shadow 0.3s ease;
}

.hover-shake:hover {
    animation: shake 0.5s ease-in-out;
}

.hover-wiggle:hover {
    animation: wiggle 0.5s ease-in-out;
}

/* Gradient Text Animation */
.animate-gradient-text {
    background: linear-gradient(90deg, var(--primary), var(--tertiary), var(--secondary), var(--primary));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textGradient 5s ease infinite;
}

/* Morphing Background */
.animate-morph {
    animation: morphBlob 8s ease-in-out infinite;
}

/* Loading States */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: loadingDots 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0; }

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: loadingSpinner 1s linear infinite;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--dark-300) 25%, var(--dark-400) 50%, var(--dark-300) 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Parallax Effect */
.parallax {
    transition: transform 0.1s ease-out;
}

/* Mouse Follow Effect */
.mouse-follow {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tilt Effect */
.tilt {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.tilt:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s, opacity 0.6s;
    opacity: 0;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
    opacity: 1;
    transition: 0s;
}

/* Underline Animation */
.underline-animation {
    position: relative;
    display: inline-block;
}

.underline-animation::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

.underline-animation:hover::after {
    width: 100%;
}

/* Border Animation */
.border-animation {
    position: relative;
}

.border-animation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid transparent;
    border-radius: inherit;
    transition: border-color 0.3s ease;
}

.border-animation:hover::before {
    border-color: var(--primary);
}

/* Page Transitions */
.page-transition-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.page-transition-exit {
    opacity: 1;
}

.page-transition-exit-active {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* 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;
    }
    
    .reveal,
    .reveal-left,
    .reveal-right,
    .reveal-scale {
        opacity: 1;
        transform: none;
        transition: none;
    }
    
    .animate-float,
    .animate-pulse,
    .animate-glow,
    .animate-spin,
    .animate-bounce,
    .animate-wiggle {
        animation: none;
    }
}

/* =========================================
   Particle System Styles
   ========================================= */
.particle {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    opacity: 0.6;
}

.particle-primary {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.particle-secondary {
    background: var(--secondary);
    box-shadow: 0 0 10px var(--secondary-glow);
}

.particle-tertiary {
    background: var(--tertiary);
    box-shadow: 0 0 10px var(--tertiary-glow);
}

/* Floating Particles Container */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Connection Lines */
.connection-line {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
    transform-origin: left center;
    pointer-events: none;
}

/* Cursor Effects */
.cursor-glow {
    position: fixed;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--primary-glow), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.3;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
}

/* Text Scramble Effect */
.text-scramble {
    display: inline-block;
}

.text-scramble .char {
    display: inline-block;
    transition: transform 0.3s ease;
}

.text-scramble:hover .char {
    animation: scrambleChar 0.3s ease forwards;
}

@keyframes scrambleChar {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Glitch Effect */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--accent);
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 var(--secondary);
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim-2 2s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
    0% { clip: rect(15px, 9999px, 100px, 0); }
    20% { clip: rect(45px, 9999px, 60px, 0); }
    40% { clip: rect(70px, 9999px, 95px, 0); }
    60% { clip: rect(30px, 9999px, 80px, 0); }
    80% { clip: rect(50px, 9999px, 110px, 0); }
    100% { clip: rect(10px, 9999px, 55px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(65px, 9999px, 120px, 0); }
    20% { clip: rect(20px, 9999px, 75px, 0); }
    40% { clip: rect(90px, 9999px, 130px, 0); }
    60% { clip: rect(40px, 9999px, 85px, 0); }
    80% { clip: rect(5px, 9999px, 45px, 0); }
    100% { clip: rect(75px, 9999px, 100px, 0); }
}
