<?php
if (!isset($footer_base)) $footer_base = '';
if (!isset($footer_hide_disclaimer)) $footer_hide_disclaimer = false;
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http";
$host = $_SERVER['HTTP_HOST'];
$path_parts = explode('/', trim($_SERVER['SCRIPT_NAME'], '/'));
$project_folder = isset($path_parts[0]) ? '/' . $path_parts[0] : '';
$home_url = $protocol . "://" . $host . $project_folder . "/";
?>
<style>
  .footer { background: linear-gradient(135deg, #880e4f, #c2185b); position: relative; z-index: 1; overflow: hidden; }
  .footer::before { content: ''; position: absolute; top: -60px; right: -60px; width: 200px; height: 200px; background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%); border-radius: 50%; pointer-events: none; }
  .footer::after  { content: ''; position: absolute; bottom: -40px; left: -40px; width: 160px; height: 160px; background: radial-gradient(circle, rgba(255,192,210,0.12) 0%, transparent 70%); border-radius: 50%; pointer-events: none; }
  .footer-disclaimer { padding: 22px 18px 18px; border-bottom: 1px solid rgba(255,255,255,0.12); position: relative; }
  .footer-disclaimer-title { font-size: 0.76rem; font-weight: 700; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 5px; }
  .footer-disclaimer-text { font-size: 0.85rem; color: rgba(255,255,255,0.6); line-height: 1.6; }
  .footer-nav { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid rgba(255,255,255,0.12); }
  .footer-nav-col { padding: 16px 18px 14px; }
  .footer-nav-col:first-child { border-right: 1px solid rgba(255,255,255,0.12); }
  .footer-nav-title { font-size: 0.76rem; font-weight: 700; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
  .footer-nav-link { display: flex; align-items: center; gap: 6px; font-size: 0.88rem; color: rgba(255,255,255,0.8); text-decoration: none; padding: 5px 0; transition: color 0.2s; }
  .footer-nav-link:hover { color: #ffc1e3; }
  .footer-nav-link .arrow { font-size: 0.7rem; opacity: 0.4; }
  .footer-home-row { padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.12); }
  .footer-home-btn { display: flex; align-items: center; justify-content: center; gap: 8px; background: rgba(255,255,255,0.15); color: #fff; text-decoration: none; border-radius: 8px; padding: 11px 18px; font-size: 0.9rem; font-weight: 700; font-family: 'Nunito', sans-serif; transition: background 0.2s; }
  .footer-home-btn:hover { background: rgba(255,255,255,0.25); }
  .footer-bottom { padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; position: relative; }
  .footer-copy { font-size: 0.75rem; color: rgba(255,255,255,0.35); }
  .footer-policy-link { font-size: 0.75rem; color: rgba(255,255,255,0.4); text-decoration: none; }
  .footer-policy-link:hover { color: rgba(255,255,255,0.85); }
</style>

<div class="footer">

  <?php if (!$footer_hide_disclaimer): ?>
  <div class="footer-disclaimer">
    <div class="footer-disclaimer-title">Disclaimer</div>
    <div class="footer-disclaimer-text">This site provides Free Fire game information for educational and entertainment purposes only. Not affiliated with Garena. All trademarks belong to their respective owners.</div>
  </div>
  <?php endif; ?>

  <div class="footer-nav">
    <div class="footer-nav-col">
      <div class="footer-nav-title">Explore</div>
      <a href="<?= $home_url ?>diamonds"   class="footer-nav-link">💎 Diamonds <span class="arrow">›</span></a>
      <a href="<?= $home_url ?>skins"      class="footer-nav-link">🎨 Skins <span class="arrow">›</span></a>
      <a href="<?= $home_url ?>characters" class="footer-nav-link">🧬 Characters <span class="arrow">›</span></a>
    </div>
    <div class="footer-nav-col">
      <div class="footer-nav-title">More</div>
      <a href="<?= $home_url ?>guide"       class="footer-nav-link">📖 Guide <span class="arrow">›</span></a>
      <a href="<?= $home_url ?>weapons"     class="footer-nav-link">🔫 Weapons <span class="arrow">›</span></a>
      <a href="<?= $home_url ?>other-games" class="footer-nav-link">🎮 Other Games <span class="arrow">›</span></a>
    </div>
  </div>

  <div class="footer-home-row">
    <a href="<?= $home_url ?>" class="footer-home-btn">🏠 Back to Home</a>
  </div>

  <div class="footer-bottom">
    <div class="footer-copy">© 2025 Webify Games Guide. Fan site — not affiliated with Garena.</div>
    <a href="<?= $home_url ?>privacy" class="footer-policy-link">Privacy</a>
  </div>

</div>
