<?php
require_once __DIR__ . '/../config.php';
require_once __DIR__ . '/cart.php';

$cart = new Cart();
$cartCount = $cart->getCount();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo isset($pageTitle) ? $pageTitle . ' - ' : ''; ?><?php echo SITE_NAME; ?></title>
    <link rel="stylesheet" href="<?php echo SITE_URL; ?>/assets/css/style.css">
    <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>R</text></svg>">
</head>
<body>
    <header class="header">
        <div class="header-inner">
            <a href="<?php echo SITE_URL; ?>/index.php" class="logo">Rorschach<span>Co.</span></a>
            
            <nav class="nav">
                <ul class="nav-links">
                    <li><a href="<?php echo SITE_URL; ?>/index.php">Home</a></li>
                    <li><a href="<?php echo SITE_URL; ?>/products.php">Shop</a></li>
                    <li><a href="<?php echo SITE_URL; ?>/products.php?category=Tops">Tops</a></li>
                    <li><a href="<?php echo SITE_URL; ?>/products.php?category=Outerwear">Outerwear</a></li>
                    <li><a href="<?php echo SITE_URL; ?>/products.php?category=Accessories">Accessories</a></li>
                </ul>
                
                <div class="header-actions">
                    <?php if (isLoggedIn()): ?>
                        <a href="<?php echo SITE_URL; ?>/account.php">Account</a>
                        <?php if (isAdmin()): ?>
                            <a href="<?php echo SITE_URL; ?>/admin/">Admin</a>
                        <?php endif; ?>
                        <a href="<?php echo SITE_URL; ?>/logout.php">Logout</a>
                    <?php else: ?>
                        <a href="<?php echo SITE_URL; ?>/login.php">Login</a>
                        <a href="<?php echo SITE_URL; ?>/register.php">Register</a>
                    <?php endif; ?>
                    <a href="<?php echo SITE_URL; ?>/cart.php" class="cart-icon">
                        Cart
                        <?php if ($cartCount > 0): ?>
                            <span class="cart-count"><?php echo $cartCount; ?></span>
                        <?php endif; ?>
                    </a>
                </div>
                
                <div class="mobile-menu-toggle" onclick="toggleMobileMenu()">
                    <span></span>
                    <span></span>
                    <span></span>
                </div>
            </nav>
        </div>
    </header>
    
    <main>
