<!DOCTYPE html>
<html>
<head>
  <link href="https://fonts.googleapis.com/css?family=Nunito+Sans:400,400i,700,900&display=swap" rel="stylesheet">
  <style>
    body {
      text-align: center;
      padding: 40px 0;
      background-color: #333;
    }
    h1 {
      color: #88B04B;
      font-family: "Nunito Sans", "Helvetica Neue", sans-serif;
      font-weight: 900;
      font-size: 40px;
      margin-bottom: 10px;
    }
    p {
      color: white;
      font-family: "Nunito Sans", "Helvetica Neue", sans-serif;
      font-size: 20px;
      margin: 0;
    }
    i {
      color: #9ABC66;
      font-size: 100px;
      line-height: 200px;
      margin-left: -15px;
    }
    .card {
      background: #333;
      padding: 60px;
      border-radius: 4px;
      box-shadow: 0 2px 3px #333;
      display: inline-block;
      margin: 0 auto;
    }
    #countdown {
      font-size: 24px;
      color: #9ABC66;
      margin-top: 10px;
    }
  </style>
</head>
<body>
  <div class="card">
    <div style="border-radius:200px; height:200px; width:200px; background: #F8FAF5; margin:0 auto;">
      <i class="checkmark">âœ“</i>
    </div>
    <h1>Success</h1>
    <p>We received your purchase request;<br/> we'll be in touch shortly!</p>
    
    <!-- Countdown timer element -->
    <div id="countdown">
      Redirecting in <span id="timer">5</span> seconds...
    </div>
  </div>

  <script>
    // Function to update the countdown timer
    function updateTimer(seconds) {
      const timerElement = document.getElementById('timer');
      timerElement.textContent = seconds;
    }

    // Function to start the countdown
    function startCountdown() {
      let seconds = 5; // Initial countdown time

      // Update the timer initially
      updateTimer(seconds);

      // Interval to update the timer
      const countdownInterval = setInterval(() => {
        seconds--;

        if (seconds >= 0) {
          updateTimer(seconds);
        } else {
          clearInterval(countdownInterval); // Stop the interval
          window.location.href = '/store-owner'; // Redirect after 5 seconds
        }
      }, 1000); // Update every 1 second
    }

    // Call the countdown function when the page loads
    window.onload = startCountdown;
  </script>
</body>
</html>
