.elementor-13578 .elementor-element.elementor-element-19ac988{--display:flex;--margin-top:-64px;--margin-bottom:0px;--margin-left:0px;--margin-right:0px;}@media(max-width:767px){.elementor-13578 .elementor-element.elementor-element-19ac988{--padding-top:0px;--padding-bottom:0px;--padding-left:0px;--padding-right:0px;}.elementor-13578 .elementor-element.elementor-element-8e9d601 > .elementor-widget-container{padding:0px 0px 0px 0px;}}/* Start custom CSS for container, class: .elementor-element-19ac988 */<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<title>GAHAWARDS & Business Summit | Walkway Branding Registration</title>
<link href="https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">

<style>
:root{
  --primary:#926761;
  --primary-light:#C49A9A;
  --gold:#D4AF37;
  --gold-light:#FFD97A;
  --white:#fff;
  --muted:#6b6b6b;
  --bg-light:#FAF7F6;
  --border:#E2D6D3;
}

*{
  box-sizing:border-box;
  margin:0;
  padding:0;
}

body{
  font-family:Inter,system-ui,-apple-system,sans-serif;
  background:#fff;
  color:#111;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

a{
  text-decoration:none;
  color:inherit;
}

/* PARTICLES */
.particles{
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:1;
}

.particle{
  position:absolute;
  border-radius:50%;
  background:linear-gradient(135deg,var(--gold),var(--gold-light));
  opacity:0.15;
  filter:blur(.5px);
  animation:floatUp linear infinite;
}

@keyframes floatUp{
  0%{ transform:translateY(0) rotate(0); opacity:0.15; }
  50%{ opacity:0.25; }
  100%{ transform:translateY(-420px) rotate(360deg); opacity:0; }
}

/* HERO SECTION - MOBILE RESPONSIVE END-TO-END */
.hero-wrap{
  width:100%;
  padding:30px 16px;
  background:linear-gradient(135deg,#fff7f7,#fff);
  position:relative;
  overflow:hidden;
  border-bottom:1px solid var(--border);
}

.hero-wave{
  position:absolute;
  inset:0;
  background-image:
    radial-gradient(circle at 20% 20%,rgba(212,175,55,0.05) 0 8%,transparent 20%),
    radial-gradient(circle at 80% 80%,rgba(140,90,90,0.03) 0 12%,transparent 30%);
  animation:waveShift 14s linear infinite;
  pointer-events:none;
}

@keyframes waveShift{
  0%{ background-position:0 0; }
  100%{ background-position:1000px 0; }
}

.hero-container{
  width:100%;
  max-width:1100px;
  margin:0 auto;
  display:flex;
  align-items:center;
  gap:24px;
  position:relative;
  z-index:2;
}

.hero-image-col{
  flex:1;
  text-align:center;
  width: 100%;
}

.hero-image-col img{
  width:100%;
  max-width:380px;
  height: auto;
  border-radius:14px;
  border:3px solid var(--gold);
  box-shadow:0 10px 25px rgba(0,0,0,0.15);
}

.hero-text-col{
  flex:1.2;
  width: 100%;
}

.hero-text-col h2{
  font-size:0.8rem;
  text-transform:uppercase;
  letter-spacing:1.5px;
  color:var(--primary);
  margin-bottom:6px;
  font-weight:700;
}

.hero-text-col h1{
  font-family:Cinzel,serif;
  font-size:1.8rem;
  color:#111;
  line-height:1.25;
  margin-bottom:12px;
}

.hero-text-col p{
  color:var(--muted);
  font-size:0.95rem;
  margin-bottom:16px;
}

.hero-details{
  background:#000;
  border:1px solid var(--gold);
  border-radius:12px;
  padding:14px 16px;
  color:#fff;
  display:block;
  margin-bottom:16px;
}

.hero-details p{
  color:#fff !important;
  margin-bottom:4px;
  font-size:0.85rem;
}
.hero-details p:last-child{
  margin-bottom:0;
}

.hero-pricing-chips{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.chip{
  background:rgba(212,175,55,0.15);
  border:1px solid var(--gold);
  padding:6px 12px;
  border-radius:20px;
  font-weight:700;
  color:#111;
  font-size:0.85rem;
}

/* PAGE FRAME & END-TO-END MOBILE CONTAINER */
.page-frame{
  width:100%;
  padding:20px 8px;
}

.page-inner{
  background:#fff;
  padding:16px 12px;
  border-radius:12px;
  box-shadow:0 10px 30px rgba(0,0,0,0.05);
  max-width:1100px;
  margin:0 auto;
  width: 100%;
}

/* FORM WRAPPER & SECTIONS */
.form-wrap{
  width:100%;
  max-width:850px;
  margin:0 auto;
}

.form-section{
  background:#FAF7F6;
  border:1px solid var(--border);
  border-radius:14px;
  padding:16px;
  margin-bottom:16px;
  width: 100%;
}

.form-section legend{
  font-family:Cinzel,serif;
  color:var(--primary);
  font-size:1.1rem;
  margin-bottom:12px;
  border-bottom:1px solid rgba(140,90,90,0.15);
  padding-bottom:6px;
  display:block;
  width:100%;
  font-weight:700;
}

.row{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  margin-bottom:12px;
  width: 100%;
}

.col{
  flex:1 1 100%;
  min-width: 0; /* Prevents flex items from overflowing container width */
}

label{
  display:block;
  font-weight:600;
  margin-bottom:4px;
  color:#222;
  font-size:0.9rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea,
input[type="number"],
input[type="file"]{
  width:100%;
  max-width: 100%;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid rgba(0,0,0,0.12);
  font-size:0.95rem;
  background:#fff;
  -webkit-appearance: none;
}

textarea{
  min-height:90px;
  resize:vertical;
}

.file-preview img{
  width:80px;
  border-radius:8px;
  margin-top:6px;
  margin-right:4px;
  border:1px solid #ccc;
}

/* REFERENCE NUMBER BADGE */
.ref-badge-box{
  background:#000;
  color:#fff;
  border:2px dashed var(--gold);
  border-radius:12px;
  padding:14px 12px;
  text-align:center;
  margin-bottom:16px;
  width: 100%;
}

.ref-badge-box h4{
  font-family:Cinzel,serif;
  color:var(--gold);
  font-size:1rem;
  margin-bottom:4px;
}

.ref-code{
  font-size:1.2rem;
  font-weight:700;
  letter-spacing:1px;
  color:#fff;
  background:#222;
  padding:6px 12px;
  border-radius:8px;
  display:inline-block;
  margin-top:4px;
  word-break:break-all;
}

/* WALKWAY GRID SELECTOR - MOBILE OPTIMIZED */
.grid-instruction{
  background:rgba(212,175,55,0.1);
  border-left:4px solid var(--gold);
  padding:8px 10px;
  font-size:0.85rem;
  margin-bottom:10px;
  border-radius:0 8px 8px 0;
  color:#333;
}

.walkway-grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr); /* 3 columns on mobile */
  gap:8px;
  max-height:340px;
  overflow-y:auto;
  padding:4px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:10px;
  margin-bottom:10px;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

@media(min-width: 640px){
  .walkway-grid{
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
}

.space-tile{
  background:#FAF7F6;
  border:2px solid var(--border);
  border-radius:8px;
  padding:8px 4px;
  text-align:center;
  cursor:pointer;
  transition:all 0.2s ease;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  min-height:70px;
}

.space-tile:hover:not(.locked):not(.disabled){
  border-color:var(--primary);
  background:#fff7f7;
}

.space-tile.selected{
  background:var(--primary) !important;
  border-color:var(--gold) !important;
  color:#fff !important;
  box-shadow:0 4px 12px rgba(146,103,97,0.4);
}

.space-tile.selected *{
  color:#fff !important;
}

.space-tile.locked, .space-tile.disabled{
  background:#1a1a1a !important;
  border-color:#333 !important;
  color:#aaa !important;
  cursor:not-allowed;
  opacity:0.85;
}

.space-tile.half-booked{
  background:#fff3cd !important;
  border-color:#ffecb5 !important;
  color:#856404 !important;
}

.tile-name{
  font-weight:700;
  font-size:0.9rem;
  margin-bottom:2px;
}

.tile-dim{
  font-size:0.65rem;
  color:var(--muted);
}

.space-tile.selected .tile-dim{
  color:#ffd97a !important;
}

.tile-status{
  font-size:0.6rem;
  font-weight:700;
  margin-top:2px;
  padding:1px 3px;
  border-radius:3px;
  background:rgba(0,0,0,0.1);
  word-break: break-all;
}

/* BUTTONS */
.btn{
  width: 100%;
  padding:12px 16px;
  border-radius:20px;
  font-weight:600;
  cursor:pointer;
  border:none;
  font-size:0.95rem;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  transition:all 0.2s ease;
  text-align: center;
}

.btn:hover{
  opacity:0.95;
}

.btn-primary{
  background:linear-gradient(135deg,var(--primary),var(--primary-light));
  color:#fff;
  box-shadow:0 4px 14px rgba(146,103,97,0.3);
}

.btn-red-full{
  background:#D32F2F;
  color:#ffffff !important;
  font-weight:700;
  font-size:0.95rem;
  padding:12px 16px;
  border-radius:20px;
  box-shadow:0 4px 14px rgba(211,47,47,0.4);
  text-align:center;
}

.btn-red-full:hover{
  background:#B71C1C;
}

/* PAYMENT BOX */
.payment-box{
  background:#000000;
  border:2px solid var(--gold);
  border-radius:14px;
  padding:16px 12px;
  margin-top:12px;
  text-align:center;
  color:#ffffff !important;
  box-shadow:0 8px 24px rgba(0,0,0,0.25);
  width: 100%;
}

.payment-box h4{
  color:#ffffff !important;
  font-family:Cinzel,serif;
  margin-bottom:6px;
  font-size:1.1rem;
}

.payment-box p,
.payment-box .small-white,
.payment-box label,
.payment-box .small,
.payment-box span{
  color:#ffffff !important;
  opacity:1 !important;
}

.pay-tabs-wrapper {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 14px 0;
  flex-wrap: wrap;
  width: 100%;
}

.pay-tab-btn {
  color: #111 !important;
  background: #e2e2e2 !important;
  border: 1px solid #ccc !important;
  border-radius: 20px !important;
  padding: 8px 12px !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  flex: 1;
  min-width: 100px;
}

.pay-tab-btn.active-tab {
  background: var(--gold) !important;
  color: #000 !important;
  border-color: var(--gold) !important;
}

/* SUCCESS MESSAGE */
#successMsg{
  display:none;
  margin-bottom:16px;
  background:linear-gradient(135deg,#FDF3E6,#F8E8C9);
  padding:14px;
  border-radius:12px;
  color:#3b2a20;
  font-weight:600;
  text-align:center;
  word-break: break-word;
}

.small{
  font-size:0.8rem;
  color:var(--muted);
}

.small-white{
  font-size:0.8rem;
  color:#ffffff !important;
}

.hover-white-text:hover,
.payment-box p:hover,
.payment-box .small:hover,
.payment-box .small-white:hover {
  color: #ffffff !important;
}

/* RESPONSIVE BREAKPOINT FOR HERO */
@media(max-width:768px){
  .hero-container{
    flex-direction:column;
    gap: 16px;
  }
  .hero-image-col img{
    max-width:280px;
  }
  .hero-text-col h1{
    font-size:1.5rem;
  }
  .page-frame {
    padding: 10px 4px;
  }
  .page-inner {
    padding: 12px 8px;
  }
}
</style>
</head>

<body>

<div class="particles" aria-hidden="true"></div>

<!-- HERO SECTION -->
<header class="hero-wrap">
  <div class="hero-wave"></div>
  <div class="hero-container">
    <div class="hero-image-col">
      <img src="https://gahawards.com/wp-content/uploads/2026/11/walkway-1-1638x2048.jpg" alt="Walkway Branding Flyer" />
    </div>
    <div class="hero-text-col">
      <h2>14th GAH Awards & Business Summit</h2>
      <h1>Own the walkway. Be the brand they see before taking their seat.</h1>
      <p>Secure your exclusive walkway exhibition space to maximize brand visibility before industry leaders and VIPs.</p>
      
      <div class="hero-details">
        <p><strong>Date:</strong> Wed, 16th Dec. 2026 • 4:00 PM Prompt</p>
        <p><strong>Venue:</strong> The Eko Hotels & Suites, Victoria Island, Lagos</p>
      </div>

      <div class="hero-pricing-chips">
        <div class="chip">Full Space: ₦1,000,000</div>
        <div class="chip">2in1 Space: ₦500,000</div>
      </div>
    </div>
  </div>
</header>

<section class="page-frame">
  <div class="page-inner">

    <div class="form-wrap">

      <div id="successMsg" role="status" aria-live="polite">
        Registration submitted successfully.
      </div>

      <form
        id="walkwayForm"
        action="/wp-admin/admin-ajax.php"
        method="POST"
        enctype="multipart/form-data"
        novalidate
      >

        <input type="hidden" name="action" value="submit_walkway_form">
        <input type="hidden" id="ref_number_input" name="ref_number" value="">
        <input type="hidden" id="selected_space_input" name="selected_space" value="" required>
        <input type="hidden" id="space_package_input" name="space_package" value="" required>

        <!-- REFERENCE NUMBER BADGE -->
        <div class="ref-badge-box">
          <h4>Your Unique Brand Reference Number</h4>
          <div id="refNumberDisplay" class="ref-code">GAH-WW-2026-XXXX</div>
          <p class="small-white" style="margin-top:4px;">Please save this reference number for payment tracking.</p>
        </div>

        <!-- SECTION 1: PERSONAL & BRAND INFO -->
        <fieldset class="form-section">
          <legend>1. Personal & Brand Information</legend>

          <div class="row">
            <div class="col">
              <label for="company_name">Company / Brand Name *</label>
              <input id="company_name" name="company_name" type="text" required placeholder="e.g. Acme Corporation">
            </div>
            <div class="col">
              <label for="contact_name">Contact Person *</label>
              <input id="contact_name" name="contact_name" type="text" required placeholder="Full Name">
            </div>
          </div>

          <div class="row">
            <div class="col">
              <label for="brand_email">Email Address *</label>
              <input id="brand_email" name="brand_email" type="email" required placeholder="brand@example.com">
            </div>
            <div class="col">
              <label for="brand_phone">Phone Number *</label>
              <input id="brand_phone" name="brand_phone" type="tel" required placeholder="+234 ...">
            </div>
          </div>
        </fieldset>

        <!-- SECTION 2: PACKAGE & WALKWAY SPOT SELECTION -->
        <fieldset class="form-section">
          <legend>2. Package & Walkway Space Selection</legend>

          <div class="row">
            <div class="col">
              <label for="package_type">Select Package Type *</label>
              <select id="package_type" name="package_type" required>
                <option value="">-- Choose Package --</option>
                <option value="Full Space (₦1,000,000)">Full Space (₦1,000,000)</option>
                <option value="2in1 Space (₦500,000)">2in1 Space (₦500,000)</option>
              </select>
            </div>
          </div>

          <div class="row">
            <div class="col">
              <label>Select Your Walkway Spot from Grid Below *</label>
              <div class="grid-instruction">
                💡 Tap an available tile to pick your space. <strong>I1</strong>, <strong>I2</strong>, <strong>K</strong> & <strong>L</strong> are reserved/locked.
              </div>
              <div id="spaceGrid" class="walkway-grid">
                <!-- Dynamically populated tiles -->
              </div>
              <div id="selectedSpaceInfo" style="margin-top:6px; font-weight:600; color:var(--primary); font-size: 0.9rem;">
                No space selected yet.
              </div>
            </div>
          </div>
        </fieldset>

        <!-- SECTION 3: GRAPHIC / ARTWORK UPLOAD -->
        <fieldset class="form-section">
          <legend>3. Artwork Submission</legend>

          <div class="row">
            <div class="col">
              <label for="promo_files">Upload Graphic / Print-Ready Artwork *</label>
              <input id="promo_files" name="promo_files" type="file" accept="image/*,.pdf,.ai,.psd,.eps,.svg" required multiple>
              <div class="file-preview" aria-hidden="true"></div>
            </div>
          </div>
        </fieldset>

        <!-- SECTION 4: PAYMENT -->
        <fieldset class="form-section">
          <legend>4. Payment & Verification</legend>

          <div id="standardPaymentBox" class="payment-box">
            <h4>Complete Walkway Space Payment</h4>
            <p class="small-white hover-white-text">Choose your preferred payment method below.</p>

            <!-- PAYMENT METHOD TABS -->
            <div class="pay-tabs-wrapper">
              <button type="button" class="btn pay-tab-btn active-tab" data-target="paystack-section">Pay Online</button>
              <button type="button" class="btn pay-tab-btn" data-target="bank-section">Bank Transfer</button>
              <button type="button" class="btn pay-tab-btn" data-target="proof-section">I Have Paid</button>
            </div>

            <!-- 1. PAYSTACK SECTION -->
            <div id="paystack-section" class="pay-content-pane">
              <a
                id="payNowBtn"
                href="#"
                target="_blank"
                rel="noopener noreferrer"
                class="btn btn-red-full"
                style="display:none;"
              >
                Pay Online Now 💳
              </a>
              <p id="payWarning" class="small-white hover-white-text" style="font-weight:600; margin-top: 6px;">
                ⚠️ Select package & space to unlock payment link.
              </p>
            </div>

            <!-- 2. BANK TRANSFER SECTION -->
            <div id="bank-section" class="pay-content-pane" style="display: none; text-align: center;">
              <p class="small-white hover-white-text" style="margin-bottom: 8px;">View or scan bank details for direct transfer:</p>
              <div style="background: #111; padding: 6px; border-radius: 8px; border: 1px solid #333;">
                <img src="https://gahawards.com/wp-content/uploads/2026/09/pay-scaled.jpg" alt="Bank Transfer Details" style="max-width: 100%; height: auto; border-radius: 6px;" />
              </div>
            </div>

            <!-- 3. PROOF OF PAYMENT SECTION -->
            <div id="proof-section" class="pay-content-pane" style="display: none; text-align: left;">
              <label for="payment_proof_file" class="small-white hover-white-text" style="font-size: 0.85rem; margin-bottom: 4px;">Upload Payment Receipt / Proof *</label>
              <input 
                id="payment_proof_file" 
                name="payment_proof_file" 
                type="file" 
                accept="image/*,.pdf" 
                style="background: #222; color: #fff; border: 1px solid #444;"
              >
              <div class="file-preview" aria-hidden="true" style="margin-top: 6px;"></div>
              <p class="small-white hover-white-text" style="margin-top: 6px;">Upload your receipt so our team can verify your payment using your Reference Number.</p>
            </div>

          </div>
        </fieldset>

        <!-- SECTION 5: ADDITIONAL INTEREST & SUBMISSION -->
        <fieldset class="form-section">
          <legend>5. Final Details & Submission</legend>

          <div class="row">
            <div class="col">
              <label for="additional_requests">Additional Interest (Optional)</label>
              <textarea id="additional_requests" name="additional_requests" placeholder="Any specific lighting or positioning notes..."></textarea>
            </div>
          </div>

          <p class="small" style="margin-bottom:14px;">
            By submitting, details & your unique Reference Number go to <strong>gahawards@gmail.com</strong>.
          </p>

          <button
            type="submit"
            class="btn btn-primary"
            id="subBtn"
          >
            Submit Walkway Registration
          </button>
        </fieldset>

      </form>

    </div>

  </div>
</section>

<script>
const PAYSTACK_PUBLIC_KEY = 'pk_live_24098b032e3dba2ea81f56da4bad115f6956e762';

const payLinks = {
  'Full Space (₦1,000,000)': 'https://paystack.com/buy/gah-walkway-full-space',
  '2in1 Space (₦500,000)': 'https://paystack.com/buy/gah-walkway-2in1-space'
};

const walkwaySpaces = [
  { id: 'A', dim: '14ft by 8ft' },
  { id: 'B', dim: '15ft by 8ft' },
  { id: 'C1', dim: '20ft by 8ft' },
  { id: 'C2', dim: '20ft by 8ft' },
  { id: 'C3', dim: '20ft by 8ft' },
  { id: 'D', dim: '18ft by 8ft' },
  { id: 'E', dim: '20ft by 8ft' },
  { id: 'F', dim: '8ft by 8ft' },
  { id: 'G1', dim: '20ft by 8ft' },
  { id: 'G2', dim: '20ft by 8ft' },
  { id: 'G3', dim: '20ft by 8ft' },
  { id: 'G4', dim: '20ft by 8ft' },
  { id: 'G5', dim: '20ft by 8ft' },
  { id: 'G6', dim: '12ft by 8ft' },
  { id: 'H', dim: '5ft by 8ft' },
  { id: 'I1', dim: '20ft by 8ft', status: 'locked', label: 'WELCOME' },
  { id: 'I2', dim: '20ft by 8ft', status: 'locked', label: 'KEYNOTE' },
  { id: 'J1', dim: '20ft by 9ft' },
  { id: 'J2', dim: '20ft by 9ft' },
  { id: 'K', dim: '13ft by 9ft', status: 'locked', label: 'RED CARPET' },
  { id: 'L', dim: '24ft by 9ft', status: 'locked', label: 'RED CARPET' },
  { id: 'M', dim: '24ft by 9ft' },
  { id: 'V1', dim: '20ft by 8ft' },
  { id: 'V2', dim: '20ft by 8ft' },
  { id: 'V3', dim: '20ft by 8ft' },
  { id: 'V4', dim: '20ft by 8ft' },
  { id: 'V5', dim: '15ft by 8ft' }
];

function generateRefNumber() {
  const rand = Math.floor(10000 + Math.random() * 90000);
  return `GAH-WW-2026-${rand}`;
}

let currentRefNum = localStorage.getItem('gah_walkway_ref') || generateRefNumber();
localStorage.setItem('gah_walkway_ref', currentRefNum);
document.getElementById('ref_number_input').value = currentRefNum;
document.getElementById('refNumberDisplay').textContent = currentRefNum;

let bookedSpaces = JSON.parse(localStorage.getItem('gah_walkway_booked_spaces') || '{}');

const spaceGrid = document.getElementById('spaceGrid');
const selectedSpaceInput = document.getElementById('selected_space_input');
const spacePackageInput = document.getElementById('space_package_input');
const selectedSpaceInfo = document.getElementById('selectedSpaceInfo');
const packageTypeSelect = document.getElementById('package_type');
const payNowBtn = document.getElementById('payNowBtn');
const payWarning = document.getElementById('payWarning');
const form = document.getElementById('walkwayForm');
const successMsg = document.getElementById('successMsg');
const subBtn = document.getElementById('subBtn');

let selectedSpaceId = null;

function renderGrid() {
  spaceGrid.innerHTML = '';
  walkwaySpaces.forEach(space => {
    const tile = document.createElement('div');
    tile.className = 'space-tile';
    tile.setAttribute('data-id', space.id);

    const bookingInfo = bookedSpaces[space.id];
    let isFullyBooked = false;
    let isHalfBooked = false;
    let statusLabel = '';

    if (space.status === 'locked') {
      tile.classList.add('locked');
      statusLabel = space.label;
    } else if (bookingInfo) {
      if (bookingInfo.type === 'full' || bookingInfo.brands.length >= 2) {
        isFullyBooked = true;
        tile.classList.add('locked');
        statusLabel = bookingInfo.brands.join(' & ');
      } else if (bookingInfo.type === '2in1' && bookingInfo.brands.length === 1) {
        isHalfBooked = true;
        tile.classList.add('half-booked');
        statusLabel = `${bookingInfo.brands[0]} • ½ Left`;
      }
    }

    if (selectedSpaceId === space.id) {
      tile.classList.add('selected');
    }

    tile.innerHTML = `
      <div class="tile-name">${space.id}</div>
      <div class="tile-dim">${space.dim}</div>
      ${statusLabel ? `<div class="tile-status">${statusLabel}</div>` : ''}
    `;

    if (!tile.classList.contains('locked')) {
      tile.addEventListener('click', () => {
        const pkg = packageTypeSelect.value;
        if (!pkg) {
          alert('Please select a Package Type first.');
          packageTypeSelect.focus();
          return;
        }

        if (isHalfBooked && pkg.includes('Full Space')) {
          alert('This space has 1 slot taken for 2in1. Full Space cannot claim a half-booked space.');
          return;
        }

        document.querySelectorAll('.space-tile').forEach(t => {
          if (!t.classList.contains('locked') && !t.classList.contains('half-booked')) {
            t.classList.remove('selected');
          } else if (t.classList.contains('half-booked') && t.getAttribute('data-id') !== space.id) {
            t.classList.remove('selected');
          }
        });

        selectedSpaceId = space.id;
        tile.classList.add('selected');
        selectedSpaceInput.value = space.id;
        spacePackageInput.value = pkg;

        let notice = `Selected Space: <strong>${space.id} (${space.dim})</strong>`;
        if (isHalfBooked) {
          notice += ` <span style="color:#856404;">(Joining 2in1 - 1 slot left)</span>`;
        } else if (pkg.includes('2in1')) {
          notice += ` <span style="color:#d4af37;">(2in1 - 1 slot claimed, 1 slot remains)</span>`;
        }
        selectedSpaceInfo.innerHTML = notice;

        updatePayButton();
      });
    }

    spaceGrid.appendChild(tile);
  });
}

function updatePayButton() {
  const pkg = packageTypeSelect.value;
  if (pkg && selectedSpaceId && payLinks[pkg]) {
    payNowBtn.href = payLinks[pkg];
    payNowBtn.style.display = 'block';
    payWarning.style.display = 'none';
  } else {
    payNowBtn.href = '#';
    payNowBtn.style.display = 'none';
    payWarning.style.display = 'block';
  }
}

packageTypeSelect.addEventListener('change', () => {
  updatePayButton();
  if (selectedSpaceId) {
    const bookingInfo = bookedSpaces[selectedSpaceId];
    if (bookingInfo && bookingInfo.type === '2in1' && packageTypeSelect.value.includes('Full Space')) {
      selectedSpaceId = null;
      selectedSpaceInput.value = '';
      selectedSpaceInfo.textContent = 'Package changed. Please re-select your walkway space.';
      renderGrid();
    }
  }
});

const tabBtns = document.querySelectorAll('.pay-tab-btn');
const panes = document.querySelectorAll('.pay-content-pane');

tabBtns.forEach(btn => {
  btn.addEventListener('click', () => {
    tabBtns.forEach(b => b.classList.remove('active-tab'));
    btn.classList.add('active-tab');
    const targetId = btn.getAttribute('data-target');
    panes.forEach(pane => {
      pane.style.display = (pane.id === targetId) ? 'block' : 'none';
    });
  });
});

function createPreviewForInput(input){
  const preview = input.parentElement.querySelector('.file-preview');
  if(!preview) return;
  preview.innerHTML = '';
  if(input.files && input.files.length){
    Array.from(input.files).forEach(file => {
      const reader = new FileReader();
      reader.onload = e => {
        if(file.type && file.type.startsWith('image/')){
          const img = document.createElement('img');
          img.src = e.target.result;
          img.alt = file.name;
          preview.appendChild(img);
        } else {
          const div = document.createElement('div');
          div.textContent = file.name;
          div.style.marginTop = '4px';
          div.style.fontSize = '0.8rem';
          preview.appendChild(div);
        }
      };
      reader.readAsDataURL(file);
    });
  }
}

document.querySelectorAll('input[type="file"]').forEach(input => {
  input.addEventListener('change', () => createPreviewForInput(input));
});

form.addEventListener('submit', async (e) => {
  e.preventDefault();

  if(!selectedSpaceId){
    alert('Please select an available Walkway Space from the grid.');
    return;
  }

  const companyName = document.getElementById('company_name').value.trim();
  const pkgType = packageTypeSelect.value;

  subBtn.disabled = true;
  subBtn.textContent = 'Submitting...';
  successMsg.style.display = 'none';

  const formData = new FormData(form);
  const ajaxUrl = form.getAttribute('action');

  try {
    const response = await fetch(ajaxUrl, {
      method:'POST',
      body:formData,
      credentials:'same-origin'
    });

    const responseText = await response.text();
    let result = null;

    try {
      result = JSON.parse(responseText);
    } catch(err) {
      result = { success: true };
    }

    if(result.success){
      const is2in1 = pkgType.includes('2in1');
      if (!bookedSpaces[selectedSpaceId]) {
        bookedSpaces[selectedSpaceId] = { type: is2in1 ? '2in1' : 'full', brands: [companyName] };
      } else {
        bookedSpaces[selectedSpaceId].brands.push(companyName);
      }
      localStorage.setItem('gah_walkway_booked_spaces', JSON.stringify(bookedSpaces));

      successMsg.style.display = 'block';
      successMsg.style.background = 'linear-gradient(135deg,#F0FFF5,#E7FBEF)';
      successMsg.style.color = '#1b5e20';
      successMsg.innerHTML = `✅ Submitted successfully! Ref Number: <strong>${currentRefNum}</strong>. Sent to gahawards@gmail.com.`;

      form.reset();
      localStorage.removeItem('gah_walkway_ref');
      selectedSpaceId = null;
      selectedSpaceInput.value = '';
      selectedSpaceInfo.textContent = 'No space selected yet.';
      
      currentRefNum = generateRefNumber();
      localStorage.setItem('gah_walkway_ref', currentRefNum);
      document.getElementById('ref_number_input').value = currentRefNum;
      document.getElementById('refNumberDisplay').textContent = currentRefNum;

      document.querySelectorAll('.file-preview').forEach(fp => fp.innerHTML = '');
      renderGrid();
      updatePayButton();

      window.scrollTo({ top: 0, behavior:'smooth' });
    } else {
      throw new Error(result.data && result.data.message ? result.data.message : 'Submission failed.');
    }
  } catch(err) {
    successMsg.style.display = 'block';
    successMsg.style.background = '#FDE2E2';
    successMsg.style.color = '#9B1C1C';
    successMsg.textContent = '❌ Error: ' + err.message;
  } finally {
    subBtn.disabled = false;
    subBtn.textContent = 'Submit Walkway Registration';
  }
});

document.addEventListener('DOMContentLoaded', () => {
  renderGrid();
  fetch('/wp-admin/admin-ajax.php?action=get_booked_walkway_spaces')
    .then(res => res.json())
    .then(data => {
      if(data && data.success && data.bookedSpaces) {
        bookedSpaces = data.bookedSpaces;
        localStorage.setItem('gah_walkway_booked_spaces', JSON.stringify(bookedSpaces));
        renderGrid();
      }
    })
    .catch(() => {});
});

for(let i = 0; i < 20; i++){
  const p = document.createElement('div');
  p.className = 'particle';
  p.style.left = Math.random() * 100 + '%';
  p.style.top = Math.random() * 100 + '%';
  const size = 3 + Math.random() * 6;
  p.style.width = size + 'px';
  p.style.height = size + 'px';
  p.style.animationDuration = (6 + Math.random() * 8) + 's';
  document.querySelector('.particles').appendChild(p);
}
</script>

</body>
</html>/* End custom CSS */