<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
    <dialog layout:fragment="overlay" id="theme-overlay" class="dialog" data-closable>
        <div class="flex vertical p-7">
            <h2 class="font-500 underlined">Appearance (beta)</h2>

            <div class="grid col-2 align-center" style="--col-1: minmax(0, 8rem)">
                <label for="theme">Theme</label>
                <select id="theme" class="textfield">
                    <option value="tu" selected>TU Delft</option>
                    <option value="light">☀️ Light</option>
                    <option value="dark">🌙 Dark</option>
                </select>
                <script>
                    document.addEventListener("DOMContentLoaded", function () {
                        const themeSelect = document.getElementById("theme");
                        themeSelect.addEventListener("change", function (event) {
                            setTheme(event.target.value);
                        });
                        if (theme !== null) {
                            themeSelect.value = theme;
                        }
                    });
                </script>
            </div>

            <div>
                <button class="button p-less" data-style="outlined" data-cancel>Close</button>
            </div>
        </div>
    </dialog>
</html>
