<?php
$isInPages = strpos($_SERVER['PHP_SELF'], '/pages/') !== false;
$basePath = $isInPages ? '../' : '';
$currentPage = basename($_SERVER['PHP_SELF'], '.php');
?>
<aside class="sidebar" id="sidebar">
    <div class="sidebar-header">
        <div class="brand">
            <div class="brand-icon"><iconify-icon icon="solar:shop-bold"></iconify-icon></div>
            <div class="brand-text">
                <h1>BarberFlow</h1>
                <span>Commerce</span>
            </div>
        </div>
        <button class="sidebar-toggle" onclick="toggleSidebar()">
            <iconify-icon icon="solar:hamburger-menu-linear"></iconify-icon>
        </button>
    </div>
    
    <nav class="sidebar-nav">
        <div class="nav-section">
            <span class="nav-section-title">Principal</span>
            <a href="<?= $basePath ?>index.php" class="nav-item <?= $currentPage === 'index' ? 'active' : '' ?>">
                <iconify-icon icon="solar:home-smile-bold"></iconify-icon>
                <span>Visão Geral</span>
            </a>
            <a href="<?= $basePath ?>pages/products.php" class="nav-item <?= $currentPage === 'products' ? 'active' : '' ?>">
                <iconify-icon icon="solar:box-bold"></iconify-icon>
                <span>Produtos</span>
                <span class="nav-badge">105</span>
            </a>
            <a href="<?= $basePath ?>pages/categories.php" class="nav-item <?= $currentPage === 'categories' ? 'active' : '' ?>">
                <iconify-icon icon="solar:widget-bold"></iconify-icon>
                <span>Categorias</span>
            </a>
            <a href="<?= $basePath ?>pages/orders.php" class="nav-item <?= $currentPage === 'orders' ? 'active' : '' ?>">
                <iconify-icon icon="solar:bag-check-bold"></iconify-icon>
                <span>Pedidos</span>
                <span class="nav-badge gold">3</span>
            </a>
        </div>
        
        <div class="nav-section">
            <span class="nav-section-title">Marketing</span>
            <a href="#" class="nav-item">
                <iconify-icon icon="solar:sale-bold"></iconify-icon>
                <span>Cupons</span>
            </a>
            <a href="#" class="nav-item">
                <iconify-icon icon="solar:gallery-bold"></iconify-icon>
                <span>Banners</span>
            </a>
        </div>
        
        <div class="nav-section">
            <span class="nav-section-title">Configurações</span>
            <a href="<?= $basePath ?>pages/appearance.php" class="nav-item <?= $currentPage === 'appearance' ? 'active' : '' ?>">
                <iconify-icon icon="solar:palette-bold"></iconify-icon>
                <span>Aparência</span>
            </a>
            <a href="#" class="nav-item">
                <iconify-icon icon="solar:settings-bold"></iconify-icon>
                <span>Configurações</span>
            </a>
        </div>
    </nav>
    
    <div class="sidebar-footer">
        <div class="store-link">
            <iconify-icon icon="solar:shop-bold"></iconify-icon>
            <span>Ver Loja</span>
            <iconify-icon icon="solar:arrow-right-up-linear" class="link-arrow"></iconify-icon>
        </div>
    </div>
</aside>
