Automated security analysis using AI to detect vulnerabilities, gas optimizations, and best practice violations