/* ================================================
   SheraChat - Advanced Animations & Effects
   ================================================ */

/* ===== Entrance Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(0, 191, 165, 0.3);
    }
    50% {
        box-shadow: 0 4px 40px rgba(0, 191, 165, 0.6);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes typing {
    0% {
        width: 0;
    }
    100% {
        width: 100%;
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

/* ===== Animation Classes ===== */
.animate-fadeInUp {
    animation: fadeInUp 0.8s ease forwards;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.8s ease forwards;
}

.animate-fadeInRight {
    animation: fadeInRight 0.8s ease forwards;
}

.animate-fadeInScale {
    animation: fadeInScale 0.8s ease forwards;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

.animate-bounce {
    animation: bounce 2s ease-in-out infinite;
}

/* ===== Scroll Reveal ===== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* ===== Stagger Animation Delays ===== */
.delay-100 { transition-delay: 100ms !important; animation-delay: 100ms !important; }
.delay-200 { transition-delay: 200ms !important; animation-delay: 200ms !important; }
.delay-300 { transition-delay: 300ms !important; animation-delay: 300ms !important; }
.delay-400 { transition-delay: 400ms !important; animation-delay: 400ms !important; }
.delay-500 { transition-delay: 500ms !important; animation-delay: 500ms !important; }
.delay-600 { transition-delay: 600ms !important; animation-delay: 600ms !important; }
.delay-700 { transition-delay: 700ms !important; animation-delay: 700ms !important; }
.delay-800 { transition-delay: 800ms !important; animation-delay: 800ms !important; }

/* ===== Hover Effects ===== */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(0, 191, 165, 0.4);
}

.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* ===== Text Animations ===== */
.text-gradient-animate {
    background: linear-gradient(90deg, #00BFA5, #1DE9B6, #64FFDA, #1DE9B6, #00BFA5);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s linear infinite;
}

.text-typing {
    overflow: hidden;
    white-space: nowrap;
    animation: typing 3s steps(40, end);
}

.text-typing::after {
    content: '|';
    animation: blink 1s step-end infinite;
}

/* ===== Loading Animations ===== */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 191, 165, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}

.loading-dots {
    display: flex;
    gap: 8px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 0.6s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.1s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.2s;
}

/* ===== Particle Effects ===== */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 8s infinite;
}

@keyframes particleFloat {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0);
    }
    10% {
        opacity: 1;
        transform: translateY(-20px) scale(1);
    }
    90% {
        opacity: 1;
        transform: translateY(-200px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-220px) scale(0);
    }
}

/* ===== Chat Bubble Animation ===== */
.chat-bubble {
    animation: bubbleIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bubbleIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ===== Message Typing Indicator ===== */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--gray-400);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite both;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* ===== Morphing Background ===== */
.morph-bg {
    position: absolute;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation: morph 8s ease-in-out infinite;
}

@keyframes morph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

/* ===== Ripple Effect ===== */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
    opacity: 0;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
    opacity: 1;
}

/* ===== Performance: Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    .reveal,
    .reveal-left,
    .reveal-right,
    .reveal-scale {
        opacity: 1;
        transform: none;
        transition: none;
    }
    
    .animate-fadeInUp,
    .animate-fadeInLeft,
    .animate-fadeInRight,
    .animate-fadeInScale,
    .animate-pulse,
    .animate-glow,
    .animate-bounce {
        animation: none;
    }
    
    .text-gradient-animate,
    .loading-spinner,
    .morph-bg,
    .particle {
        animation: none;
    }
}
