<?php
require 'config.php';
$sections = $conn->query("SELECT * FROM sections ORDER BY id ASC");
$data = [];
while($row = $sections->fetch_assoc()){
    $data[] = $row;
}
?>

<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Portofolio - Ashifa Nur Hidayah</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #667eea 100%);
            color: #ffffff;
            min-height: 100vh;
        }
        .navbar-custom {
            background-color: rgba(20, 15, 52, 0.8) !important;
            backdrop-filter: blur(10px);
        }
        .hero-section {
            padding: 100px 0 50px;
            text-align: center;
        }
        .content-card {
            background-color: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 15px;
            padding: 30px;
            margin-bottom: 30px;
            box-shadow: 0 4px 15px rgba(0,0,0,0.2);
        }
    </style>
</head>
<body>

    <nav class="navbar navbar-expand-lg navbar-dark navbar-custom sticky-top">
        <div class="container">
            <a class="navbar-brand fw-bold" href="#">Ashifa N.H</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav ms-auto">
                    <?php foreach($data as $menu): ?>
                    <li class="nav-item">
                        <a class="nav-link" href="#section-<?= $menu['id'] ?>"><?= htmlspecialchars($menu['menu_title']) ?></a>
                    </li>
                    <?php endforeach; ?>
                </ul>
            </div>
        </div>
    </nav>

    <div class="container hero-section">
        <img src="https://ui-avatars.com/api/?name=Ashifa+Nur&background=764ba2&color=fff&size=150" alt="Profile" class="rounded-circle mb-3 shadow-lg">
        <h1 class="display-4 fw-bold">Ashifa Nur Hidayah</h1>
        <p class="lead">XI TKJ 2 | No. Absen 3</p>
    </div>

    <div class="container pb-5">
        <?php foreach($data as $section): ?>
        <div class="content-card" id="section-<?= $section['id'] ?>">
            <h2 class="fw-bold mb-4" style="color: #c9d6ff;"><?= htmlspecialchars($section['menu_title']) ?></h2>
            <div>
                <?= $section['content'] ?>
            </div>
        </div>
        <?php endforeach; ?>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

