<?php
include "../koneksi.php";

$id = $_GET['id'];
$data = mysqli_query($conn, "SELECT * FROM kelas WHERE id_kelas='$id'");
$k = mysqli_fetch_assoc($data);
?>

<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Edit Kelas</title>

<style>
body{
    font-family:Arial, sans-serif;
    background:#f3f4f6;
    margin:0;
    min-height:100vh;
    display:flex;
    justify-content:center;
    align-items:center;
}

.card{
    width:100%;
    max-width:500px;
    background:#fff;
    padding:30px;
    border-radius:16px;
    box-shadow:0 10px 30px rgba(0,0,0,.1);
}

.card h2{
    margin-top:0;
    margin-bottom:20px;
}

.form-group{
    margin-bottom:16px;
}

.form-group label{
    display:block;
    margin-bottom:6px;
    font-weight:bold;
}

.form-group input{
    width:100%;
    padding:10px 12px;
    border:1px solid #d1d5db;
    border-radius:10px;
    font-size:14px;
}

.form-group input:focus{
    outline:none;
    border-color:#3b82f6;
}

.btn{
    padding:10px 16px;
    border:none;
    border-radius:10px;
    cursor:pointer;
    font-size:14px;
}

.btn-update{
    background:#3b82f6;
    color:#fff;
}

.btn-update:hover{
    background:#2563eb;
}

.btn-kembali{
    background:#e5e7eb;
    color:#111827;
    text-decoration:none;
    margin-left:10px;
}
</style>
</head>

<body>

<div class="card">
    <h2>Edit Kelas</h2>

    <form action="kelas_proses_edit.php" method="post">
        <input type="hidden" name="id_kelas" value="<?= $k['id_kelas']; ?>">

        <div class="form-group">
            <label>Nama Kelas</label>
            <input type="text" name="nama_kelas"
                   value="<?= $k['nama_kelas']; ?>" required>
        </div>

        <div class="form-group">
            <label>Wali Kelas</label>
            <input type="text" name="wali_kelas"
                   value="<?= $k['wali_kelas']; ?>" required>
        </div>

        <button type="submit" class="btn btn-update">Update</button>
        <a href="kelas.php" class="btn btn-kembali">Kembali</a>
    </form>
</div>

</body>
</html>
