<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sign Up - MindRoot</title>
    <link rel="stylesheet" href="/home/static/css/reset.css">
    <link rel="stylesheet" href="/home/static/css/default.css">
    <link rel="stylesheet" href="/home/static/css/home.css">
    <style>
        .signup-container {
            width: 100%;
            max-width: 1200px;
            margin: 0 auto;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 20px;
            box-sizing: border-box;
        }

        .signup-card {
            background: rgb(10, 10, 25);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 8px;
            padding: 2rem;
            width: 100%;
            max-width: 400px;
            margin-top: 1rem;
        }

        .logo-container {
            text-align: center;
            margin-bottom: 1rem;
        }

        .logo {
            width: 96px;
            margin-bottom: 1rem;
        }

        h1 {
            color: #f0f0f0;
            text-align: center;
            margin-bottom: 2rem;
            font-size: 1.5rem;
        }

        .form-group {
            margin-bottom: 1.5rem;
        }

        .form-group label {
            display: block;
            margin-bottom: 0.5rem;
            color: #f0f0f0;
        }

        .form-group input {
            width: 100%;
            padding: 0.75rem;
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 4px;
            background: rgb(15, 15, 30);
            color: #f0f0f0;
            transition: border-color 0.3s ease;
        }

        .form-group input:focus {
            border-color: #4a90e2;
            outline: none;
        }

        .error-message {
            background: rgba(255, 0, 0, 0.1);
            border: 1px solid rgba(255, 0, 0, 0.3);
            color: #ff6b6b;
            padding: 0.75rem;
            border-radius: 4px;
            margin-bottom: 1.5rem;
        }

        .submit-btn {
            width: 100%;
            padding: 0.75rem;
            background: #4a90e2;
            color: #fff;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 1rem;
            transition: background-color 0.3s ease;
        }

        .submit-btn:hover {
            background: #357abd;
        }

        .login-link {
            text-align: center;
            margin-top: 1rem;
            color: #f0f0f0;
        }

        .login-link a {
            color: #4a90e2;
            text-decoration: none;
        }

        .login-link a:hover {
            text-decoration: underline;
        }

        .requirements {
            font-size: 0.8rem;
            color: rgba(255, 255, 255, 0.6);
            margin-top: 0.25rem;
        }
    </style>
</head>
<body>
    <div class="signup-container">
        <div class="logo-container">
            <img src="/home/static/imgs/logo.png" alt="MindRoot Logo" class="logo">
            <h1>Create Your MindRoot Account</h1>
        </div>

        <div class="signup-card">
            {% if error %}
            <div class="error-message">
                {{ error }}
            </div>
            {% endif %}

            <form method="POST" action="/signup">
                <div class="form-group">
                    <label for="username">Username</label>
                    <input type="text" id="username" name="username" required 
                           minlength="3" maxlength="32" pattern="^[a-zA-Z0-9_]+$">
                    <div class="requirements">3-32 characters, letters, numbers, and underscores only</div>
                </div>

                <div class="form-group">
                    <label for="email">Email Address</label>
                    <input type="email" id="email" name="email" required>
                </div>

                <div class="form-group">
                    <label for="password">Password</label>
                    <input type="password" id="password" name="password" required minlength="8">
                    <div class="requirements">Minimum 8 characters</div>
                </div>

                <div class="form-group">
                    <label for="password_confirm">Confirm Password</label>
                    <input type="password" id="password_confirm" name="password_confirm" required minlength="8">
                </div>

                <button type="submit" class="submit-btn">Create Account</button>
            </form>

            <div class="login-link">
                Already have an account? <a href="/login">Login here</a>
            </div>
        </div>
    </div>

    <script>
    document.addEventListener('DOMContentLoaded', function() {
        const form = document.querySelector('form');
        const password = document.getElementById('password');
        const passwordConfirm = document.getElementById('password_confirm');
        
        form.addEventListener('submit', function(e) {
            if (password.value !== passwordConfirm.value) {
                e.preventDefault();
                const errorDiv = document.createElement('div');
                errorDiv.className = 'error-message';
                errorDiv.textContent = 'Passwords do not match!';
                form.insertBefore(errorDiv, form.firstChild);
                
                // Remove error message after 3 seconds
                setTimeout(() => {
                    errorDiv.remove();
                }, 3000);
            }
        });
    });
    </script>
</body>
</html>