<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Connecting to Meshtastic...</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', system-ui, sans-serif;
            background: #0f172a;
            color: #f1f5f9;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
        }

        .loading-container {
            text-align: center;
            padding: 2rem;
        }

        .spinner {
            width: 80px;
            height: 80px;
            border: 6px solid #334155;
            border-top-color: #2563eb;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 2rem auto;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        h1 {
            font-size: 2rem;
            margin-bottom: 1rem;
            color: #2563eb;
        }

        p {
            color: #94a3b8;
            margin-bottom: 0.5rem;
        }

        .status {
            margin-top: 2rem;
            padding: 1rem;
            background: #1e293b;
            border: 1px solid #334155;
            border-radius: 8px;
            max-width: 500px;
            margin-left: auto;
            margin-right: auto;
        }

        .status-item {
            display: flex;
            justify-content: space-between;
            padding: 0.5rem 0;
            border-bottom: 1px solid #334155;
        }

        .status-item:last-child {
            border-bottom: none;
        }

        .status-label {
            color: #94a3b8;
        }

        .status-value {
            color: #f1f5f9;
            font-weight: 500;
        }
    </style>
</head>
<body>
    <div class="loading-container">
        <div class="spinner"></div>
        <h1>Connecting to Meshtastic Node</h1>
        <p>Please wait while we establish connection...</p>
        <p style="font-size: 0.9rem; margin-top: 1rem;">
            This usually takes 5-15 seconds
        </p>

        <div class="status">
            <div class="status-item">
                <span class="status-label">Status:</span>
                <span class="status-value">Searching for device</span>
            </div>
            <div class="status-item">
                <span class="status-label">Protocol:</span>
                <span class="status-value">Bluetooth / USB Serial</span>
            </div>
        </div>

        <p style="margin-top: 2rem; font-size: 0.85rem; color: #64748b;">
            If connection takes longer than 30 seconds, check that:<br>
            • Your device is powered on<br>
            • Bluetooth is enabled (if using BLE)<br>
            • USB cable is connected (if using Serial)<br>
            • No other app is connected to the device
        </p>

        <script>
            // Auto-refresh every 3 seconds
            setTimeout(() => {
                window.location.reload();
            }, 3000);
        </script>
    </div>
</body>
</html>