<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>XPA25 Registration</title>
    <style>
        /* General Reset */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Arial', sans-serif;
        }

        body {
            background-color: #121212;
            color: #eaeaea;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            min-height: 100vh;
            padding: 20px;
            overflow-y: auto;
        }

        .container {
            background: linear-gradient(145deg, #1e1e1e, #2c2c2c);
            border-radius: 15px;
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.6);
            width: 100%;
            max-width: 600px;
            padding: 40px;
            animation: fadeIn 0.8s ease-in-out;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: scale(0.95);
            }
            to {
                opacity: 1;
                transform: scale(1);
            }
        }

        h1 {
            text-align: center;
            margin-bottom: 20px;
            font-size: 32px;
            color: #ffffff;
        }

        p {
            text-align: center;
            font-size: 15px;
            margin-bottom: 30px;
            color: #a9a9a9;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: bold;
            color: #c1c1c1;
        }

        .form-group input,
        .form-group textarea {
            width: 100%;
            padding: 12px;
            border: none;
            border-radius: 8px;
            background-color: #2f2f2f;
            color: #eaeaea;
            font-size: 14px;
            outline: none;
            transition: background-color 0.3s, box-shadow 0.3s;
        }

        .form-group input:focus,
        .form-group textarea:focus {
            background-color: #3a3a3a;
            box-shadow: 0 0 5px rgba(0, 255, 127, 0.5);
        }

        .form-group textarea {
            resize: none;
            height: 120px;
        }

        .form-group button {
            display: block;
            width: 100%;
            background: linear-gradient(145deg, #5efc82, #4caf50);
            color: #ffffff;
            font-size: 16px;
            padding: 12px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.3s ease, transform 0.3s ease;
            font-weight: bold;
        }

        .form-group button:hover {
            background: linear-gradient(145deg, #4caf50, #5efc82);
            transform: translateY(-2px);
        }

        .form-group button:active {
            transform: translateY(0);
        }

        .error-message {
            color: #ff6b6b;
            font-size: 13px;
            margin-top: -10px;
            margin-bottom: 10px;
            display: none;
        }

        .thank-you-message {
            display: none;
            text-align: center;
            color: #5efc82;
            font-size: 18px;
            font-weight: bold;
            margin-top: 20px;
        }

        .form-divider {
            height: 1px;
            background-color: #3a3a3a;
            margin: 30px 0;
        }

        .footer {
            text-align: center;
            font-size: 12px;
            color: #555;
            margin-top: 20px;
        }
    </style>
</head>
<body>

<div class="container">
    <h1>🎄 XPA25 Registration</h1>
    <p>Sign up now and showcase your creativity at the XPA Christmas Expo!</p>
    <form id="xpaForm">
        <!-- Roblox Username -->
        <div class="form-group">
            <label for="robloxUsername">Roblox Username</label>
            <input type="text" id="robloxUsername" placeholder="Enter your Roblox username" required>
        </div>

        <!-- Discord Username -->
        <div class="form-group">
            <label for="discordUsername">Discord Username (with ID)</label>
            <input type="text" id="discordUsername" placeholder="Example: JohnDoe#1234" required>
        </div>

        <!-- Company Name -->
        <div class="form-group">
            <label for="companyName">Company Name</label>
            <input type="text" id="companyName" placeholder="Enter your company name" required>
        </div>

        <div class="form-divider"></div>

        <!-- Booth Description -->
        <div class="form-group">
            <label for="description">Booth Description</label>
            <textarea id="description" placeholder="Describe your booth or topic" required></textarea>
        </div>

        <!-- Merch Items -->
        <div class="form-group">
            <label for="merchItems">Merch Items (Optional)</label>
            <input type="text" id="merchItems" placeholder="List up to 3 shirt designs (if applicable)">
        </div>

        <div class="form-divider"></div>

        <!-- Submit Button -->
        <div class="form-group">
            <button type="submit">Submit Registration</button>
        </div>

        <!-- Error Message -->
        <div class="error-message" id="errorMessage">Please fill in all required fields.</div>
    </form>
    <div class="thank-you-message" id="thankYouMessage">
        🎉 Thank you for registering! Your submission has been received.
    </div>

    <div class="footer">
        Powered by XPA Christmas Expo 2025 | Design by Aurora Technology
    </div>
</div>

<script>
    const webhookUrl = "https://discord.com/api/webhooks/1315400936902099064/SV5eX1wd4d9PUOgZqJadEbhEoz1KaoEjsM1_9jgQTelXZZoCU-89SvHfFYsg9zJ_hpG1"; // Replace with your Discord webhook URL
    let formSubmitted = false;

    document.getElementById('xpaForm').addEventListener('submit', async (e) => {
        e.preventDefault();

        if (formSubmitted) return; // Prevent multiple submissions

        const robloxUsername = document.getElementById('robloxUsername').value.trim();
        const discordUsername = document.getElementById('discordUsername').value.trim();
        const companyName = document.getElementById('companyName').value.trim();
        const description = document.getElementById('description').value.trim();
        const merchItems = document.getElementById('merchItems').value.trim();
        const errorMessage = document.getElementById('errorMessage');
        const thankYouMessage = document.getElementById('thankYouMessage');

        if (!robloxUsername || !discordUsername || !companyName || !description) {
            errorMessage.textContent = "Please fill in all required fields.";
            errorMessage.style.display = "block";
            return;
        }

        errorMessage.style.display = "none";

        const payload = {
            embeds: [
                {
                    title: "🎄 XPA25 Registration",
                    color: 3066993,
                    fields: [
                        { name: "Roblox Username", value: robloxUsername, inline: true },
                        { name: "Discord Username", value: discordUsername, inline: true },
                        { name: "Company Name", value: companyName, inline: true },
                        { name: "Booth Description", value: description, inline: false },
                        { name: "Merch Items", value: merchItems || "None", inline: false }
                    ],
                    footer: {
                        text: "XPA Christmas Expo Registration",
                        icon_url: "https://i.imgur.com/x6tto6A.png"
                    },
                    timestamp: new Date().toISOString()
                }
            ]
        };

        try {
            const response = await fetch(webhookUrl, {
                method: "POST",
                headers: {
                    "Content-Type": "application/json"
                },
                body: JSON.stringify(payload)
            });

            if (response.ok) {
                formSubmitted = true;
                document.getElementById('xpaForm').style.display = "none";
                thankYouMessage.style.display = "block";
            } else {
                throw new Error("Failed to send data to Discord webhook");
            }
        } catch (error) {
            console.error("Error:", error);
            errorMessage.textContent = "Error: Could not submit the form. Please try again later.";
            errorMessage.style.display = "block";
        }
    });
</script>

</body>
</html>