/* Custom Animations and Styles for RJ Chat */

/* Global Styles */
* {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    overflow-x: hidden;
}

/* Custom Keyframe Animations */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes wiggle {
    0%, 7%, 14%, 21%, 28%, 35%, 42%, 49%, 56%, 63%, 70%, 77%, 84%, 91%, 98%, 100% {
        transform: translate3d(0, 0, 0);
    }
    4%, 18%, 32%, 46%, 60%, 74%, 88% {
        transform: translate3d(-1px, 0, 0);
    }
    11%, 25%, 39%, 53%, 67%, 81%, 95% {
        transform: translate3d(1px, 0, 0);
    }
}

@keyframes typing {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

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

@keyframes userMessageSlide {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Loading Screen Animations */
#loading-screen {
    background: linear-gradient(45deg, #667eea, #764ba2, #f093fb, #f5576c);
    background-size: 400% 400%;
    animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Chat Messages */
.message {
    animation: messageSlide 0.3s ease-out;
}

.user-message {
    animation: userMessageSlide 0.3s ease-out;
}

.message-content {
    position: relative;
    word-wrap: break-word;
    line-height: 1.5;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    space-x: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 1.5rem;
    margin: 0.5rem 0;
    animation: fadeIn 0.3s ease-in;
}

.typing-dots {
    display: flex;
    space-x: 0.25rem;
}

.typing-dot {
    width: 0.5rem;
    height: 0.5rem;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

/* Avatar Animations */
.avatar-bounce {
    animation: bounce 2s infinite;
}

.avatar-glow {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    transition: box-shadow 0.3s ease;
}

.avatar-glow:hover {
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.8);
}

/* Button Hover Effects */
.btn-hover {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-hover:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* Glass Morphism Effects */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.glass-strong {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Input Focus Effects */
.input-glow:focus {
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.3);
    transform: scale(1.02);
}

/* Custom Scrollbar */
#messages-container {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

#messages-container::-webkit-scrollbar {
    width: 6px;
}

#messages-container::-webkit-scrollbar-track {
    background: transparent;
}

#messages-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

#messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Quick Actions Animation */
.quick-action {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.quick-action::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.quick-action:hover::before {
    left: 100%;
}

/* RJ Character Doodles */
.rj-doodle {
    position: relative;
}

.rj-doodle::after {
    content: '✨';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.8rem;
    animation: wiggle 2s infinite;
}

/* Message Bubble Animations */
.message-bubble {
    position: relative;
    overflow: hidden;
}

.message-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent);
    transform: translateX(-100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Status Indicator */
.status-online {
    position: relative;
}

.status-online::before {
    content: '';
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* Responsive Design Enhancements */
@media (max-width: 640px) {
    .message-content {
        font-size: 0.9rem;
    }
    
    #messages-container {
        padding: 1rem;
    }
    
    .quick-action {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .glass {
        background: rgba(0, 0, 0, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Special Effects for RJ Character */
.rj-special {
    background: linear-gradient(45deg, #ffd700, #ffb347);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

/* Particle Effect Container */
.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: float 3s infinite linear;
}

/* Login Screen Special Effects */
#login-screen {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* Success Animation */
@keyframes successPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.success-animation {
    animation: successPulse 0.6s ease-out;
}