<?php
$user=current_user();
$cartSummary=App\Core\Cart::summary();
$resolvedTitle=(string)($pageTitle ?? BRAND_NAME . ' | ' . APP_NAME);
$resolvedDescription=trim(strip_tags((string)($pageDescription ?? 'Smart Tech OMP multi-vendor marketplace powered by Smart Tech.')));
$resolvedOgImage=(string)($pageOgImage ?? asset('brand/logo.png'));
$requestPath=(string)(parse_url((string)($_SERVER['REQUEST_URI'] ?? '/'), PHP_URL_PATH) ?? '/');
$appParts=APP_URL !== '' ? parse_url(APP_URL) : false;
$appOrigin=is_array($appParts) && !empty($appParts['scheme']) && !empty($appParts['host']) ? $appParts['scheme'].'://'.$appParts['host'].(!empty($appParts['port'])?':'.$appParts['port']:'') : '';
$resolvedCanonical=(string)($pageCanonical ?? ($appOrigin !== '' ? $appOrigin . $requestPath : ''));
?>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="theme-color" content="#0B5FFF"><title><?= e($resolvedTitle) ?></title><meta name="description" content="<?= e($resolvedDescription) ?>"><meta property="og:type" content="<?= e($pageOgType ?? 'website') ?>"><meta property="og:title" content="<?= e($resolvedTitle) ?>"><meta property="og:description" content="<?= e($resolvedDescription) ?>"><meta property="og:image" content="<?= e($resolvedOgImage) ?>"><?php if($resolvedCanonical!==''): ?><meta property="og:url" content="<?= e($resolvedCanonical) ?>"><link rel="canonical" href="<?= e($resolvedCanonical) ?>"><?php endif; ?><meta name="twitter:card" content="summary_large_image"><meta name="twitter:title" content="<?= e($resolvedTitle) ?>"><meta name="twitter:description" content="<?= e($resolvedDescription) ?>"><meta name="twitter:image" content="<?= e($resolvedOgImage) ?>"><link rel="manifest" href="<?= url('public/manifest.php') ?>"><link rel="icon" href="<?= asset('brand/favicon.svg') ?>"><link rel="stylesheet" href="<?= asset('css/bootstrap.min.css') ?>"><link rel="stylesheet" href="<?= asset('css/bootstrap-icons.min.css') ?>"><link rel="stylesheet" href="<?= asset('css/purchase-haat.css') ?>"></head><body>
<header class="site-header sticky-top bg-white border-bottom"><div class="top-strip text-white py-2"><div class="container d-flex justify-content-between small"><span>Nationwide delivery, wallet, rewards and multi-vendor shopping</span><a class="text-white text-decoration-none" href="<?= url('public/track-order.php') ?>">Track Order</a></div></div><nav class="navbar navbar-expand-lg bg-white py-3"><div class="container"><a class="navbar-brand" href="<?= url('') ?>"><img src="<?= asset('brand/logo.png') ?>" height="52" alt="Smart Tech OMP"></a><button class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#nav"><span class="navbar-toggler-icon"></span></button><div class="collapse navbar-collapse" id="nav"><form class="d-flex mx-lg-auto my-3 my-lg-0 search-box position-relative" action="<?= url('public/products.php') ?>"><input id="globalProductSearch" class="form-control" name="q" value="<?= e($_GET['q']??'') ?>" placeholder="Search products, SKU or vendors..." autocomplete="off"><button class="btn btn-primary">Search</button><div id="globalSearchResults" class="list-group position-absolute w-100 shadow d-none" style="top:100%;z-index:1050"></div></form><ul class="navbar-nav ms-auto align-items-lg-center gap-lg-2"><li class="nav-item"><a class="nav-link" href="<?= url('public/products.php') ?>">Products</a></li><li class="nav-item"><a class="nav-link" href="<?= url('public/categories.php') ?>">Categories</a></li><li class="nav-item"><a class="nav-link" href="<?= url('public/shops.php') ?>">Shops</a></li><?php if($user): ?><li class="nav-item"><a class="nav-link" href="<?= url('public/wishlist.php') ?>"><i class="bi bi-heart"></i></a></li><li class="nav-item"><a class="nav-link" href="<?= url('public/compare.php') ?>"><i class="bi bi-arrow-left-right"></i></a></li><?php endif; ?><li class="nav-item"><a class="nav-link" href="<?= url('public/cart.php') ?>">Cart <span id="cartCount" class="badge rounded-pill bg-primary"><?= (int)$cartSummary['count'] ?></span></a></li><?php if($user): ?><li class="nav-item"><a class="btn btn-outline-primary btn-sm" href="<?= url(role_dashboard_url($user['role']??null)) ?>">Dashboard</a></li><li class="nav-item"><form method="post" action="<?= url('public/logout.php') ?>" class="nav-item m-0"><?= csrf_field() ?><button class="nav-link btn btn-link border-0">Logout</button></form></li><?php else: ?><li class="nav-item"><a class="btn btn-primary btn-sm" href="<?= url('public/login.php') ?>">Login</a></li><?php endif; ?></ul></div></div></nav></header><main>
<div id="phToastContainer" class="toast-container position-fixed top-0 end-0 p-3" style="z-index:2000"></div>
