/* Animations - All keyframe animations and transitions */

/* Keyframe animations */
@keyframes selectedPulse {
    0%, 100% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.6), 0 15px 40px rgba(34, 211, 238, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.8), 0 20px 50px rgba(34, 211, 238, 0.5);
    }
}

@keyframes checkmarkBounce {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(-90deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes iconFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes nameGlow {
    0%, 100% {
        text-shadow: 0 0 5px currentColor;
    }
    50% {
        text-shadow: 0 0 20px currentColor, 0 0 30px currentColor;
    }
}


@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes errorSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes logoGlow {
    0%, 100% {
        filter: drop-shadow(0 0 20px rgba(34, 211, 238, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 30px rgba(34, 211, 238, 0.8));
    }
}

@keyframes titlePulse {
    0%, 100% {
        text-shadow: 0 0 20px rgba(34, 211, 238, 0.7);
    }
    50% {
        text-shadow: 0 0 30px rgba(34, 211, 238, 1);
    }
}

@keyframes buttonPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(34, 211, 238, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(34, 211, 238, 0.5);
    }
}

/* Transition classes */
.transition-all {
    transition: all 0.3s ease;
}

.transition-colors {
    transition: background-color 0.3s ease, color 0.3s ease;
}

.transition-transform {
    transition: transform 0.3s ease;
}

.transition-opacity {
    transition: opacity 0.3s ease;
}

.mode-transition {
    transition: background-color 0.5s ease !important;
}

/* Smooth transitions for mode elements */
#modeText, #modeStatus {
    transition: color 0.3s ease, font-weight 0.3s ease;
}

.btn, .character-card, .input-field, .chat-message {
    transition: all 0.3s ease;
}

/* Day mode specific transitions and background */
body.day-mode {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%) !important;
    color: #1f2937 !important;
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* Night mode (default) - make it darker */
body:not(.day-mode):not(.palette-red):not(.palette-cyan) {
    background: linear-gradient(135deg, #000000 0%, #0f172a 50%, #1e293b 100%) !important;
    color: #22d3ee !important;
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* ========================================
   🎨 GROWTH PLAN 3-PALETTE SYSTEM
======================================== */

/* Palette 1: Black (Default Dark Mode) */
body.palette-black {
    background: linear-gradient(135deg, #000000 0%, #0f172a 50%, #1e293b 100%) !important;
    color: #22d3ee !important;
    transition: background-color 0.5s ease, color 0.5s ease;
}

body.palette-black .btn, 
body.palette-black .character-card {
    border-color: #22d3ee !important;
}

body.palette-black .character-card:hover {
    box-shadow: 0 10px 25px rgba(34, 211, 238, 0.3) !important;
}

/* Palette 2: Red Theme */
body.palette-red {
    background: linear-gradient(135deg, #1a0000 0%, #2d0a0a 50%, #4a1515 100%) !important;
    color: #dc2626 !important;
    transition: background-color 0.5s ease, color 0.5s ease;
}

body.palette-red .btn,
body.palette-red .character-card {
    border-color: #dc2626 !important;
    color: #dc2626 !important;
}

body.palette-red .character-card:hover {
    box-shadow: 0 10px 25px rgba(220, 38, 38, 0.3) !important;
}

body.palette-red .input-field {
    background: rgba(220, 38, 38, 0.1) !important;
    border-color: #dc2626 !important;
    color: #dc2626 !important;
}

body.palette-red .chat-message.user {
    background: rgba(220, 38, 38, 0.2) !important;
    border-color: #dc2626 !important;
}

body.palette-red .chat-message.ai {
    background: rgba(220, 38, 38, 0.1) !important;
    border-color: #dc2626 !important;
}

/* Palette 3: Cyan Theme */
body.palette-cyan {
    background: linear-gradient(135deg, #001a1a 0%, #0a2d2d 50%, #154a4a 100%) !important;
    color: #22d3ee !important;
    transition: background-color 0.5s ease, color 0.5s ease;
}

body.palette-cyan .btn,
body.palette-cyan .character-card {
    border-color: #22d3ee !important;
    color: #22d3ee !important;
}

body.palette-cyan .character-card:hover {
    box-shadow: 0 10px 25px rgba(34, 211, 238, 0.4) !important;
}

body.palette-cyan .input-field {
    background: rgba(34, 211, 238, 0.1) !important;
    border-color: #22d3ee !important;
    color: #22d3ee !important;
}

body.palette-cyan .chat-message.user {
    background: rgba(34, 211, 238, 0.2) !important;
    border-color: #22d3ee !important;
}

body.palette-cyan .chat-message.ai {
    background: rgba(34, 211, 238, 0.1) !important;
    border-color: #22d3ee !important;
}

/* ========================================
   🎭 PREMIUM ANIMATIONS - MAX PLAN ONLY
======================================== */

/* Character Portrait Breathing/Idle Animations */
@keyframes breathe {
    0%, 100% {
        transform: scale(1) translateY(0px);
    }
    50% {
        transform: scale(1.02) translateY(-2px);
    }
}

@keyframes gentleFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    33% {
        transform: translateY(-3px) rotate(0.5deg);
    }
    66% {
        transform: translateY(2px) rotate(-0.5deg);
    }
}

/* Premium Character Portrait Glow Effects */
@keyframes premiumGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(34, 211, 238, 0.4), 
                    0 0 40px rgba(255, 215, 0, 0.2),
                    inset 0 0 20px rgba(34, 211, 238, 0.1);
    }
    50% {
        box-shadow: 0 0 30px rgba(34, 211, 238, 0.6), 
                    0 0 60px rgba(255, 215, 0, 0.4),
                    inset 0 0 30px rgba(34, 211, 238, 0.2);
    }
}

/* Character Portrait Eye Movement */
@keyframes eyeMovement {
    0%, 100% { transform: translateX(0px); }
    25% { transform: translateX(2px); }
    75% { transform: translateX(-2px); }
}

/* Blinking Animation */
@keyframes blink {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
}


/* Character-Specific Magical Effects */
@keyframes cosmicParticles {
    0% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.7;
    }
    100% {
        transform: translateY(-40px) rotate(360deg);
        opacity: 0;
    }
}

@keyframes mysticalSparkles {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

@keyframes healingWaves {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.4;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes fireEnergy {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.1) rotate(5deg);
        opacity: 1;
    }
}

@keyframes gentleGlow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(34, 211, 238, 0.6);
    }
}

/* Galaxy text animation for gradient text effects */
@keyframes galaxyText {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Interactive Animations */
@keyframes nod {
    0%, 100% {
        transform: rotateX(0deg);
    }
    50% {
        transform: rotateX(10deg);
    }
}

@keyframes wave {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(15deg);
    }
    75% {
        transform: rotate(-15deg);
    }
}

@keyframes smile {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.05);
        filter: brightness(1.2);
    }
}

/* Voice Chat Lip Sync */
@keyframes talking {
    0%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(1.1);
    }
}

@keyframes lipSync {
    0%, 40%, 100% {
        transform: scaleY(1);
    }
    20%, 60% {
        transform: scaleY(1.15);
    }
}

/* Typing Indicator */
@keyframes typingPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

@keyframes thinkingDots {
    0%, 20% {
        color: rgba(34, 211, 238, 0.3);
        transform: scale(0.8);
    }
    50% {
        color: rgba(34, 211, 238, 1);
        transform: scale(1.2);
    }
    80%, 100% {
        color: rgba(34, 211, 238, 0.3);
        transform: scale(0.8);
    }
}

/* Spin Animation for Mystical Elements */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Enhanced Pulse */
@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(0.95);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* Character Hover Effects */
@keyframes characterHover {
    0%, 100% {
        transform: translateY(0px) scale(1);
    }
    50% {
        transform: translateY(-5px) scale(1.02);
    }
}

/* Magic Particle System */
@keyframes particleFloat {
    0% {
        transform: translateY(0px) translateX(0px) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-50px) translateX(20px) rotate(360deg);
        opacity: 0;
    }
}

/* ========================================
   🌟 PREMIUM ANIMATION CLASSES
======================================== */

/* Premium Character Portrait Container */
.premium-character-portrait {
    position: relative;
    animation: breathe 4s ease-in-out infinite, premiumGlow 3s ease-in-out infinite;
    border-radius: 50%;
    overflow: hidden;
}

.premium-character-portrait::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        rgba(34, 211, 238, 0.3),
        rgba(255, 215, 0, 0.3),
        rgba(168, 85, 247, 0.3),
        rgba(34, 211, 238, 0.3)
    );
    animation: spin 8s linear infinite;
    z-index: -1;
}

/* Premium Particle Effects */
.premium-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.premium-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.8), transparent);
    border-radius: 50%;
    animation: particleFloat 3s ease-in-out infinite;
}

.premium-particle:nth-child(2) {
    animation-delay: 0.5s;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.8), transparent);
}

.premium-particle:nth-child(3) {
    animation-delay: 1s;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.8), transparent);
}

.premium-particle:nth-child(4) {
    animation-delay: 1.5s;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.8), transparent);
}

.premium-particle:nth-child(5) {
    animation-delay: 2s;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.8), transparent);
}

/* Premium Text Effects */
.premium-text-glow {
    background: linear-gradient(45deg, #22d3ee, #ffd700, #a855f7, #22d3ee);
    background-size: 200% 200%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: galaxyText 4s ease-in-out infinite;
}

/* Premium Button Animations */
.premium-button {
    position: relative;
    overflow: hidden;
    animation: buttonPulse 2s ease-in-out infinite;
}

.premium-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

/* Premium Typing Indicator */
.premium-typing {
    display: flex;
    gap: 4px;
    align-items: center;
}

.premium-typing-dot {
    width: 8px;
    height: 8px;
    background: linear-gradient(45deg, #22d3ee, #ffd700);
    border-radius: 50%;
    animation: typingPulse 1.5s ease-in-out infinite;
}

.premium-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.premium-typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* Premium Voice Wave Visualization */
.premium-voice-wave {
    display: flex;
    gap: 2px;
    align-items: center;
    height: 20px;
}

.premium-wave-bar {
    width: 3px;
    background: linear-gradient(to top, #22d3ee, #ffd700);
    border-radius: 2px;
    animation: talking 0.8s ease-in-out infinite;
}

.premium-wave-bar:nth-child(2) { animation-delay: 0.1s; }
.premium-wave-bar:nth-child(3) { animation-delay: 0.2s; }
.premium-wave-bar:nth-child(4) { animation-delay: 0.3s; }
.premium-wave-bar:nth-child(5) { animation-delay: 0.4s; }

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .character-card::before,
    .btn::before,
    .premium-character-portrait::before,
    .premium-button::before {
        display: none !important;
    }
    
    .premium-particles {
        display: none !important;
    }
}
