/* =============================================
   GUNTER APP - ANIMATIONS
   ============================================= */

/* ===== KEYFRAME DEFINITIONS ===== */

/* Pulse Animation */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.05);
    }
}

/* Spin Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Slide In */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide Up */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Float Animation */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Glow Pulse */
@keyframes glowPulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.3), 0 0 40px rgba(0, 212, 255, 0.1);
    }

    50% {
        box-shadow: 0 0 30px rgba(0, 212, 255, 0.5), 0 0 60px rgba(0, 212, 255, 0.2);
    }
}

/* Neural Mesh Animation */
@keyframes meshMove {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* Wave Animation */
@keyframes wave {
    0% {
        transform: scaleY(0.5);
    }

    50% {
        transform: scaleY(1);
    }

    100% {
        transform: scaleY(0.5);
    }
}

/* Shimmer Animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Rotate Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Bounce Animation */
@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    25% {
        transform: translateY(-8px);
    }

    50% {
        transform: translateY(0);
    }

    75% {
        transform: translateY(-4px);
    }
}

/* Gentle Float Animation (for avatars) */
@keyframes gentleFloat {

    0%,
    100% {
        transform: translateY(0) scale(1);
        filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.4));
    }

    50% {
        transform: translateY(-12px) scale(1.02);
        filter: drop-shadow(0 0 30px rgba(0, 212, 255, 0.6));
    }
}

/* State Change Flash */
@keyframes stateFlash {
    0% {
        filter: drop-shadow(0 0 40px rgba(0, 212, 255, 0.8)) brightness(1.3);
    }

    100% {
        filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.4)) brightness(1);
    }
}

/* Typing Cursor */
@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* ===== ANIMATION CLASSES ===== */

.animate-fade-in {
    animation: fadeIn var(--transition-base) ease forwards;
}

.animate-slide-up {
    animation: slideUp var(--transition-base) ease forwards;
}

.animate-scale-in {
    animation: scaleIn var(--transition-base) ease forwards;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-glow-pulse {
    animation: glowPulse 2s ease-in-out infinite;
}

.animate-bounce {
    animation: bounce 1s ease infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Stagger Animations */
.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;
}

/* Hover Transitions */
.hover-lift {
    transition: transform var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
}

.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: var(--glow-primary);
}

.hover-scale {
    transition: transform var(--transition-base);
}

.hover-scale:hover {
    transform: scale(1.02);
}

/* ===== AVATAR STATE ANIMATIONS ===== */

/* Base Avatar Container */
.gunter-avatar {
    position: relative;
    transition: all var(--transition-slow);
}

/* Transparent Avatar Image Styling */
.gunter-avatar-img {
    filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.4));
    transition: filter 0.5s ease, transform 0.5s ease;
}

/* Default floating animation */
.gunter-avatar[data-state="default"] .gunter-avatar-img {
    animation: gentleFloat 4s ease-in-out infinite;
}

/* Listening State */
.gunter-avatar[data-state="listening"] {
    animation: float 2s ease-in-out infinite;
}

.gunter-avatar[data-state="listening"]::after {
    content: '';
    position: absolute;
    inset: -10px;
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
    opacity: 0;
    animation: pulse 1.5s ease-in-out infinite;
}

/* Analyzing State */
.gunter-avatar[data-state="analyzing"] .avatar__image {
    animation: none;
}

.gunter-avatar[data-state="analyzing"]::before {
    content: '';
    position: absolute;
    inset: -15px;
    background: conic-gradient(from 0deg, var(--accent-primary), var(--accent-secondary), var(--accent-primary));
    border-radius: 50%;
    opacity: 0.3;
    animation: rotate 3s linear infinite;
    z-index: -1;
}

/* Alert State */
.gunter-avatar[data-state="alert"] {
    animation: bounce 0.5s ease;
}

.gunter-avatar[data-state="alert"]::after {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: var(--accent-amber);
    border-radius: 50%;
    animation: pulse 1s ease-in-out infinite;
}

/* Celebration State */
.gunter-avatar[data-state="celebration"] {
    animation: bounce 0.8s ease-in-out 2;
}

.gunter-avatar[data-state="celebration"]::before {
    content: '✨';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    animation: float 1s ease-in-out infinite;
}

/* Speaking State */
.gunter-avatar[data-state="speaking"] .avatar__image {
    animation: pulse 1s ease-in-out infinite;
}

/* ===== AUDIO VISUALIZER ===== */
.audio-visualizer {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    height: 40px;
}

.audio-bar {
    width: 4px;
    background: linear-gradient(to top, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-full);
    animation: wave 0.5s ease-in-out infinite;
}

.audio-bar:nth-child(1) {
    animation-delay: 0s;
    height: 60%;
}

.audio-bar:nth-child(2) {
    animation-delay: 0.1s;
    height: 80%;
}

.audio-bar:nth-child(3) {
    animation-delay: 0.2s;
    height: 100%;
}

.audio-bar:nth-child(4) {
    animation-delay: 0.3s;
    height: 70%;
}

.audio-bar:nth-child(5) {
    animation-delay: 0.4s;
    height: 90%;
}

.audio-bar:nth-child(6) {
    animation-delay: 0.5s;
    height: 50%;
}

.audio-bar:nth-child(7) {
    animation-delay: 0.6s;
    height: 75%;
}

/* ===== TYPING INDICATOR ===== */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: var(--space-3);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* ===== NEURAL MESH BACKGROUND ===== */
.neural-mesh-bg {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(123, 104, 238, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 0, 110, 0.05) 0%, transparent 30%);
    z-index: -1;
    animation: meshMove 20s ease infinite;
    background-size: 200% 200%;
}

.neural-mesh-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.5;
}

/* ===== PAGE TRANSITIONS ===== */
.page-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all var(--transition-slow);
}

.page-exit {
    opacity: 1;
}

.page-exit-active {
    opacity: 0;
    transform: translateY(-20px);
    transition: all var(--transition-base);
}

/* ===== SKELETON LOADING ===== */
.skeleton {
    background: linear-gradient(90deg,
            var(--bg-card) 25%,
            rgba(255, 255, 255, 0.05) 50%,
            var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 1em;
    margin-bottom: var(--space-2);
}

.skeleton-title {
    height: 1.5em;
    width: 60%;
    margin-bottom: var(--space-4);
}

.skeleton-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
}