<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Paragraph Converter</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        }

        body {
            min-height: 100vh;
            background: #0f172a;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
            color: #e2e8f0;
        }

        .container {
            width: 100%;
            max-width: 900px;
            background: rgba(30, 41, 59, 0.7);
            backdrop-filter: blur(10px);
            border-radius: 24px;
            padding: 2.5rem;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
            position: relative;
            overflow: hidden;
        }

        .container::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 2px;
            background: linear-gradient(90deg, #60a5fa, #a855f7, #ec4899);
            animation: gradientBorder 3s linear infinite;
        }

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

        h1 {
            color: #f8fafc;
            margin-bottom: 2rem;
            font-size: 2.5rem;
            font-weight: 700;
            text-align: center;
            background: linear-gradient(135deg, #60a5fa, #a855f7);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            animation: titleGlow 2s ease-in-out infinite alternate;
        }

        @keyframes titleGlow {
            0% { filter: drop-shadow(0 0 2px rgba(96, 165, 250, 0.3)); }
            100% { filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.5)); }
        }

        .input-section, .output-section {
            margin-bottom: 2rem;
            position: relative;
        }

        label {
            display: block;
            margin-bottom: 1rem;
            color: #94a3b8;
            font-weight: 500;
            font-size: 0.9rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        textarea {
            width: 100%;
            min-height: 200px;
            padding: 1.25rem;
            background: rgba(15, 23, 42, 0.6);
            border: 2px solid rgba(148, 163, 184, 0.1);
            border-radius: 16px;
            resize: vertical;
            font-size: 1rem;
            line-height: 1.6;
            color: #e2e8f0;
            transition: all 0.3s ease;
        }

        textarea:focus {
            outline: none;
            border-color: #60a5fa;
            box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.1);
        }

        button {
            width: 100%;
            padding: 1.25rem;
            background: linear-gradient(135deg, #60a5fa, #a855f7);
            color: white;
            border: none;
            border-radius: 16px;
            font-size: 1.1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        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);
            transition: 0.5s;
        }

        button:hover::before {
            left: 100%;
        }

        button:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 30px rgba(96, 165, 250, 0.3);
        }

        .output-section {
            opacity: 0;
            transform: translateY(20px);
            transition: all 0.5s ease;
            display: none;
        }

        .output-section.visible {
            opacity: 1;
            transform: translateY(0);
            display: block;
        }

        .output-box {
            width: 100%;
            min-height: 100px;
            padding: 1.25rem;
            background: rgba(15, 23, 42, 0.6);
            border-radius: 16px;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            border: 2px solid rgba(148, 163, 184, 0.1);
            color: #e2e8f0;
            line-height: 1.6;
        }

        .output-box:hover {
            background: rgba(30, 41, 59, 0.8);
            border-color: #60a5fa;
        }

        .output-box::after {
            content: 'Click to Copy';
            position: absolute;
            top: 0.5rem;
            right: 0.5rem;
            font-size: 0.8rem;
            color: #94a3b8;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .output-box:hover::after {
            opacity: 1;
        }

        .copy-tooltip {
            position: fixed;
            background: #60a5fa;
            color: white;
            padding: 0.75rem 1.5rem;
            border-radius: 12px;
            font-size: 0.9rem;
            pointer-events: none;
            opacity: 0;
            transition: all 0.3s ease;
            box-shadow: 0 10px 25px rgba(96, 165, 250, 0.2);
            transform: translateY(10px);
        }

        .copy-tooltip.visible {
            opacity: 1;
            transform: translateY(0);
        }

        .background-shapes {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            overflow: hidden;
        }

        .shape {
            position: absolute;
            border-radius: 50%;
            background: linear-gradient(135deg, #60a5fa20, #a855f720);
            animation: floatingShape 20s infinite linear;
        }

        .shape:nth-child(1) {
            width: 400px;
            height: 400px;
            top: -100px;
            left: -100px;
            animation-delay: -5s;
        }

        .shape:nth-child(2) {
            width: 300px;
            height: 300px;
            bottom: -50px;
            right: -50px;
            animation-delay: -10s;
        }

        @keyframes floatingShape {
            0% {
                transform: rotate(0deg) translate(50px) rotate(0deg);
            }
            100% {
                transform: rotate(360deg) translate(50px) rotate(-360deg);
            }
        }

        @media (max-width: 768px) {
            .container {
                padding: 1.5rem;
            }

            h1 {
                font-size: 2rem;
            }

            textarea {
                min-height: 150px;
            }
        }

        /* Loading animation */
        .loading {
            display: none;
            justify-content: center;
            align-items: center;
            gap: 8px;
            margin: 1rem 0;
        }

        .loading.visible {
            display: flex;
        }

        .loading span {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #60a5fa;
            animation: loadingDots 1.4s infinite ease-in-out both;
        }

        .loading span:nth-child(1) { animation-delay: -0.32s; }
        .loading span:nth-child(2) { animation-delay: -0.16s; }

        @keyframes loadingDots {
            0%, 80%, 100% { transform: scale(0); }
            40% { transform: scale(1); }
        }
    </style>
</head>
<body>
    <div class="background-shapes">
        <div class="shape"></div>
        <div class="shape"></div>
    </div>

    <div class="container">
        <h1>Paragraph Converter</h1>
        
        <div class="input-section">
            <label for="input-text">Input Text</label>
            <textarea id="input-text" placeholder="Paste your paragraphs here..."></textarea>
        </div>

        <button id="convert-btn">Convert to Single Paragraph</button>

        <div class="loading" id="loading">
            <span></span>
            <span></span>
            <span></span>
        </div>

        <div class="output-section" id="output-section">
            <label>Converted Text</label>
            <div class="output-box" id="output-text"></div>
        </div>
    </div>

    <div class="copy-tooltip" id="tooltip">Copied to clipboard! 📋</div>

    <script>
        const inputText = document.getElementById('input-text');
        const convertBtn = document.getElementById('convert-btn');
        const outputText = document.getElementById('output-text');
        const outputSection = document.getElementById('output-section');
        const tooltip = document.getElementById('tooltip');
        const loading = document.getElementById('loading');

        convertBtn.addEventListener('click', () => {
            if (!inputText.value.trim()) return;

            // Show loading animation
            loading.classList.add('visible');
            outputSection.classList.remove('visible');

            // Simulate processing time for better UX
            setTimeout(() => {
                const text = inputText.value
                    .trim()
                    .replace(/[\r\n]+/g, ' ')
                    .replace(/\s+/g, ' ');
                
                outputText.textContent = text;
                loading.classList.remove('visible');
                outputSection.classList.add('visible');
            }, 800);
        });

        outputText.addEventListener('click', async () => {
            try {
                await navigator.clipboard.writeText(outputText.textContent);
                
                // Show tooltip
                const rect = outputText.getBoundingClientRect();
                tooltip.style.left = `${rect.left + rect.width/2 - tooltip.offsetWidth/2}px`;
                tooltip.style.top = `${rect.top - tooltip.offsetHeight - 10}px`;
                tooltip.classList.add('visible');
                
                // Hide tooltip after 2 seconds
                setTimeout(() => {
                    tooltip.classList.remove('visible');
                }, 2000);
            } catch (err) {
                console.error('Failed to copy text:', err);
            }
        });

        // Responsive textarea height
        inputText.addEventListener('input', function() {
            this.style.height = 'auto';
            this.style.height = (this.scrollHeight) + 'px';
        });
    </script>
</body>
</html>