<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Network as Code Combined Test Results Summary</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        :root {
            --primary: #2c3e50;
            --secondary: #34495e;
            --accent: #3498db;
            --success: #2ecc71;
            --danger: #e74c3c;
            --warning: #f39c12;
            --skip: #95a5a6;
            --info: #3498db;
            --neutral: #95a5a6;
            --light: #ecf0f1;
            --dark: #2c3e50;
            --shadow: rgba(0, 0, 0, 0.1);
        }

        body {
            font-family: 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', sans-serif;
            margin: 0;
            padding: 0;
            color: var(--dark);
            background-color: #f9f9f9;
            line-height: 1.6;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }

        header {
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            color: white;
            padding: 30px 20px;
            box-shadow: 0 4px 6px var(--shadow);
            margin-bottom: 30px;
            text-align: center;
        }

        h1, h2, h3, h4 {
            margin-top: 0;
            line-height: 1.2;
            color: var(--primary);
            font-weight: 600;
        }

        header h1 {
            color: white;
            margin-bottom: 10px;
        }

        .test-type-badge {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 0.9rem;
            font-weight: 500;
            margin-right: 10px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .api-badge {
            background-color: rgba(52, 152, 219, 0.15);
            color: var(--accent);
            border: 1px solid var(--accent);
        }

        .d2d-badge {
            background-color: rgba(155, 89, 182, 0.15);
            color: #9b59b6;
            border: 1px solid #9b59b6;
        }

        .robot-badge {
            background-color: rgba(243, 156, 18, 0.15);
            color: #f39c12;
            border: 1px solid #f39c12;
        }

        .summary {
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px var(--shadow);
            margin: 20px 0;
            padding: 25px;
        }

        .overall-summary {
            margin-bottom: 40px;
        }

        .summary-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            grid-gap: 20px;
            margin-top: 20px;
        }

        .summary-item {
            padding: 20px;
            border-radius: 8px;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
            user-select: none;
        }

        .summary-item:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 8px var(--shadow);
        }

        .summary-item:focus {
            outline: 3px solid var(--accent);
            outline-offset: 2px;
        }

        .summary-item.active {
            opacity: 1 !important;
            box-shadow: 0 0 0 3px var(--accent);
            transform: scale(1.05);
        }

        .summary-item.filtered-out {
            opacity: 0.4;
        }

        .summary-item h3 {
            font-size: 2.5rem;
            margin: 10px 0;
        }

        .summary-item p {
            color: #7f8c8d;
            margin: 0;
        }

        .total {
            background-color: rgba(52, 152, 219, 0.1);
            border-left: 4px solid var(--accent);
        }

        .passed {
            background-color: rgba(46, 204, 113, 0.1);
            border-left: 4px solid var(--success);
        }

        .failed {
            background-color: rgba(231, 76, 60, 0.1);
            border-left: 4px solid var(--danger);
        }

        .skipped {
            background-color: rgba(149, 165, 166, 0.1);
            border-left: 4px solid var(--neutral);
        }

        .rate {
            background-color: rgba(52, 152, 219, 0.1);
            border-left: 4px solid var(--accent);
        }

        .progress-container {
            margin-top: 10px;
            background-color: #f1f1f1;
            border-radius: 10px;
            height: 10px;
            position: relative;
        }

        .progress-bar {
            border-radius: 10px;
            height: 10px;
            background: linear-gradient(to right, var(--success), var(--accent));
            width: var(--progress-width);
        }

        .test-type-section {
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px var(--shadow);
            margin: 30px 0;
            padding: 25px;
        }

        .section-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 2px solid var(--light);
        }

        .section-title {
            display: flex;
            align-items: center;
        }

        .section-title h2 {
            margin: 0;
            margin-left: 10px;
        }

        .view-report-btn {
            display: inline-block;
            padding: 10px 20px;
            background-color: var(--accent);
            color: white;
            border-radius: 4px;
            text-decoration: none;
            transition: background-color 0.3s ease;
            font-weight: 500;
        }

        .view-report-btn:hover {
            background-color: #2980b9;
            text-decoration: none;
        }

        .mini-stats {
            display: flex;
            justify-content: space-around;
            flex-wrap: wrap;
            gap: 20px;
            margin-top: 20px;
        }

        .mini-stat {
            text-align: center;
            flex: 1;
            min-width: 120px;
        }

        .mini-stat-value {
            font-size: 2rem;
            font-weight: 600;
            margin: 5px 0;
        }

        .mini-stat-label {
            color: #7f8c8d;
            font-size: 0.9rem;
        }

        .passed-value {
            color: var(--success);
        }

        .failed-value {
            color: var(--danger);
        }

        .skipped-value {
            color: var(--warning);
        }

        .total-value {
            color: var(--accent);
        }

        footer {
            text-align: center;
            margin-top: 50px;
            padding: 20px;
            color: #7f8c8d;
        }

        /* Filter indicator styles */
        .filter-indicator {
            background: linear-gradient(135deg, var(--accent), var(--info));
            color: white;
            padding: 12px 20px;
            border-radius: 8px;
            margin: 15px 0;
            display: none;
            align-items: center;
            justify-content: space-between;
            box-shadow: 0 2px 8px var(--shadow);
        }

        .filter-indicator.active {
            display: flex;
        }

        .filter-indicator strong {
            text-transform: capitalize;
        }

        .filter-indicator button {
            background: rgba(255, 255, 255, 0.2);
            border: 1px solid rgba(255, 255, 255, 0.5);
            color: white;
            padding: 6px 12px;
            border-radius: 4px;
            cursor: pointer;
            font-weight: bold;
            transition: background 0.3s ease;
        }

        .filter-indicator button:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        /* Sortable table header styles */
        table.results-table thead th.sortable {
            cursor: pointer;
            user-select: none;
        }

        table.results-table thead th.sortable:hover {
            background: var(--secondary);
        }

        table.results-table thead th.sortable::after {
            content: ' ↕';
            opacity: 0.5;
        }

        table.results-table thead th.sortable.sort-asc::after {
            content: ' ↑';
            opacity: 1;
        }

        table.results-table thead th.sortable.sort-desc::after {
            content: ' ↓';
            opacity: 1;
        }

        /* Hidden row for filtering */
        tr.hidden {
            display: none !important;
        }

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

            .summary-grid {
                grid-template-columns: 1fr;
            }

            .section-header {
                flex-direction: column;
                align-items: flex-start;
            }

            .view-report-btn {
                margin-top: 15px;
            }

            .mini-stats {
                flex-direction: column;
            }
        }
    </style>
</head>
<body>
    <header>
        <div class="container">
            <h1>Network as Code Combined Test Results</h1>
            <div class="date-info">Generated on {{ generation_time }}</div>
        </div>
    </header>

    <div class="container">
        <!-- Overall Summary Section -->
        <div class="summary overall-summary">
            <h2>Overall Executive Summary</h2>
            <div class="summary-grid">
                <div class="summary-item total">
                    <p>Total Tests</p>
                    <h3>{{ overall_stats.total }}</h3>
                </div>
                <div class="summary-item passed">
                    <p>Passed</p>
                    <h3>{{ overall_stats.passed }}</h3>
                </div>
                <div class="summary-item failed">
                    <p>Failed</p>
                    <h3>{{ overall_stats.failed }}</h3>
                </div>
                <div class="summary-item skipped">
                    <p>Skipped</p>
                    <h3>{{ overall_stats.skipped }}</h3>
                </div>
                <div class="summary-item rate">
                    <p>Success Rate</p>
                    <h3>{{ "%.1f"|format(overall_stats.success_rate) }}%</h3>
                    <div class="progress-container">
                        <div class="progress-bar" style="--progress-width: {{ overall_stats.success_rate }}%"></div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Individual Test Type Sections -->
        {% for test_type, framework_data in test_type_stats.items() %}
        <div class="test-type-section">
            <div class="section-header">
                <div class="section-title">
                    <span class="test-type-badge {{ test_type.lower() }}-badge">{{ test_type }}</span>
                    <h2>{{ framework_data.title }} Test Results</h2>
                </div>
                <a href="{{ framework_data.report_path }}" class="view-report-btn">
                    View Detailed Report →
                </a>
            </div>
            
            <div class="mini-stats">
                <div class="mini-stat">
                    <div class="mini-stat-value total-value">{{ framework_data.stats.total }}</div>
                    <div class="mini-stat-label">Total Tests</div>
                </div>
                <div class="mini-stat">
                    <div class="mini-stat-value passed-value">{{ framework_data.stats.passed }}</div>
                    <div class="mini-stat-label">Passed</div>
                </div>
                <div class="mini-stat">
                    <div class="mini-stat-value failed-value">{{ framework_data.stats.failed }}</div>
                    <div class="mini-stat-label">Failed</div>
                </div>
                <div class="mini-stat">
                    <div class="mini-stat-value skipped-value">{{ framework_data.stats.skipped }}</div>
                    <div class="mini-stat-label">Skipped</div>
                </div>
                <div class="mini-stat">
                    <div class="mini-stat-value">{{ "%.1f"|format(framework_data.stats.success_rate) }}%</div>
                    <div class="mini-stat-label">Success Rate</div>
                </div>
            </div>
        </div>
        {% endfor %}

        <footer>
            <p>Generated by Cisco's Network as Code <code>nac-test</code> Tool</p>
            <p>This combined report aggregates results from {{ test_type_stats|length }} test type(s)</p>
        </footer>
    </div>
</body>
</html> 