<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>{% block title %}{{ page_title | default("Dazzle App") }}{% endblock %}</title>

  {# Inter font #}
  <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@400;500;600;700&display=swap" rel="stylesheet">

  {# DaisyUI + Tailwind CDN #}
  <link href="https://cdn.jsdelivr.net/npm/daisyui@4.12.14/dist/full.min.css" rel="stylesheet" type="text/css" />
  <script src="https://cdn.tailwindcss.com"></script>

  {# HTMX + extensions #}
  <script src="https://unpkg.com/htmx.org@2.0.8"></script>
  <script src="https://unpkg.com/htmx-ext-json-enc@2.0.1/json-enc.js"></script>
  <script src="https://unpkg.com/idiomorph@0.7.4/dist/idiomorph-ext.min.js"></script>

  {# Dazzle micro-runtime — replaces Alpine.js #}
  <link rel="stylesheet" href="/static/css/dz.css">
  <script defer src="/static/js/dz.js"></script>

  {# Design token CSS custom properties #}
  <style>
    :root {
      {% if design_tokens %}
      {% for key, value in design_tokens.items() %}
      --dz-{{ key }}: {{ value }};
      {% endfor %}
      {% else %}
      --dz-primary: #3b82f6;
      --dz-secondary: #6c757d;
      --dz-success: #28a745;
      --dz-danger: #dc3545;
      --dz-warning: #ffc107;
      --dz-space-xs: 0.25rem;
      --dz-space-sm: 0.5rem;
      --dz-space-md: 1rem;
      --dz-space-lg: 1.5rem;
      --dz-space-xl: 2rem;
      --dz-radius: 0.25rem;
      {% endif %}
    }
  </style>

  {% if theme_css %}
  <style>{{ theme_css }}</style>
  {% endif %}

  {% block head_extra %}{% endblock %}
</head>
<body class="min-h-screen bg-base-200" style="font-family: var(--font-sans)" hx-boost="true" hx-ext="morph">
  {% block body %}
  {% endblock %}

  {# Toast notifications area — no Alpine, just a container for dz.toast() #}
  <div id="dz-toast" class="toast toast-end toast-top" aria-live="polite"></div>

  {% block scripts_extra %}{% endblock %}
</body>
</html>
