<?php
/**
 * Admin Layout Footer — Closes content wrapper & initializes scripts
 */
?>
  </main><!-- end main content -->

  <!-- Admin Sub-Footer -->
  <footer class="px-8 py-4 bg-white/80 border-t border-slate-200/80 flex items-center justify-between text-xs text-slate-500 font-sans">
    <div>
      <span class="font-bold text-slate-900">AJOUAMAI IMMO-BUSINESS</span> &copy; <?= date('Y') ?> — Console d'Administration Privée
    </div>
    <div class="flex items-center gap-4">
      <a href="<?= SITE_URL ?>/" target="_blank" class="hover:text-brand-700 font-medium">Site Public</a>
      <span>•</span>
      <span class="text-slate-400">Version 2.5 Pro</span>
    </div>
  </footer>

</div><!-- end main wrapper -->

<script src="<?= SITE_URL ?>/assets/js/app.js"></script>
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.3/dist/quill.js"></script>
<script>
// Initialize Quill editors
document.querySelectorAll('.quill-editor').forEach(function(el) {
  const editorId = el.id;
  const hiddenInput = document.getElementById(editorId + '_value');
  const quill = new Quill('#' + editorId, {
    theme: 'snow',
    modules: {
      toolbar: [
        ['bold','italic','underline'],
        [{'list':'ordered'},{'list':'bullet'}],
        ['link'],
        [{'header':[2,3,false]}],
        ['clean']
      ]
    }
  });
  if (hiddenInput && hiddenInput.value) {
    quill.root.innerHTML = hiddenInput.value;
  }
  quill.on('text-change', function() {
    if (hiddenInput) hiddenInput.value = quill.root.innerHTML;
  });
});

// Auto-close flash messages
const flashes = document.querySelectorAll('[data-flash]');
flashes.forEach(f => { setTimeout(() => f.remove(), 5000); });
</script>
</body>
</html>
