<?php
$currentPage  = 'contact';
$pageTitle    = 'Contact Us — Greasely Workshop Management Software';
$pageDesc     = 'Get in touch with the Greasely team. We\'d love to hear from you — whether you have a question, want a demo, or need support.';
$pageKeywords = 'contact greasely, workshop software support, greasely demo, auto repair software help';
include 'includes/header.php';
?>

<!-- Page Hero -->
<section class="page-hero" aria-label="Contact page">
  <div class="container">
    <div class="section-label" style="background:rgba(255,255,255,.15);border-color:rgba(255,255,255,.25);color:#fff;" aria-hidden="true">Contact</div>
    <h1 class="page-hero__title">Get in touch</h1>
    <p class="page-hero__sub">Whether you have a question about features, pricing, or just want to see a demo — we'd love to hear from you.</p>
    <button class="btn btn-white btn-lg" onclick="openTrialModal()">Try Free for 2 Weeks</button>
  </div>
</section>

<section class="section" aria-labelledby="contact-heading">
  <div class="container">
    <div class="contact-grid">

      <!-- Contact info -->
      <aside aria-label="Contact information">
        <h2 class="section-title" id="contact-heading" style="font-size:1.75rem;margin-bottom:12px;">We're real people. Really.</h2>
        <p style="font-size:1rem;color:var(--text-muted);line-height:1.7;margin-bottom:40px;">Our team typically responds within a few hours on business days. We're passionate about helping auto repair workshops get the most from Greasely.</p>

        <div class="contact-info" role="list">
          <div class="contact-info-item" role="listitem">
            <div class="contact-info-item__icon" aria-hidden="true">
              <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/><polyline points="22,6 12,13 2,6"/></svg>
            </div>
            <div>
              <div class="contact-info-item__title">Email us</div>
              <div class="contact-info-item__text"><a href="#contactForm" style="color:var(--primary);">Send us a message</a></div>
            </div>
          </div>

          <div class="contact-info-item" role="listitem">
            <div class="contact-info-item__icon" aria-hidden="true">
              <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
            </div>
            <div>
              <div class="contact-info-item__title">Live chat</div>
              <div class="contact-info-item__text">Available in-app during business hours</div>
            </div>
          </div>

          <div class="contact-info-item" role="listitem">
            <div class="contact-info-item__icon" aria-hidden="true">
              <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
            </div>
            <div>
              <div class="contact-info-item__title">Response time</div>
              <div class="contact-info-item__text">Within a few hours on business days</div>
            </div>
          </div>
        </div>

        <!-- Quick links -->
        <div style="margin-top:48px;padding:24px;background:var(--blue-50);border:1px solid var(--blue-100);border-radius:var(--radius-lg);">
          <h3 style="font-size:1rem;font-weight:700;margin-bottom:16px;">Quick answers</h3>
          <div style="display:flex;flex-direction:column;gap:10px;">
            <a href="/faq.php" style="display:flex;align-items:center;gap:8px;color:var(--primary);font-size:.9375rem;font-weight:500;">
              <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>
              Browse our FAQ
            </a>
            <a href="/features.php" style="display:flex;align-items:center;gap:8px;color:var(--primary);font-size:.9375rem;font-weight:500;">
              <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="9 11 12 14 22 4"/><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"/></svg>
              Explore all features
            </a>
          </div>
        </div>
      </aside>

      <!-- Contact form -->
      <div class="contact-form-card" role="main">
        <h2 style="font-size:1.375rem;font-weight:800;margin-bottom:8px;">Send us a message</h2>
        <p style="font-size:.9375rem;color:var(--text-muted);margin-bottom:28px;">Fill in the form below and we'll get back to you as soon as possible.</p>

        <form id="contactForm" method="post" action="contact-handler.php" novalidate aria-label="Contact form">
          <input type="hidden" name="csrf_token" value="<?= htmlspecialchars(csrf_token()) ?>">
          <!-- Honeypot -->
          <div style="display:none;" aria-hidden="true">
            <label for="hp_url_c">Leave this blank</label>
            <input type="text" name="_url" id="hp_url_c" tabindex="-1" autocomplete="off">
          </div>

          <div class="form-group form-group--row">
            <div>
              <label class="form-label" for="contact_name">Your Name <span class="req" aria-hidden="true">*</span></label>
              <input class="form-input" type="text" id="contact_name" name="name" placeholder="Jane Smith" autocomplete="name" required aria-required="true">
            </div>
            <div>
              <label class="form-label" for="contact_email">Email Address <span class="req" aria-hidden="true">*</span></label>
              <input class="form-input" type="email" id="contact_email" name="email" placeholder="jane@yourworkshop.com" autocomplete="email" required aria-required="true">
            </div>
          </div>

          <div class="form-group">
            <label class="form-label" for="contact_workshop">Workshop Name</label>
            <input class="form-input" type="text" id="contact_workshop" name="workshop" placeholder="e.g. Smiths Auto Repair (optional)" autocomplete="organization">
          </div>

          <div class="form-group">
            <label class="form-label" for="contact_subject">Subject <span class="req" aria-hidden="true">*</span></label>
            <select class="form-select" id="contact_subject" name="subject" required aria-required="true">
              <option value="">Please select a topic…</option>
              <option value="general">General enquiry</option>
              <option value="demo">I'd like to request a demo</option>
              <option value="pricing">Question about pricing</option>
              <option value="features">Question about features</option>
              <option value="support">Technical support</option>
              <option value="billing">Billing question</option>
              <option value="other">Something else</option>
            </select>
          </div>

          <div class="form-group">
            <label class="form-label" for="contact_message">Message <span class="req" aria-hidden="true">*</span></label>
            <textarea class="form-textarea" id="contact_message" name="message" placeholder="Tell us how we can help…" rows="5" required aria-required="true"></textarea>
          </div>

          <!-- Cloudflare Turnstile widget -->
          <div class="cf-turnstile" data-sitekey="<?= htmlspecialchars(TURNSTILE_SITE_KEY) ?>" data-theme="light" style="margin-bottom:16px;"></div>

          <button type="submit" class="btn btn-primary btn-lg btn-full">
            <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>
            Send Message
          </button>
          <p style="font-size:.8125rem;color:var(--text-muted);margin-top:12px;text-align:center;">
            By submitting this form you agree to our <a href="/privacy.php" style="color:var(--primary);">Privacy Policy</a>.
          </p>
        </form>
      </div>

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

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