<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Corqz Converter</title>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <style>
        body {
            font-family: Arial, sans-serif;
            background: linear-gradient(135deg, #1a1a2e, #16213e);
            color: white;
            text-align: center;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            flex-direction: column;
            position: relative;
            overflow: hidden;
        }
        .crypto-bg {
            position: absolute;
            width: 100%;
            height: 100%;
            overflow: hidden;
            z-index: -1;
        }
        .crypto-bg img {
            position: absolute;
            width: 30px;
            height: 30px;
            opacity: 0.2;
            animation: float 15s infinite alternate ease-in-out;
        }
        @keyframes float {
            0% { transform: translateY(0px) translateX(0px) rotate(0deg); }
            50% { transform: translateY(-50px) translateX(50px) rotate(180deg); }
            100% { transform: translateY(0px) translateX(0px) rotate(360deg); }
        }
        h1 {
            font-size: 3rem;
            text-shadow: 0 0 10px cyan;
            animation: glow 1.5s infinite alternate;
        }
        @keyframes glow {
            from { text-shadow: 0 0 10px cyan; }
            to { text-shadow: 0 0 20px white; }
        }
        .crypto-buttons {
            display: flex;
            gap: 15px;
            margin: 20px 0;
        }
        .crypto-buttons button {
            background: linear-gradient(90deg, #ff7eb3, #ff758c);
            color: white;
            border: none;
            padding: 12px 20px;
            border-radius: 8px;
            font-size: 1rem;
            cursor: pointer;
            transition: transform 0.3s, box-shadow 0.3s;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .crypto-buttons button img {
            width: 24px;
            height: 24px;
        }
        .crypto-buttons button:hover {
            transform: scale(1.1);
            box-shadow: 0 0 15px #ff758c;
        }
        .custom-modal {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) scale(0.9);
            background: #202040;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 0 15px cyan;
            text-align: center;
            animation: modalShow 0.3s ease-in-out forwards;
        }
        @keyframes modalShow {
            from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
            to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
        }
        .custom-modal input {
            margin: 10px;
            padding: 10px;
            border-radius: 5px;
            border: none;
            font-size: 1rem;
            background: #2a2a50;
            color: white;
        }
        .custom-modal button {
            background: cyan;
            border: none;
            padding: 10px 15px;
            cursor: pointer;
            border-radius: 5px;
        }
        .result {
            margin-top: 20px;
            font-size: 1.5rem;
            font-weight: bold;
            color: cyan;
        }
    </style>
</head>
<body>
    <div class="crypto-bg"></div>
    <h1>Corqz Converter</h1>
    <p>Welcome to Corqz Converter! Select a cryptocurrency below to convert it to USD.</p>
    <div class="crypto-buttons">
        <button onclick="openModal('solana')"><img src="https://cryptologos.cc/logos/solana-sol-logo.svg">Solana</button>
        <button onclick="openModal('litecoin')"><img src="https://cryptologos.cc/logos/litecoin-ltc-logo.svg">Litecoin</button>
        <button onclick="openModal('ethereum')"><img src="https://cryptologos.cc/logos/ethereum-eth-logo.svg">Ethereum</button>
        <button onclick="openModal('bitcoin')"><img src="https://cryptologos.cc/logos/bitcoin-btc-logo.svg">Bitcoin</button>
        <button onclick="openModal('dogecoin')"><img src="https://cryptologos.cc/logos/dogecoin-doge-logo.svg">Dogecoin</button>
    </div>
    <div class="custom-modal" id="modal">
        <p>Enter amount:</p>
        <input type="number" id="modal-amount" placeholder="Enter amount" min="0" step="0.01">
        <button onclick="convertCurrency()">Convert</button>
    </div>
    <div class="result" id="result"></div>
    <script>
        const cryptoIcons = [
            "https://cryptologos.cc/logos/bitcoin-btc-logo.svg",
            "https://cryptologos.cc/logos/ethereum-eth-logo.svg",
            "https://cryptologos.cc/logos/solana-sol-logo.svg",
            "https://cryptologos.cc/logos/litecoin-ltc-logo.svg",
            "https://cryptologos.cc/logos/dogecoin-doge-logo.svg"
        ];
        for (let i = 0; i < 50; i++) {
            let img = document.createElement("img");
            img.src = cryptoIcons[Math.floor(Math.random() * cryptoIcons.length)];
            img.style.top = Math.random() * 100 + "%";
            img.style.left = Math.random() * 100 + "%";
            document.querySelector(".crypto-bg").appendChild(img);
        }
        
        let selectedCrypto = "";
        function openModal(crypto) {
            selectedCrypto = crypto;
            document.getElementById("modal").style.display = "block";
        }
        
        function convertCurrency() {
            const amount = document.getElementById("modal-amount").value;
            if (!amount || amount <= 0) {
                document.getElementById("result").innerText = "Please enter a valid amount.";
                return;
            }
            axios.get(`https://api.coingecko.com/api/v3/simple/price?ids=${selectedCrypto}&vs_currencies=usd`)
                .then(response => {
                    const rate = response.data[selectedCrypto].usd;
                    const converted = (amount * rate).toFixed(2);
                    document.getElementById("result").innerText = `${amount} ${selectedCrypto.toUpperCase()} = $${converted} USD`;
                    document.getElementById("modal").style.display = "none";
                })
                .catch(error => {
                    document.getElementById("result").innerText = "Error fetching conversion rate.";
                });
        }
    </script>
</body>
</html>
