<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}Moonlab{% endblock %}</title>
    <link rel="stylesheet" href="/static/style.css">
    <link rel="icon" href="/static/logo.png" type="image/png">
    <style>
        html, body {
            height: 100%;
            overflow: hidden;
        }
        body {
            background-image: url('/static/background.png');
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            height: 100vh;
            margin: 0;
            display: flex;
            flex-direction: column;
        }

        .content-wrapper {
            flex: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
            height: 100vh;
            overflow: hidden;
        }

        .form-container {
            background: rgba(255, 255, 255, 0.6);
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            max-width: 400px;
            width: 100%;
            text-align: center;
            display: flex;
            flex-direction: column;
            align-items: center;
            box-sizing: border-box;
        }

        .form-container input[type="text"],
        .form-container input[type="password"] {
            width: 100%;
            max-width: 350px;
            box-sizing: border-box;
            padding: 10px;
            margin: 8px 0 16px 0;
            border: 1px solid #ccc;
            border-radius: 4px;
            font-size: 15px;
            background: #fff;
        }

        .theme-toggle {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 60px;
            height: 60px;
            border-radius: 16px;
            background-color: gray;
            background-size: 70%;
            background-position: center;
            background-repeat: no-repeat;
            cursor: pointer;
            box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
            transition: background-image 0.3s ease;
        }

        .neon-button {
            width: 100%;
            padding: 14px 20px;
            font-size: 15px;
            font-weight: bold;
            border: 2px solid;
            color: inherit;
            background: transparent;
            cursor: pointer;
            position: relative;
            overflow: hidden;
            transition: 0.3s;
            box-shadow: 0 0 8px currentColor, 0 0 14px currentColor inset;
            margin: 10px 0;
            border-radius: 6px;
        }

        .neon1 { color: #00fff7; border-color: #00fff7; }
        .neon2 { color: #ff00ff; border-color: #ff00ff; }
        .neon3 { color: #39ff14; border-color: #39ff14; }

        .neon-button::before {
            content: '';
            position: absolute;
            top: 0; left: 0;
            width: 100%; height: 100%;
            background: currentColor;
            z-index: 0;
            transform: scaleX(0);
            transform-origin: left;
            transition: 0.3s ease-in-out;
        }

        .neon-button:hover::before {
            transform: scaleX(1);
        }

        .neon-button span {
            position: relative;
            z-index: 1;
            transition: color 0.3s;
        }

        .neon-button:hover span {
            color: #000;
        }
    </style>
</head>
<body>
{% include "top_bar.html" %}
<div class="content-wrapper">
    {% block content %}
    {% endblock %}
</div>

<div class="theme-toggle" id="themeToggle" style="background-image: url('/static/{{ 'night-mode.png' if session['theme'] == 'lightmode' else 'light-mode.png' }}');"></div>

<script>
    const themeToggle = document.getElementById('themeToggle');
    themeToggle.addEventListener('click', () => {
        fetch('/toggle-theme', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            },
            credentials: 'same-origin'
        }).then(response => {
            if (response.ok) {
                location.reload();
            } else {
                console.error('Failed to toggle theme:', response.statusText);
            }
        });
    });
</script>
</body>
</html>