<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>Cius AI Chat History</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    
        :root {
            --primary-color: #6e48aa;
            --secondary-color: #9d50bb;
            --accent-color: #4776E6;
            --text-color: #f8f9fa;
            --bg-dark: #121212;
            --bg-darker: #0a0a0a;
            --user-bubble: #6e48aa;
            --ai-bubble: #333344;
            --bubble-pointer: 12px;
            --transition-speed: 0.3s;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
        }

        body {
            background: var(--bg-dark);
            color: var(--text-color);
            overflow-x: hidden;
            height: 100vh;
            position: relative;
            touch-action: manipulation;
        }

        #particles-js {
            position: fixed;
            width: 100%;
            height: 100%;
            z-index: -1;
            background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
        }

        .floating-icons {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
            z-index: -1;
            pointer-events: none;
        }

        .floating-icon {
            position: absolute;
            opacity: 0.1;
            animation: float linear infinite;
        }

        .chat-container {
            display: flex;
            flex-direction: column;
            height: 100vh;
            width: 100%;
            overflow: hidden;
        }

        .chat-header {
            padding: 15px 20px;
            background: rgba(20, 20, 20, 0.8);
            backdrop-filter: blur(10px);
            display: flex;
            align-items: center;
            justify-content: center;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            z-index: 10;
        }

        .chat-header .logo {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .chat-header .logo i {
            font-size: 24px;
            color: var(--secondary-color);
            animation: pulse 2s infinite;
        }

        .chat-header .logo h1 {
            font-size: 20px;
            font-weight: 700;
            background: linear-gradient(to right, var(--secondary-color), var(--accent-color));
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }

        .chat-messages {
            flex: 1;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            padding: 20px 15px 80px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 20px;
        }

        .message {
            max-width: 85%;
            min-width: 60%;
            padding: 15px 20px;
            border-radius: 20px;
            line-height: 1.5;
            position: relative;
            animation: fadeIn 0.4s ease-out;
            word-wrap: break-word;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        }

        .user-message {
            background: var(--user-bubble);
            color: white;
            align-self: flex-end;
            margin-right: 30px;
        }

        .user-message::after {
            content: '';
            position: absolute;
            right: -var(--bubble-pointer);
            top: 50%;
            transform: translateY(-50%);
            width: 0;
            height: 0;
            border-top: var(--bubble-pointer) solid transparent;
            border-bottom: var(--bubble-pointer) solid transparent;
            border-left: var(--bubble-pointer) solid var(--user-bubble);
        }

        .ai-message {
            background: var(--ai-bubble);
            align-self: flex-start;
            margin-left: 30px;
        }

        .ai-message::before {
            content: '';
            position: absolute;
            left: -var(--bubble-pointer);
            top: 50%;
            transform: translateY(-50%);
            width: 0;
            height: 0;
            border-top: var(--bubble-pointer) solid transparent;
            border-bottom: var(--bubble-pointer) solid transparent;
            border-right: var(--bubble-pointer) solid var(--ai-bubble);
        }

        .message-content {
            font-size: 16px;
        }

        .message-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 10px;
            font-size: 12px;
            opacity: 0.8;
        }

        .message-role {
            font-weight: 600;
        }

        .message-role i {
            margin-right: 5px;
        }

        .message-time {
            font-style: italic;
        }

        .scroll-to-bottom {
            position: fixed;
            bottom: 70px;
            left: 50%;
            transform: translateX(-50%);
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: rgba(110, 72, 170, 0.8);
            backdrop-filter: blur(5px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all var(--transition-speed);
            opacity: 0;
            visibility: hidden;
            z-index: 20;
        }

        .scroll-to-bottom.visible {
            opacity: 1;
            visibility: visible;
        }

        .scroll-to-bottom:hover {
            background: rgba(110, 72, 170, 1);
            transform: translateX(-50%) scale(1.1);
        }

        .scroll-to-bottom i {
            font-size: 20px;
            color: white;
        }

        /* Animations */
        @keyframes float {
            0% { transform: translateY(0) rotate(0deg); }
            100% { transform: translateY(-100vh) rotate(360deg); }
        }

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

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

        /* Responsive adjustments */
        @media (max-width: 480px) {
            .message {
                max-width: 90%;
                min-width: 70%;
            }
            
            .user-message {
                margin-right: 20px;
            }
            
            .ai-message {
                margin-left: 20px;
            }
        }
    
</head>
<body>
    <div id="particles-js"></div>
    
    <div class="floating-icons">
        <i class="floating-icon fas fa-comment" style="top: 10%; left: 5%; font-size: 24px; animation-duration: 25s;"></i>
        <i class="floating-icon fas fa-brain" style="top: 20%; left: 80%; font-size: 30px; animation-duration: 30s;"></i>
        <i class="floating-icon fas fa-robot" style="top: 50%; left: 15%; font-size: 28px; animation-duration: 20s;"></i>
        <i class="floating-icon fas fa-microphone" style="top: 70%; left: 75%; font-size: 22px; animation-duration: 22s;"></i>
    </div>

    <div class="chat-container">
        <div class="chat-header">
            <div class="logo">
                <i class="fas fa-robot"></i>
                <h1>Cius AI Chat History</h1>
            </div>
        </div>

        <div class="chat-messages" id="chatMessages">
            <!-- Messages will be loaded here from JSON -->
        </div>

        <button class="scroll-to-bottom" id="scrollToBottom">
            <i class="fas fa-arrow-down"></i>
        </button>
    </div>

    <script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
    <script>
        // Sample chat history data
        const chatHistory = [
            {
                "role": "user",
                "message": "Salut Cius AI, comment ça va ?",
                "timestamp": "2025-05-13T20:50:27.214Z"
            },
            {
                "role": "Cius AI",
                "message": "Bonjour ! 😊 Je vais très bien, merci de demander. Et vous, comment allez-vous aujourd'hui ?",
                "timestamp": "2025-05-13T20:50:29.120Z"
            },
            {
                "role": "user",
                "message": "Je vais bien aussi, merci ! Peux-tu m'expliquer comment fonctionne ton système ?",
                "timestamp": "2025-05-13T20:51:15.876Z"
            },
            {
                "role": "Cius AI",
                "message": "Bien sûr ! Je suis une IA conversationnelle basée sur un modèle de langage avancé. Je peux comprendre et générer du texte dans plusieurs langues, répondre à des questions, aider avec diverses tâches, et même discuter de sujets complexes. Mon savoir est vaste, mais j'ai mes limites - je ne suis pas parfaite !",
                "timestamp": "2025-05-13T20:51:18.542Z"
            },
            {
                "role": "user",
                "message": "Impressionnant ! Et quelles langues parles-tu ?",
                "timestamp": "2025-05-13T20:52:03.214Z"
            },
            {
                "role": "Cius AI",
                "message": "Je parle couramment plusieurs langues dont l'anglais, le français, le coréen, l'espagnol, l'allemand et bien d'autres ! Je peux aussi aider avec des traductions si besoin. Quelle langue souhaitez-vous utiliser ? 🌍",
                "timestamp": "2025-05-13T20:52:05.876Z"
            }
        ];

        // DOM elements
        const chatMessages = document.getElementById('chatMessages');
        const scrollToBottomBtn = document.getElementById('scrollToBottom');

        // Load chat history
        function loadChatHistory() {
            chatHistory.forEach(message => {
                addMessageToChat(message);
            });
            
            // Scroll to bottom initially
            setTimeout(() => {
                scrollToBottom();
            }, 100);
        }

        // Add message to chat UI
        function addMessageToChat(msg) {
            const messageDiv = document.createElement('div');
            messageDiv.className = `message ${msg.role === 'user' ? 'user-message' : 'ai-message'}`;
            
            const messageContent = document.createElement('div');
            messageContent.className = 'message-content';
            messageContent.textContent = msg.message;
            messageDiv.appendChild(messageContent);
            
            const messageMeta = document.createElement('div');
            messageMeta.className = 'message-meta';
            
            const messageRole = document.createElement('div');
            messageRole.className = 'message-role';
            if (msg.role === 'user') {
                messageRole.innerHTML = '<i class="fas fa-user"></i> You';
            } else {
                messageRole.innerHTML = '<i class="fas fa-robot"></i> Cius AI';
            }
            messageMeta.appendChild(messageRole);
            
            const messageTime = document.createElement('div');
            messageTime.className = 'message-time';
            messageTime.textContent = formatDate(msg.timestamp);
            messageMeta.appendChild(messageTime);
            
            messageDiv.appendChild(messageMeta);
            chatMessages.appendChild(messageDiv);
        }

        // Format timestamp to readable time
        function formatDate(isoString) {
            const date = new Date(isoString);
            return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
        }

        // Scroll to bottom of chat
        function scrollToBottom() {
            chatMessages.scrollTop = chatMessages.scrollHeight;
        }

        // Show/hide scroll to bottom button based on scroll position
        chatMessages.addEventListener('scroll', function() {
            const scrollThreshold = 100;
            const isNearBottom = chatMessages.scrollHeight - chatMessages.scrollTop - chatMessages.clientHeight < scrollThreshold;
            
            if (isNearBottom) {
                scrollToBottomBtn.classList.remove('visible');
            } else {
                scrollToBottomBtn.classList.add('visible');
            }
        });

        // Scroll to bottom button click handler
        scrollToBottomBtn.addEventListener('click', scrollToBottom);

        // Particles.js initialization
        particlesJS("particles-js", {
            "particles": {
                "number": {
                    "value": 60,
                    "density": {
                        "enable": true,
                        "value_area": 800
                    }
                },
                "color": {
                    "value": "#9d50bb"
                },
                "shape": {
                    "type": "circle",
                    "stroke": {
                        "width": 0,
                        "color": "#000000"
                    }
                },
                "opacity": {
                    "value": 0.5,
                    "random": false,
                    "anim": {
                        "enable": false,
                        "speed": 1,
                        "opacity_min": 0.1,
                        "sync": false
                    }
                },
                "size": {
                    "value": 3,
                    "random": true,
                    "anim": {
                        "enable": false,
                        "speed": 40,
                        "size_min": 0.1,
                        "sync": false
                    }
                },
                "line_linked": {
                    "enable": true,
                    "distance": 150,
                    "color": "#6e48aa",
                    "opacity": 0.4,
                    "width": 1
                },
                "move": {
                    "enable": true,
                    "speed": 2,
                    "direction": "none",
                    "random": false,
                    "straight": false,
                    "out_mode": "out",
                    "bounce": false,
                    "attract": {
                        "enable": false,
                        "rotateX": 600,
                        "rotateY": 1200
                    }
                }
            },
            "interactivity": {
                "detect_on": "canvas",
                "events": {
                    "onhover": {
                        "enable": true,
                        "mode": "grab"
                    },
                    "onclick": {
                        "enable": true,
                        "mode": "push"
                    },
                    "resize": true
                },
                "modes": {
                    "grab": {
                        "distance": 140,
                        "line_linked": {
                            "opacity": 1
                        }
                    },
                    "bubble": {
                        "distance": 400,
                        "size": 40,
                        "duration": 2,
                        "opacity": 8,
                        "speed": 3
                    },
                    "repulse": {
                        "distance": 200,
                        "duration": 0.4
                    },
                    "push": {
                        "particles_nb": 4
                    },
                    "remove": {
                        "particles_nb": 2
                    }
                }
            },
            "retina_detect": true
        });

        // Load chat history when page loads
        window.addEventListener('DOMContentLoaded', loadChatHistory);
    </script>
</body>
</html>