{% extends "base.html" %}

{% block title %}Reset Password - {{ lab_name }}{% endblock %}

{% block content %}
<div style="display: flex; justify-content: center; align-items: center; min-height: 80vh;">
    <div class="card" style="max-width: 500px; width: 100%;">
        <div style="text-align: center; margin-bottom: 2rem;">
            <h1 style="color: var(--primary); font-size: 2.5rem; margin-bottom: 0.5rem;">{{ lab_name }}</h1>
            <p style="color: var(--text-light); font-size: 1.1rem;">Set New Password</p>
        </div>
        
        <div class="card-header">Create New Password</div>
        
        <form method="POST">
            <div class="form-group">
                <label for="new_password">New Password</label>
                <input type="password" id="new_password" name="new_password" 
                       class="form-control" required minlength="6"
                       placeholder="Enter new password (minimum 6 characters)">
                <small style="color: var(--text-light); display: block; margin-top: 0.5rem;">
                    Password should be at least 6 characters long.
                </small>
            </div>
            
            <div class="form-group">
                <label for="confirm_password">Confirm New Password</label>
                <input type="password" id="confirm_password" name="confirm_password" 
                       class="form-control" required minlength="6"
                       placeholder="Re-enter new password">
            </div>
            
            <button type="submit" class="btn btn-primary" style="width: 100%; margin-top: 1rem;">
                Reset Password
            </button>
        </form>
        
        <div style="margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); text-align: center;">
            <a href="{{ url_for('login') }}" style="color: var(--primary); text-decoration: none;">
                ← Back to Login
            </a>
        </div>
    </div>
</div>

<script>
// Client-side password match validation
document.querySelector('form').addEventListener('submit', function(e) {
    const newPassword = document.getElementById('new_password').value;
    const confirmPassword = document.getElementById('confirm_password').value;
    
    if (newPassword !== confirmPassword) {
        e.preventDefault();
        alert('Passwords do not match!');
    }
});
</script>
{% endblock %}
