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

/* Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }

    to {
        opacity: 1;
        max-height: 500px;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

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

    100% {
        background-position: -200% 0;
    }
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.5;
    }

    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 20px var(--accent-glow);
    }

    50% {
        box-shadow: 0 0 40px var(--accent-glow), 0 0 60px var(--accent-glow);
    }
}

@keyframes textReveal {
    from {
        clip-path: inset(0 100% 0 0);
    }

    to {
        clip-path: inset(0 0 0 0);
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.4s var(--transition-spring) forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 0.4s var(--transition-spring) forwards;
}

.animate-slide-up {
    animation: slideUp 0.4s var(--transition-spring) forwards;
}

.animate-scale-in {
    animation: scaleIn 0.3s var(--transition-spring) forwards;
}

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

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

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

/* Staggered animations */
.stagger-1 {
    animation-delay: 0.05s;
}

.stagger-2 {
    animation-delay: 0.1s;
}

.stagger-3 {
    animation-delay: 0.15s;
}

.stagger-4 {
    animation-delay: 0.2s;
}

.stagger-5 {
    animation-delay: 0.25s;
}

/* 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 Reveal */
.scroll-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Interactive States */
.pressable {
    transition: transform var(--transition-fast);
}

.pressable:active {
    transform: scale(0.96);
}

/* Ripple Effect */
.ripple-container {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

/* Theme Transition */
.theme-transitioning * {
    transition: background-color 0.3s ease-out,
        border-color 0.3s ease-out,
        color 0.3s ease-out !important;
}

/* Loading Skeleton */
.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--glass-subtle);
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    animation: shimmer 1.5s infinite;
}

/* Typing Animation for AI Response */
.typing-animation {
    overflow: hidden;
    white-space: nowrap;
    animation: textReveal 0.5s steps(30) forwards;
}

/* Hover Effects */
@media (hover: hover) {
    .hover-lift {
        transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    }

    .hover-lift:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px var(--glass-shadow);
    }

    .hover-scale {
        transition: transform var(--transition-fast);
    }

    .hover-scale:hover {
        transform: scale(1.02);
    }
}

/* Visible State for Hidden Elements */
.hidden {
    display: none !important;
}

.invisible {
    visibility: hidden;
    opacity: 0;
}

.visible {
    visibility: visible;
    opacity: 1;
}