<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Loading Test Report</title>
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
    <style>
        body {
            background-color: #222320;
            margin: 0;
            padding: 0;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            overflow: hidden;
        }

        .loading-spinner {
            border: 4px solid #f3f3f3;
            border-top: 4px solid #ff9900;
            border-radius: 50%;
            width: 35px;
            height: 35px;
            animation: spin 2s linear infinite;
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }

        p {
            font-size: 18px;
            color: #999;
            margin-left: 10px;
        }

        #terminal {
            background-color: black;
            color: white;
            padding: 10px;
            height: 500px;
            width: 100%;
            font-family: monospace;
            font-size: 14px;
            overflow-y: auto;
            border: 1px solid #333;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
        }

        #terminal-header {
            background-color: #333;
            color: white;
            padding: 8px 16px;
            font-family: monospace;
            font-size: 13px;
        }

        .red-text {
            color: red;
        }

        .green-text {
            color: green;
        }

        .yellow-text {
            color: yellow;
        }

        .time {
            font-size: 21px;
            font-family: Arial, sans-serif;
            padding: 3px;
            border: 2px solid #333;
            border-radius: 5px;
            width: 150px;
            text-align: center;
            color: #bbb;
        }
    </style>
</head>

<body>
    <div class="w-100 h-100 py-4 px-2">

        <div id="in_progress">
            <div class="d-flex justify-content-center mb-2">
                <div class="d-flex align-items-center px-3">
                    <div class="loading-spinner"></div>
                </div>
                <div class="d-flex align-items-center px-3">
                    <div class="time" id="time">00:00:00</div>
                </div>
            </div>
        </div>

        <div id="in_success" style="display: none;">
            <div class="d-flex justify-content-center mb-2">
                <div class="d-flex align-items-center">
                    <span class="green-text px-3"><i class="fas fa-check-circle"></i> Successfully completed</span>
                </div>
                <button id="show_report_btn" type="button" class="btn btn-outline-success"><i
                    class="fas fa-file-alt"></i> Show report</button>
            </div>
        </div>

        <div id="in_failure" style="display: none;">
            <div class="d-flex justify-content-center mb-2">
                <div class="d-flex align-items-center">
                    <span class="red-text px-3"><i class="fas fa-exclamation-circle"></i> Testing failed</span>
                </div>
                <button id="show_report_btn" type="button" class="btn btn-outline-danger"><i
                    class="fas fa-file-alt"></i> Show report</button>
            </div>
        </div>

        <div id="in_stopped" style="display: none;">
            <div class="d-flex justify-content-center">
                <div class="d-flex align-items-center">
                    <p class="yellow-text"><i class="fas fa-times-circle"></i> Testing terminated</p>
                </div>
            </div>
        </div>

        <div class="pt-2">
            <div id="terminal-header">NATT Output</div>
            <pre id="terminal"></pre>
        </div>

    </div>

    <script>
        function formatTime(time) {
            let hours = Math.floor(time / 3600);
            let minutes = Math.floor((time % 3600) / 60);
            let seconds = Math.floor(time % 60);

            hours = (hours < 10) ? '0' + hours : hours;
            minutes = (minutes < 10) ? '0' + minutes : minutes;
            seconds = (seconds < 10) ? '0' + seconds : seconds;

            return hours + ':' + minutes + ':' + seconds;
        }

        function startStopwatch() {
            let time = 0;
            let display = document.getElementById('time');

            setInterval(function () {
                time++;
                display.textContent = formatTime(time);
            }, 1000);
        }

        startStopwatch();
    </script>

</body>

</html>