/* AI Cursor Animation Styles */

.ai-cursor-container {
    position: fixed;
    width: 50px;
    height: 50px;
    pointer-events: none;
    z-index: 9999;
    transition: transform 0.05s linear;
    will-change: transform;
}

/* Make it interactive on hover */
.ai-cursor-container:hover {
    pointer-events: auto;
}

.ai-robot {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.5));
}

/* Robot face */
.robot-face {
    position: absolute;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #ff0000, #990000);
    border-radius: 8px;
    top: 10px;
    left: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 10px rgba(255, 0, 0, 0.3);
    overflow: hidden;
}

/* Robot eyes */
.robot-eye {
    position: relative;
    width: 10px;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    margin: 0 3px;
    overflow: hidden;
}

/* Eye pupil that follows mouse */
.robot-eye::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 5px;
    background-color: #000;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* The eye-direction variable is set via JavaScript */
    transform: translate(
        calc(cos(var(--eye-direction, 0rad)) * 2px),
        calc(sin(var(--eye-direction, 0rad)) * 2px)
    );
}

/* Robot antenna */
.robot-antenna {
    position: absolute;
    width: 4px;
    height: 12px;
    background-color: #cc0000;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px;
    z-index: 1;
}

.robot-antenna::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: #ff3333;
    border-radius: 50%;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    animation: pulse 1.5s infinite alternate;
}

/* Pulse effect around the robot */
.pulse-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 0, 0, 0.3) 0%, rgba(255, 0, 0, 0) 70%);
    opacity: 0.5;
    animation: pulse 1.5s infinite alternate;
    z-index: -1;
}

/* Message bubble */
.ai-message-bubble {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%) translateY(10px) scale(0.8);
    background-color: white;
    color: #333;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    z-index: 10;
    font-family: Arial, sans-serif;
    border: 1px solid rgba(255, 0, 0, 0.3);
}

.ai-message-bubble::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background-color: white;
    border-right: 1px solid rgba(255, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 0, 0, 0.3);
}

/* Dark theme message bubble */
body.dark-theme .ai-message-bubble {
    background-color: #333;
    color: #fff;
    border: 1px solid rgba(255, 0, 0, 0.5);
}

body.dark-theme .ai-message-bubble::after {
    background-color: #333;
    border-right: 1px solid rgba(255, 0, 0, 0.5);
    border-bottom: 1px solid rgba(255, 0, 0, 0.5);
}

/* Hover effect */
.ai-robot.hover {
    transform: scale(1.2);
    filter: drop-shadow(0 0 15px rgba(255, 0, 0, 0.8));
}

.ai-robot.hover .robot-face {
    background: linear-gradient(135deg, #ff3333, #cc0000);
}

.ai-robot.hover .pulse-effect {
    animation: pulse-fast 0.8s infinite alternate;
}

/* Excited state */
.ai-robot.excited {
    transform: scale(1.1);
    filter: drop-shadow(0 0 12px rgba(255, 0, 0, 0.7));
    animation: excited-bounce 0.5s infinite alternate;
}

.ai-robot.excited .robot-face {
    background: linear-gradient(135deg, #ff5555, #ff0000);
}

.ai-robot.excited .robot-eye::after {
    width: 6px;
    height: 6px;
}

.ai-robot.excited .robot-antenna::after {
    animation: pulse 0.5s infinite alternate;
}

/* Click ripple effect */
.ai-click-ripple {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: rgba(255, 0, 0, 0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9998;
    animation: ripple 0.7s ease-out forwards;
}

/* Click reaction */
.ai-robot.click-reaction {
    transform: scale(0.8);
    animation: click-bounce 0.5s ease-out forwards;
}

.ai-robot.click-reaction .robot-face {
    background: linear-gradient(135deg, #ff5555, #ff0000);
}

/* Scroll reactions */
.ai-robot.scroll-down {
    transform: translateY(5px) rotate(10deg);
}

.ai-robot.scroll-up {
    transform: translateY(-5px) rotate(-10deg);
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(0.9);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes pulse-fast {
    0% {
        transform: scale(0.9);
        opacity: 0.7;
    }
    100% {
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes ripple {
    0% {
        width: 20px;
        height: 20px;
        opacity: 1;
    }
    100% {
        width: 100px;
        height: 100px;
        opacity: 0;
    }
}

@keyframes click-bounce {
    0% {
        transform: scale(0.8);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes excited-bounce {
    0% {
        transform: translateY(0) scale(1.1);
    }
    100% {
        transform: translateY(-3px) scale(1.15);
    }
}

/* Dark theme adjustments */
body.dark-theme .robot-face {
    background: linear-gradient(135deg, #ff3333, #cc0000);
    box-shadow: 0 2px 10px rgba(255, 0, 0, 0.5);
}

body.dark-theme .pulse-effect {
    background: radial-gradient(circle, rgba(255, 0, 0, 0.4) 0%, rgba(255, 0, 0, 0) 70%);
}

body.dark-theme .ai-robot {
    filter: drop-shadow(0 0 8px rgba(255, 0, 0, 0.7));
}

body.dark-theme .ai-robot.hover {
    filter: drop-shadow(0 0 20px rgba(255, 0, 0, 1));
}