<?php
session_start();
if (isset($_GET['logout'])) {
    session_destroy();
    header("Location: login.php");
    exit;
}
$password = "nox2026"; // Tvoje heslo

if (isset($_POST['pass'])) {
    if ($_POST['pass'] === $password) {
        $_SESSION['auth'] = true;
        header("Location: index.php");
        exit;
    } else {
        $error = "Špatné heslo, přístup odepřen. 🌑";
    }
}
?>
<!DOCTYPE html>
<html lang="cs">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Nox Login 🌑</title>
    <style>
        body {
            background: #050505;
            color: #fff;
            font-family: 'Inter', sans-serif;
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
        }
        .login-box {
            background: #0d0d0e;
            padding: 40px;
            border-radius: 16px;
            border: 1px solid #1a1a1a;
            width: 300px;
            text-align: center;
            box-shadow: 0 0 30px rgba(0, 242, 255, 0.1);
        }
        input {
            width: 100%;
            padding: 12px;
            margin: 20px 0;
            background: #111;
            border: 1px solid #222;
            color: #fff;
            border-radius: 8px;
            box-sizing: border-box;
            outline: none;
        }
        input:focus { border-color: #00f2ff; }
        button {
            background: #00f2ff;
            color: #000;
            border: none;
            padding: 12px 24px;
            border-radius: 8px;
            font-weight: 800;
            cursor: pointer;
            width: 100%;
        }
        .error { color: #ff4b2b; font-size: 0.8rem; margin-top: 10px; }
    </style>
</head>
<body>
    <div class="login-box">
        <h2 style="margin:0; letter-spacing:-1px;">NOX ACCESS</h2>
        <span style="font-size:0.7rem; color:#666; text-transform:uppercase;">Security Perimeter</span>
        <form method="POST">
            <input type="password" name="pass" placeholder="Vstupní kód..." autofocus required>
            <button type="submit">Ověřit</button>
        </form>
        <?php if(isset($error)) echo "<div class='error'>$error</div>"; ?>
    </div>
</body>
</html>
