<?php
require_once __DIR__ . '/config.php';
$page_title = 'Balimeen Private Limited – Premium Stainless Steel Kitchen Sinks';
$meta_desc  = 'Balimeen Pvt Ltd manufactures premium SS 304 stainless steel kitchen sinks. Factory-direct pricing. Aurangabad, Bihar.';
$db = getDB();

// Fetch featured products
$featured = $db->query("SELECT p.*, c.name AS cat_name FROM products p LEFT JOIN categories c ON p.category_id=c.id WHERE p.is_featured=1 AND p.status='active' LIMIT 8")->fetchAll();

// Fetch all categories
$categories = $db->query("SELECT * FROM categories ORDER BY id")->fetchAll();

// Fetch testimonials
$testimonials = $db->query("SELECT * FROM testimonials WHERE status='active' ORDER BY id LIMIT 6")->fetchAll();

// Handle inquiry form
$form_msg = ''; $form_type = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['inquiry_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! Your inquiry has been received. We will contact you shortly.';
        $form_type = 'success';
    } else {
        $form_msg = '⚠ Please fill in your name and phone number.';
        $form_type = 'error';
    }
}
include __DIR__ . '/includes/header.php';
?>

<!-- Hero Section -->
<section class="hero">
  <div class="hero-bg"><img src="<?= SITE_URL ?>/assets/images/hero_sink.png" alt="Steel Sinks"></div>
  <div class="hero-overlay"></div>
  <div class="container hero-content">
    <div>
      <div class="hero-badge">🏆 &nbsp; India's Premium Steel Sink Manufacturer</div>
      <h1 class="hero-title">Premium <span>Stainless Steel</span><br>Kitchen Sinks</h1>
      <p class="hero-sub">Crafted with precision engineering and premium SS 304 steel. Factory-direct prices. Trusted by thousands of homes and businesses across India.</p>
      <div class="hero-buttons">
        <a href="pages/products.php" class="btn btn-primary">🛒 Explore Products</a>
        <a href="pages/contact.php#inquiry" class="btn btn-outline">📞 Get a Free Quote</a>
      </div>
      <div class="hero-stats">
        <div class="hero-stat"><div class="num" data-target="500" data-suffix="+">0+</div><div class="lbl">Happy Clients</div></div>
        <div class="hero-stat"><div class="num" data-target="15" data-suffix="+">0+</div><div class="lbl">Years Exp.</div></div>
        <div class="hero-stat"><div class="num" data-target="10000" data-suffix="+">0+</div><div class="lbl">Units Sold</div></div>
        <div class="hero-stat"><div class="num" data-target="25" data-suffix="+">0+</div><div class="lbl">States</div></div>
      </div>
    </div>
    <div class="hero-img-wrap">
      <img src="<?= SITE_URL ?>/assets/images/sink_double_bowl.png" alt="Double Bowl Sink">
      <div class="hero-float">
        <div class="tag">Material Grade</div>
        <div class="val">SS 304 / SS 316</div>
      </div>
    </div>
  </div>
</section>

<!-- Features Strip -->
<div class="features-strip">
  <div class="container">
    <div class="feature-item"><div class="icon">🏭</div><div><h4>Factory Direct</h4><p>No middlemen, best prices</p></div></div>
    <div class="feature-item"><div class="icon">🛡️</div><div><h4>ISI Certified</h4><p>Premium quality assured</p></div></div>
    <div class="feature-item"><div class="icon">🚚</div><div><h4>Pan-India Shipping</h4><p>Fast & safe delivery</p></div></div>
    <div class="feature-item"><div class="icon">🔧</div><div><h4>Custom Orders</h4><p>OEM & bulk available</p></div></div>
  </div>
</div>

<!-- Categories -->
<section class="categories-section section-pad">
  <div class="container">
    <div class="text-center" style="margin-bottom:40px;">
      <div class="section-label" style="color:var(--gold);">What We Make</div>
      <h2 class="section-title" style="color:#fff;">Our Product <span style="color:var(--gold);">Categories</span></h2>
    </div>
    <div class="grid-4">
      <?php
      $icons = ['🪣','🔲','⬇️','🏠'];
      foreach ($categories as $i => $cat): ?>
      <a href="pages/products.php?cat=<?= h($cat['slug']) ?>" class="cat-card">
        <div class="cat-icon"><?= $icons[$i % 4] ?></div>
        <h3><?= h($cat['name']) ?></h3>
        <p><?= h($cat['description']) ?></p>
      </a>
      <?php endforeach; ?>
    </div>
  </div>
</section>

<!-- Featured Products -->
<section class="products-section section-pad">
  <div class="container">
    <div style="display:flex;justify-content:space-between;align-items:flex-end;margin-bottom:36px;flex-wrap:wrap;gap:16px;">
      <div>
        <div class="section-label">Top Picks</div>
        <h2 class="section-title">Featured <span>Products</span></h2>
        <p class="section-desc">Premium quality sinks for every kitchen style and budget.</p>
      </div>
      <a href="pages/products.php" class="btn btn-primary">View All Products →</a>
    </div>
    <div class="products-grid">
      <?php foreach ($featured as $p): ?>
      <div class="product-card" data-cat="<?= h($p['cat_name']) ?>" onclick="window.location='pages/product.php?slug=<?= h($p['slug']) ?>'">
        <div class="product-card-img">
          <img src="<?= SITE_URL ?>/assets/images/<?= h($p['image']) ?>" alt="<?= h($p['name']) ?>" loading="lazy">
          <?php if ($p['is_featured']): ?>
          <span class="product-badge">⭐ Featured</span>
          <?php endif; ?>
        </div>
        <div class="product-card-body">
          <h3><?= h($p['name']) ?></h3>
          <p><?= h($p['short_desc']) ?></p>
          <div class="product-card-meta">
            <div class="product-price">₹<?= number_format($p['price']) ?> <span>onwards</span></div>
            <a href="pages/product.php?slug=<?= h($p['slug']) ?>" class="btn btn-primary btn-sm" onclick="event.stopPropagation()">View →</a>
          </div>
        </div>
      </div>
      <?php endforeach; ?>
    </div>
  </div>
</section>

<!-- About Section -->
<section class="about-section section-pad">
  <div class="container">
    <div class="grid-2" style="gap:60px;align-items:center;">
      <div class="about-img">
        <img src="<?= SITE_URL ?>/assets/images/about_factory.png" alt="Our Factory" style="width:100%;height:100%;object-fit:cover;">
      </div>
      <div class="about-content">
        <div class="section-label">Who We Are</div>
        <h2 class="section-title">About <span>Balimeen</span><br>Private Limited</h2>
        <p style="color:var(--text-light);margin-bottom:16px;">A leading manufacturer of premium stainless steel kitchen sinks based in Aurangabad, Bihar. Our state-of-the-art factory produces top-quality sinks using SS 304 and SS 316 steel, meeting the highest industry standards.</p>
        <ul class="about-list">
          <li>Over 15 years of manufacturing excellence</li>
          <li>SS 304 &amp; SS 316 marine-grade steel</li>
          <li>Anti-noise sound deadening technology</li>
          <li>Rust-proof &amp; scratch-resistant finish</li>
          <li>Factory-direct pricing for dealers &amp; builders</li>
          <li>Pan-India distribution network</li>
        </ul>
        <div class="about-stats">
          <div class="about-stat"><div class="num" data-target="500" data-suffix="+">0+</div><div class="lbl">Satisfied Clients</div></div>
          <div class="about-stat"><div class="num" data-target="15" data-suffix=" Years">0</div><div class="lbl">Experience</div></div>
          <div class="about-stat"><div class="num" data-target="10000" data-suffix="+">0+</div><div class="lbl">Units Sold</div></div>
          <div class="about-stat"><div class="num" data-target="25" data-suffix="+">0+</div><div class="lbl">States</div></div>
        </div>
        <div style="margin-top:24px;display:flex;gap:14px;flex-wrap:wrap;">
          <a href="pages/about.php" class="btn btn-primary">Learn More</a>
          <a href="pages/contact.php" class="btn btn-outline" style="color:var(--blue-main);border-color:var(--blue-main);">Contact Us</a>
        </div>
      </div>
    </div>
  </div>
</section>

<!-- Why Choose Us -->
<section class="why-section section-pad">
  <div class="container">
    <div class="text-center" style="margin-bottom:40px;">
      <div class="section-label">Our Edge</div>
      <h2 class="section-title">Why Choose <span>Balimeen?</span></h2>
    </div>
    <div class="why-grid">
      <div class="why-card"><div class="why-icon">🏭</div><h3>Direct Manufacturing</h3><p>We manufacture every sink in our own factory, ensuring quality control and factory-direct pricing without markup.</p></div>
      <div class="why-card"><div class="why-icon">⚙️</div><h3>Premium SS 304 Steel</h3><p>All our sinks use food-grade stainless steel (SS 304 / SS 316), ensuring longevity, hygiene and corrosion resistance.</p></div>
      <div class="why-card"><div class="why-icon">🔇</div><h3>Anti-Noise Technology</h3><p>Built-in sound deadening pads reduce noise from water and utensils, making your kitchen a quieter place.</p></div>
      <div class="why-card"><div class="why-icon">💰</div><h3>Competitive Pricing</h3><p>Factory prices with bulk discounts available for dealers, contractors, and builders across India.</p></div>
      <div class="why-card"><div class="why-icon">🚚</div><h3>Pan-India Delivery</h3><p>We ship to all major states across India with secure packaging and timely delivery guaranteed.</p></div>
      <div class="why-card"><div class="why-icon">🛠️</div><h3>After-Sales Support</h3><p>Dedicated customer support team for installation guidance and after-sales service queries.</p></div>
    </div>
  </div>
</section>

<!-- Testimonials -->
<?php if ($testimonials): ?>
<section class="testimonials-section section-pad">
  <div class="container">
    <div class="text-center" style="margin-bottom:40px;">
      <div class="section-label">Happy Customers</div>
      <h2 class="section-title">What Our Clients <span>Say</span></h2>
    </div>
    <div class="testimonials-grid">
      <?php foreach ($testimonials as $t): ?>
      <div class="testi-card">
        <div class="stars"><?= str_repeat('⭐', (int)$t['rating']) ?></div>
        <p>"<?= h($t['message']) ?>"</p>
        <div class="testi-author">
          <div class="testi-avatar"><?= strtoupper(substr($t['name'],0,1)) ?></div>
          <div>
            <div class="testi-name"><?= h($t['name']) ?></div>
            <div class="testi-co"><?= h($t['company']) ?>, <?= h($t['city']) ?></div>
          </div>
        </div>
      </div>
      <?php endforeach; ?>
    </div>
  </div>
</section>
<?php endif; ?>

<!-- CTA / Quick Inquiry -->
<section class="contact-section section-pad" id="inquiry">
  <div class="container">
    <div class="contact-grid">
      <div class="contact-info">
        <div class="section-label">Get In Touch</div>
        <h2 class="section-title">Request a <span>Free Quote</span></h2>
        <p class="section-desc" style="margin-bottom:28px;">Fill the form and our team will get back to you within 24 hours with the best prices.</p>
        <div class="contact-item">
          <div class="contact-icon">📍</div>
          <div><h4>Factory Address</h4><p><?= SITE_ADDRESS ?></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>
      <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 Your Inquiry</h3>
        <form method="POST" action="#inquiry">
          <input type="hidden" name="inquiry_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 Name"></div>
          </div>
          <div class="form-group"><label>Message / Requirements</label><textarea name="message" placeholder="Tell us about your requirements (product type, quantity, etc.)"></textarea></div>
          <button type="submit" class="btn btn-primary" style="width:100%;justify-content:center;">📨 Send Inquiry</button>
        </form>
      </div>
    </div>
  </div>
</section>

<section class="cta-section">
  <div class="container">
    <h2>Ready to Order? Call Us Now!</h2>
    <p>Get the best factory prices on premium stainless steel kitchen sinks.</p>
    <div style="display:flex;gap:16px;justify-content:center;flex-wrap:wrap;">
      <a href="tel:+917870626467" class="btn btn-gold">📞 +91 78706 26467</a>
      <a href="tel:+919661427644" class="btn btn-outline">📞 +91 96614 27644</a>
    </div>
  </div>
</section>

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