<?php
if (!isset($page_title))   $page_title   = 'Free Fire Guide 2025';
if (!isset($header_title)) $header_title = 'Free Fire Guide';
if (!isset($back_url))     $back_url     = '';
if (!isset($header_tabs))  $header_tabs  = [];
?>
<style>
  .site-header {
    background: linear-gradient(135deg, #c2185b, #e91e8c);
    display: flex; align-items: center; gap: 10px;
    padding: 15px 16px; position: relative; z-index: 10;
    box-shadow: 0 2px 12px rgba(194,24,91,0.25);
  }
  .site-header .back-btn {
    color: rgba(255,255,255,0.9); text-decoration: none;
    font-size: 1.1rem; font-weight: 600; opacity: 0.85;
    line-height: 1; min-width: 24px;
  }
  .site-header .back-btn:hover { opacity: 1; }
  .site-header .header-title {
    font-size: 1rem; font-weight: 700; color: #fff;
    flex: 1; text-align: center;
    font-family: 'Rajdhani', 'Segoe UI', sans-serif; letter-spacing: 0.03em;
  }
  .site-header .header-spacer { width: 24px; }
  .site-tabs {
    display: flex; background: #fff;
    border-bottom: 2px solid #fce4ec; position: relative; z-index: 1;
  }
  .site-tabs .page-tab {
    flex: 1; padding: 11px 8px; text-align: center;
    font-size: 0.8rem; font-weight: 600; color: #9c5070;
    text-decoration: none; border-bottom: 3px solid transparent; transition: all 0.2s;
  }
  .site-tabs .page-tab.active { color: #c2185b; border-bottom-color: #c2185b; }
  .site-tabs .page-tab:hover { color: #c2185b; }
</style>

<?php include __DIR__ . '/adheader.php'; ?>

<div class="site-header">
  <?php if ($back_url !== ''): ?>
    <a href="<?= htmlspecialchars($back_url) ?>" class="back-btn">&#8592;</a>
  <?php else: ?>
    <span class="back-btn" style="opacity:0;pointer-events:none;">&#8592;</span>
  <?php endif; ?>
  <div class="header-title"><?= htmlspecialchars($header_title) ?></div>
  <?php if ($back_url !== ''): ?>
    <div class="header-spacer"></div>
  <?php else: ?>
    <span class="back-btn" style="opacity:0;pointer-events:none;">&#8592;</span>
  <?php endif; ?>
</div>

<?php if (!empty($header_tabs)): ?>
<div class="site-tabs">
  <?php foreach ($header_tabs as $tab): ?>
    <a href="<?= htmlspecialchars($tab['url']) ?>"
       class="page-tab<?= !empty($tab['active']) ? ' active' : '' ?>">
      <?= htmlspecialchars($tab['label']) ?>
    </a>
  <?php endforeach; ?>
</div>
<?php endif; ?>
