@{
    var sidebarVariant = (ViewData["SidebarVariant"] as string) ?? "1";
    var hideChrome = ViewData["HideChrome"] is bool hc && hc;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>EDK - @ViewData["Title"]</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.13.0/dist/cdn.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.7/dist/chart.umd.min.js"></script>
    <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=Poppins:wght@300;400;450;500;600;700;800&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="~/css/style@(sidebarVariant).css" asp-append-version="true" />
    @foreach (var key in ViewData.Keys.Where(k => k.StartsWith("Css:")).ToList())
    {
        <link rel="stylesheet" href="~/@(ViewData[key])" asp-append-version="true" />
    }
    <style>
        body { font-family: "Poppins", sans-serif; }
        [x-cloak] { display: none !important; }
    </style>
</head>
<body>
    @if (!hideChrome && ViewData["SidebarVariant"] is string)
    {
        <div x-data="{ side: true, isMobile: false }"
             x-init="isMobile = window.innerWidth <= 768; if(isMobile){ side = false } window.addEventListener('resize', function(){ isMobile = window.innerWidth <= 768; if(isMobile){ side = false } else { side = true } })">
            <div x-show="side && isMobile" x-on:click="side = false" class="fixed inset-0 bg-black/60 z-40 md:hidden"></div>
            <partial name="_Sidebar@(sidebarVariant)" />
            <main id="main" x-bind:class="{ 'shift': side }">
                <partial name="_Topbar" />
                @RenderBody()
            </main>
        </div>
    }
    else
    {
        @RenderBody()
    }

    <script src="~/js/script.js" asp-append-version="true"></script>
    @foreach (var key in ViewData.Keys.Where(k => k.StartsWith("Js:")).ToList())
    {
        <script src="~/@(ViewData[key])" asp-append-version="true"></script>
    }

    @await RenderSectionAsync("Scripts", required: false)
</body>
</html>
