<?php
require_once __DIR__ . '/../config.php';
$db = getDB();
$form_msg = ''; $form_type = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['contact_form'])) {
    $name    = trim($_POST['name'] ?? '');
    $phone   = trim($_POST['phone'] ?? '');
    $email   = trim($_POST['email'] ?? '');
    $company = trim($_POST['company'] ?? '');
    $message = trim($_POST['message'] ?? '');
    if ($name && $phone) {
        $stmt = $db->prepare("INSERT INTO inquiries (name,email,phone,company,message) VALUES (?,?,?,?,?)");
        $stmt->execute([$name, $email, $phone, $company, $message]);
        $form_msg = '✅ Thank you! We\'ve received your message and will reply within 24 hours.';
        $form_type = 'success';
    } else { $form_msg = '⚠ Name and phone are required.'; $form_type = 'error'; }
}
$page_title = 'Contact Us | Balimeen Private Limited';
include __DIR__ . '/../includes/header.php';
?>
<div class="page-hero">
  <div class="container">
    <h1>Contact Us</h1>
    <p>Reach out for product inquiries, pricing, and bulk orders.</p>
    <div class="breadcrumb"><a href="<?= SITE_URL ?>">Home</a> → Contact</div>
  </div>
</div>

<section class="contact-section section-pad" id="inquiry">
  <div class="container">
    <div class="contact-grid">
      <div class="contact-info">
        <div class="section-label">Reach Us</div>
        <h2 class="section-title">Get In <span>Touch</span></h2>
        <p class="section-desc" style="margin-bottom:28px;">We'd love to hear from you. Send us a message or call directly.</p>
        <div class="contact-item"><div class="contact-icon">📍</div><div><h4>Factory &amp; Office Address</h4><p>Plot No-1695, Darzi Bigha, Umga, Madanpur,<br>Aurangabad (Bihar) – 824208</p></div></div>
        <div class="contact-item"><div class="contact-icon">👤</div><div><h4>Director – Rituraj Sharma</h4><a href="tel:+917870626467">+91 78706 26467</a></div></div>
        <div class="contact-item"><div class="contact-icon">🏭</div><div><h4>Plant Manager – Amresh Sharma</h4><a href="tel:+919661427644">+91 96614 27644</a></div></div>
        <div class="contact-item"><div class="contact-icon">📧</div><div><h4>Email</h4><a href="mailto:info@balimeen.com">info@balimeen.com</a></div></div>
        <div class="contact-item"><div class="contact-icon">🏛️</div><div><h4>GSTIN</h4><p>10AAOCB2122R1ZO</p></div></div>
        <div style="margin-top:28px;padding:20px;background:var(--blue-dark);border-radius:12px;color:#fff;">
          <h4 style="font-family:'Outfit',sans-serif;margin-bottom:8px;font-size:1rem;">Business Hours</h4>
          <p style="font-size:.87rem;color:rgba(255,255,255,.7);">Monday – Saturday: 9:00 AM – 6:00 PM<br>Sunday: By Appointment</p>
        </div>
      </div>
      <div class="contact-form">
        <?php if ($form_msg): ?>
        <div class="alert alert-<?= $form_type ?>"><?= $form_msg ?></div>
        <?php endif; ?>
        <h3 style="font-family:'Outfit',sans-serif;font-size:1.2rem;font-weight:700;color:var(--blue-dark);margin-bottom:20px;">Send Us a Message</h3>
        <form method="POST" action="#inquiry">
          <input type="hidden" name="contact_form" value="1">
          <div class="form-row">
            <div class="form-group"><label>Your Name *</label><input type="text" name="name" placeholder="Full Name" required></div>
            <div class="form-group"><label>Phone Number *</label><input type="tel" name="phone" placeholder="+91 XXXXX XXXXX" required></div>
          </div>
          <div class="form-row">
            <div class="form-group"><label>Email Address</label><input type="email" name="email" placeholder="email@example.com"></div>
            <div class="form-group"><label>Company / Business</label><input type="text" name="company" placeholder="Your Company"></div>
          </div>
          <div class="form-group"><label>Message / Requirements</label><textarea name="message" placeholder="Describe your requirements (product type, quantity, customization, etc.)"></textarea></div>
          <button type="submit" class="btn btn-primary" style="width:100%;justify-content:center;font-size:1rem;padding:14px;">📨 Send Message</button>
        </form>
      </div>
    </div>
  </div>
</section>

<!-- Map embed placeholder -->
<div style="background:var(--blue-dark);padding:6px 0;text-align:center;">
  <iframe src="https://maps.google.com/maps?q=Aurangabad+Bihar+India&output=embed&z=11"
    width="100%" height="350" frameborder="0" style="border:0;display:block;" allowfullscreen loading="lazy"></iframe>
</div>

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