<?php

if (file_exists(__DIR__ . '/../../app/helpers/auth.php')) {
    require_once __DIR__ . '/../../app/helpers/auth.php';
}
$pageTitle = $pageTitle ?? APP_NAME;
$pageDescription = $pageDescription ?? 'Shop premium LOVE-U Essentials products online with secure checkout and smooth delivery.';

if (file_exists(__DIR__ . '/../../app/helpers/settings.php')) {
    require_once __DIR__ . '/../../app/helpers/settings.php';
}

$siteName = function_exists('get_setting') ? get_setting('site_name', APP_NAME) : APP_NAME;
$announcementText = function_exists('get_setting') ? get_setting('announcement_text', 'Free shipping on selected orders · Secure checkout · UK & Grenada delivery options') : 'Free shipping on selected orders · Secure checkout · UK & Grenada delivery options';

$pageTitle = $pageTitle ?? (function_exists('get_setting') ? get_setting('default_seo_title', APP_NAME) : APP_NAME);
$pageDescription = $pageDescription ?? (function_exists('get_setting') ? get_setting('default_seo_description', 'Shop premium LOVE-U Essentials products online with secure checkout and smooth delivery.') : 'Shop premium LOVE-U Essentials products online with secure checkout and smooth delivery.');

?>


<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title><?= e($pageTitle); ?></title>
    <meta name="description" content="<?= e($pageDescription); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <meta property="og:title" content="<?= e($pageTitle); ?>">
    <meta property="og:description" content="<?= e($pageDescription); ?>">
    <meta property="og:type" content="website">

    <link rel="stylesheet" href="<?= e(BASE_URL); ?>/public/assets/css/style.css">
</head>

<body>

    <?php if ($announcementText !== ''): ?>
    <div class="site-announcement">
        <?= e($announcementText); ?>
    </div>
<?php endif; ?>

    <header class="site-header">
        <div class="header-inner">
            <a href="<?= e(BASE_URL); ?>/public/index.php" class="logo logo-image">
    <img src="<?= e(BASE_URL); ?>/uploads/products/loveu-logo.png" alt="<?= e($siteName); ?>">
</a>

            <nav class="nav">
                <a href="<?= e(BASE_URL); ?>/public/shop.php">Shop</a>
                <a href="<?= e(BASE_URL); ?>/public/shop.php?filter=best-sellers">Best Sellers</a>
                <a href="<?= e(BASE_URL); ?>/public/shop.php?filter=new-arrivals">New Arrivals</a>
                <a href="<?= e(BASE_URL); ?>/public/faq.php">FAQ</a>
                <a href="<?= e(BASE_URL); ?>/public/contact.php">Contact</a>
                <a href="<?= e(BASE_URL); ?>/public/order-tracking.php">Track Order</a>
            </nav>

            <div class="header-actions">
    <form method="GET" action="<?= e(BASE_URL); ?>/public/search.php" class="header-search">
    <input type="search" name="q" placeholder="Search..." aria-label="Search products">
</form>

    <?php if (function_exists('is_customer_logged_in') && is_customer_logged_in()): ?>
        <a href="<?= e(BASE_URL); ?>/public/wishlist.php">Wishlist</a>
        <a href="<?= e(BASE_URL); ?>/public/account.php">Account</a>
    <?php else: ?>
        <a href="<?= e(BASE_URL); ?>/public/login.php">Login</a>
    <?php endif; ?>

    <a href="<?= e(BASE_URL); ?>/public/cart.php">Cart<?= function_exists('cart_count') && cart_count() > 0 ? ' (' . e(cart_count()) . ')' : ''; ?></a>
</div>
        </div>
    </header>