<?php
// Usage:
// $title = '...'; $subtitle = '...'; $actions = [ ['label'=>'...', 'href'=>'...', 'class'=>'btn btn-primary ec-btn', 'icon'=>'fa-solid fa-plus'] ];
?>
<div class="d-flex justify-content-between align-items-center flex-wrap gap-2 mb-3">
  <div>
    <div class="fw-bold" style="font-size:1.25rem;"><?= e((string)($title ?? '')) ?></div>
    <?php if (!empty($subtitle)): ?>
      <div class="text-muted small"><?= e((string)$subtitle) ?></div>
    <?php endif; ?>
  </div>

  <div class="d-flex gap-2 flex-wrap">
    <?php if (!empty($actions) && is_array($actions)): ?>
      <?php foreach ($actions as $a): ?>
        <a class="<?= e((string)($a['class'] ?? 'btn btn-outline-primary ec-btn')) ?>" href="<?= e((string)($a['href'] ?? '#')) ?>">
          <?php if (!empty($a['icon'])): ?><i class="<?= e((string)$a['icon']) ?> me-2"></i><?php endif; ?>
          <?= e((string)($a['label'] ?? '')) ?>
        </a>
      <?php endforeach; ?>
    <?php endif; ?>
  </div>
</div>
