<?php
session_start();

// --- SECURITY GATE ---
if (!isset($_SESSION['logged_in']) || $_SESSION['logged_in'] !== true) {
    header('Location: login.php');
    exit;
}

// Menggunakan nama sesuai permintaan
$STADTNESIASB = $_SESSION['username'] ?? 'LEVYULTIMATE';
?>
<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Create Panel | <?= htmlspecialchars($STADTNESIASB) ?></title>
    
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&family=Orbitron:wght@700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    
    <style>
        :root {
            --primary: #00d2ff; 
            --primary-glow: rgba(0, 210, 255, 0.4);
            --accent: #ffffff;
            --dark-overlay: rgba(0, 0, 0, 0.85);
        }

        * { margin: 0; padding: 0; box-sizing: border-box; }

        body {
            font-family: 'Poppins', sans-serif;
            background: linear-gradient(var(--dark-overlay), var(--dark-overlay)), 
                        url('https://i.ibb.co.com/k840Tpb/IMG-20240909-WA0075.jpg') no-repeat center center fixed;
            background-size: cover;
            height: 100vh;
            width: 100vw;
            display: flex;
            justify-content: center;
            align-items: center;
            color: #fff;
            overflow: hidden;
            position: relative;
        }

        #particles-js {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 1;
        }

        .navbar-custom {
            position: fixed;
            top: 0;
            width: 100%;
            background: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(15px);
            -webkit-backdrop-filter: blur(15px);
            border-bottom: 1px solid var(--primary);
            padding: 15px 20px;
            z-index: 1000;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .navbar-brand {
            font-family: 'Orbitron', sans-serif;
            font-size: 18px;
            font-weight: 700;
            color: #fff !important;
            text-transform: uppercase;
            letter-spacing: 2px;
        }
        
        .navbar-brand span { color: var(--primary); }

        .LEVYULTIMATE_display { 
            font-size: 13px; 
            color: var(--accent); 
            font-weight: 600;
            padding: 6px 18px;
            border-radius: 25px;
            background: rgba(0, 210, 255, 0.4); 
            border: 1px solid var(--primary);
            box-shadow: 0 0 10px var(--primary-glow);
        }

        .glass-card {
            position: relative;
            z-index: 10;
            width: 95%;
            max-width: 420px; 
            padding: 30px; 
            background: rgba(255, 255, 255, 0.03); 
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border: 2px solid var(--accent); 
            border-radius: 35px;
            box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
            text-align: center;
        }

        .card-title {
            font-size: 20px;
            font-family: 'Orbitron';
            font-weight: 700;
            margin-bottom: 20px;
            text-transform: uppercase;
            letter-spacing: 2px;
            color: var(--accent);
        }

        .form-control {
            background: rgba(255, 255, 255, 0.1) !important;
            color: #fff !important;
            border: 1px solid rgba(0, 210, 255, 0.4);
            border-radius: 15px;
            padding: 25px;
            text-align: center;
            transition: 0.3s;
        }

        .form-control:focus {
            border-color: var(--primary);
            box-shadow: 0 0 15px var(--primary-glow);
        }

        .btn-custom {
            background: linear-gradient(45deg, #00d2ff);
            border: 1px solid var(--accent);
            color: #000; /* Teks hitam agar kontras dengan emas terang */
            font-weight: 800;
            width: 100%;
            padding: 14px;
            border-radius: 15px;
            text-transform: uppercase;
            margin-top: 15px;
            transition: 0.4s;
            font-family: 'Orbitron';
            box-shadow: 0 5px 15px rgba(0, 210, 255, 0.4);
        }

        .btn-custom:hover {
            transform: translateY(-3px);
            color: #fff;
            box-shadow: 0 8px 25px var(--primary-glow);
        }

        .logout-link { 
            margin-top: 20px; 
            display: inline-block; 
            color: var(--primary); 
            font-size: 13px; 
            font-weight: 600;
            text-decoration: none;
            transition: 0.3s;
        }

        .logout-link:hover {
            color: var(--accent);
            text-shadow: 0 0 10px var(--primary);
        }

        .rocket-icon {
            font-size: 55px; 
            color: var(--accent); 
            margin-bottom: 15px; 
            filter: drop-shadow(0 0 15px var(--primary));
            animation: launch 3s ease-in-out infinite;
        }

        @keyframes launch {
            0%, 100% { transform: translateY(0) rotate(-45deg); }
            50% { transform: translateY(-15px) rotate(-45deg); }
        }

        audio { display: none; }
    </style>
</head>
<body>

    <div id="particles-js"></div>

    <audio id="myAudio" loop>
        <source src="audio/Sad.mp3" type="audio/mpeg">
    </audio>

    <nav class="navbar-custom">
        <div class="navbar-brand">TEAM <span> LEVY ULTIMATE!</span></div>
        <div class="MANGWANZZNESIA01_display">
            <i class="fas fa-crown mr-2" style="color: #003366;"></i> <?= htmlspecialchars($STADTNESIASB) ?>
        </div>
    </nav>

    <div class="glass-card">
        <div class="rocket-icon">
            <i class="fas fa-rocket"></i> 
        </div>
        <h2 class="card-title">Create Panel <span style="color: var(--primary);">Murni!</span></h2>
        
        <form method="post" action="panel.php">
            <div class="form-group">
                <input type="text" name="WEB" id="WEB" class="form-control" placeholder="Nama Panel Kamu..." required autocomplete="off">
            </div>
            <button type="submit" class="btn-custom">
                <i class="fas fa-bolt mr-2"></i> Buat Sekarang
            </button>
        </form>

        <a href="logout.php" class="logout-link">
            <i class="fas fa-power-off mr-2"></i> Keluar Sistem
        </a>
    </div>

    <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <script src="https://cdn.jsdelivr.net/npm/particles.js@2.0.0/particles.min.js"></script>
    
    <script>
    // --- CONFIG PARTICLES LEBIH BESAR & JELAS ---
    particlesJS('particles-js', {
        "particles": {
            "number": { "value": 120, "density": { "enable": true, "value_area": 800 } },
            "color": { "value": ["#00f2ff", "#ffffff", "#ffea00"] },
            "shape": { "type": "circle" },
            "opacity": { "value": 0.6, "random": true },
            "size": { "value": 7, "random": true }, /* Ukuran partikel diperbesar */
            "line_linked": { "enable": true, "distance": 140, "color": "#00f2ff", "opacity": 0.3, "width": 1.5 },
            "move": { "enable": true, "speed": 4, "direction": "none", "random": true, "out_mode": "out" }
        }
    });

        function playMusic() {
            const audio = document.getElementById('myAudio');
            audio.play().catch(() => {});
        }

        document.addEventListener('DOMContentLoaded', function() {
            Swal.fire({
                title: '<span style="font-family:Orbitron; color:#00d2ff">Welcome To Back</span>',
                html: 'Selamat Datang <b><?= htmlspecialchars($LEVYULTIMATE) ?></b>,<br>Buat Panel Digunakan Yaa!!',
                icon: 'success',
                confirmButtonText: 'MASUK',
                background: '#000000',
                confirmButtonColor: '#003366',
                color: '#ffffff'
            }).then((result) => { 
                if (result.isConfirmed) playMusic(); 
            });
            
            document.body.addEventListener('click', function() {
                playMusic();
            }, { once: true });
        });
    </script>
</body>
</html>