<?php
require_once 'includes/header.php';
require_once 'includes/navbar.php';
// Pastikan session dimulai
//require_once 'includes/header.php';

// Jika tidak login, redirect sudah ditangani oleh header.php
// Jadi kita hanya perlu memastikan pengguna sudah login di sini
if (!isset($_SESSION['login'])) {
    exit(); // Header sudah melakukan redirect
}

// Tampilkan alert login sukses jika ada
if (isset($_SESSION['show_login_alert']) && $_SESSION['show_login_alert'] === true) {
    $alert_data = $_SESSION['login_alert_data'];
    echo "<script>
        Swal.fire({
            icon: '{$alert_data['icon']}',
            title: '{$alert_data['title']}',
            text: '{$alert_data['text']}',
            timer: {$alert_data['timer']},
            showConfirmButton: false
        });
    </script>";
    
    // Hapus session alert setelah ditampilkan
    unset($_SESSION['show_login_alert']);
    unset($_SESSION['login_alert_data']);
}
?>
<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Halaman Dalam Pembuatan - Buku Induk Sekolah</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        body {
            background-color: #f8f9fa;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        .construction-container {
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }
        .construction-card {
            background: white;
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            padding: 40px;
            text-align: center;
            max-width: 700px;
            width: 100%;
        }
        .construction-icon {
            font-size: 5rem;
            color: #6c757d;
            margin-bottom: 20px;
        }
        .construction-title {
            color: #343a40;
            font-weight: 700;
            margin-bottom: 15px;
        }
        .construction-text {
            color: #6c757d;
            margin-bottom: 30px;
            font-size: 1.1rem;
        }
        .progress {
            height: 10px;
            margin-bottom: 30px;
        }
        .btn-return {
            background-color: #0d6efd;
            color: white;
            padding: 10px 25px;
            border-radius: 50px;
            font-weight: 600;
            transition: all 0.3s;
        }
        .btn-return:hover {
            background-color: #0b5ed7;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }
        .countdown {
            font-size: 1.2rem;
            font-weight: 600;
            color: #0d6efd;
            margin-top: 20px;
        }
        .construction-container {
            margin-top: -100px; /* atur sesuai kebutuhan */
        }
    </style>
</head>
<body>
    <div class="construction-container">
        <div class="construction-card">
            <div class="construction-icon">
                <i class="fas fa-tools"></i>
            </div>
            <h1 class="construction-title">Halaman Sedang Dalam Pembuatan</h1>
            <p class="construction-text">
                Maaf, fitur yang Anda coba akses saat ini masih dalam proses pengembangan. 
                Kami sedang bekerja keras untuk menyelesaikannya secepat mungkin.
            </p>
            
        <!--    <div class="progress">
                <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" 
                     style="width: 65%;" aria-valuenow="65" aria-valuemin="0" aria-valuemax="100">65%</div>
            </div>
            
            <p class="construction-text">
                Perkiraan waktu penyelesaian: <span id="countdown">14</span> hari lagi
            </p>
            
            <a href="index.php" class="btn btn-return">
                <i class="fas fa-arrow-left me-2"></i>Kembali ke Beranda
            </a> -->
            
            <div class="mt-4">
                <p class="text-muted">Butuh bantuan? Hubungi admin sistem di <strong>admin@sman1bantaran.sch.id</strong></p>
            </div>
        </div>
    </div>

    <script>
        // Hitung mundur sederhana (14 hari dari sekarang)
        document.addEventListener('DOMContentLoaded', function() {
            const daysElement = document.getElementById('countdown');
            let days = 14;
            
            const countdown = setInterval(function() {
                if (days > 0) {
                    days--;
                    daysElement.textContent = days;
                } else {
                    clearInterval(countdown);
                    daysElement.textContent = "0";
                    daysElement.parentElement.innerHTML = "Fitur telah selesai dikembangkan!";
                }
            }, 1000); // Diperbarui setiap detik (hanya untuk demonstrasi)
        });
    </script>
</body>
</html>