<?php
session_start();
if(!isset($_SESSION['admin'])){
    header("Location: login.php");
}
?>

<!DOCTYPE html>
<html>
<head>
<title>Dashboard Admin</title>

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css" rel="stylesheet">

<style>
body {
    background: #f4f6f9;
    font-family: 'Segoe UI', sans-serif;
}

/* Sidebar */
.sidebar {
    width: 250px;
    height: 100vh;
    position: fixed;
    background: linear-gradient(180deg, #0d6efd, #003f88);
    color: white;
    padding: 20px;
}

.sidebar h4 {
    font-weight: bold;
}

.sidebar a {
    display: block;
    color: white;
    padding: 10px;
    border-radius: 10px;
    text-decoration: none;
    margin-bottom: 8px;
    transition: 0.3s;
}

.sidebar a:hover {
    background: rgba(255,255,255,0.2);
}

/* Content */
.content {
    margin-left: 260px;
    padding: 30px;
}

/* Card */
.card-dashboard {
    border: none;
    border-radius: 20px;
    transition: 0.3s;
}

.card-dashboard:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

/* Header */
.header {
    background: white;
    padding: 15px 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}
</style>

</head>
<body>

<!-- Sidebar -->
<div class="sidebar">
    <h4>⚙️ Admin Panel</h4>
    <hr>

    <a href="#"><i class="bi bi-speedometer2"></i> Dashboard</a>
    <a href="tambah_jadwal.php"><i class="bi bi-calendar"></i> Kelola Jadwal</a>
    <a href="upload_galeri.php"><i class="bi bi-images"></i> Galeri</a>
    <a href="upload_modul.php"><i class="bi bi-book"></i> Modul</a>
    <a href="data_peserta.php" class="list-group-item">👨‍🎓 Data Peserta</a>

    <hr>

    <!-- Tombol Logout Popup -->
    <a href="#" data-bs-toggle="modal" data-bs-target="#logoutModal" class="text-warning">
        <i class="bi bi-box-arrow-right"></i> Logout
    </a>
</div>

<!-- Content -->
<div class="content">

    <!-- Header -->
    <div class="header d-flex justify-content-between align-items-center">
        <h5>Dashboard Admin</h5>
        <span>👋 Selamat Datang</span>
    </div>

    <!-- Card Menu -->
    <div class="row">

        <div class="col-md-4">
            <div class="card card-dashboard shadow p-4 text-center">
                <i class="bi bi-calendar-event fs-1 text-primary"></i>
                <h5 class="mt-3">Kelola Jadwal</h5>
                <a href="tambah_jadwal.php" class="btn btn-primary btn-sm mt-2">Masuk</a>
            </div>
        </div>

        <div class="col-md-4">
            <div class="card card-dashboard shadow p-4 text-center">
                <i class="bi bi-images fs-1 text-success"></i>
                <h5 class="mt-3">Upload Galeri</h5>
                <a href="upload_galeri.php" class="btn btn-success btn-sm mt-2">Upload</a>
            </div>
        </div>

        <div class="col-md-4">
            <div class="card card-dashboard shadow p-4 text-center">
                <i class="bi bi-journal-text fs-1 text-warning"></i>
                <h5 class="mt-3">Upload Modul</h5>
                <a href="upload_modul.php" class="btn btn-warning btn-sm mt-2">Upload</a>
            </div>
        </div>

    </div>

</div>

<!-- MODAL LOGOUT -->
<div class="modal fade" id="logoutModal" tabindex="-1">
    <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">

            <div class="modal-header bg-danger text-white">
                <h5 class="modal-title">Konfirmasi Logout</h5>
                <button class="btn-close bg-white" data-bs-dismiss="modal"></button>
            </div>

            <div class="modal-body text-center">
                <p>Yakin ingin keluar dari dashboard?</p>
            </div>

            <div class="modal-footer">
                <a href="logout.php" class="btn btn-danger">Ya, Logout</a>
                <button class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
            </div>

        </div>
    </div>
</div>

<!-- JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>

</body>
</html>