<?php 
include 'koneksi.php'; 

// Ambil ID dari URL
if(isset($_GET['id_jurusan'])){
    $id = intval($_GET['id_jurusan']);
} else {
    die("ID Jurusan tidak ditemukan.");
}

// Query sesuai ID yang dipilih
$query = "SELECT * FROM tb_jurusan WHERE id_jurusan = $id";
$result = mysqli_query($host,$query);
$row = mysqli_fetch_assoc($result);

if ($row) {
    $judul = htmlspecialchars($row['nama_jurusan']);
    $imgSrc = !empty($row['gambar_jurusan']) 
                ? "upload/" . htmlspecialchars($row['gambar_jurusan']) 
                : "upload/default.jpg";
    $deskripsi = nl2br(htmlspecialchars($row['deksripsi']));
} else {
    $judul = 'Data tidak ditemukan';
    $imgSrc = 'upload/default.jpg';
    $deskripsi = '';
}
?>
<!DOCTYPE html>
<html lang="id">
<head><link rel="icon" href="upload/bn2.png" type="image/png">
<meta charset="UTF-8">
<title><?php echo $judul; ?> | SMK Budiniah 2</title>

<style>
    body{
        margin:0;
        padding:0;
        font-family: Arial, Helvetica, sans-serif;
    }
    body a{ 
        cursor: pointer; 
    }
    .akuntansi img{
        margin: 20px;
    }
    .akuntansi{
        width: 100%;
        background: #eef5ff;
        padding: 60px 0 120px;
        text-align: center;
        justify-content: center;
        justify-items: center;
        
    }
    .akuntansi h1{
        font-size: 60px;
        max-width: 1000px;
        font-weight: bold;
        text-transform: capitalize;
        color: #2a2a2a;
    }
    .jurusan-akuntansi{
        margin: -80px auto 40px auto;
        background: #fff;
        padding: 30px;
        border-radius: 15px;
        max-width: 1100px;
        display: grid;
        gap: 20px;
        box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    }
    .bagian-teks{
        background: #fff;
        border-radius: 10px;
        line-height: 1.6;
    }
    .bagian-teks h3{
        margin-top: 20px;
    }
    .bagian-teks p{
        margin-bottom: 15px;
        text-align: left;
    }
    .button-kembali a{
        margin-top: 5%;
        text-decoration: none;
        text-align: center;
        color: #ffffff;
        padding: 10px 20px;
        border-radius: 25px;
        background: linear-gradient(135deg, #3426ffff, #5b8cffff);
        box-shadow: 0 4px 8px rgba(0,0,0,0.2);
        transition: 0.3s;
        display: inline-block;
        font-weight: bold;
    }
    .button-kembali a:hover{
        box-shadow: 0 6px 12px rgba(0,0,0,0.3);
        transform: translateY(-2px);
    }
</style>

</head>
<body>

<?php include 'navbar.php'; ?>

<div class="akuntansi">
    <h1><?php echo $judul; ?></h1>
    <img src="<?php echo $imgSrc; ?>" alt="<?php echo $judul; ?>" width="200">
</div>

<div class="jurusan-akuntansi">
    <div class="bagian-teks">
        <h3>Informasi Jurusan</h3>
        <p><?php echo $deskripsi; ?></p>

        <h3>Dokumentasi</h3>
        <p>*belum ada dokumentasi</p>

        <div class="button-kembali">
            <a href="jurusan.php">Kembali Ke Jurusan</a>
        </div>
    </div>
</div>

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

</body>
</html>

