<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Redirect ke halaman login
    header("Location: login.php");
    exit();
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
    <meta charset="utf-8">
    <title>FORXZZHOST - SIGN UP HD</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
    <style>
        :root {
            --primary: #03e9f4;
            --secondary: #ff00c1;
            --bg-gradient: linear-gradient(-45deg, #0f0c29, #302b63, #24243e);
        }

        body {
            margin: 0;
            padding: 0;
            font-family: 'Poppins', sans-serif;
            background: var(--bg-gradient);
            background-size: 400% 400%;
            animation: gradientBG 10s ease infinite;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            overflow: hidden;
            transition: 0.5s;
        }

        @keyframes gradientBG {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }

        /* Kotak Crystal HD - Tidak Pudar */
        .center {
            position: relative;
            width: 400px;
            padding: 40px;
            background: rgba(255, 255, 255, 0.05);
            backdrop-filter: blur(25px);
            -webkit-backdrop-filter: blur(25px);
            border-radius: 20px;
            border: 2px solid rgba(255, 255, 255, 0.1);
            box-shadow: 0 0 30px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(255, 255, 255, 0.05);
            text-align: center;
        }

        /* Nama Brand FORXZZHOST Keren */
        .brand-name {
            font-family: 'Orbitron', sans-serif;
            font-size: 28px;
            font-weight: 700;
            background: linear-gradient(to right, var(--primary), var(--secondary));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            margin-bottom: 5px;
            display: block;
            text-transform: uppercase;
            filter: drop-shadow(0 0 10px var(--primary));
        }

        .center h1 {
            color: #fff;
            margin-bottom: 30px;
            font-size: 18px;
            letter-spacing: 3px;
            opacity: 0.8;
        }

        /* Input Field Glow */
        .txt_field {
            position: relative;
            margin-bottom: 30px;
            text-align: left;
        }

        .txt_field input {
            width: 100%;
            padding: 12px 10px 12px 40px; /* Space for icons */
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 8px;
            color: #fff;
            outline: none;
            font-size: 16px;
            transition: 0.3s;
            box-sizing: border-box;
        }

        .txt_field i {
            position: absolute;
            left: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--primary);
            font-size: 18px;
            transition: 0.3s;
        }

        .txt_field label {
            position: absolute;
            top: 50%;
            left: 40px;
            color: #aaa;
            transform: translateY(-50%);
            transition: 0.3s;
            pointer-events: none;
        }

        .txt_field input:focus ~ label,
        .txt_field input:valid ~ label {
            top: -12px;
            left: 10px;
            color: var(--primary);
            font-size: 12px;
            font-weight: bold;
        }

        .txt_field input:focus {
            border-color: var(--primary);
            box-shadow: 0 0 15px rgba(3, 233, 244, 0.4);
            background: rgba(255, 255, 255, 0.15);
        }

        /* Tombol Sign Up RGB */
        input[type="submit"] {
            width: 100%;
            padding: 15px;
            background: linear-gradient(90deg, #03e9f4, #ff00c1, #03e9f4);
            background-size: 200%;
            border: none;
            border-radius: 30px;
            color: #fff;
            font-size: 18px;
            font-weight: bold;
            cursor: pointer;
            transition: 0.5s;
            text-transform: uppercase;
            box-shadow: 0 0 20px rgba(3, 233, 244, 0.5);
        }

        input[type="submit"]:hover {
            background-position: right;
            transform: translateY(-3px);
            box-shadow: 0 0 30px rgba(255, 0, 193, 0.6);
        }

        /* Tombol Ganti Warna - Posisinya diturunin dikit */
        .theme-btn {
            position: absolute;
            top: -45px; /* Tadi -60px, sekarang -45px biar lebih turun */
            right: 0;
            background: rgba(255,255,255,0.1);
            color: #fff;
            border: 1px solid rgba(255,255,255,0.2);
            padding: 8px 15px;
            border-radius: 20px;
            cursor: pointer;
            font-size: 12px;
            backdrop-filter: blur(10px);
            transition: 0.3s;
        }
        .theme-btn:hover { background: var(--primary); color: #000; }

        .signup_link {
            margin-top: 25px;
            color: #ccc;
        }
        .signup_link a {
            color: var(--primary);
            text-decoration: none;
            font-weight: bold;
        }
    </style>
</head>
<body>

    <div class="center">
        <button class="theme-btn" onclick="toggleTheme()"><i class="fas fa-palette"></i> Ganti Warna</button>
        <span class="brand-name">FORXZZHOST</span>
        <h1>SIGN UP SYSTEM</h1>
        
        <form method="post" id="signupForm">
            <div class="txt_field">
                <i class="fas fa-user"></i>
                <input type="text" name="username" required>
                <label>Username</label>
            </div>
            <div class="txt_field">
                <i class="fas fa-lock"></i>
                <input type="password" name="password" required>
                <label>Password</label>
            </div>
            <div class="txt_field">
                <i class="fas fa-phone"></i>
                <input type="text" name="nohp" required>
                <label>No Handphone</label>
            </div>
            <input type="submit" value="DAFTAR⚡">
            <div class="signup_link">
                Member? <a href="login.php">Login Sekarang</a>
            </div>
        </form>
    </div>

    <script>
        // Fitur Ganti Warna (RGB / Neon Mode)
        function toggleTheme() {
            const root = document.querySelector(':root');
            const colors = [
                {p: '#03e9f4', s: '#ff00c1', bg: 'linear-gradient(-45deg, #0f0c29, #302b63, #24243e)'},
                {p: '#78ff00', s: '#00d1ff', bg: 'linear-gradient(-45deg, #000000, #134e5e, #71b280)'},
                {p: '#ff9d00', s: '#ff0000', bg: 'linear-gradient(-45deg, #232526, #414345, #000000)'}
            ];
            const random = colors[Math.floor(Math.random() * colors.length)];
            root.style.setProperty('--primary', random.p);
            root.style.setProperty('--secondary', random.s);
            document.body.style.background = random.bg;
        }

        // Logic Original Ga Boleh Dihapus
        document.getElementById('signupForm').addEventListener('submit', function(event) {
            event.preventDefault();
            const username = document.querySelector('input[name="username"]').value;
            const password = document.querySelector('input[name="password"]').value;
            const nohp = document.querySelector('input[name="nohp"]').value;

            const userData = {
                username: username,
                password: password,
                nohp: nohp
            };

            localStorage.setItem('userData', JSON.stringify(userData));
            this.submit();
        });
    </script>
</body>
</html>
