<?php
include 'koneksi.php';
session_start();
if (!isset($_SESSION['login_admin'])) {
    header('Location: dashboard.php');
    exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head><link rel="icon" href="upload/bn2.png" type="image/png">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dashboard Admin | Smk Budiniah 2</title>
    <link rel="stylesheet" href="style_admin.css">
    <style>
        body {
            font-family: Arial, Helvetica, sans-serif;
            background: #ddd;
            color: #333;
            margin: 0;
            padding: 0;
        }
        .dashboard-container {
            padding: 20px;
            max-width: 1200px;
            margin: 50px auto;
        }
        .dashboard-header {
            text-align: center;
            margin-bottom: 30px;
            background:#ffffff;
            padding:20px;
            border-radius:8px;
            box-shadow:1px 2px 6px rgba(0,0,0,.1);
        }
        .dashboard-header h1 {
            font-size: 32px;
            font-weight: bold;
            color: #333;
        }
        .dashboard-content {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 20px;
        }
        .card {
            background: #f9fcff;
            border: 1px solid #ddd;
            border-radius: 10px;
            box-shadow: 5px 4px 8px rgba(0,0,0,0.1);
            padding: 20px;
            text-align: center;
        }
        .card h3 {
            margin-bottom: 15px;
            font-size: 20px;
            font-weight: bold;
        }
        .card a {
            display: inline-block;
            background-color: #0037fd;
            color: white;
            text-decoration: none;
            padding: 10px 20px;
            border-radius: 5px;
            transition: background-color 0.3s ease;
        }
        .card a:hover {
            background-color: #0026b3;
        }
        .logout-btn {
            display: block;
            margin: 30px auto;
            background-color: #dc3545;
            color: white;
            text-decoration: none;
            padding: 12px 24px;
            border-radius: 5px;
            text-align: center;
            width: fit-content;
            transition: background-color 0.3s ease;
        }
        .logout-btn:hover {
            background-color: #c82333;
        }
        .hero-page {
            display: flex;
            align-items: center;
            gap: 20px;
            padding-left:5%;
            padding-right:5%;
            justify-content: space-between;
        }
        .hero-content {
            width: 75%;
        }
        .hero-image {
            width: 55%;
            height:auto;
           
        }
        .hero-image img{
            border-radius: 22px;
            box-shadow: 34px 28px 0px 0px rgba(60,172,222,0.2);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        .hero-image img:hover{
            transform: scale(1.05);
            box-shadow: 40px 35px 0px 0px rgba(60,172,222,0.3);
        }
        .hero-page h2 {
            font-family: 'Times New Roman', Times, serif;
            font-size: 55px;
            width: 55%;
            font: 500;
            text-transform: capitalize;
        }
        .hero-page p{
            text-transform: capitalize;
            text-align: justify;
            width: 80%;
            max-width: 100%;
            line-height: 1.5;
            font-size: 22px;
        }
        .button a{
        background:linear-gradient(135deg,#0f62fe,#3f3ea5ff);
        border-radius: 22px;
        padding: 14px 16px;
        display: inline-block;
        text-align: center;
        justify-content: center;
        align-items: center; 
        margin:10px;
        transition: all 0.3s ease-in-out;
         text-decoration: none;
        color: #fff;
    }
    .button {
       margin-top:20px ;
    }
    .button a:hover{
        background: linear-gradient(135deg,#3f3ea5ff,#0f62fe);
        transform: translateY(-5%);
    }
    .hero-page img{
        width: 100%;
        height: auto;
    }
    .next-page {
            margin-top: 60px;
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: 40px;
            justify-content: space-between;
            padding-left: 5%;
            padding-right: 5%;
            
        }
        .next-page .hero-img img {
            width: 80%;
            height: auto;
            border-radius: 22px;
            box-shadow: 34px 28px 0px 0px rgba(60,172,222,0.2);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        .next-page .hero-img img:hover {
            transform: scale(1.05);
            box-shadow: 40px 35px 0px 0px rgba(60,172,222,0.3);
        }
        .deskripsi-tentang {
            width: 80%;
            font-family: 'Times New Roman', Times, serif;
            font-size: 20px;
            max-width: 100%;
            padding-left: 20px;
            line-height: 1.5;
            text-align: justify;
        }
.siapa {
    color: rgba(0, 0, 0, 0.5);
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 0.5em;
}
.tentang {
    color: #333;
    font-weight: normal;
    font-size: 1rem;
    line-height: 1.5;
    font-size: 22px;
    width: 100%;
    text-align: justify;
}
.deskripsi-tentang .siapa{
    align-items: center;
    align-content: center;
}



        /* Mobile Responsiveness */
        @media (max-width: 768px) {
            .dashboard-container {
                padding: 20px 5%;
            }
            .dashboard-content {
                grid-template-columns: 1fr;
            }
            .hero-page {
        flex-direction: column;
        gap: 20px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .hero-content {
        width: 100%;
        text-align: center;
    }

    .hero-content h2 {
        font-size: 35px;
        width: 100%;
    }

    .hero-content p {
        width: 100%;
        font-size: 18px;
    }

    .hero-image {
        width: 100%;
        order: -1; /* Move image above text on mobile */
    }

    /* Next Page Section */
    .next-page {
        flex-direction: column;
        gap: 20px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .next-page .hero-img img {
        width: 100%;
    }

    .deskripsi-tentang {
        width: 100%;
        padding-left: 0;
        text-align: center;
    }

    .deskripsi-tentang p {
        font-size: 18px;
    }

        }
    </style>
</head>
<body>
    <?php require 'navbar_admin.php'; ?>
    <div class="main-content">
    <div class="dashboard-container">
        <div class="dashboard-header">
            <h1>Dashboard Admin</h1>
            <p>Selamat datang, <?php echo htmlspecialchars($_SESSION['username']); ?> baik! </p>
        </div>
        <div class="edit-deskripsi-sekolah">
            <div class="hero-page">
            <?php 
            $query = "SELECT * FROM deskripsi_sekolah";
            $result = mysqli_query($host, $query);
            $row = mysqli_fetch_assoc($result);
            $id = htmlspecialchars($row['id_deskripsi']);
            $judul = htmlspecialchars($row['judul_selamatdatang']);
            $deskripsi = htmlspecialchars($row['paragraf_1']);
            $gambar = htmlspecialchars($row['gambar_deskripsi_sekolah']);
            if ($row){
            ?>
            <div class="hero-content">
                <h2><?php echo $judul; ?></h2>
                <div class="typing-wrap">
                    <span class="typed-text" id="typed"></span>
                    <span class="cursor" aria-hidden="true"></span>
                </div>
                <div class="paraf">
                    <p><?php echo $deskripsi; ?></p>
                </div>
                <div class="button">
                    <a href="edit-deskripsi-sekolah.php?id_deskripsi=<?php echo $id; ?>">mulai edit</a>
    </div>
</div>
        <div class="hero-image">
                <a href=""><img src="upload/<?php echo $gambar; ?>" alt="budiniah"></a>
            </div>
             <?php }else{
                echo '<p>Data tidak tersedia.</p>';
             } ?>
        </div>
        <div class="next-page" id="bawah">
            <?php 
            $query = "SELECT * FROM siapa_kami";
            $result = mysqli_query($host, $query);
            $row = mysqli_fetch_assoc($result);
            $id = htmlspecialchars($row['id_siapa_kami']);
            $paragraf = htmlspecialchars($row['paragraf_1']);
            $gambar = htmlspecialchars($row['gambar_tentang']);
            if ($row){
            ?>
            <div class="hero-img">
                <a href=""><img src="upload/<?php echo $gambar; ?>" alt="foto sekolah"></a>
            </div>
            <div class="deskripsi-tentang">
                <h4 class="siapa">siapa kami?</h4>
                <p class="tentang"><?php echo $paragraf; ?></p>
            </div>
            <?php }else{
                echo '<p>Data tidak tersedia.</p>';
             } ?>
             
        </div>
        <div class="button">
                    <a href="edit-tentang-sekolah.php?id_siapa_kami=<?php echo $id; ?>">mulai edit</a>
    </div>
        </div>

        <div class="dashboard-content">
            <div class="card">
                <h3>Manage Berita</h3>
                <a href="berita_admin.php">Manage</a>
            </div>
            <div class="card">
                <h3>Manage Prestasi</h3>
                <a href="Manage_prestasi.php">Manage</a>
            </div>
            <div class="card">
                <h3>Manage Galeri</h3>
                <a href="Manage_galeri.php">Manage</a>
            </div>
            <div class="card">
                <h3>Manage Pengumuman</h3>
                <a href="Manage_pengumuman.php">Manage</a>
            </div>
            <div class="card">
                <h3>Manage Organisasi</h3>
                <a href="manage_organisasi.php">Manage</a>
            </div>
            <div class="card">
                <h3>Manage Jurusan</h3>
                <a href="Manage_jurusan.php">Manage</a>
            </div>
        </div>
        <a href="logout.php" class="logout-btn">Logout</a>
    </div>
    </div>
</body>
</html>

