<!DOCTYPE html>
<html lang="pl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>BackPRO - Zarządzanie Zapleczem SEO</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
    <link href="/assets/css/app.css" rel="stylesheet">
</head>
<body class="bg-light-subtle">
<?php if (\App\Core\Auth::check()): ?>
<div class="app-shell" id="js-app-shell">
    <?php require __DIR__ . '/sidebar.php'; ?>
    <div class="sidebar-backdrop" id="js-sidebar-backdrop"></div>
    <div class="app-main">
        <?php require __DIR__ . '/header.php'; ?>
        <main class="p-4 flex-grow-1">
            <div class="container-fluid p-0">
                <?php if (!empty($flashMessages)): ?>
                    <?php foreach ($flashMessages as $flash): ?>
                        <div class="alert alert-<?= htmlspecialchars($flash['type']) ?> alert-dismissible fade show shadow-sm border-0">
                            <?= htmlspecialchars($flash['message']) ?>
                            <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                        </div>
                    <?php endforeach; ?>
                <?php endif; ?>
                <?= $content ?>
            </div>
        </main>
    </div>
</div>
<?php else: ?>
    <?php if (!empty($flashMessages)): ?>
        <?php foreach ($flashMessages as $flash): ?>
            <div class="alert alert-<?= htmlspecialchars($flash['type']) ?> m-3">
                <?= htmlspecialchars($flash['message']) ?>
            </div>
        <?php endforeach; ?>
    <?php endif; ?>
    <?= $content ?>
<?php endif; ?>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="/assets/js/app.js"></script>
</body>
</html>
