
<!DOCTYPE html>
<html lang="de">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title><?= htmlspecialchars($title ?? 'Mailresponder') ?></title>

  <?php
  $config = include __DIR__ . '/../includes/config.php';
  $appMeta = include __DIR__ . '/../includes/app_meta.php';
  ?>

  <link rel="stylesheet" href="<?php echo $config['app']['base_url'] ?>/assets/bootstrap/dist/css/bootstrap.min.css">
  <?php $styleVersion = @filemtime(__DIR__ . '/../templates/style.css') ?: time(); ?>
  <link rel="stylesheet" href="<?php echo $config['app']['base_url'] ?>/templates/style.css?v=<?= urlencode((string) $styleVersion) ?>">
</head>
<body>
<!-- Header -->
<?php include dirname(__DIR__) . '/includes/menu/header.php'; ?>

<!-- Sub Navigation -->
<?php include dirname(__DIR__) . '/includes/menu/navigation.php'; ?>

<!-- Page Content -->
<div class="page-contend">
	  <div class="container-fluid">
	    <div class="row">
	      <div class="col">
	        <?php
	        $renderedPageContent = $pageContent ?? '';
		        if ($renderedPageContent !== '' && strpos($renderedPageContent, 'class="page-help"') === false) {
		            $fallbackPageHelp = '';
		            if (!empty($pageHelp)) {
		                $fallbackPageHelp = $pageHelp;
		            } else {
		                $fallbackPageHelp = renderPageHelp([
		                    'sections' => [
		                        [
		                            'heading' => 'Kurzinfo',
		                            'items' => [
		                                inferPageHelpPurpose((string)($title ?? ''), (string)($_SERVER['SCRIPT_NAME'] ?? '')),
		                            ],
		                        ],
		                    ],
		                ]);
		            }
		            if ($fallbackPageHelp !== '') {
		                $renderedPageContent = $fallbackPageHelp . $renderedPageContent;
		            }
		        }
	        if ($renderedPageContent !== '') {
	            echo $renderedPageContent;
	        }
	        ?>
	        <br>
	      </div>
	    </div>
	  </div>
</div>

<!-- Footer -->
<nav class="navbar navbar-expand-md fixed-bottom footer">
  <div class="container d-flex flex-wrap align-items-center gap-2 small">
    <span>Version: <?= htmlspecialchars($appMeta['version'] ?? 'unbekannt') ?></span>
    <span>|</span>
    <a href="https://mailresponder.de" target="_blank" rel="noopener noreferrer">Powered by mailresponder.de &ndash; Open Source Email Marketing</a>
    <span>|</span>
    <span>Licensed under GPL-3.0-only</span>
    <span>|</span>
    <a href="https://www.gnu.org/licenses/gpl-3.0.html" target="_blank" rel="noopener noreferrer">GPL-3.0</a>
  </div>
</nav>

<!-- Bootstrap Bundle mit Popper fuer Collapse und andere Komponenten -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="/assets/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<?= renderFieldTooltipBootstrap($fieldTooltips ?? []) ?>
<script>
// Blendet Bootstrap-Alerts mit .auto-dismiss nach 5 Sekunden automatisch aus
setTimeout(function () {
  const alerts = document.querySelectorAll('.auto-dismiss');
  alerts.forEach(alert => {
    alert.classList.add('fade');
    setTimeout(() => {
      alert.remove();
    }, 500);
  });
}, 5000);
</script>
</body>
</html>


