<?php include('auth_guard.php'); ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>QR Code Generator | Hamna Shahzadi</title>
    <!-- QRCode.js Library -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
    <style>
        body { background: #1a1a1a; color: white; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; text-align: center; padding: 50px; }
        .container { background: #262626; padding: 30px; border-radius: 15px; display: inline-block; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
        input { padding: 12px; width: 300px; border-radius: 5px; border: 1px solid #444; background: #333; color: white; margin-bottom: 20px; }
        button { padding: 12px 25px; background: #0056b3; color: white; border: none; cursor: pointer; border-radius: 5px; font-weight: bold; transition: 0.3s; }
        button:hover { background: #007bff; }
        #qrcode { background: white; padding: 15px; margin-top: 25px; display: none; border-radius: 10px; }
    </style>
</head>
<body>

    <div class="container">
        <h2>QR Code Generator</h2>
        <p>Enter any Text or URL below:</p>
        
        <input type="text" id="userInput" placeholder="https://hamnashahzadi.online or Name">
        <br>
        <button onclick="generateQR()">Generate QR Code</button>

        <br>
        <div id="qrcode"></div>
    </div>

    <script>
        // QR Code object ko initialize karna
        var qrcode = new QRCode(document.getElementById("qrcode"), {
            width: 200,
            height: 200
        });

        function generateQR() {
            let val = document.getElementById("userInput").value;
            if(val) {
                document.getElementById("qrcode").style.display = "inline-block";
                qrcode.clear(); // Purana QR saaf karna
                qrcode.makeCode(val); // Naya QR banana (URL ho ya Text)
            } else {
                alert("Kuch to likho! (Enter some text or URL)");
            }
        }
    </script>
</body>
</html>