<?php include 'db.php'; ?>

<nav class="navbar">
    <div class="container">
        <div class="nav-wrapper">

            <!-- LOGO -->
            <div class="logo">
                <a href="index.php">
                    <img src="assets/images/logo4-removebg-preview.png" alt="MK Trading Company Logo">
                </a>
                <h2>TILES AND BATHWARE </h2>
                <p>SHAPING HOMES WITH EXCELLENCE</p>
            </div>

            <!-- NAV MENU -->
            <ul class="nav-menu" id="navMenu">

                <li><a href="index.php">Home</a></li>
                <li><a href="about.php">About Us</a></li>
                <li><a href="gallery.php">Gallery</a></li>

                <!-- SECTORS DROPDOWN -->
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle">
                        Sectors <span class="arrow">▼</span>
                    </a>
                    <ul class="dropdown-menu">
                        <?php
              $categories = $conn->query("SELECT * FROM categories ORDER BY FIELD(title, 'Sanitary', 'Tiles', 'Electrical', 'Plumbing', 'Hardware'), title ASC");

              if ($categories->num_rows > 0):
                while ($cat = $categories->fetch_assoc()):
            ?>
                        <li>
                            <a href="products.php?sector_id=<?= $cat['id'] ?>">
                                <?= htmlspecialchars($cat['title']) ?>
                            </a>
                        </li>
                        <?php
                endwhile;
              else:
            ?>
                        <li><a href="#">No Sectors Found</a></li>
                        <?php endif; ?>
                    </ul>
                </li>

                <li><a href="services.php">Services</a></li>
                <li><a href="offers.php">Offers</a></li>
                <li><a href="careers.php">Careers</a></li>

                <!-- CONTACT DROPDOWN (LINKS TO contact.php) -->
                <li class="dropdown contact-dropdown">
                    <a href="contact.php#contact-branch" class="btn-contact dropdown-toggle">
                        Contact Us <span class="arrow">▼</span>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a href="#" class="branch-option-contact" data-branch="branch1">Cherkala</a></li>
                        <li><a href="#" class="branch-option-contact" data-branch="branch2">Ishwaramangala</a></li>
                    </ul>
                </li>


            </ul>

            <!-- MOBILE MENU -->
            <div class="hamburger" id="hamburger">
                <span></span>
                <span></span>
                <span></span>
            </div>

        </div>
    </div>
</nav>