<?php include 'koneksi.php'; ?>
<!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>Kompetensi keahlian | Smk Budiniah 2</title>
    <style>
        body{
            margin:0;
            font-family: Arial, Helvetica, sans-serif;
        }
        body a{
            cursor: pointer;
        }
        .hero-caption{
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            margin-bottom: 10%;
            padding: 20px;
        }
        .hero-caption h1{
            margin: 0 0 20px 0;
            font-size: 50px; 
            font-weight: 700;
        }
        .hero-caption p{
            margin: 0 0 20px 0;
            max-width: 800px;
            line-height: 1.6;
            font-weight: 500;
        }
        .hero-caption ol{
            text-align: left;
            max-width: 600px;
            margin: 0;
            font-weight: 500;
        }
        .hero-caption li{
            margin-bottom: 10px;
        }
        .cart-jurusan{
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            justify-content: center;
            align-items: center;
            text-transform: capitalize;
            gap:20px;
            padding: 20px 0;
            background: linear-gradient(
                to bottom,
                #131a33 25%,
                #131a33 75%,
                #ffffff 75%,
                #ffffff 100%
            );
        }
        .jurusan-card {
            background: white;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
            padding: 30px;
            max-width: 600px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin: 10px;
        }
        .card-content {
            flex: 1;
            text-align: left;
        }
        .card-image {
            flex-shrink: 0;
            margin-left: 20px;
        }
        .jurusan-card img {
            border-radius: 10px;
            margin-bottom: 15px;
        }
        .jurusan-card h3 {
            color: #131a33;
            margin-bottom: 10px;
        }
        .jurusan-card p {
            color: #666;
            line-height: 1.5;
        }
        .card-content a{
            margin-top: 5% ;
            text-decoration: none;
            text-align: center;
            color: #ffffff;
            padding: 10px 20px;
            border: none;
            border-radius: 25px;
            background: linear-gradient(135deg, #3426ffff, #5b8cffff);
            box-shadow: 0 4px 8px rgba(0,0,0,0.2);
            transition: all 0.3s ease;
            display: inline-block;
            font-weight: bold;
        }
        .card-content a:hover {
            box-shadow: 0 6px 12px rgba(0,0,0,0.3);
            transform: translateY(-2px);
        }

        /* Initial states for animations */
        .hero-caption {
            opacity: 0;
            transform: translateX(100px);
            transition: all 1s ease-out;
        }

        .hero-caption.slide-in-from-right {
            opacity: 1;
            transform: translateX(0);
        }

        .jurusan-card {
            opacity: 0;
            transform: translateX(100px);
            transition: all 1s ease-out;
        }

        .jurusan-card.slide-in-from-right {
            opacity: 1;
            transform: translateX(0);
        }

        /* Responsive Design */
        @media (max-width: 768px) {
            .hero-caption{
                padding-left: 5%;
                padding-right: 5%;
            }
            .hero-caption{
                padding-left: 5%;
                padding-right: 5%;
            }
            .hero-caption h1 {
                font-size: 30px;
            }
            .hero-caption p {
                font-size: 14px;
            }
            .hero-caption ol {
                font-size: 14px;
            }
            .cart-jurusan {
                flex-direction: column;
                gap: 10px;
                padding: 10px 0;
                padding-left: 5%;
                padding-right: 5%;
            }
            .jurusan-card {
                flex-direction: column;
                padding: 20px;
                margin: 5px;
                max-width: 100%;
            }
            .card-image {
                margin-left: 0;
                margin-top: 20px;
            }
            .jurusan-card img {
                width: 100%;
                height: auto;
                max-width: 300px;
            }
            .card-content a {
                margin-top: 10px;
            }
        }

        @media (max-width: 480px) {
            .hero-caption h1 {
                font-size: 24px;
            }
            .hero-caption p {
                font-size: 12px;
            }
            .hero-caption ol {
                font-size: 12px;
            }
            .jurusan-card {
                padding: 15px;
            }
        }

    </style>
</head>
<body>
    <?php require 'navbar.php'; ?>
    <div class="hero-caption">
        <h1>Jurusan</h1>
        <p>SMK (Sekolah Menengah Kejuruan) Budiniah 2 merupakan sekolah vokasi atau khusus keahlian, yang diharapkan untuk mencetak generasi muda yang memiliki skill atau keahlian yang siap untuk bekerja dan wirausaha, adapun jurusan yang ada di SMK Budiniah 2 antara lain :</p>
        <ol style="max-width: 500px;">
            <li>Program Keahlian : Akuntansi dan Keuangan Lembaga (AKL)

Konsentrasi Keahlian : Akuntansi</li>
            <li>Program Keahlian : Pemasaran (PM)

Konsentrasi Keahlian : Bisnis Digital</li>
            <li>Program Keahlian : Pengembangan Perangkat Lunak dan Gim (PPLG)

Rekayasa Perangkat Lunak (RPL)</li>
        </ol>
    </div>
    <div class="cart-jurusan">
        <?php
        $query = "SELECT * FROM tb_jurusan";
        $result = mysqli_query($host,$query);
        if ($result && mysqli_num_rows($result) > 0){
            while ($row = mysqli_fetch_assoc($result)){
                $imgSrc = !empty($row['gambar_jurusan']) ? "upload/" . htmlspecialchars($row['gambar_jurusan']) : "upload/default.jpg";
                $judul = htmlspecialchars($row['nama_jurusan']);
                $deskripsi = htmlspecialchars($row['deksripsi']);
                echo '<div class="jurusan-card">';
                echo '<div class="card-content">';
                echo '<h3>' . $judul . '</h3>';
                echo '<p>' . $deskripsi . '</p>';
                echo "<a href='detail_jurusan.php?id_jurusan=".$row['id_jurusan']."'>Lihat Detail</a>";
                echo '</div>';
                echo '<div class="card-image">';
                echo '<img src="' . $imgSrc . '" alt="' . $judul . '" style="width: 300px; height: 300px; object-fit: cover;">';
                echo '</div>';
                echo '</div>';
            }
        } else {
            echo '<p>Tidak ada data jurusan.</p>';
        }
        ?>
    </div>

    <script>
        // Intersection Observer for slide-in animations
        document.addEventListener('DOMContentLoaded', function() {
            const observerOptions = {
                threshold: 0.1,
                rootMargin: '0px 0px -50px 0px'
            };

            const observer = new IntersectionObserver((entries) => {
                entries.forEach(entry => {
                    if (entry.isIntersecting) {
                        if (entry.target.classList.contains('hero-caption')) {
                            entry.target.classList.add('slide-in-from-right');
                        } else if (entry.target.classList.contains('jurusan-card')) {
                            // Add staggered animation for cards
                            const cards = document.querySelectorAll('.jurusan-card');
                            cards.forEach((card, index) => {
                                setTimeout(() => {
                                    card.classList.add('slide-in-from-right');
                                }, index * 300); // 300ms delay between each card
                            });
                        }
                        observer.unobserve(entry.target);
                    }
                });
            }, observerOptions);

            // Observe the elements
            const heroCaption = document.querySelector('.hero-caption');
            const jurusanCards = document.querySelectorAll('.jurusan-card');

            if (heroCaption) observer.observe(heroCaption);
            jurusanCards.forEach(card => observer.observe(card));
        });
    </script>
    <?php require 'footer.php' ?>
</body>
</html>

