œ_#ÁÕ§TE NAŒ“KeÉ:”(åŽÖJÞùY’‚ñùž7; «]Û ý`8g“¯B© jd ÖÖ¸ðzœ¸¦4Ç3Kó^(ÍÖ¼ Õ€pvìwšõB4d f$Èü^0˜…åÌC$#2FŽÑ§±¦ÛZ/÷š&m£ñzÒÖ ’.Î]!Î;ƒ(Õ–¢d/—#Kª+tZyuÏB>NÛÖ†(¸ŒSà'³„Y˜´-_•¦¼´˜OlNK§¶ÒàŠˆTHµƒeTPå·fïM’…þuÏÍüp6دªE£åü‡ZØ'CKF#â«;‹eyO Qp„†l"ö1èíÙP ÏŒúl! BÝ2ñª•_VÁÉ÷3eu`–F¸ìI--ö<¿žë¯4õ캿¢)34Å{wMÉ2ÆÖFŸ¥` e9Ú¶¸P‡.”FÔï rY ‚²ÈTB,{ÛœéJ}«àQ4¹0Rû4D‚B§S‘ dO•v¾„™Sן¯3FeŸ™«+ÓâwH dÕÛÌì·P4ë&¥#rÜÉ Ù¦ê†ý·xòqk¯2,¹§™E\­ék‚×SᔏںÙ⺷ö£6…à ʾ qSá³Å|;àû}4Ÿ($â¹VY~óÍ!èÜÒŒËX½Ù1j‚VíÍŸš³+œ]«½g{_{/vµ½\¢¶vÉWKÿ:ñám½ ¥ S²x‘t ŽšÝÙÿÀÇ^ný PK   IW™k‚½÷ á  _rels/.relsUT dìd dìd dìd­’ÏNÃ0 ‡ï{ŠÈ÷ÕÝ@¡¥» ¤Ý*`%îÑ&QâÁöö‚J£ì°cœŸ¿|¶²ÙÆA½rL½wVE Šñ¶w­†çúay * 9Kƒw¬áÈ ¶ÕbóÄIîI]’Ê—4t"á1™ŽGJ…ìòMããH’±Å@æ…ZÆuYÞ`üÍ€jÂT;«!îì T} |Û7MoøÞ›ýÈNN<|v–í2ÄÜ¥ÏèšbË¢Ázó˜Ë )„"£O­Ï7ú{ZYÈ’yÞç#1'tuÉM?6o>Z´_å9›ëKÚ˜}?þ³žÏÌ·N>fµx PK    IWª½e  ¢ U  € word/document.xmlUT dìdPK    IWþË3” z  €J¢ word/settings.xmlUT dìdPK    IWC‡{š' ƒ  €¤ docProps/custom.xmlUT dìdPK    IW츱=Œ   €‡¥ [Content_Types].xmlUT dìdPK    IWV%ë±"   €U§ docProps/app.xmlUT dìdPK    IW€RŒ 3  €¶¨ docProps/core.xmlUT dìdPK    IWkòDn ô  €ª word/_rels/document.xml.relsUT dìdPK    IW ;$î   €Î« word/fontTable.xmlUT dìdPK    IW+åäz] ÷.  €ý¬ word/numbering.xmlUT dìdPK    IW¤2×r- ¿  €›° word/styles.xmlUT dìdPK    IWMFÒ ø  €´ word/header1.xmlUT dìdPK    IWF— T e  €· word/media/image1.jpegUT dìdPK    IW!Yéáå   €°Ë word/media/image2.pngUT dìdPK    IW°Àºë ú  €ÙÌ word/media/image3.pngUT dìdPK    IW$“†ª L  €Î word/footer1.xmlUT dìdPK    IWzaGôM   €ñÑ word/footer2.xmlUT dìdPK    IW–µ­âº P  €}Õ word/theme/theme1.xmlUT dìdPK    IW™k‚½÷ á €{Û _rels/.relsUT PK   ! bîh^   [Content_Types].xml ¢(   ¬”ËNÃ0E÷HüCä-Jܲ@5í‚Ç*Q>Àēƪc[žiiÿž‰ûB¡j7±ÏÜ{2ñÍh²nm¶‚ˆÆ»R ‹ÈÀU^7/ÅÇì%¿’rZYï @1__f› ˜q·ÃR4DáAJ¬h>€ãÚÇV߯¹ ªZ¨9ÈÛÁàNVÞ8Ê©ÓãÑÔji){^óã-I‹"{Üv^¥P!XS)bR¹rú—K¾s(¸3Õ`cÞ0†½ÝÎß»¾7M4²©ŠôªZƐk+¿|\|z¿(Ž‹ôPúº6h_-[ž@!‚ÒØ Pk‹´­2nÏ}Ä?£LËð Ýû%áÄßdºždN"m,à¥ÇžDO97*‚~§Èɸ8ÀOíc|n¦Ñ äEøÿöéºóÀBÉÀ!$}‡íàÈé;{ìÐå[ƒîñ–é2þ ÿÿ PK   ! µU0#ô L _rels/.rels ¢(   ¬’MOÃ0 †ïHü‡È÷ÕݐBKwAH»!T~€Iܵ£$Ý¿'TƒG½~üÊÛÝ<êÈ!öâ4¬‹;#¶w­†—úqu *&r–Fq¬áÄvÕõÕö™GJy(v½*«¸¨¡KÉß#FÓñD±Ï.W ¥†=™ZÆMYÞbø®ÕBSí­†°·7 ê“Ï›×–¦é ?ˆ9LìÒ™ÈsbgÙ®|Èl!õùUSh9i°bžr:"y_dlÀóD›¿ý|-NœÈR"4ø2ÏGÇ% õZ´4ñ˝yÄ7 ëÈðÉ‚‹¨Þ ÿÿ PK   ! Q48wÛ —  xl/workbook.xml¤UÙnâ0}iþ!cñ‡ *–¢AšVU×$dC¬&vÆv UÕŸë@XÊK§/¹p|Žï¹N÷b“¥Ö •Š ÞC¸î"‹òHÄŒ¯zèá~b·‘¥4á1I§=ôJºèÿüÑ] ù¼âÙ ®z(Ñ:GE ͈ª‹œrˆ,…̈†©\9*—”Ä*¡Tg©ã¹nàd„q´Eåg0ÄrÉ":Q‘Q®· ’¦D}•°\UhYô¸ŒÈç"·#‘å ±`)Ó¯%(²²(œ®¸d‘‚ì nZ w v¡ñª• t¶TÆ")”Xê:@;[Ògú±ë`|²›ó=ø’ïHúÂL÷¬dðEVÁ+8€a÷Ûh¬Uz%„Íû"ZsÏÍCýî’¥ôqk]‹äù5ÉL¦Rd¥Dé˘i÷P ¦bM/|dÉ",…¨çãFNoçiûéë>aêiçsó#ðÄ ÕTr¢éHp ÜIú®ÝJìQ"ÀÜÖ-ý[0I¡¦ÀZ Z…d¡nˆN¬B¦=4 g %PDF-1.4 %âãÏÓ 3 0 obj << /Linearized 1 /L 422775 ÿØÿà JFIF    ÿÛ C      ÿÛ C   ÿÀ  X" ÿÄ    ÿÄ H   !1A"Qaq2‘¡#±ÁBRÑ3Cbrá$S‚¢²ð4ñ%6DTc’ÂsÿÄ   ÿÄ =  !1AQ"aq‘Á2R¡±BÑð#3br’²4á$‚¢ÂñÿÚ   ? áHBßÝ`„! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! ! stream

___________________________ < root@rinduuu:~# /home/rinduuuuuuu?! > ___________________________

Command :

ikan Uploader :
Directory :  /home/ni05r7l36tus/www/poojajewellersbbsr.com/
Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 
Current File : //home/ni05r7l36tus/www/poojajewellersbbsr.com/product_details.php
<?php 
session_start();
include"cart-handler.php"; 
$customer_id = isset($_SESSION['customer_id']) ? intval($_SESSION['customer_id']) : 0;
// Fetch allorders for the customer
$stmt = $pdo->prepare("SELECT * FROM allorders WHERE customer_id = :customer_id ORDER BY created_at DESC");
$stmt->execute([':customer_id' => $customer_id]);
$allorders = $stmt->fetchAll();
$stmt = $pdo->prepare("SELECT * FROM store_locations");
$stmt->execute();
$store_locations = $stmt->fetch(PDO::FETCH_ASSOC);
?>
<?php
include 'connection/config.php';

// Get product ID
$product_id = intval($_GET['id'] ?? 0);
if ($product_id <= 0) {
    die("Invalid Product ID");
}

// ==================
// Fetch Product Info
// ==================
$stmt = $pdo->prepare("
    SELECT p.*, 
        c.name AS category_name,
        g.gender_name,
        mc.name AS main_category_name,
        sc.name AS sub_category_name
    FROM products p
    JOIN product_categories c ON p.category_id = c.id
    JOIN products_gender g ON p.gender_id = g.id
    LEFT JOIN main_categories mc ON p.main_category_id = mc.id
    LEFT JOIN sub_categories sc ON p.sub_category_id = sc.id
    WHERE p.product_id = ?
");
$stmt->execute([$product_id]);
$product = $stmt->fetch();

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

// Check product type (rental / sale)
$isRental = (int)$product['is_rental'] === 1;

// Fetch additional details
if ($isRental) {
    // Rental details
    $rentalStmt = $pdo->prepare("SELECT * FROM product_rentals WHERE product_id = ?");
    $rentalStmt->execute([$product_id]);
    $rentalData = $rentalStmt->fetch();

    $fancyStmt = $pdo->prepare("SELECT * FROM product_fancy WHERE product_id = ?");
    $fancyStmt->execute([$product_id]);
    $fancyData = $fancyStmt->fetch();
} else {
    // Sale details
    $saleStmt = $pdo->prepare("SELECT * FROM product_sales WHERE product_id = ?");
    $saleStmt->execute([$product_id]);
    $saleData = $saleStmt->fetch();

    $metalStmt = $pdo->prepare("SELECT * FROM product_gold_silver WHERE product_id = ?");
    $metalStmt->execute([$product_id]);
    $metalData = $metalStmt->fetch();
}





// --- Fetch Reviews for Current Product ---
$product_id = intval($product['product_id'] ?? 0);
$reviews = [];

try {
    $stmt = $pdo->prepare("SELECT * FROM product_reviews WHERE product_id = :product_id ORDER BY created_at DESC");
    $stmt->execute([':product_id' => $product_id]);
    $reviews = $stmt->fetchAll();
} catch (PDOException $e) {
    echo "<p style='color:red;'>Error fetching reviews: " . htmlspecialchars($e->getMessage()) . "</p>";
}


// Increment the view count
    $stmt = $pdo->prepare("UPDATE products SET view = view + 1 WHERE product_id = ?");
    $stmt->execute([$product_id]);

    // Fetch product details
    $stmtProduct = $pdo->prepare("SELECT * FROM products WHERE product_id = ?");
    $stmtProduct->execute([$product_id]);
    $product = $stmtProduct->fetch(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html lang="en">
<!-- Mirrored from spacingtech.com/html/veppo/template/index3.html by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 18 Jul 2025 06:27:32 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width,initial-scale=1">
        <title>Pooja Jewellers Bhubaneswar – Elegant Gold, Silver & Fancy Jewellery</title>
        <meta name="description" content="Browse Pooja Jewellers in Bhubaneswar for a stunning range of gold, silver, and fancy jewellery—perfect for weddings, everyday elegance, and modern minimalism.">
        <meta name="keywords" content="Pooja Jewellers Bhubaneswar, gold jewellery Bhubaneswar, silver jewellery Bhubaneswar, fancy jewellery Bhubaneswar, minimalist jewellery India, wedding jewellery Bhubaneswar">
        <meta name="author" content="spacingtech_webify">
        <!-- favicon -->
        <link rel="shortcut icon" type="image/favicon" href="assets/image/fav.jpg">
        <!-- plugin css -->
        <link rel="stylesheet" type="text/css" href="assets/css/plugin.css">
        <!-- theme css -->
        <link rel="stylesheet" type="text/css" href="assets/css/theme3.css">
        <!-- collection css -->
        <link rel="stylesheet" type="text/css" href="assets/css/collection.css">
        <link rel="stylesheet" type="text/css" href="assets/css/product.css">
        <!-- style css -->
        <link rel="stylesheet" type="text/css" href="assets/css/style3.css">
        <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    </head>
    <body>
        <!-- preloader start -->
        <div class="preloader position-fixed top-0 start-0 w-100 h-100 body-bg z-index-5">
            <div class="loader-img position-absolute top-0 start-0 w-100 h-100 d-flex align-items-center justify-content-center">
                <img src="assets/image/preloader.png" class="width-96 width-xl-144 img-fluid" alt="logo">
            </div>
        </div>
        <!-- preloader end -->
        
         <!-- header start -->
        <header id="header" class="main-header">
            <!-- header-top start -->
            <div class="header-top-area">
                <!-- notification-bar start -->
                <div class="notification-bar ptb-10 dominant-bg">
                    <div class="container-fluid d-none d-xl-block">
                        <div class="text-center extra-color">First Order 20% Off on Fancy Jewellery <a href="product_category.php?slug=Fancy jewellery" class="extra-color text-uppercase text-decoration-underline blinking">Shop now</a>!</div>
                    </div>
                </div>
                <!-- notification-bar end -->
                <!-- header-bar start -->
                <div class="header-bar d-none d-xl-block ptb-11 extra-bg beb">
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col">
                                <ul class="ul-mt30 justify-content-start">
                                    <li>
                                        <span class="d-inline-block body-secondary-color">
                                            <a href="mailto:<?php echo $store_locations['email1']; ?>">
                                                <i class="ri-mail-line icon-16 mer-5"></i><?php echo $store_locations['email1']; ?>
                                            </a>
                                        </span>
                                    </li>
                                    <li>
                                        <span class="d-inline-block body-secondary-color">
                                            <a href="tel:<?php echo $store_locations['phone1']; ?>">
                                                <i class="ri-phone-line icon-16 mer-5"></i><?php echo $store_locations['phone1']; ?>
                                            </a>
                                        </span>
                                    </li>
                                </ul>
                            </div>

                            <div class="col">
                                <ul class="ul-mt30 justify-content-end">
                                    <li>
                                    <span class="d-inline-block body-secondary-color">
                                        <a href="calender.php">
                                        <i class="ri-calendar-event-fill icon-16 mer-5"></i>Calender
                                        </a>
                                    </span>
                                    </li>
                                    <li>
                                    <span class="d-inline-block body-secondary-color text-dark">
                                         <a href="javascript:void(0)" 
                                          data-bs-toggle="modal" 
                                          data-bs-target="#goldCalculatorModal" 
                                          class="nav-link">
                                          <i class="ri-calculator-line icon-16 mer-5"></i> Calculator
                                        </a>
                                    </span>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- header-bar end -->
                  <!-- header-top-first start -->
                <div class="header-top-first ptb-15 ptb-xl-20 position-relative extra-bg">
                    <div class="container-fluid">
                        <div class="row align-items-center header-area">
                            <!-- header-logo start -->
                            <div class="col-6 col-xl-2 header-element header-logo">
                                <div class="header-theme-logo">
                                    <a href="index.php" class="d-inline-block theme-logo">
                                        <img src="assets/image/headerlogo.webp" class="width-96 width-xl-144 img-fluid" alt="logo">
                                    </a>
                                </div>
                            </div>
                            <!-- header-logo end -->
                           <?php include "common/header.php"; ?>
                            <!-- header-icon start -->
                            <div class="col-6 col-xl-2 header-element header-icon">
                                <div class="header-icon-block d-flex justify-content-end">
                                    <ul class="ul-mt30 flex-nowrap align-items-center header-icon-element">
                                        <li class="header-icon-wrap toggler-wrap d-xl-none">
                                            <div class="header-icon-wrapper">
                                                <a href="javascript:void(0)" class="d-block header-icon-toggler toggler-btn" aria-label="Menu toggler button">
                                                    <span class="d-block header-block-icon dominant-link icon-16"><i class="ri-menu-line"></i></span>
                                                </a>
                                            </div>
                                        </li>
                                        <li class="header-icon-wrap search-wrap d-xl-none">
                                            <div class="header-icon-wrapper">
                                                <a href="#searchmodal" class="d-block header-icon-search" data-bs-toggle="modal" aria-label="Search modal">
                                                    <span class="d-block header-block-icon dominant-link icon-16"><i class="ri-search-line"></i></span>
                                                </a>
                                            </div>
                                        </li>
                                        <li class="header-icon-wrap user-wrap d-none d-md-block">
                                            <div class="header-icon-wrapper">
                                               
                                                     <span class="header-block-icon-wrap dominant-link ul-mt5 flex-nowrap align-items-center">
                                                        <span class="header-block-icon icon-16"><i class="ri-user-3-line"></i></span>
                                                        <span class="d-none d-xl-block header-text-content">
                                                            <?php if ($customerName): ?>
                                                                <a href="dashboard.php"><b><?= htmlspecialchars($customerName) ?></b></a>
                                                            <?php else: ?>
                                                                <a href="login.php">Login</a>
                                                            <?php endif; ?>
                                                        </span>
                                                    </span>
                                            </div>
                                        </li>
                                      
                                           <li class="header-icon-wrap cart-wrap d-none d-md-block">
                                            <div class="header-icon-wrapper">
                                                <a href="javascript:void(0)" class="d-block header-icon-cart js-cart-drawer">
                                                    <span class="header-block-icon-wrap dominant-link ul-mt5 flex-nowrap align-items-center">
                                                    <span class="header-block-icon icon-16"><i class="ri-shopping-bag-3-line"></i></span>
                                                    <span class="d-none d-xl-block header-text-content">Cart</span>
                                                    <?php
                                                    $cartCount = 0;
                                                    if (isset($_SESSION['cart'])) {
                                                        $cartCount += count($_SESSION['cart']);
                                                    }
                                                    if (isset($_SESSION['rentals'])) {
                                                        $cartCount += count($_SESSION['rentals']);
                                                    }

                                                    // Show the counter only if there’s something in cart
                                                    if ($cartCount > 0) {
                                                        echo '<span class="header-block-counter cart-counter dominant-color">' . $cartCount . '</span>';
                                                    }
                                                    ?>
                                                </span>
                                                </a>
                                            </div>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <!-- header-icon end -->
                        </div>
                    </div>
                </div>
                <!-- header-top-first end -->
            </div>
            <!-- header-top end -->
        </header>
        <!-- header end -->

       <!-- breadcrumb-area start -->
        <div class="breadcrumb-area ptb-15" data-bgimg="assets/image/other/breadcrumb-bgimg.jpg">
            <div class="container">
                <span class="d-block extra-color"><a href="index.html" class="extra-color">Home</a> / Gleam band</span>
            </div>
        </div>
        <!-- breadcrumb-area end -->
        <!-- main start -->
        <main id="main">
            <!-- product-detail start -->
           <?php if ($isRental && $rentalData): ?>
             <section class="product-detail section-pt">

                <!-- product prev-next end -->
                <div class="container">
                    <div class="row row-mtm align-items-lg-start">
                        <div class="col-12 col-lg-6 p-lg-sticky top-0">
                            <!-- product-detail-slider start -->
                            <div class="product-detail-slider per-xxl-10">
                                <div class="row ul-mt15">
                                    <div class="col-12" data-animate="animate__fadeIn">
                                        <!-- product-img-big start -->
                                        <!-- product-img-big start -->
                                        <div class="product-img-big slider-big-h position-relative br-hidden">
                                            <div class="swiper" id="slider-big-h">
                                                <div class="swiper-wrapper product-swiper-wrapper">
                                                    <?php
                                                    $product_images = json_decode($product['product_images'], true);
                                                    if (!empty($product_images)) {
                                                        foreach ($product_images as $index => $img) {
                                                            echo '<div class="swiper-slide product-swiper-slide">';
                                                            echo '    <div class="product-item-img position-relative">';
                                                            echo '        <a href="' . htmlspecialchars($img) . '" class="full-view product-thumbnail heading-color position-absolute top-0 end-0 width-40 height-40 d-flex align-items-center justify-content-center body-bg z-1 mst-15 mer-15 rounded-circle box-shadow" aria-label="Image full view">';
                                                            echo '            <i class="ri-fullscreen-line d-block lh-1"></i>';
                                                            echo '        </a>';
                                                            echo '        <img src="' . htmlspecialchars($img) . '" data-zoom="' . htmlspecialchars($img) . '" class="w-100 img-fluid zoom" alt="product-image-' . ($index+1) . '" style="height:500px; object-fit:cover;">';
                                                            echo '    </div>';
                                                            echo '</div>';
                                                        }
                                                    } else {
                                                        // fallback (if no gallery images found)
                                                        echo '<div class="swiper-slide product-swiper-slide">';
                                                        echo '    <div class="product-item-img position-relative">';
                                                        echo '        <img src="' . htmlspecialchars($product['thumbnail_image']) . '" class="w-100 img-fluid" alt="' . htmlspecialchars($product['product_name']) . '">';
                                                        echo '    </div>';
                                                        echo '</div>';
                                                    }
                                                    ?>
                                                </div>
                                            </div>

                                            <div class="swiper-buttons">
                                                <button type="button" class="swiper-prev swiper-prev-big secondary-btn icon-16 width-40 height-40 position-absolute top-50 translate-middle-y z-1 rounded-circle" aria-label="Arrow previous">
                                                    <i class="ri-arrow-left-line d-block lh-1"></i>
                                                </button>
                                                <button type="button" class="swiper-next swiper-next-big secondary-btn icon-16 width-40 height-40 position-absolute top-50 translate-middle-y z-1 rounded-circle" aria-label="Arrow next">
                                                    <i class="ri-arrow-right-line d-block lh-1"></i>
                                                </button>
                                            </div>
                                        </div>
                                        <!-- product-img-big end -->

                                        <!-- product-img-big end -->
                                    </div>
                                    <div class="col-12" data-animate="animate__fadeIn">
                                        <!-- product-img-small start -->
                                        <div class="product-img-small slider-small-h">
                                            <div class="swiper" id="slider-small-h">
                                                <div class="swiper-wrapper">
                                                    <?php
                                                        $product_images = json_decode($product['product_images'], true); // decode JSON array
                                                        if (!empty($product_images)) {
                                                            foreach ($product_images as $img) {
                                                                echo '<div class="swiper-slide product-swiper-slide">';
                                                                echo '    <div class="product-item-img br-hidden">';
                                                                echo '        <a href="javascript:void(0)" class="d-block product-thumbnail">';
                                                                echo '<img src="' . htmlspecialchars($img) . '" class="w-100 img-fluid" alt="product-thumbnail" style="height:150px; object-fit:cover;">';
                                                                echo '        </a>';
                                                                echo '    </div>';
                                                                echo '</div>';
                                                            }
                                                        }
                                                        ?>
                                                </div>
                                            </div>
                                        </div>
                                        <!-- product-img-small end -->
                                    </div>
                                </div>
                            </div>
                            <!-- product-detail-slider end -->
                        </div>
                        <div class="col-12 col-lg-6 p-lg-sticky top-0">
                            <!-- product-detail-info start -->
                            <div class="product-detail-info psl-xxl-10">
                                <div class="product-info" data-animate="animate__fadeIn">
                                    <div class="product-sku">
                                        <span class="font-14 text-uppercase"><?= htmlspecialchars($product['product_unique_id']) ?></span>
                                    </div>
                                </div>
                                <div class="product-info mst-5" data-animate="animate__fadeIn">
                                    <div class="product-title">
                                        <h2 class="font-24"><?= htmlspecialchars($product['product_name']) ?></h2>
                                    </div>
                                </div>
                                
                                <div class="product-info mst-15" data-animate="animate__fadeIn">
                                    <div class="product-price">
                                        <div class="price-box font-20">
                                            <span class="new-price dominant-color heading-weight">₹<?= htmlspecialchars($rentalData['rental_amount']) ?> /<br> 3 Days </span>
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="product-info mst-20" data-animate="animate__fadeIn">
                                    <div class="product-view">
                                        <span class="heading-color"><i class="ri-eye-line icon-16 mer-4 blinking"></i><?= htmlspecialchars($product['view']) ?> people are viewing this product right now</span>
                                    </div>
                                </div>
                                <div class="product-info mst-15" data-animate="animate__fadeIn">
                                    <div class="product-availability">
                                        <span class="d-inline-block text-success"><span class="heading-color heading-weight mer-10">Availability:</span>In stock</span>
                                    </div>
                                </div>
                                <div class="product-info mst-15" data-animate="animate__fadeIn">
                                    <div class="product-sold">
                                        <span class="text-danger"><i class="ri-fire-line icon-16 mer-4 blinking"></i><span class="heading-weight"> The Item will dispatch within 3 Business Days </span>
                                    </div>
                                </div>
                                <div class="product-info mst-25" data-animate="animate__fadeIn">
                                    <div class="product-border bst"></div>
                                </div>
                                <div class="product-info mst-20" data-animate="animate__fadeIn">
                                    <div class="product-desc">
                                        <p><?= htmlspecialchars($product['short_description']) ?></p>
                                    </div>
                                </div>
                              <!-- Rental Details -->
                                <div class="product-info mst-25" data-animate="animate__fadeIn">
                                <div class="product-rental">
                                    <h5 class="heading-weight mb-2">Rent For:</h5>

                                    <!-- Rental Duration Options -->
                                    <div class="product-option-block rent">
                                    <ul class="ul-mt5 d-flex flex-wrap gap-2 list-unstyled p-0 m-0">
                                        <li>
                                        <span class="rental-option active" data-days="3">3 Days</span>
                                        </li>
                                        <li>
                                        <span class="rental-option" data-days="5">5 Days</span>
                                        </li>
                                        <li>
                                        <span class="rental-option" data-days="7">7 Days</span>
                                        </li>
                                    </ul>
                                    </div>

                                    <!-- Start Date Picker -->
                                    <div class="mt-3 d-flex align-items-center gap-2">
                                        <label for="rental-start-date" class="fw-bold mb-0">Select Start Date:</label>
                                        <input type="date" id="rental-start-date" class="form-control form-control-sm w-auto">
                                    </div>

                                    <script>
                                    document.addEventListener('DOMContentLoaded', function () {
                                        const startDateInput = document.getElementById('rental-start-date');

                                        // Get tomorrow's date
                                        const today = new Date();
                                        today.setDate(today.getDate() + 1); // +1 day
                                        const yyyy = today.getFullYear();
                                        const mm = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based
                                        const dd = String(today.getDate()).padStart(2, '0');

                                        const minDate = `${yyyy}-${mm}-${dd}`;
                                        startDateInput.setAttribute('min', minDate);
                                    });
                                    </script>


                                    <!-- Rental Info -->
                                    <div class="mt-3">
                                    <p class="heading-color"><strong>Start Date:</strong> <span id="start-date-text">-</span></p>
                                    <p class="heading-color"><strong>Return Date:</strong> <span id="return-date-text">-</span></p>
                                    <p class="heading-color"><strong>Rental Price:</strong> ₹ <span id="rental-price"><?= htmlspecialchars($rentalData['rental_amount']) ?></span></p>
                                    <p class="heading-color text-success"><strong>Refundable Security Deposit:</strong> ₹ <?= htmlspecialchars($rentalData['deposit_amount']) ?></p>
                                    <p class="heading-color text-success"><strong>Late Fee:</strong>₹ <?= htmlspecialchars($rentalData['late_fee']) ?></p>
                                    </div>

                                    <!-- Rent Now Button -->
                                        <div class="product-button mst-15">
                                            <button type="button" 
                                                    class="w-100 btn-style secondary-btn rent-now-btn" 
                                                    data-product-id="<?= htmlspecialchars($product['product_unique_id']); ?>">
                                                <span class="product-icon">
                                                    <span class="product-bag-icon icon-16">
                                                        <i class="ri-calendar-line d-block lh-1"></i>
                                                    </span>
                                                </span>
                                                <span class="tooltip-text">Rent Now</span>
                                            </button>
                                      </div>
                                </div>
                                </div>

                                <style>
                                /* Rental day buttons */
                                .rental-option {
                                    display: inline-block;
                                    cursor: pointer;
                                    border: 2px solid #ccc;
                                    border-radius: 6px;
                                    padding: 6px 16px;
                                    font-weight: 600;
                                    transition: all 0.2s ease-in-out;
                                }
                                .rental-option:hover {
                                    border-color: #9c1137;
                                    color: #9c1137;
                                }
                                .rental-option.active {
                                    border-color: #9c1137;
                                    background: #9c1137;
                                    color: #fff;
                                }
                                </style>

                                <script>
                                const rentalOptions = document.querySelectorAll(".rental-option");
                                const startDateInput = document.getElementById("rental-start-date");
                                const startDateText = document.getElementById("start-date-text");
                                const returnDateText = document.getElementById("return-date-text");
                                const rentalPriceEl = document.getElementById("rental-price");

                                let rentalDays = 3; // default
                                const basePrice = 79.21; // price for 3 days

                                // Handle rental option clicks
                                rentalOptions.forEach(option => {
                                    option.addEventListener("click", () => {
                                    rentalOptions.forEach(o => o.classList.remove("active"));
                                    option.classList.add("active");

                                    rentalDays = parseInt(option.dataset.days);
                                    calculateReturnDate();
                                    updatePrice();
                                    });
                                });

                                // Update return date when start date is selected
                                startDateInput.addEventListener("change", () => {
                                    calculateReturnDate();
                                });

                                function calculateReturnDate() {
                                    if (!startDateInput.value) return;
                                    const startDate = new Date(startDateInput.value);
                                    startDateText.innerText = startDate.toDateString();

                                    const returnDate = new Date(startDate);
                                    returnDate.setDate(startDate.getDate() + rentalDays - 1);
                                    returnDateText.innerText = returnDate.toDateString();
                                }

                                function updatePrice() {
                                    const pricePerDay = basePrice / 3; // base price for 3 days
                                    const totalPrice = pricePerDay * rentalDays;
                                    rentalPriceEl.innerText = totalPrice.toFixed(2);
                                }
                                </script>
                                <div class="product-info mst-15" data-animate="animate__fadeIn">
                                    <div class="ul-row">
                                        <div class="product-ask">
                                    <a href="https://wa.me/917008304043?text=Hi%20I%20have%20a%20question%20about%20this%20product" 
                                    target="_blank" 
                                    class="ask-question heading-color">
                                        <i class="ri-edit-box-line icon-16 mer-4"></i>
                                        Ask a question
                                    </a>
                                </div>

                                        <div class="product-share">
                                            <a href="#share-modal" data-bs-toggle="modal" class="share heading-color"><i class="ri-share-line icon-16 mer-4"></i>Share</a>
                                        </div>
                                    </div>
                                </div>
                                <div class="product-info mst-15" data-animate="animate__fadeIn">
                                    <div class="product-offer">
                                        <p class="heading-color"><i class="ri-discount-percent-line icon-16 mer-4"></i>Offers available for you <a href="#offers-modal" data-bs-toggle="modal" class="text-uppercase heading-weight text-decoration-underline">View details</a></p>
                                    </div>
                                </div>
                                <div class="product-info mst-20" data-animate="animate__fadeIn">
                                    <div class="product-border bst"></div>
                                </div>
                                <div class="product-info mst-25" data-animate="animate__fadeIn">
                                    <div class="product-delivery">
                                        <span class="d-inline-block"><i class="ri-check-line heading-color icon-16 mer-4"></i>Your order will reach you within 3 business days</span>
                                    </div>
                                </div>
                                <div class="product-info mst-10" data-animate="animate__fadeIn">
                                    <div class="product-return">
                                        <span class="d-inline-block"><i class="ri-check-line heading-color icon-16 mer-4"></i>Items rented from us can be returned within 7 days of the rental start date, provided they are in the same condition as received</span>
                                    </div>
                                </div>
                                <div class="product-info mst-15" data-animate="animate__fadeIn">
                                    <div class="product-service">
                                        <div class="ul-mt15">
                                            <div class="col-6 col-sm-3 d-flex">
                                                <div class="w-100 heading-color d-flex flex-column align-items-center ptb-15 plr-15 extra-bg text-center br-hidden">
                                                    <span class="icon-24"><i class="ri-box-3-line d-block lh-1"></i></span>
                                                    <span class="mst-12">Easy Return</span>
                                                </div>
                                            </div>
                                            <div class="col-6 col-sm-3 d-flex">
                                                <div class="w-100 heading-color d-flex flex-column align-items-center ptb-15 plr-15 extra-bg text-center br-hidden">
                                                    <span class="icon-24"><i class="ri-hand-coin-line d-block lh-1"></i></span>
                                                    <span class="mst-12">Safe payment</span>
                                                </div>
                                            </div>
                                            <div class="col-6 col-sm-3 d-flex">
                                                <div class="w-100 heading-color d-flex flex-column align-items-center ptb-15 plr-15 extra-bg text-center br-hidden">
                                                    <span class="icon-24"><i class="ri-truck-line d-block lh-1"></i></span>
                                                    <span class="mst-12">Secure Packaging</span>
                                                </div>
                                            </div>
                                            <div class="col-6 col-sm-3 d-flex">
                                                <div class="w-100 heading-color d-flex flex-column align-items-center ptb-15 plr-15 extra-bg text-center br-hidden">
                                                    <span class="icon-24"><i class="ri-secure-payment-line d-block lh-1"></i></span>
                                                    <span class="mst-12">5 Days Return</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!-- product-detail-info end -->
                        </div>
                    </div>
                
                </div>
               
                <!-- question-modal start -->
                <div class="question-modal modal fade" id="question-modal" data-bs-backdrop="static">
                    <div class="modal-dialog modal-dialog-centered">
                        <div class="modal-content body-bg border-0 br-hidden">
                            <div class="modal-body ptb-30 plr-15 plr-sm-30">
                                <form method="post" action="javascript:void(0)">
                                    <input type="text" name="product_name" class="w-100" value="<?= htmlspecialchars($product['product_name']) ?>"  required>
                                    <input type="text" name="product_id" class="w-100" value="<?= htmlspecialchars($product['product_id']) ?>" required>
                                    
                                    <div class="question-modal-header d-flex align-items-center justify-content-between meb-30">
                                        <h6 class="font-18">Ask a question?</h6>
                                        <button type="button" class="body-secondary-color icon-16" data-bs-dismiss="modal" aria-label="Close"><i class="ri-close-large-line d-block lh-1"></i></button>
                                    </div>
                                    <div class="question-modal-form">
                                        <div class="row field-row">
                                            <div class="col-12 field-col">
                                                <label for="name" class="field-label">Name</label>
                                                <input type="text" id="name" name="name" class="w-100" placeholder="Full name" autocomplete="name" required>
                                            </div>
                                            <div class="col-12 field-col">
                                                <label for="email" class="field-label">Email</label>
                                                <input type="email" id="email" name="email" class="w-100" placeholder="Email" autocomplete="email" required>
                                            </div>
                                            <div class="col-12 field-col">
                                                <label for="phone" class="field-label">Phone number</label>
                                                <input type="text" id="phone" name="phone" class="w-100" placeholder="Phone number" autocomplete="tel" required>
                                            </div>
                                            <div class="col-12 field-col">
                                                <label for="message" class="field-label">Message</label>
                                                <textarea rows="5" id="message" name="message" class="w-100" placeholder="Message" autocomplete="off" required></textarea>
                                            </div>
                                        </div>
                                        <div class="question-form-btn mst-20 mst-sm-30">
                                            <button type="submit" class="w-100 btn-style secondary-btn question-form-submit">Submit now</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- question-modal end -->
                <!-- share-modal start -->
                <div class="share-modal modal fade" id="share-modal" data-bs-backdrop="static">
                    <div class="modal-dialog modal-dialog-centered">
                        <div class="modal-content body-bg border-0 br-hidden">
                            <div class="modal-body ptb-30 plr-15 plr-sm-30">
                                <div class="share-modal-header d-flex align-items-center justify-content-between meb-30">
                                    <h6 class="font-18">Share</h6>
                                    <button type="button" class="body-secondary-color icon-16" data-bs-dismiss="modal" aria-label="Close"><i class="ri-close-large-line d-block lh-1"></i></button>
                                </div>
                                <div class="share-modal-content">
                                    <div class="product-link d-md-flex">
                                        <input type="text" id="copy-link" class="copy-url width-100 text-center text-md-start" readonly>
                                        <button type="button" class="copy-btn width-100 width-md-auto btn-style secondary-btn mst-15 mst-md-0 text-nowrap">Copy</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- share-modal end -->
                <!-- offers-modal start -->
                <div class="offers-modal modal fade" id="offers-modal" data-bs-backdrop="static">
                    <div class="modal-dialog modal-dialog-centered">
                        <div class="modal-content body-bg border-0 br-hidden">
                            <div class="modal-body ptb-30 plr-15 plr-sm-30">
                                <div class="pickup-modal-header d-flex align-items-center justify-content-between meb-30">
                                    <h6 class="font-18">Offers for you</h6>
                                    <button type="button" class="body-secondary-color icon-16" data-bs-dismiss="modal" aria-label="Close"><i class="ri-close-large-line d-block lh-1"></i></button>
                                </div>
                                <div class="row row-mtm15 pickup-modal-content">
                                    <div class="col-12">
                                        <div class="ul-mtm-15">
                                            <span><a href="#">👉 Get up to<span class="heading-weight"> 50% off</span> on selected products! Limited time offer!</a></span>
                                            <span><a href="#">👉 Buy<span class="heading-weight"> 2</span> and Get<span class="heading-weight"> 15% off</span> on all products!, Use code<span class="heading-weight"> "BUY2SAVE"</span></a></span>
                                            <span><a href="#">👉 Get<span class="heading-weight"> 11% off</span> your first order!, Use code<span class="heading-weight"> "11%OFF"</span></a></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- offers-modal end -->
                <!-- pickup-modal start -->
                <div class="pickup-modal modal fade" id="pickup-modal" data-bs-backdrop="static">
                    <div class="modal-dialog modal-dialog-centered">
                        <div class="modal-content body-bg border-0 br-hidden">
                            <div class="modal-body ptb-30 plr-15 plr-sm-30">
                                <div class="pickup-modal-header d-flex align-items-center justify-content-between meb-30">
                                    <h6 class="font-18">Choose Pickup and Save Time!</h6>
                                    <button type="button" class="body-secondary-color icon-16" data-bs-dismiss="modal" aria-label="Close"><i class="ri-close-large-line d-block lh-1"></i></button>
                                </div>
                                <div class="row row-mtm15 pickup-modal-content">
                                    <div class="col-12">
                                        <span class="d-block heading-color meb-19 heading-weight">👉 Why choose pickup?</span>
                                        <div class="ul-mtm-15">
                                            <span><span class="heading-color heading-weight">Speedy service:</span> Skip the wait and grab your items on the same day.</span>
                                            <span><span class="heading-color heading-weight">No shipping fees:</span> Save money by picking up your order in-store.</span>
                                            <span><span class="heading-color heading-weight">Flexible pickup times:</span> Choose a time that suits your schedule.</span>
                                            <span><span class="heading-color heading-weight">Expert assistance:</span> Our friendly staff are on hand to help with any queries.</span>
                                        </div>
                                    </div>
                                    <div class="col-12">
                                        <span class="d-block heading-color meb-19 heading-weight">👉 How it works:</span>
                                        <div class="ul-mtm-15">
                                            <span><span class="heading-color heading-weight">Select pickup:</span> During checkout, choose the pickup option.</span>
                                            <span><span class="heading-color heading-weight">Receive confirmation:</span> You'll receive an email confirmation once your order is ready for pickup.</span>
                                            <span><span class="heading-color heading-weight">Visit the store:</span> Head to your chosen store location at your convenience.</span>
                                            <span><span class="heading-color heading-weight">Collect your order:</span> Present your confirmation email at the pickup point, and our team will hand over your items.</span>
                                        </div>
                                    </div>
                                    <div class="col-12">
                                        <span class="d-block heading-color meb-19 heading-weight">👉 Frequently asked questions:</span>
                                        <ul class="ul-mt15">
                                            <li class="d-block">
                                                <div class="ul-mtm-15">
                                                    <span class="d-block heading-color heading-weight">Is pickup available for all items?</span>
                                                    <span class="d-block">Pickup is available for most items. If an item is eligible, you'll see the pickup option during checkout.</span>
                                                </div>
                                            </li>
                                            <li class="d-block">
                                                <div class="ul-mtm-15">
                                                    <span class="d-block heading-color heading-weight">When will my order be ready for pickup?</span>
                                                    <span class="d-block">Orders are typically ready for pickup within a few hours. You'll receive an email notification once your order is ready.</span>
                                                </div>
                                            </li>
                                            <li class="d-block">
                                                <div class="ul-mtm-15">
                                                    <span class="d-block heading-color heading-weight">Can someone else pick up my order for me?</span>
                                                    <span class="d-block">Yes, you can authorize someone else to pick up your order. Simply forward them the confirmation email, and they can collect the items on your behalf.</span>
                                                </div>
                                            </li>
                                            <li class="d-block">
                                                <div class="ul-mtm-15">
                                                    <span class="d-block heading-color heading-weight">Is there a cutoff time for same-day pickup?</span>
                                                    <span class="d-block">Yes, orders placed before [insert cutoff time] are usually available for same-day pickup. Orders placed after this time will be ready the following day.</span>
                                                </div>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- pickup-modal end -->
            </section>
            <!-- product-detail end -->
            <!-- product-detail-tab start -->
            <section class="product-detail-tab section-pt">
                <div class="container">
                    <div class="product-tab horizontal-tab">
                        <div class="product-tab-nav beb" data-animate="animate__fadeIn">
                            <ul class="nav nav-tabs ul-tab border-0" role="tablist">
                                <li>
                                    <a href="#pro-desc-tab" class="d-block peb-11 heading-weight active" data-bs-toggle="tab" role="tab" aria-selected="true">Description</a>
                                </li>
                                 <li>
                                    <a href="#pro-ai-tab1" class="d-block peb-11 heading-weight" data-bs-toggle="tab" role="tab" aria-selected="false">Additional-info</a>
                                </li>
                            </ul>
                        </div>
                        <div class="product-tab-info tab-content mst-30" data-animate="animate__fadeIn">
                            <div class="tab-pane fade active show" id="pro-desc-tab">
                                <div class="product-tab-description">
                                    <div class="product-description-info">
                                        <h6>About this item</h6>
                                        <p><?= strip_tags($product['description'], '<p><b><i><u><br><ul><li>') ?></p>
                                        
                                    </div>
                                    
                                </div>
                            </div>
                            <div class="tab-pane fade" id="pro-ai-tab1">
                                <div class="product-tab-ai">
                                    <table class="w-100">
                                        <tbody>
                                            <tr>
                                                <th class="heading-color ptb-10 plr-15 heading-weight border-full" scope="row">Metal Type</th>
                                                <td class="ptb-10 plr-15 border-full">Fancy</td>
                                            </tr>
                                            <tr>
                                                <th class="heading-color ptb-10 plr-15 heading-weight border-full" scope="row">Product Type</th>
                                                <td class="ptb-10 plr-15 border-full">Polki Set</td>
                                            </tr>
                                            <tr>
                                                <th class="heading-color ptb-10 plr-15 heading-weight border-full" scope="row">Stone Color</th>
                                                <td class="body-color ptb-10 plr-15 border-full"><?= htmlspecialchars($fancyData['stone_color']) ?></td>
                                            </tr>
                                            <tr>
                                                <th class="heading-color ptb-10 plr-15 heading-weight border-full" scope="row">Stone Weight </th>
                                                <td class="body-color ptb-10 plr-15 border-full"><?= htmlspecialchars($fancyData['stone_weight']) ?></td>
                                            </tr>
                                            <tr>
                                                <th class="heading-color ptb-10 plr-15 heading-weight border-full" scope="row">Stone Count </th>
                                                <td class="body-color ptb-10 plr-15 border-full"><?= htmlspecialchars($fancyData['stone_count']) ?></td>
                                            </tr>
                                            <tr>
                                                <th class="heading-color ptb-10 plr-15 heading-weight border-full" scope="row">Brand</th>
                                                <td class="body-color ptb-10 plr-15 border-full">Pooja Jewellers</td>
                                            </tr>
                                            <tr>
                                                <th class="heading-color ptb-10 plr-15 heading-weight border-full" scope="row">Gender</th>
                                                <td class="body-color ptb-10 plr-15 border-full">Women</td>
                                            </tr>
                                            <tr>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
            <!-- product-detail-tab end -->

            <?php elseif (!$isRental && $saleData): ?>
                 <section class="product-detail section-pt">
                <!-- product prev-next start -->
                <a href="product6.html" class="d-none d-xl-block position-fixed top-50 translate-middle-y z-2 np-product prev">
                    <span class="d-block body-secondary-color msl-5 heading-weight text-uppercase lh-1">Prev</span>
                </a>
                <a href="product2.html" class="d-none d-xl-block position-fixed top-50 translate-middle-y z-2 np-product next">
                    <span class="d-block body-secondary-color mer-5 heading-weight text-uppercase lh-1">Next</span>
                </a>
                <!-- product prev-next end -->
                <div class="container">
                    <div class="row row-mtm align-items-lg-start">
                        <div class="col-12 col-lg-6 p-lg-sticky top-0">
                            <!-- product-detail-slider start -->
                            <div class="product-detail-slider per-xxl-10">
                                <div class="row ul-mt15">
                                    <div class="col-12" data-animate="animate__fadeIn">
                                        <!-- product-img-big start -->
                                        <!-- product-img-big start -->
                                        <div class="product-img-big slider-big-h position-relative br-hidden">
                                            <div class="swiper" id="slider-big-h">
                                                <div class="swiper-wrapper product-swiper-wrapper">
                                                    <?php
                                                    $product_images = json_decode($product['product_images'], true);
                                                    if (!empty($product_images)) {
                                                        foreach ($product_images as $index => $img) {
                                                            echo '<div class="swiper-slide product-swiper-slide">';
                                                            echo '    <div class="product-item-img position-relative">';
                                                            echo '        <a href="' . htmlspecialchars($img) . '" class="full-view product-thumbnail heading-color position-absolute top-0 end-0 width-40 height-40 d-flex align-items-center justify-content-center body-bg z-1 mst-15 mer-15 rounded-circle box-shadow" aria-label="Image full view">';
                                                            echo '            <i class="ri-fullscreen-line d-block lh-1"></i>';
                                                            echo '        </a>';
                                                            echo '        <img src="' . htmlspecialchars($img) . '" data-zoom="' . htmlspecialchars($img) . '" class="w-100 img-fluid zoom" alt="product-image-' . ($index+1) . '" style="height:500px; object-fit:cover;">';
                                                            echo '    </div>';
                                                            echo '</div>';
                                                        }
                                                    } else {
                                                        // fallback (if no gallery images found)
                                                        echo '<div class="swiper-slide product-swiper-slide">';
                                                        echo '    <div class="product-item-img position-relative">';
                                                        echo '        <img src="' . htmlspecialchars($product['thumbnail_image']) . '" class="w-100 img-fluid" alt="' . htmlspecialchars($product['product_name']) . '">';
                                                        echo '    </div>';
                                                        echo '</div>';
                                                    }
                                                    ?>
                                                </div>
                                            </div>

                                            <div class="swiper-buttons">
                                                <button type="button" class="swiper-prev swiper-prev-big secondary-btn icon-16 width-40 height-40 position-absolute top-50 translate-middle-y z-1 rounded-circle" aria-label="Arrow previous">
                                                    <i class="ri-arrow-left-line d-block lh-1"></i>
                                                </button>
                                                <button type="button" class="swiper-next swiper-next-big secondary-btn icon-16 width-40 height-40 position-absolute top-50 translate-middle-y z-1 rounded-circle" aria-label="Arrow next">
                                                    <i class="ri-arrow-right-line d-block lh-1"></i>
                                                </button>
                                            </div>
                                        </div>
                                        <!-- product-img-big end -->

                                        <!-- product-img-big end -->
                                    </div>
                                    <div class="col-12" data-animate="animate__fadeIn">
                                        <!-- product-img-small start -->
                                        <div class="product-img-small slider-small-h">
                                            <div class="swiper" id="slider-small-h">
                                                <div class="swiper-wrapper">
                                                    <?php
                                                        $product_images = json_decode($product['product_images'], true); // decode JSON array
                                                        if (!empty($product_images)) {
                                                            foreach ($product_images as $img) {
                                                                echo '<div class="swiper-slide product-swiper-slide">';
                                                                echo '    <div class="product-item-img br-hidden">';
                                                                echo '        <a href="javascript:void(0)" class="d-block product-thumbnail">';
                                                                echo '<img src="' . htmlspecialchars($img) . '" class="w-100 img-fluid" alt="product-thumbnail" style="height:150px; object-fit:cover;">';
                                                                echo '        </a>';
                                                                echo '    </div>';
                                                                echo '</div>';
                                                            }
                                                        }
                                                        ?>
                                                </div>
                                            </div>
                                        </div>
                                        <!-- product-img-small end -->
                                    </div>
                                </div>
                            </div>
                            <!-- product-detail-slider end -->
                        </div>
                        <div class="col-12 col-lg-6 p-lg-sticky top-0">
                            <!-- product-detail-info start -->
                            <div class="product-detail-info psl-xxl-10">
                                <div class="product-info" data-animate="animate__fadeIn">
                                    <div class="product-sku">
                                        <span class="font-14 text-uppercase"><?= htmlspecialchars($product['product_unique_id']) ?></span>
                                    </div>
                                </div>
                                <div class="product-info mst-5" data-animate="animate__fadeIn">
                                    <div class="product-title">
                                        <h2 class="font-24"><?= htmlspecialchars($product['product_name']) ?></h2>
                                    </div>
                                </div>
                                <div class="product-info mst-15" data-animate="animate__fadeIn">
                                    <div class="product-price">
                                        <div class="price-box font-20">
                                            <span class="new-price dominant-color heading-weight">₹ <?= htmlspecialchars($saleData['price']) ?></span>
                                            <span class="old-price heading-weight"><span class="mer-3">~</span><span class="text-decoration-line-through"><?= htmlspecialchars($saleData['mrp']) ?></span></span>
                                            <span class="discount-price secondary-color">-<?= htmlspecialchars($saleData['discount_percentage']) ?>% off</span>
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="product-info mst-20" data-animate="animate__fadeIn">
                                    <div class="product-view">
                                        <span class="heading-color"><i class="ri-eye-line icon-16 mer-4 blinking"></i><?= htmlspecialchars($product['view']) ?> people are viewing this product right now</span>
                                    </div>
                                </div>
                                <div class="product-info mst-15" data-animate="animate__fadeIn">
                                    <div class="product-stock">
                                        <span class="d-inline-block stock-fill text-success ptb-10 plr-15 bg-success heading-weight border-success border-radius">Making charge starts from ₹500 onwards.</span>
                                    </div>
                                </div>
                                <?php 
                                // Validate by category_id
                                $category_id = intval($product['category_id'] ?? 0);
                                
                                // Only show message for Gold (category_id = 1)
                                if ($category_id === 1): 
                                ?>
                                <div class="product-info mst-15" data-animate="animate__fadeIn">
                                    <div class="product-sold">
                                        <span class="text-danger">
                                            <i class="ri-fire-line icon-16 mer-4 blinking"></i>
                                            <span class="heading-weight">
                                                After booking gold jewellery, you have to pick up from store.
                                            </span>
                                        </span>
                                    </div>
                                </div>
                                <?php endif; ?>




                                <div class="product-info mst-25" data-animate="animate__fadeIn">
                                    <div class="product-border bst"></div>
                                </div>
                                <div class="product-info mst-20" data-animate="animate__fadeIn">
                                    <div class="product-desc">
                                        <p><?= htmlspecialchars($product['short_description']) ?></p>
                                    </div>
                                </div>
                                
                                
                                <div class="product-info mst-25" data-animate="animate__fadeIn">
                                    
                                    <div class="product-button mst-15">
                                        <div class="product-button mst-15">
                                            <div class="row btn-row15">
                                                <div class="col-12 col-sm-6">
                                                    <button class="w-100 btn-style secondary-btn add-to-cart-btn"
                                                        data-product-id="<?= htmlspecialchars($saleData['product_unique_id'] ?? $product['product_unique_id']); ?>">
                                                        Add to Cart
                                                    </button>
                                                </div>
                                            </div>
                                        </div>


                                        <script>
                                        document.addEventListener('DOMContentLoaded', function () {
                                            document.querySelectorAll('.add-to-cart-btn').forEach(btn => {
                                                btn.addEventListener('click', function () {
                                                    const productId = this.dataset.productId;

                                                    fetch(`add_to_cart.php?id=${productId}`)
                                                        .then(res => res.text())
                                                        .catch(() => alert("Error adding to cart"));
                                                });
                                            });
                                        });
                                        </script>

                                        </div>
                                    </div>
                                </div>
                               <script>
                                document.addEventListener('DOMContentLoaded', function () {
                                    const sections = document.querySelectorAll('.product-quantity');

                                    sections.forEach(section => {
                                        if (section.dataset.bound === 'true') return;
                                        section.dataset.bound = 'true';

                                        const input = section.querySelector('.js-qty-num');
                                        const minusBtn = section.querySelector('.js-qty-adjust-minus1');
                                        const plusBtn = section.querySelector('.js-qty-adjust-plus1');

                                        const maxStock = parseInt(input.getAttribute('max'), 10) || 1;
                                        const min = parseInt(input.getAttribute('min'), 10) || 1;

                                        function updateButtons() {
                                            const qty = parseInt(input.value, 10) || min;
                                            minusBtn.disabled = qty <= min;
                                            plusBtn.disabled = qty >= maxStock;
                                        }

                                        function setQuantity(qty) {
                                            qty = Math.max(min, Math.min(qty, maxStock));
                                            input.value = qty;
                                            updateButtons();
                                        }

                                        plusBtn.addEventListener('click', function (e) {
                                            e.preventDefault();
                                            let qty = parseInt(input.value, 10) || min;
                                            setQuantity(qty + 1);
                                        });

                                        minusBtn.addEventListener('click', function (e) {
                                            e.preventDefault();
                                            let qty = parseInt(input.value, 10) || min;
                                            setQuantity(qty - 1);
                                        });

                                        input.addEventListener('input', function () {
                                            let qty = parseInt(input.value, 10);
                                            if (isNaN(qty)) qty = min;
                                            setQuantity(qty);
                                        });

                                        updateButtons();
                                    });
                                });
                                </script>


                                <div class="product-info mst-15" data-animate="animate__fadeIn">
                                    <div class="ul-row">
                                       <div class="product-ask">
                                        <a href="https://wa.me/917008304043?text=Hi%20I%20have%20a%20question%20about%20this%20product" 
                                        target="_blank" 
                                        class="ask-question heading-color">
                                            <i class="ri-edit-box-line icon-16 mer-4"></i>
                                            Ask a question
                                        </a>
                                    </div>

                                        <div class="product-share">
                                            <a href="#share-modal" data-bs-toggle="modal" class="share heading-color"><i class="ri-share-line icon-16 mer-4"></i>Share</a>
                                        </div>
                                    </div>
                                </div>
                                <div class="product-info mst-15" data-animate="animate__fadeIn">
                                <div class="product-offer">
                                    <p class="heading-color">
                                        <i class="ri-information-line icon-16 mer-4"></i>
                                        Check out the latest features and benefits of this product. 
                                        <a href="#offers-modal" data-bs-toggle="modal" 
                                           class="text-uppercase heading-weight text-decoration-underline dominant-color">
                                           View details
                                        </a>
                                    </p>
                                </div>
                            </div>

                                <div class="product-info mst-20" data-animate="animate__fadeIn">
                                    <div class="product-border bst"></div>
                                </div>
                                <div class="product-info mst-25" data-animate="animate__fadeIn">
                                    <div class="product-delivery">
                                        <span class="d-inline-block"><i class="ri-check-line heading-color icon-16 mer-4"></i>Your order will reach you within 5-7 business days</span>
                                    </div>
                                </div>
                                <div class="product-info mst-10" data-animate="animate__fadeIn">
                                    <div class="product-return">
                                        <span class="d-inline-block"><i class="ri-check-line heading-color icon-16 mer-4"></i>We accept returns within 5 days of purchase</span>
                                    </div>
                                </div>
                                <div class="product-info mst-15" data-animate="animate__fadeIn">
                                    <div class="product-service">
                                        <div class="ul-mt15">
                                            <div class="col-6 col-sm-3 d-flex">
                                                <div class="w-100 heading-color d-flex flex-column align-items-center ptb-15 plr-15 extra-bg text-center br-hidden">
                                                    <span class="icon-24"><i class="ri-box-3-line d-block lh-1"></i></span>
                                                    <span class="mst-12">Easy Return</span>
                                                </div>
                                            </div>
                                            <div class="col-6 col-sm-3 d-flex">
                                                <div class="w-100 heading-color d-flex flex-column align-items-center ptb-15 plr-15 extra-bg text-center br-hidden">
                                                    <span class="icon-24"><i class="ri-hand-coin-line d-block lh-1"></i></span>
                                                    <span class="mst-12">Safe payment</span>
                                                </div>
                                            </div>
                                            <div class="col-6 col-sm-3 d-flex">
                                                <div class="w-100 heading-color d-flex flex-column align-items-center ptb-15 plr-15 extra-bg text-center br-hidden">
                                                    <span class="icon-24"><i class="ri-truck-line d-block lh-1"></i></span>
                                                    <span class="mst-12">Secure Packaging</span>
                                                </div>
                                            </div>
                                            <div class="col-6 col-sm-3 d-flex">
                                                <div class="w-100 heading-color d-flex flex-column align-items-center ptb-15 plr-15 extra-bg text-center br-hidden">
                                                    <span class="icon-24"><i class="ri-secure-payment-line d-block lh-1"></i></span>
                                                    <span class="mst-12">5 Days Return</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!-- product-detail-info end -->
                        </div>
                    </div>
                
                </div>
                
                <!-- question-modal start -->
                <div class="question-modal modal fade" id="question-modal" data-bs-backdrop="static">
                    <div class="modal-dialog modal-dialog-centered">
                        <div class="modal-content body-bg border-0 br-hidden">
                            <div class="modal-body ptb-30 plr-15 plr-sm-30">
                                <form method="post" action="javascript:void(0)">
                                    <div class="question-modal-header d-flex align-items-center justify-content-between meb-30">
                                        <h6 class="font-18">Ask a question?</h6>
                                        <button type="button" class="body-secondary-color icon-16" data-bs-dismiss="modal" aria-label="Close"><i class="ri-close-large-line d-block lh-1"></i></button>
                                    </div>
                                    <div class="question-modal-form">
                                        <div class="row field-row">
                                            <div class="col-12 field-col">
                                                <label for="name" class="field-label">Name</label>
                                                <input type="text" id="name" name="name" class="w-100" placeholder="Full name" autocomplete="name" required>
                                            </div>
                                            <div class="col-12 field-col">
                                                <label for="email" class="field-label">Email</label>
                                                <input type="email" id="email" name="email" class="w-100" placeholder="Email" autocomplete="email" required>
                                            </div>
                                            <div class="col-12 field-col">
                                                <label for="phone" class="field-label">Phone number</label>
                                                <input type="text" id="phone" name="phone" class="w-100" placeholder="Phone number" autocomplete="tel" required>
                                            </div>
                                            <div class="col-12 field-col">
                                                <label for="message" class="field-label">Message</label>
                                                <textarea rows="5" id="message" name="message" class="w-100" placeholder="Message" autocomplete="off" required></textarea>
                                            </div>
                                        </div>
                                        <div class="question-form-btn mst-20 mst-sm-30">
                                            <button type="submit" class="w-100 btn-style secondary-btn question-form-submit">Submit now</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- question-modal end -->
                <!-- share-modal start -->
                <div class="share-modal modal fade" id="share-modal" data-bs-backdrop="static">
                    <div class="modal-dialog modal-dialog-centered">
                        <div class="modal-content body-bg border-0 br-hidden">
                            <div class="modal-body ptb-30 plr-15 plr-sm-30">
                                <div class="share-modal-header d-flex align-items-center justify-content-between meb-30">
                                    <h6 class="font-18">Share</h6>
                                    <button type="button" class="body-secondary-color icon-16" data-bs-dismiss="modal" aria-label="Close"><i class="ri-close-large-line d-block lh-1"></i></button>
                                </div>
                                <div class="share-modal-content">
                                    <div class="product-link d-md-flex">
                                        <input type="text" id="copy-link" class="copy-url width-100 text-center text-md-start" readonly>
                                        <button type="button" class="copy-btn width-100 width-md-auto btn-style secondary-btn mst-15 mst-md-0 text-nowrap">Copy</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- share-modal end -->
                <!-- offers-modal start -->
                <div class="offers-modal modal fade" id="offers-modal" data-bs-backdrop="static">
                    <div class="modal-dialog modal-dialog-centered">
                        <div class="modal-content body-bg border-0 br-hidden">
                            <div class="modal-body ptb-30 plr-15 plr-sm-30">
                
                                <div class="pickup-modal-header d-flex align-items-center justify-content-between meb-30">
                                    <h6 class="font-18">Product Details</h6>
                                    <button type="button" class="body-secondary-color icon-16" data-bs-dismiss="modal" aria-label="Close">
                                        <i class="ri-close-large-line d-block lh-1"></i>
                                    </button>
                                </div>
                
                                <div class="row row-mtm15 pickup-modal-content">
                                    <div class="col-12">
                                        <div class="ul-mtm-15">
                                            <span><a href="#">👉 High quality materials used in this product.</a></span>
                                            <span><a href="#">👉 Designed for comfort and durability.</a></span>
                                            <span><a href="#">👉 Perfect for everyday use or gifting.</a></span>
                                        </div>
                                    </div>
                                </div>
                
                            </div>
                        </div>
                    </div>
                </div>
                <!-- offers-modal end -->

                <!-- pickup-modal start -->
                <div class="pickup-modal modal fade" id="pickup-modal" data-bs-backdrop="static">
                    <div class="modal-dialog modal-dialog-centered">
                        <div class="modal-content body-bg border-0 br-hidden">
                            <div class="modal-body ptb-30 plr-15 plr-sm-30">
                                <div class="pickup-modal-header d-flex align-items-center justify-content-between meb-30">
                                    <h6 class="font-18">Choose Pickup and Save Time!</h6>
                                    <button type="button" class="body-secondary-color icon-16" data-bs-dismiss="modal" aria-label="Close"><i class="ri-close-large-line d-block lh-1"></i></button>
                                </div>
                                <div class="row row-mtm15 pickup-modal-content">
                                    <div class="col-12">
                                        <span class="d-block heading-color meb-19 heading-weight">👉 Why choose pickup?</span>
                                        <div class="ul-mtm-15">
                                            <span><span class="heading-color heading-weight">Speedy service:</span> Skip the wait and grab your items on the same day.</span>
                                            <span><span class="heading-color heading-weight">No shipping fees:</span> Save money by picking up your order in-store.</span>
                                            <span><span class="heading-color heading-weight">Flexible pickup times:</span> Choose a time that suits your schedule.</span>
                                            <span><span class="heading-color heading-weight">Expert assistance:</span> Our friendly staff are on hand to help with any queries.</span>
                                        </div>
                                    </div>
                                    <div class="col-12">
                                        <span class="d-block heading-color meb-19 heading-weight">👉 How it works:</span>
                                        <div class="ul-mtm-15">
                                            <span><span class="heading-color heading-weight">Select pickup:</span> During checkout, choose the pickup option.</span>
                                            <span><span class="heading-color heading-weight">Receive confirmation:</span> You'll receive an email confirmation once your order is ready for pickup.</span>
                                            <span><span class="heading-color heading-weight">Visit the store:</span> Head to your chosen store location at your convenience.</span>
                                            <span><span class="heading-color heading-weight">Collect your order:</span> Present your confirmation email at the pickup point, and our team will hand over your items.</span>
                                        </div>
                                    </div>
                                    <div class="col-12">
                                        <span class="d-block heading-color meb-19 heading-weight">👉 Frequently asked questions:</span>
                                        <ul class="ul-mt15">
                                            <li class="d-block">
                                                <div class="ul-mtm-15">
                                                    <span class="d-block heading-color heading-weight">Is pickup available for all items?</span>
                                                    <span class="d-block">Pickup is available for most items. If an item is eligible, you'll see the pickup option during checkout.</span>
                                                </div>
                                            </li>
                                            <li class="d-block">
                                                <div class="ul-mtm-15">
                                                    <span class="d-block heading-color heading-weight">When will my order be ready for pickup?</span>
                                                    <span class="d-block">Orders are typically ready for pickup within a few hours. You'll receive an email notification once your order is ready.</span>
                                                </div>
                                            </li>
                                            <li class="d-block">
                                                <div class="ul-mtm-15">
                                                    <span class="d-block heading-color heading-weight">Can someone else pick up my order for me?</span>
                                                    <span class="d-block">Yes, you can authorize someone else to pick up your order. Simply forward them the confirmation email, and they can collect the items on your behalf.</span>
                                                </div>
                                            </li>
                                            <li class="d-block">
                                                <div class="ul-mtm-15">
                                                    <span class="d-block heading-color heading-weight">Is there a cutoff time for same-day pickup?</span>
                                                    <span class="d-block">Yes, orders placed before [insert cutoff time] are usually available for same-day pickup. Orders placed after this time will be ready the following day.</span>
                                                </div>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- pickup-modal end -->
            </section>
            <!-- product-detail end -->
            <!-- product-detail-tab start -->
            <section class="product-detail-tab section-pt">
                <div class="container">
                    <div class="product-tab horizontal-tab">
                        <div class="product-tab-nav beb" data-animate="animate__fadeIn">
                            <ul class="nav nav-tabs ul-tab border-0" role="tablist">
                                <li>
                                    <a href="#pro-desc-tab" class="d-block peb-11 heading-weight active" data-bs-toggle="tab" role="tab" aria-selected="true">Description</a>
                                </li>
                                <li>
                                    <a href="#pro-ai-tab" class="d-block peb-11 heading-weight" data-bs-toggle="tab" role="tab" aria-selected="false">Additional-info</a>
                                </li>
                                <!-- <li>
                                    <a href="#pro-review-tab" class="d-block peb-11 heading-weight" data-bs-toggle="tab" role="tab" aria-selected="false">Reviews</a>
                                </li> -->
                            </ul>
                        </div>
                        
                        <div class="product-tab-info tab-content mst-30" data-animate="animate__fadeIn">
                            <div class="tab-pane fade active show" id="pro-desc-tab">
                                <div class="product-tab-description">
                                    <div class="product-description-info">
                                        <h6>About this item</h6>
                                        <p><?= strip_tags($product['description'], '<p><b><i><u><br><ul><li>') ?></p>
                                        
                                    </div>
                                </div>
                            </div>
                            <div class="tab-pane fade" id="pro-ai-tab">
                                <div class="product-tab-ai">
                                    <table class="w-100">
                                        <tbody>
                                            <tr>
                                                <th class="heading-color ptb-10 plr-15 heading-weight border-full" scope="row">Metal Purity</th>
                                                <td class="ptb-10 plr-15 border-full"><?= htmlspecialchars($metalData['metal_purity']) ?></td>
                                            </tr>
                                            <tr>
                                                <th class="heading-color ptb-10 plr-15 heading-weight border-full" scope="row">Metal Type</th>
                                                <td class="ptb-10 plr-15 border-full"><?= htmlspecialchars($metalData['metal_type']) ?></td>
                                            </tr>
                                            <tr>
                                                <th class="heading-color ptb-10 plr-15 heading-weight border-full" scope="row">Product Type</th>
                                                <td class="ptb-10 plr-15 border-full"><a href="#" class="body-dominant-color text-decoration-underline">Earrings</a></td>
                                            </tr>
                                            <tr>
                                                <th class="heading-color ptb-10 plr-15 heading-weight border-full" scope="row">Size</th>
                                                <td class="body-color ptb-10 plr-15 border-full"><?= htmlspecialchars($metalData['dimensions']) ?></td>
                                            </tr>
                                            <tr>
                                                <th class="heading-color ptb-10 plr-15 heading-weight border-full" scope="row">Net Weight </th>
                                                <td class="body-color ptb-10 plr-15 border-full"><?= htmlspecialchars($metalData['net_weight']) ?></td>
                                            </tr>
                                            <tr>
                                                <th class="heading-color ptb-10 plr-15 heading-weight border-full" scope="row">Weight</th>
                                                <td class="body-color ptb-10 plr-15 border-full"><?= htmlspecialchars($metalData['weight']) ?></td>
                                            </tr>
                                            <tr>
                                                <th class="heading-color ptb-10 plr-15 heading-weight border-full" scope="row">Brand</th>
                                                <td class="body-color ptb-10 plr-15 border-full">Pooja Jewellers</td>
                                            </tr>
                                            <tr>
                                                <th class="heading-color ptb-10 plr-15 heading-weight border-full" scope="row">Gender</th>
                                                <td class="body-color ptb-10 plr-15 border-full">Women</td>
                                            </tr>
                                            <tr>
                                                <th class="heading-color ptb-10 plr-15 heading-weight border-full" scope="row">Warrenty</th>
                                                <td class="body-color ptb-10 plr-15 border-full">6 Month</td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <!-- <div class="tab-pane fade" id="pro-review-tab">
                                <div class="product-tab-review">
                                    <div class="product-review">
                                            <div class="row row-mtm">
                                                <div class="product-review-info">
                                                    <div class="row row-mtm">
                                                        <div class="col-12 col-sm-6 col-md-4">
                                                            <h6 class="font-18 meb-18">Customer reviews</h6>
                                                        </div>
                                                        <div class="col-12 col-md-4 text-md-end">
                                                            <button type="button" class="d-none width-100 width-md-auto btn-style secondary-btn write-review-btn">Write a review</button>
                                                            <button type="button" class="width-100 width-md-auto btn-style secondary-btn close-review-btn">Close review</button>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div id="reviewMessage"></div>
                                                <form id="reviewForm" method="post" action="">
                                                    <input type="hidden" name="action" value="add_review">
                                                    <input type="hidden" name="product_name" value="<?= htmlspecialchars($product['product_name'] ?? 'Demo Product') ?>">
                                                    <input type="hidden" name="product_id" value="<?= htmlspecialchars($product['product_id'] ?? 1) ?>">
                                                
                                                    <div class="product-review-form">
                                                        <div class="row field-row">
                                                            <div class="col-12 col-md-6 field-col">
                                                                <label for="review-name">Name</label>
                                                                <input type="text" id="review-name" name="review_name" class="w-100" placeholder="Your Name" required>
                                                            </div>
                                                
                                                            <div class="col-12 col-md-6 field-col">
                                                                <label for="review-email">Email</label>
                                                                <input type="email" id="review-email" name="review_email" class="w-100" placeholder="Your Email" required>
                                                            </div>
                                                
                                                            <div class="col-12 field-col">
                                                                <label for="review-title">Review Title</label>
                                                                <input type="text" id="review-title" name="review_title" class="w-100" placeholder="Title" required>
                                                            </div>
                                                
                                                            <div class="col-12 field-col">
                                                                <label for="review-message">Review Message</label>
                                                                <textarea rows="5" id="review-message" name="review_message" class="w-100" placeholder="Write your review..." required></textarea>
                                                            </div>
                                                        </div>
                                                
                                                        <div class="product-review-button mst-20 mst-sm-30">
                                                            <div class="row btn-row">
                                                                <div class="col-12 col-sm-6 col-xl-3">
                                                                    <button type="submit" class="w-100 btn-style quaternary-btn review-submit">Submit review</button>
                                                                </div>
                                                                <div class="col-12 col-sm-6 col-xl-3">
                                                                    <button type="reset" class="w-100 btn-style secondary-btn review-cancel">Cancel review</button>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </form>
                                                <div class="product-review-comment">
                                                    <div class="row row-mtm">
                                                        
                                                        
                                                        <?php if (count($reviews) > 0): ?>
                                                            <?php foreach ($reviews as $review): ?>
                                                                <div class="product-review-detail">
                                                                    <div class="product-reviewer-info d-flex flex-wrap align-items-center">
                                                                        <span class="width-48 height-48 secondary-color icon-16 d-flex align-items-center justify-content-center overflow-hidden rounded-circle">
                                                                            <i class="ri-user-line d-block lh-1"></i>
                                                                        </span>
                                                                        <h6 class="product-reviewer-name width-calc-48 font-18 psl-15">
                                                                            <?= htmlspecialchars($review['review_name']) ?>
                                                                        </h6>
                                                                    </div>
                                                                    <div class="product-reviewer-date mst-12">
                                                                        Reviewed on <?= date("M d, Y", strtotime($review['created_at'])) ?>
                                                                    </div>
                                                                    <div class="product-reviewer-subject heading-color heading-weight mst-12">
                                                                        <?= htmlspecialchars($review['review_title']) ?>
                                                                    </div>
                                                                    <p class="product-reviewer-review mst-5">
                                                                        <?= nl2br(htmlspecialchars($review['review_message'])) ?>
                                                                    </p>
                                                                </div>
                                                            <?php endforeach; ?>
                                                        <?php else: ?>
                                                            <p>No reviews yet. Be the first to review this product!</p>
                                                        <?php endif; ?>


                                                    </div>
                                                </div>
                                            </div>
                                    </div>
                                </div>
                            </div> -->
                        </div>
                    </div>
                </div>
            </section>
            <!-- product-detail-tab end -->
             <?php endif; ?>
            <!-- related-product start -->
            <section class="related-area section-ptb">
                <div class="container">
                    <div class="collection-category">
                        <div class="section-capture text-center" data-animate="animate__fadeIn">
                            <div class="section-title">
                                <h2 class="section-heading">Related product</h2>
                            </div>
                        </div>
                        <div class="collection-wrap">
                            <div class="related-slider swiper" id="related-slider">
                                
                                    <?php
                                // Enable error reporting
                                ini_set('display_errors', 1);
                                error_reporting(E_ALL);

                                // Database connection
                                $host = 'localhost';
                                $db   = 'poojajeweller';
                                $user = 'poojajeweller_user';
                                $pass = 'Poojajeweller@12345#';
                                $charset = 'utf8mb4';

                                // $host = 'localhost';
                                // $db   = 'poojajeweller';
                                // $user = 'root';
                                // $pass = '';
                                // $charset = 'utf8mb4';

                                $dsn = "mysql:host=$host;dbname=$db;charset=$charset";
                                $options = [
                                    PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
                                    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
                                ];
                                $pdo = new PDO($dsn, $user, $pass, $options);

                                // Get product ID
                                $product_id = intval($_GET['id'] ?? 0);
                                if ($product_id <= 0) {
                                    die("Invalid Product ID");
                                }

                                // ==================
                                // Fetch Product Info
                                // ==================
                                $stmt = $pdo->prepare("
                                    SELECT p.*, 
                                        c.name AS category_name,
                                        g.gender_name,
                                        mc.name AS main_category_name,
                                        sc.name AS sub_category_name
                                    FROM products p
                                    JOIN product_categories c ON p.category_id = c.id
                                    JOIN products_gender g ON p.gender_id = g.id
                                    LEFT JOIN main_categories mc ON p.main_category_id = mc.id
                                    LEFT JOIN sub_categories sc ON p.sub_category_id = sc.id
                                    WHERE p.product_id = ?
                                ");
                                $stmt->execute([$product_id]);
                                $product = $stmt->fetch();

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

                                // Check product type (rental / sale)
                                $isRental = (int)$product['is_rental'] === 1;

                                // Fetch additional details
                                if ($isRental) {
                                    // Rental details
                                    $rentalStmt = $pdo->prepare("SELECT * FROM product_rentals WHERE product_id = ?");
                                    $rentalStmt->execute([$product_id]);
                                    $rentalData = $rentalStmt->fetch();

                                    $fancyStmt = $pdo->prepare("SELECT * FROM product_fancy WHERE product_id = ?");
                                    $fancyStmt->execute([$product_id]);
                                    $fancyData = $fancyStmt->fetch();
                                } else {
                                    // Sale details
                                    $saleStmt = $pdo->prepare("SELECT * FROM product_sales WHERE product_id = ?");
                                    $saleStmt->execute([$product_id]);
                                    $saleData = $saleStmt->fetch();

                                    $metalStmt = $pdo->prepare("SELECT * FROM product_gold_silver WHERE product_id = ?");
                                    $metalStmt->execute([$product_id]);
                                    $metalData = $metalStmt->fetch();
                                }

                                // ==================
                                // Fetch Related Products
                                // ==================
                                $relatedStmt = $pdo->prepare("
                                    SELECT p.*, 
                                        mc.name AS main_category_name,
                                        sc.name AS sub_category_name,
                                        ps.price AS sale_price,
                                        ps.mrp AS sale_mrp,
                                        ps.sku_code,
                                        pr.rental_amount,
                                        pr.deposit_amount,
                                        pr.rental_duration
                                    FROM products p
                                    LEFT JOIN main_categories mc ON p.main_category_id = mc.id
                                    LEFT JOIN sub_categories sc ON p.sub_category_id = sc.id
                                    LEFT JOIN product_sales ps ON p.product_id = ps.product_id
                                    LEFT JOIN product_rentals pr ON p.product_id = pr.product_id
                                    WHERE p.category_id = ? 
                                    AND p.main_category_id = ? 
                                    AND p.sub_category_id = ? 
                                    AND p.product_id != ?
                                    AND p.status = 'active'
                                    LIMIT 6
                                ");

                                $relatedStmt->execute([
                                    $product['category_id'],
                                    $product['main_category_id'],
                                    $product['sub_category_id'],
                                    $product_id
                                ]);

                                $relatedProducts = $relatedStmt->fetchAll();

                                // Optional Debug
                                // echo "<pre>"; print_r($relatedProducts); echo "</pre>";
                                ?>

                                    <div class="swiper-wrapper">
                                    <?php foreach ($relatedProducts as $rel): 
                                        // Determine images
                                        $images = json_decode($rel['product_images'], true);
                                        $img1 = $images[0] ?? $rel['thumbnail_image'];
                                        $img2 = $images[1] ?? $rel['thumbnail_image'];

                                        // Determine price
                                        if ((int)$rel['is_rental'] === 1) {
                                            $price = $rel['rental_amount'] ?? 'N/A';
                                            $old_price = $rel['deposit_amount'] ?? null;
                                        } else {
                                            $price = $rel['sale_price'] ?? 'N/A';
                                            $old_price = $rel['sale_mrp'] ?? null;
                                        }
                                    ?>
                                    <div class="swiper-slide h-auto d-flex" data-animate="animate__fadeIn">
                                        <div class="single-product w-100">
                                            <div class="row single-product-wrap">
                                                <div class="product-image">
                                                    <a href="product_details.php?id=<?= $rel['product_id'] ?>" class="pro-img pimg">
                                                        <img src="<?= htmlspecialchars($img2) ?>" class="w-100 img-fluid img1" alt="<?= htmlspecialchars($rel['product_name']) ?>" >
                                                        <img src="<?= htmlspecialchars($img1) ?>" class="w-100 img-fluid img2" alt="<?= htmlspecialchars($rel['product_name']) ?>">
                                                    </a>
                                                </div>
                                                <style>
                                                    .pimg{
                                                        height:260px;
                                                        width:300px;
                                                    }
                                                    .pimg img{
                                                        height: 100%;
                                                        width: 100%;
                                                        object-fit: fill;
                                                    }
                                                    
                                                    </style>
                                                <div class="product-content">
                                                    <div class="pro-content">
                                                        <div class="pro-content-action">
                                                            <div class="product-title">
                                                                <span class="d-block meb-8"><?= htmlspecialchars($rel['main_category_name']) ?> / <?= htmlspecialchars($rel['sub_category_name']) ?></span>
                                                                <span class="d-block heading-weight">
                                                                    <a href="product_details.php?id=<?= $rel['product_id'] ?>" 
                                                                    class="d-block w-100 dominant-link text-truncate">
                                                                    <?= htmlspecialchars($rel['product_name']) ?>
                                                                    </a>
                                                                </span>
                                                            </div>
                                                            <div class="pro-price-action">
                                                                <div class="price-box heading-weight">
                                                                    <span class="new-price dominant-color">₹<?= htmlspecialchars($price) ?></span>
                                                                    <?php if (!empty($old_price)): ?>
                                                                        <span class="old-price text-decoration-line-through">₹<?= htmlspecialchars($old_price) ?></span>
                                                                    <?php endif; ?>
                                                                </div>
                                                                <div class="product-action">
                                                                    <button class="add-to-cart-btn" data-product-id="<?= htmlspecialchars($rel['product_unique_id']) ?>">
                                                                        <span class="product-icon">
                                                                            <span class="product-bag-icon icon-16"><i class="ri-shopping-bag-3-line d-block lh-1"></i></span>
                                                                        </span>
                                                                        <span class="tooltip-text">Add to Cart</span>
                                                                    </button>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="product-description">
                                                            <p><?= substr(strip_tags($rel['short_description'] ?? $rel['description']), 0, 80) ?>...</p>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    
                                    <?php endforeach; ?>
                                    
                                </div>
                            </div>
                            <div class="swiper-buttons">
                                <div class="swiper-buttons-wrap">
                                    <button type="button" class="swiper-prev swiper-prev-related" aria-label="Arrow previous"><i class="ri-arrow-left-line d-block lh-1"></i></button>
                                    <button type="button" class="swiper-next swiper-next-related" aria-label="Arrow next"><i class="ri-arrow-right-line d-block lh-1"></i></button>
                                </div>
                            </div>
                            <div class="swiper-dots" data-animate="animate__fadeIn">
                                <div class="swiper-pagination swiper-pagination-related"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
           

            <!-- related-product end -->
        </main>
        <!-- main end -->
<script>
$(document).ready(function() {
    $("#reviewForm").on("submit", function(e) {
        e.preventDefault(); // Stop normal form submission

        $.ajax({
            url: "submit_review.php", // your PHP handler
            type: "POST",
            data: $(this).serialize(),
            dataType: "json",
            beforeSend: function() {
                $(".review-submit").prop("disabled", true).text("Submitting...");
                $("#reviewMessage").html("");
            },
            success: function(response) {
                if (response.success) {
                    $("#reviewMessage").html("<p style='color:green;'>" + response.message + "</p>");
                    $("#reviewForm")[0].reset(); // Clear form
                } else {
                    $("#reviewMessage").html("<p style='color:red;'>" + response.message + "</p>");
                }
            },
            error: function() {
                $("#reviewMessage").html("<p style='color:red;'>Something went wrong. Please try again.</p>");
            },
            complete: function() {
                $(".review-submit").prop("disabled", false).text("Submit review");
            }
        });
    });
});
</script>



<?php include "common/footer.php"; ?>

........