<?php
include("admin/connection.php");
include('include/header.php');

if (!isset($_GET['slug'])) {
    die("Invalid Request");
}

$slug = mysqli_real_escape_string($con, $_GET['slug']);

$ser = mysqli_query($con, "SELECT * FROM product WHERE slug='$slug'");
$row = mysqli_fetch_assoc($ser);

if (!$row) {
    die("Product not found");
}

$title       = $row['title'];
$slug        = $row['slug'];
$Image       = $row['Image'];
$p_id        = $row['p_id'];
$t_id        = $row['t_id'];
$description = $row['description'];
?>
<style>
    table {
        width: 100%;
        border-collapse: collapse;
        font-family: Arial, sans-serif;
        background: #fff;
    }

    /* ===== TABLE CELLS ===== */
    table th,
    table td {
        padding: 10px 16px;
        color: #000;
        border: 2px solid #000000;
        text-align: left;
        vertical-align: top;
        white-space: normal;
        word-break: break-word;
        font-weight: 600;
    }

    table th {
        background: #f5f5f5;
        font-weight: 700;
    }

    @media (max-width: 768px) {

        table,
        tbody,
        tr,
        td {
            display: block;
            width: 100%;
        }

        thead {
            display: none;
        }

        table {
            border: none;
        }

        tr {
            width: 70%;
            border: 1px solid #ddd;
            overflow: hidden;
            background: #fff;
            display: flex;
        }

        td {
            border: 1px solid #000000 !important;
            border-bottom: none !important;
            padding: 12px 15px;
            position: relative;
        }

        td:last-child {
            border-bottom: none;
        }

        td::before {
            content: attr(data-label);
            display: block;
            font-weight: 700;
            margin-bottom: 5px;
            color: #333;
        }
    }

</style>

<!--Page Header Start-->
<section class="page-header">
    <div class="page-header__bg" style="background-image: url(<?php path() ?>assets/images/backgrounds/page-header-bg.jpg);">
    </div>
    <div class="container">
        <div class="page-header__inner">

            <h3><?php echo $title; ?></h3>
            <div class="thm-breadcrumb__inner">
                <ul class="thm-breadcrumb list-unstyled">
                    <li><a href="<?php path() ?>index.php">Home</a></li>
                    <li><span class="fas fa-angle-right"></span></li>
                    <li><?php echo $title; ?></li>
                </ul>
            </div>
        </div>
    </div>
</section>
<!--Page Header End-->

<!--Start Product Details-->
<section class="product-details">
    <div class="container">
        <div class="row">
            <div class="col-lg-6 col-xl-6">
                <img src="<?php path(); ?>/admin/assets/images/service/<?php echo htmlspecialchars($Image); ?>" alt="" style="width:100%;">
            </div>

            <div class="col-lg-6 col-xl-6">
                <div class="product-details__right">
                    <div class="product-details__top">
                        <h3 class="product-details__title">
                            <?php echo htmlspecialchars($title); ?>
                        </h3>
                    </div>


                    <div class="product-details__content">
                        <p class="product-details__content-text1"><?php echo $description; ?></p>

                    </div>

                    <div class="product-details__inner">


                        <div class="product-details__buttons-boxes">
                            <div class="product-details__buttons-1">
                                <a href="tel:+917303326553" class="thm-btn">Call Now
                                    <span><i class="fa fa-phone"></i></span>
                                </a>
                            </div>
                            <div class="product-details__buttons-2">
                                <a href="" class="thm-btn" data-bs-toggle="modal" data-bs-target="#exampleModal">Get Quote
                                    <span><i class="fa-regular fa-envelope"></i></span>
                                </a>
                            </div>
                           
                        </div>

                    </div>

                </div>
            </div>
        </div>
    </div>
</section>
<!--End Product Details-->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h1 class="modal-title fs-5" id="exampleModalLabel">Get In Touch</h1>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <form class="row g-3">
                    <div class="col-md-12">
                        <label for="inputEmail4" class="form-label">Name</label>
                        <input type="text" class="form-control" name="name" id="inputEmail4">
                    </div>
                    <div class="col-md-12">
                        <label for="inputPassword4" class="form-label">Email</label>
                        <input type="email" class="form-control" name="email" id="inputPassword4">
                    </div>
                    <div class="col-12">
                        <label for="inputAddress" class="form-label">Phone Number</label>
                        <input type="tel" class="form-control" name="phone" id="inputAddress" placeholder="1234*******">
                    </div>
                    <div class="col-12">
                        <label for="inputAddress2" class="form-label">Address</label>
                        <input type="text" class="form-control" name="address" id="inputAddress2" placeholder="Apartment, studio, or floor">
                    </div>
                    <div class="col-md-12">
                        <label for="inputCity" class="form-label">Product Name</label>
                        <input type="text" class="form-control" name="product" value="<?php echo $title; ?>" id="inputCity">
                    </div>
                    <div class="col-12">
                        <button type="submit" class="btn btn-primary">Submit Now</button>
                    </div>
                </form>
            </div>

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

<?php
include("include/footer.php");
?>