<?php
// ✅ Includes from root
include '../header.php';
include '../menu.php';

$aboutFile = '../data/about.txt';
$aboutText = file_exists($aboutFile) ? file_get_contents($aboutFile) : '';

if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['about'])) {
  file_put_contents($aboutFile, trim($_POST['about']));
  header('Location: admin_about.php');
  exit;
}
?>

<main class="main-container">
  <section class="admin-card">
    <h2 class="text-warning">📝 Edit About Page</h2>
    <p class="text-muted mb-3">Update the About section content below. Changes will appear instantly on the public page.</p>

    <form method="POST" class="admin-form">
      <textarea name="about" class="admin-textarea" rows="10"><?= htmlspecialchars($aboutText) ?></textarea>
      <div class="form-actions">
        <button type="submit" class="btn btn-warning">💾 Save Changes</button>
      </div>
    </form>
  </section>
</main>

<?php include '../footer.php'; ?>
