<?php
/*
 * Template Name: Gaming Offer Landing Page
 */
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
  <meta charset="<?php bloginfo( 'charset' ); ?>">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <title><?php wp_title('|', true, 'right'); bloginfo('name'); ?></title>
  <style>
    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    }

    html, body {
      width: 100%;
      height: 100%;
      overflow: hidden;
      background-color: #f0f4f8;
    }

    .data-landing-wrapper {
      background-color: #f0f4f8;
      padding: 8px 12px;
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100vw;
      height: 100vh;
      overflow: hidden;
    }

    .data-card-container {
      background: #ffffff;
      width: 100%;
      max-width: 390px;
      padding: 18px 16px;
      border-radius: 18px;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
      text-align: center;
    }

    .alert-ticker {
      background-color: #eafaf1;
      border: 1px solid #d4f3e2;
      color: #1a1a1a;
      padding: 7px 12px;
      border-radius: 30px;
      font-size: 12px;
      font-weight: 600;
      margin-bottom: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      width: 100%;
      transition: opacity 0.3s ease;
      white-space: nowrap;
      overflow: hidden;
    }

    .ticker-highlight {
      color: #d90429;
      font-weight: 800;
    }

    .offer-subheading {
      font-size: 13px;
      color: #555555;
      margin-bottom: 14px;
      font-weight: 600;
    }

    .bundle-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-bottom: 14px;
    }

    .bundle-item {
      border: 1.5px solid #e2e8f0;
      border-radius: 12px;
      padding: 10px 8px;
      cursor: pointer;
      background: #ffffff;
      display: flex;
      align-items: center;
      gap: 8px;
      text-align: left;
      transition: all 0.2s ease-in-out;
      user-select: none;
    }

    .bundle-item:hover {
      border-color: #059669;
    }

    .bundle-item.active {
      border: 2px solid #059669;
      box-shadow: 0 0 0 1.5px rgba(5, 150, 105, 0.2);
    }

    .item-icon {
      font-size: 26px;
      line-height: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .item-content {
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .bundle-title {
      font-size: 12.5px;
      font-weight: 800;
      color: #065f46;
      line-height: 1.2;
      margin-bottom: 2px;
      white-space: nowrap;
    }

    .bundle-sub {
      font-size: 10px;
      font-weight: 600;
      color: #555555;
      line-height: 1.2;
      white-space: nowrap;
    }

    .bundle-sub span {
      color: #dc2626;
      font-weight: 800;
    }

    .summary-pill {
      background-color: #eafaf1;
      color: #0b132a;
      padding: 8px 10px;
      border-radius: 30px;
      font-size: 11px;
      font-weight: 700;
      margin-bottom: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
    }

    .cta-button {
      background-color: #065f46;
      color: #ffffff;
      border: none;
      width: 100%;
      padding: 13px;
      border-radius: 40px;
      font-size: 16px;
      font-weight: 900;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      cursor: pointer;
      box-shadow: 0 4px 12px rgba(6, 95, 70, 0.3);
      transition: transform 0.1s ease, background 0.2s ease;
      margin-bottom: 10px;
      display: block;
    }

    .cta-button:hover {
      background-color: #044e39;
    }

    .cta-button:active {
      transform: scale(0.98);
    }

    .progress-container {
      background-color: #e2e8f0;
      height: 7px;
      border-radius: 10px;
      overflow: hidden;
      margin-bottom: 8px;
    }

    .progress-bar {
      background-color: #059669;
      height: 100%;
      width: 84%;
      border-radius: 10px;
      transition: width 0.5s ease;
    }

    .slots-text {
      font-size: 11.5px;
      font-weight: 700;
      color: #0b132a;
    }
  </style>
  <?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>

  <div class="data-landing-wrapper">
    <div class="data-card-container">
      <div class="alert-ticker" id="ticker">
        <span>🏆</span>
        <span><span id="ticker-name">Kojo</span> from <span id="ticker-city">Accra</span> just won <span class="ticker-highlight" id="ticker-bundle">GH&#8373;200</span>!</span>
        <span>🇬🇭</span>
      </div>

      <p class="offer-subheading">Choose an offer to get started</p>

      <div class="bundle-grid">
        <div class="bundle-item active" onclick="selectOffer(this)">
          <div class="item-icon">🎮</div>
          <div class="item-content">
            <div class="bundle-title">Gaming Access</div>
            <div class="bundle-sub">Win up to <span>GH&#8373;300</span></div>
          </div>
        </div>

        <div class="bundle-item" onclick="selectOffer(this)">
          <div class="item-icon">🏆</div>
          <div class="item-content">
            <div class="bundle-title">Cash Giveaway</div>
            <div class="bundle-sub">Win up to <span>GH&#8373;1,000</span></div>
          </div>
        </div>

        <div class="bundle-item" onclick="selectOffer(this)">
          <div class="item-icon">🎁</div>
          <div class="item-content">
            <div class="bundle-title">Amazing Prizes</div>
            <div class="bundle-sub">Get a chance to win</div>
          </div>
        </div>

        <div class="bundle-item" onclick="selectOffer(this)">
          <div class="item-icon">&#11088;</div>
          <div class="item-content">
            <div class="bundle-title">Special Offers</div>
            <div class="bundle-sub">Unlock more games</div>
          </div>
        </div>
      </div>

      <div class="summary-pill">
        <span>🎉</span> Discover our gaming offers and find out how to win.
      </div>

      <button class="cta-button" onclick="goToOffer()" type="button">
        SUBSCRIBE
      </button>

      <div class="progress-container">
        <div class="progress-bar" id="progress-bar"></div>
      </div>

      <div class="slots-text">
        Only <span id="slots-count">253</span> slots left today!
      </div>
    </div>
  </div>

  <script>
    var OFFER_LINK = "https://iibuzpb.com/cl/fbdb0759a06136a3";

    function selectOffer(element) {
      var items = document.querySelectorAll('.bundle-item');
      for (var i = 0; i < items.length; i++) {
        items[i].classList.remove('active');
      }
      element.classList.add('active');
    }

    function goToOffer() {
      window.location.href = OFFER_LINK;
    }

    var names = ["Kojo", "Kwame", "Abena", "Kofi", "Ama", "Yaw", "Akua", "Esi"];
    var cities = ["Accra", "Kumasi", "Takoradi", "Tamale", "Tema", "Cape Coast", "Sunyani"];
    var amounts = ["GH₵150", "GH₵200", "GH₵300", "GH₵500", "GH₵1,000"];

    setInterval(function() {
      var ticker = document.getElementById('ticker');
      if (!ticker) return;

      var randomName = names[Math.floor(Math.random() * names.length)];
      var randomCity = cities[Math.floor(Math.random() * cities.length)];
      var randomAmount = amounts[Math.floor(Math.random() * amounts.length)];

      ticker.style.opacity = '0';

      setTimeout(function() {
        var nameEl = document.getElementById('ticker-name');
        var cityEl = document.getElementById('ticker-city');
        var bundleEl = document.getElementById('ticker-bundle');

        if (nameEl) nameEl.innerText = randomName;
        if (cityEl) cityEl.innerText = randomCity;
        if (bundleEl) bundleEl.innerText = randomAmount;

        ticker.style.opacity = '1';
      }, 300);
    }, 4000);

    var slots = 253;
    setInterval(function() {
      if (slots > 10) {
        slots -= Math.floor(Math.random() * 3) + 1;
        var countEl = document.getElementById('slots-count');
        var barEl = document.getElementById('progress-bar');

        if (countEl) countEl.innerText = slots;
        if (barEl) {
          var progressPercent = Math.max(10, (slots / 300) * 100);
          barEl.style.width = progressPercent + '%';
        }
      }
    }, 5000);
  </script>

  <?php wp_footer(); ?>
</body>
</html>