<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<link href="<?php echo APP_URL; ?>/assets/css/style.css" rel="stylesheet">

<nav class="navbar navbar-expand-lg">
    <div class="container-fluid">
        <a class="navbar-brand" href="<?php echo APP_URL; ?>/dashboard.php">
            <i class="fas fa-cash-register me-1"></i> KasirMurah.biz.id
        </a>
        <!-- Mobile Logout Button -->
        <a href="<?php echo APP_URL; ?>/auth/logout.php" class="mobile-logout-btn" title="Logout">
            <i class="fas fa-sign-out-alt"></i>
        </a>
        <button class="navbar-toggler desktop-only" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse desktop-only" id="navbarNav">
            <ul class="navbar-nav ms-auto align-items-lg-center">
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo APP_URL; ?>/dashboard.php">
                        <i class="fas fa-home me-1"></i> Dashboard
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo APP_URL; ?>/pos/index.php">
                        <i class="fas fa-shopping-cart me-1"></i> Kasir
                    </a>
                </li>
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                        <i class="fas fa-box me-1"></i> Produk
                    </a>
                    <ul class="dropdown-menu">
                        <li><a class="dropdown-item" href="<?php echo APP_URL; ?>/products/index.php"><i class="fas fa-list me-2"></i>Daftar Produk</a></li>
                        <li><a class="dropdown-item" href="<?php echo APP_URL; ?>/products/create.php"><i class="fas fa-plus me-2"></i>Tambah Produk</a></li>
                    </ul>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo APP_URL; ?>/reports/index.php">
                        <i class="fas fa-chart-bar me-1"></i> Laporan
                    </a>
                </li>
                <?php if (isset($_SESSION['role']) && $_SESSION['role'] === 'admin'): ?>
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle text-warning fw-bold" href="#" role="button" data-bs-toggle="dropdown">
                        <i class="fas fa-shield-alt me-1"></i> Admin
                    </a>
                    <ul class="dropdown-menu">
                        <li><a class="dropdown-item" href="<?php echo APP_URL; ?>/admin/users.php"><i class="fas fa-users me-2"></i>Daftar User</a></li>
                        <li><a class="dropdown-item" href="<?php echo APP_URL; ?>/admin/payments.php"><i class="fas fa-money-bill me-2"></i>Verifikasi Pembayaran</a></li>
                    </ul>
                </li>
                <?php endif; ?>
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                        <i class="fas fa-user-circle me-1"></i> <?php echo htmlspecialchars($_SESSION['name'] ?? ''); ?>
                    </a>
                    <ul class="dropdown-menu dropdown-menu-end">
                        <li><a class="dropdown-item" href="<?php echo APP_URL; ?>/profile.php"><i class="fas fa-user me-2"></i>Profile</a></li>
                        <li><a class="dropdown-item" href="<?php echo APP_URL; ?>/subscription/status.php"><i class="fas fa-crown me-2"></i>Status Langganan</a></li>
                        <li><a class="dropdown-item" href="<?php echo APP_URL; ?>/subscription/payments.php"><i class="fas fa-money-bill me-2"></i>Pembayaran</a></li>
                        <li><hr class="dropdown-divider"></li>
                        <li><a class="dropdown-item text-danger" href="<?php echo APP_URL; ?>/auth/logout.php"><i class="fas fa-sign-out-alt me-2"></i>Logout</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
</nav>

<!-- Mobile Bottom Navigation -->
<nav class="mobile-bottom-nav">
    <a href="<?php echo APP_URL; ?>/dashboard.php" class="nav-item nav-link <?php echo strpos($_SERVER['REQUEST_URI'],'dashboard') !== false ? 'active' : ''; ?>">
        <i class="fas fa-home"></i><span>Home</span>
    </a>
    <a href="<?php echo APP_URL; ?>/pos/index.php" class="nav-item nav-link <?php echo strpos($_SERVER['REQUEST_URI'],'/pos/') !== false ? 'active' : ''; ?>">
        <i class="fas fa-shopping-cart"></i><span>Kasir</span>
    </a>
    <a href="<?php echo APP_URL; ?>/products/index.php" class="nav-item nav-link <?php echo strpos($_SERVER['REQUEST_URI'],'products') !== false ? 'active' : ''; ?>">
        <i class="fas fa-box"></i><span>Produk</span>
    </a>
    <a href="<?php echo APP_URL; ?>/reports/index.php" class="nav-item nav-link <?php echo strpos($_SERVER['REQUEST_URI'],'reports') !== false ? 'active' : ''; ?>">
        <i class="fas fa-chart-bar"></i><span>Laporan</span>
    </a>
    <a href="<?php echo APP_URL; ?>/subscription/status.php" class="nav-item nav-link <?php echo strpos($_SERVER['REQUEST_URI'],'subscription') !== false ? 'active' : ''; ?>">
        <i class="fas fa-crown"></i><span>Langganan</span>
    </a>
    <a href="<?php echo APP_URL; ?>/profile.php" class="nav-item nav-link <?php echo strpos($_SERVER['REQUEST_URI'],'profile') !== false ? 'active' : ''; ?>">
        <i class="fas fa-user"></i><span>Profil</span>
    </a>
</nav>
