<?php
require_once __DIR__ . '/config/config.php';
$pageTitle = 'Payroll Solutions - Fantom Capital';
include __DIR__ . '/includes/header.php';
?>

<!-- Hero Section -->
<section class="bg-gradient-to-br from-primary-green to-green-800 text-white py-20 md:py-28">
  <div class="container mx-auto px-4">
    <div class="max-w-4xl mx-auto text-center">
      <h1 class="text-4xl md:text-6xl font-bold mb-6">Payroll Solutions</h1>
      <p class="text-xl md:text-2xl mb-8 opacity-90">Streamline your payroll management with our comprehensive, hassle-free solutions designed for businesses of all sizes</p>
      <div class="flex flex-wrap justify-center gap-4">
        <div class="flex items-center gap-2">
          <svg class="w-6 h-6 text-white" fill="currentColor" viewBox="0 0 20 20">
            <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
          </svg>
          <span>Automated Processing</span>
        </div>
        <div class="flex items-center gap-2">
          <svg class="w-6 h-6 text-white" fill="currentColor" viewBox="0 0 20 20">
            <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
          </svg>
          <span>Tax Compliance</span>
        </div>
        <div class="flex items-center gap-2">
          <svg class="w-6 h-6 text-white" fill="currentColor" viewBox="0 0 20 20">
            <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
          </svg>
          <span>Secure & Reliable</span>
        </div>
      </div>
    </div>
  </div>
</section>

<!-- Features Section -->
<section class="py-16 bg-white">
  <div class="container mx-auto px-4">
    <div class="max-w-6xl mx-auto">
      <h2 class="text-3xl md:text-4xl font-bold text-gray-900 mb-12 text-center">Why Choose Our Payroll Solutions?</h2>
      
      <div class="grid md:grid-cols-3 gap-8">
        <div class="bg-soft-gray rounded-2xl p-8 hover:shadow-xl transition-shadow">
          <div class="w-16 h-16 bg-gradient-to-br from-primary-green to-green-600 rounded-xl flex items-center justify-center mb-4">
            <svg class="w-8 h-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
            </svg>
          </div>
          <h3 class="text-xl font-bold text-gray-900 mb-3">Time-Saving Automation</h3>
          <p class="text-gray-600">Automate salary calculations, deductions, and disbursements. Focus on growing your business while we handle the details.</p>
        </div>
        
        <div class="bg-soft-gray rounded-2xl p-8 hover:shadow-xl transition-shadow">
          <div class="w-16 h-16 bg-gradient-to-br from-primary-blue to-blue-600 rounded-xl flex items-center justify-center mb-4">
            <svg class="w-8 h-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"/>
            </svg>
          </div>
          <h3 class="text-xl font-bold text-gray-900 mb-3">Full Compliance</h3>
          <p class="text-gray-600">Stay compliant with KRA, NSSF, NHIF, and other statutory requirements. We keep you updated with all regulatory changes.</p>
        </div>
        
        <div class="bg-soft-gray rounded-2xl p-8 hover:shadow-xl transition-shadow">
          <div class="w-16 h-16 bg-gradient-to-br from-purple-600 to-indigo-600 rounded-xl flex items-center justify-center mb-4">
            <svg class="w-8 h-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"/>
            </svg>
          </div>
          <h3 class="text-xl font-bold text-gray-900 mb-3">Detailed Reporting</h3>
          <p class="text-gray-600">Access comprehensive payroll reports, payslips, and analytics. Make informed decisions with real-time data insights.</p>
        </div>
        
        <div class="bg-soft-gray rounded-2xl p-8 hover:shadow-xl transition-shadow">
          <div class="w-16 h-16 bg-gradient-to-br from-orange-500 to-red-600 rounded-xl flex items-center justify-center mb-4">
            <svg class="w-8 h-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9V7a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2m2 4h10a2 2 0 002-2v-6a2 2 0 00-2-2H9a2 2 0 00-2 2v6a2 2 0 002 2zm7-5a2 2 0 11-4 0 2 2 0 014 0z"/>
            </svg>
          </div>
          <h3 class="text-xl font-bold text-gray-900 mb-3">Seamless Integration</h3>
          <p class="text-gray-600">Integrate with your existing accounting systems and bank platforms for smooth financial operations.</p>
        </div>
        
        <div class="bg-soft-gray rounded-2xl p-8 hover:shadow-xl transition-shadow">
          <div class="w-16 h-16 bg-gradient-to-br from-pink-500 to-rose-600 rounded-xl flex items-center justify-center mb-4">
            <svg class="w-8 h-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"/>
            </svg>
          </div>
          <h3 class="text-xl font-bold text-gray-900 mb-3">Employee Self-Service</h3>
          <p class="text-gray-600">Empower employees with access to payslips, leave requests, and personal information updates through a secure portal.</p>
        </div>
        
        <div class="bg-soft-gray rounded-2xl p-8 hover:shadow-xl transition-shadow">
          <div class="w-16 h-16 bg-gradient-to-br from-yellow-500 to-amber-600 rounded-xl flex items-center justify-center mb-4">
            <svg class="w-8 h-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.364 5.636l-3.536 3.536m0 5.656l3.536 3.536M9.172 9.172L5.636 5.636m3.536 9.192l-3.536 3.536M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-5 0a4 4 0 11-8 0 4 4 0 018 0z"/>
            </svg>
          </div>
          <h3 class="text-xl font-bold text-gray-900 mb-3">24/7 Support</h3>
          <p class="text-gray-600">Our dedicated support team is always available to assist you with any payroll queries or technical issues.</p>
        </div>
      </div>
    </div>
  </div>
</section>

<!-- Enquiry Form Section -->
<section class="py-20 bg-gradient-to-br from-soft-gray to-gray-200">
  <div class="container mx-auto px-4">
    <div class="max-w-3xl mx-auto">
      <div class="bg-white rounded-2xl shadow-2xl p-8 md:p-12">
        <div class="text-center mb-8">
          <h2 class="text-3xl md:text-4xl font-bold text-gray-900 mb-3">Get Started Today</h2>
          <p class="text-lg text-gray-600">Fill out the form below and our payroll experts will contact you to discuss your business needs</p>
        </div>
        
        <form id="payrollForm" class="space-y-6">
          <div class="grid md:grid-cols-2 gap-6">
            <div>
              <label class="block text-sm font-semibold text-gray-700 mb-2">Company Name *</label>
              <input type="text" name="name" required class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-green" placeholder="Your company name">
            </div>
            <div>
              <label class="block text-sm font-semibold text-gray-700 mb-2">Contact Person *</label>
              <input type="text" name="contact_person" required class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-green" placeholder="Full name">
            </div>
          </div>
          
          <div class="grid md:grid-cols-2 gap-6">
            <div>
              <label class="block text-sm font-semibold text-gray-700 mb-2">Email Address *</label>
              <input type="email" name="email" required class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-green" placeholder="company@email.com">
            </div>
            <div>
              <label class="block text-sm font-semibold text-gray-700 mb-2">Phone Number *</label>
              <input type="tel" name="phone" required class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-green" placeholder="07xx xxx xxx">
            </div>
          </div>
          
          <div class="grid md:grid-cols-2 gap-6">
            <div>
              <label class="block text-sm font-semibold text-gray-700 mb-2">Number of Employees *</label>
              <select name="employee_count" required class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-green">
                <option value="">Select range</option>
                <option value="1-10">1-10 employees</option>
                <option value="11-50">11-50 employees</option>
                <option value="51-100">51-100 employees</option>
                <option value="101-500">101-500 employees</option>
                <option value="500+">500+ employees</option>
              </select>
            </div>
            <div>
              <label class="block text-sm font-semibold text-gray-700 mb-2">Industry *</label>
              <input type="text" name="industry" required class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-green" placeholder="e.g., Retail, Manufacturing">
            </div>
          </div>
          
          <div>
            <label class="block text-sm font-semibold text-gray-700 mb-2">Tell Us About Your Needs *</label>
            <textarea name="message" rows="4" required class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-green resize-none" placeholder="Describe your current payroll challenges and what you're looking for in a payroll solution..."></textarea>
          </div>
          
          <div class="bg-soft-gray rounded-lg p-4">
            <h4 class="font-bold text-gray-900 mb-2">What happens next?</h4>
            <ul class="space-y-1 text-sm text-gray-700">
              <li class="flex items-start gap-2">
                <svg class="w-5 h-5 text-primary-green mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
                  <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
                </svg>
                <span>We'll review your submission within 24 hours</span>
              </li>
              <li class="flex items-start gap-2">
                <svg class="w-5 h-5 text-primary-green mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
                  <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
                </svg>
                <span>Our payroll specialist will contact you for a consultation</span>
              </li>
              <li class="flex items-start gap-2">
                <svg class="w-5 h-5 text-primary-green mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
                  <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
                </svg>
                <span>We'll provide a customized quote based on your requirements</span>
              </li>
            </ul>
          </div>
          
          <button type="submit" class="w-full bg-gradient-to-r from-primary-green to-green-600 text-white px-8 py-4 rounded-lg font-bold text-lg hover:opacity-90 transition shadow-lg hover:shadow-xl">
            Submit Enquiry
          </button>
        </form>
        
        <div id="payrollResult" class="mt-4 hidden"></div>
      </div>
    </div>
  </div>
</section>

<!-- Contact CTA -->
<section class="py-16 bg-primary-blue text-white">
  <div class="container mx-auto px-4 text-center">
    <h2 class="text-3xl md:text-4xl font-bold mb-4">Have Questions?</h2>
    <p class="text-xl mb-8 max-w-2xl mx-auto opacity-90">Our team is ready to help you streamline your payroll operations</p>
    <div class="flex flex-wrap justify-center gap-4">
      <a href="tel:0723000500" class="bg-white text-primary-blue px-8 py-4 rounded-full font-bold hover:bg-opacity-90 transition shadow-lg inline-flex items-center gap-2">
        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"/>
        </svg>
        Call Us: 0723 000 500
      </a>
      <a href="mailto:hello@fantomgrp.com" class="bg-primary-green text-white px-8 py-4 rounded-full font-bold hover:bg-opacity-90 transition shadow-lg inline-flex items-center gap-2">
        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/>
        </svg>
        Email Us
      </a>
    </div>
  </div>
</section>

<script>
const payrollForm = document.getElementById('payrollForm');
const payrollResult = document.getElementById('payrollResult');

if (payrollForm) {
  payrollForm.addEventListener('submit', async (e) => {
    e.preventDefault();
    const form = e.currentTarget;
    const data = new FormData(form);
    data.set('subject', 'Payroll Solutions Enquiry');
    data.set('inquiry_type', 'payroll');

    payrollResult.className = 'mt-4 text-sm text-gray-600 text-center';
    payrollResult.textContent = 'Submitting your enquiry...';
    payrollResult.classList.remove('hidden');

    try {
      data.append('csrf_token', document.querySelector('meta[name="csrf-token"]')?.content || '');
      const res = await fetch('<?php echo SITE_URL; ?>/api/submit_contact.php', { method: 'POST', body: data });
      const result = await res.json().catch(() => ({ success: false, message: 'Invalid server response' }));
      if (result.success) {
        payrollResult.className = 'mt-4 p-4 bg-green-100 border border-green-300 text-green-800 rounded-lg text-center';
        payrollResult.textContent = 'Thank you! Your enquiry has been received. Our payroll team will contact you within 24 hours.';
        form.reset();
      } else {
        payrollResult.className = 'mt-4 p-4 bg-red-100 border border-red-300 text-red-800 rounded-lg text-center';
        payrollResult.textContent = result.message || 'Failed to submit enquiry. Please try again.';
      }
    } catch (err) {
      console.error(err);
      payrollResult.className = 'mt-4 p-4 bg-red-100 border border-red-300 text-red-800 rounded-lg text-center';
      payrollResult.textContent = 'Network error. Please check your connection and try again.';
    }
  });
}
</script>

<?php include __DIR__ . '/includes/footer.php'; ?>
