/* ============================================
   Keyframe Animations
   ============================================ */

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes pulse-slow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-25%); }
}

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

@keyframes slide-down {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slide-in-right {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scale-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes accordion-down {
    from { height: 0; overflow: hidden; }
    to { height: var(--accordion-height); }
}

@keyframes accordion-up {
    from { height: var(--accordion-height); }
    to { height: 0; overflow: hidden; }
}

/* Animation utility classes */
.animate-gradient {
    background-size: 200% 200%;
    animation: gradient-shift 8s ease infinite;
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-pulse-slow {
    animation: pulse-slow 3s ease-in-out infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-bounce {
    animation: bounce 1s infinite;
}

.animate-slide-up {
    animation: slide-up 0.5s ease-out;
}

.animate-slide-down {
    animation: slide-down 0.3s ease-out;
}

.animate-slide-in-right {
    animation: slide-in-right 0.3s ease-out;
}

.animate-scale-in {
    animation: scale-in 0.2s ease-out;
}

/* Staggered animation delays for lists */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }
.stagger-7 { animation-delay: 0.7s; }

/* Fill mode for staggered animations */
.animate-slide-up,
.animate-slide-down,
.animate-slide-in-right,
.animate-scale-in {
    animation-fill-mode: both;
}

/* Loading spinner */
.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid hsl(var(--muted));
    border-top-color: hsl(var(--primary));
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner-sm {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
}

.loading-spinner-lg {
    width: 3rem;
    height: 3rem;
    border-width: 4px;
}

/* Hover transform utilities */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}
.hover-glow:hover {
    box-shadow: 0 0 20px rgba(var(--primary), 0.3);
}

.active-press:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
}

/* Glow Pulse */
@keyframes glow-pulse {
    0%, 100% { opacity: 0.15; transform: scale(1); }
    50% { opacity: 0.25; transform: scale(1.05); }
}
.animate-glow-pulse { animation: glow-pulse 4s ease-in-out infinite; }

/* Background Glow Orbs */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
    animation: glow-pulse 6s ease-in-out infinite;
    will-change: opacity, transform;
    contain: strict;
}

@media (max-width: 767px) {
    .glow-orb {
        filter: blur(40px);
        width: 200px !important;
        height: 200px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .glow-orb { animation: none; opacity: 0.1; }
}
.glow-orb-1 {
    width: 300px; height: 300px;
    background: var(--theme-glow-1, #3b82f6);
    top: -50px; left: -100px;
}
.glow-orb-2 {
    width: 250px; height: 250px;
    background: var(--theme-glow-2, #8b5cf6);
    bottom: -30px; right: -80px;
    animation-delay: 2s;
}

/* Fancy Gradient Border */
.fancy-border {
    position: relative;
    border-radius: calc(var(--radius) + 2px);
    padding: 2px;
    background: linear-gradient(135deg, var(--text-gradient-from, #2563eb), var(--text-gradient-to, #0ea5e9));
    background-size: 200% 200%;
    animation: gradient-shift 3s ease infinite;
}
.fancy-border > * {
    border-radius: var(--radius);
}

/* Typing Dots */
.typing-dots {
    display: flex; align-items: center; gap: 4px;
    padding: 8px 16px;
}
.typing-dots span {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.4;
    animation: typing-bounce 1.4s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* Additional stagger delays */
.stagger-8 { animation-delay: 0.8s; }
.stagger-9 { animation-delay: 0.9s; }
.stagger-10 { animation-delay: 1.0s; }

/* Confetti burst for success states */
@keyframes confetti-burst {
    0% { transform: scale(0) rotate(0); opacity: 1; }
    50% { opacity: 1; }
    100% { transform: scale(1.5) rotate(180deg); opacity: 0; }
}

/* Shimmer loading */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.animate-shimmer {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Wizard chat slide */
@keyframes wizard-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes wizard-chat-open {
    from { transform: translateY(100%) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Card enter animation */
@keyframes card-enter {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.animate-card-enter {
    animation: card-enter 0.4s var(--ease-out-expo, cubic-bezier(0.19, 1, 0.22, 1)) both;
}

/* Subtle float for decorative elements */
@keyframes subtle-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.animate-subtle-float {
    animation: subtle-float 3s ease-in-out infinite;
}

/* Focus ring pulse for interactive elements */
@keyframes focus-ring-pulse {
    0% { box-shadow: 0 0 0 0 hsl(var(--primary) / 0.4); }
    70% { box-shadow: 0 0 0 6px hsl(var(--primary) / 0); }
    100% { box-shadow: 0 0 0 0 hsl(var(--primary) / 0); }
}

/* Fade in up for page sections */
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up {
    animation: fade-in-up 0.6s var(--ease-out-expo, cubic-bezier(0.19, 1, 0.22, 1)) both;
}
