<!doctype html>
<html lang="fr" class="h-full">
  <head>
    <meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{% block title %}Kodi - Médiathèque{% endblock %}</title>
    <script>(function(){const s=localStorage.getItem('theme');const d=window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches;if(s==='dark'||(!s&&d)){document.documentElement.classList.add('dark');}else{document.documentElement.classList.remove('dark');}})();</script>
    <script src="https://cdn.tailwindcss.com"></script><script>tailwind.config={darkMode:'class'}</script>
  </head>
  <body class="h-full bg-gray-50 text-gray-900 dark:bg-gray-900 dark:text-gray-100">
    <div class="max-w-7xl mx-auto p-4 md:p-6">
      <header class="flex items-center gap-3 mb-4">
        <nav class="flex gap-2">
          <a href="/movies" class="px-3 py-1 rounded-lg border dark:border-gray-700 bg-white dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700">🎬 Films</a>
          <a href="/shows"  class="px-3 py-1 rounded-lg border dark:border-gray-700 bg-white dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700">📺 Séries</a>
        </nav>
        <div class="ml-auto"><button id="themeToggle" class="px-3 py-1 rounded-lg border dark:border-gray-700 bg-white dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700"><span class="inline dark:hidden">🌙 Mode sombre</span><span class="hidden dark:inline">☀️ Mode clair</span></button></div>
      </header>
      {% block content %}{% endblock %}
    </div>
    <script>document.getElementById('themeToggle')?.addEventListener('click',()=>{const el=document.documentElement;const t=el.classList.contains('dark')?'light':'dark';el.classList.toggle('dark');localStorage.setItem('theme',t);});</script>
  </body>
</html>
