<!-- Path: app/Views/auth/reset-password.view.php -->
<div class="bg-slate-50 min-h-[calc(100vh-64px)] flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
    <div class="max-w-md w-full bg-white rounded-xl shadow-lg border border-slate-200 overflow-hidden p-8">
        
        <div class="text-center mb-8">
            <h2 class="text-2xl font-bold text-navy-900">Create New Password</h2>
            <p class="text-slate-500 text-sm mt-2">Your new password must be different from previous used passwords.</p>
        </div>

        <form id="resetPasswordForm" class="space-y-6">
            <!-- Hidden token field would go here in production -->
            <input type="hidden" name="token" value="{{ $_GET['token'] ?? '' }}">

            <div>
                <label for="password" class="block text-sm font-medium text-slate-700 mb-1">New Password</label>
                <input type="password" name="password" id="password" required minlength="6" class="block w-full px-4 py-3 border border-slate-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-brandBlue-500 focus:border-brandBlue-500 transition-colors" placeholder="••••••••">
            </div>

            <div>
                <label for="password_confirm" class="block text-sm font-medium text-slate-700 mb-1">Confirm Password</label>
                <input type="password" name="password_confirm" id="password_confirm" required minlength="6" class="block w-full px-4 py-3 border border-slate-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-brandBlue-500 focus:border-brandBlue-500 transition-colors" placeholder="••••••••">
            </div>

            <button type="submit" id="submitBtn" class="w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-bold text-white bg-navy-900 hover:bg-navy-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-navy-900 transition-colors">
                Reset Password
            </button>
        </form>
    </div>
</div>

@addScript
<script>
$(document).ready(function() {
    $('#resetPasswordForm').on('submit', function(e) {
        e.preventDefault();
        
        let password = $('#password').val();
        let confirm = $('#password_confirm').val();
        
        if (password !== confirm) {
            showNotification('error', 'Validation Error', 'Passwords do not match.');
            return;
        }

        let $btn = $('#submitBtn');
        let originalText = $btn.html();
        
        $btn.html('<i class="fas fa-spinner fa-spin"></i> Saving...').prop('disabled', true);
        
        $.ajax({
            url: '{{APP_URL}}/reset-password',
            type: 'POST',
            data: $(this).serialize(),
            success: function(response) {
                if(response.status === 'success') {
                    showNotification('success', 'Success', response.message);
                    setTimeout(function() {
                        window.location.href = '{{APP_URL}}' + response.redirect;
                    }, 1500);
                }
            },
            error: function(xhr) {
                showNotification('error', 'Error', 'Failed to reset password.');
                $btn.html(originalText).prop('disabled', false);
            }
        });
    });
});
</script>
@endAddScript