<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{report_title}}</title>
    <style>
        /* Inline CSS for consistent rendering */
        body {
            font-family: sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f4f4f4;
            color: #333;
        }

        .container {
            max-width: 960px;
            margin: 20px auto;
            padding: 20px;
            background-color: #fff;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        h1 {
            text-align: center;
            color: #007bff;
        }

        h2 {
            margin-top: 20px;
            border-bottom: 2px solid #eee;
            padding-bottom: 5px;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 10px;
        }

        th, td {
            padding: 8px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }

        th {
            background-color: #f2f2f2;
        }

        .passed {
            color: green;
        }

        .failed {
            color: red;
        }

        .skipped {
            color: orange;
        }

        .coverage-bar {
            height: 10px;
            background-color: #ddd;
            margin-top: 5px;
            border-radius: 5px;
            overflow: hidden; /* Ensure the inner bar stays within the container */
        }

        .coverage-bar-fill {
            height: 10px;
            background-color: #28a745; /* Green for coverage */
            width: {{coverage_percentage}}%; /* Dynamic width based on coverage */
            display: block; /* Make it a block-level element to control height and width */
        }

        .trend-chart {
            width: 100%;
            height: 300px; /* Adjust height as needed */
            background-color: #eee; /* Placeholder for the chart */
            text-align: center;
            line-height: 300px;
            color: #777;
            font-style: italic;
        }

        /* Responsive adjustments */
        @media (max-width: 768px) {
            .container {
                padding: 10px;
            }

            table {
                font-size: 0.9em;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>{{report_title}}</h1>
        <p>Generated on: {{report_date}}</p>

        <h2>Summary</h2>
        <p>Total Tests: {{total_tests}}</p>
        <p class="passed">Passed: {{passed_tests}}</p>
        <p class="failed">Failed: {{failed_tests}}</p>
        <p class="skipped">Skipped: {{skipped_tests}}</p>

        <h2>Test Results</h2>
        <table>
            <thead>
                <tr>
                    <th>Test Name</th>
                    <th>Status</th>
                    <th>Duration (ms)</th>
                    <th>Error Message</th>
                </tr>
            </thead>
            <tbody>
                {{test_results}}
            </tbody>
        </table>

        <h2>Coverage</h2>
        <p>Overall Coverage: {{coverage_percentage}}%</p>
        <div class="coverage-bar">
            <div class="coverage-bar-fill"></div>
        </div>

        <h2>Trend Analysis</h2>
        <div class="trend-chart">
            <!-- Placeholder for Trend Chart.  Replace with actual chart implementation -->
            Trend Chart Placeholder
        </div>

        <h2>Failure Analysis</h2>
        <p>{{failure_analysis}}</p>

        <p>Generated by Test Report Generator Plugin</p>
    </div>
</body>
</html>