<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% if success %}CLI Authentication Successful{% else %}CLI Authentication Failed{% endif %} - Rise</title>
    <link rel="icon" type="image/x-icon" href="/assets/favicon.ico">
    <link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon-16x16.png">
    <link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32.png">
    <style>
        :root {
            --bg: #111111;
            --panel: #141414;
            --line: #3a3a3a;
            --text: #ececec;
            --muted: #b8b8b8;
            --ok: #b7ffce;
            --bad: #ffc0c0;
        }
        * { box-sizing: border-box; }
        body {
            margin: 0;
            min-height: 100vh;
            font-family: "IBM Plex Mono", ui-monospace, monospace;
            color: var(--text);
            background: radial-gradient(circle at 0 0, #202020 0%, #101010 40%), var(--bg);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 1rem;
        }
        .card {
            width: 100%;
            max-width: 48rem;
            background: var(--panel);
            border: 1px solid var(--line);
            padding: 1.2rem;
            text-align: center;
        }
        .logo {
            width: 2rem;
            height: 2rem;
            margin: 0 auto 0.75rem;
            background-color: currentColor;
            mask-size: contain;
            mask-repeat: no-repeat;
            mask-position: center;
            -webkit-mask-size: contain;
            -webkit-mask-repeat: no-repeat;
            -webkit-mask-position: center;
            mask-image: url(/assets/logo.svg);
            -webkit-mask-image: url(/assets/logo.svg);
        }
        .state-ok { color: var(--ok); font-size: 2rem; margin-bottom: 0.4rem; }
        .state-bad { color: var(--bad); font-size: 2rem; margin-bottom: 0.4rem; }
        h2 { margin: 0.2rem 0 0.8rem; font-size: 1.2rem; }
        p { color: var(--muted); }
        .mono-box {
            border: 1px solid var(--line);
            background: #1a1a1a;
            text-align: left;
            padding: 0.75rem;
            margin-top: 0.9rem;
        }
        .mono-code {
            color: var(--text);
            background: #111;
            border: 1px solid var(--line);
            padding: 0.1rem 0.35rem;
            font-size: 0.82rem;
        }
        .errbox {
            border: 1px solid #7d4b4b;
            color: var(--bad);
            background: #1a1212;
            padding: 0.6rem;
            margin: 0.8rem 0;
        }
    </style>
</head>
<body>
    <div class="card">
        {% if success %}
        <div>
            <div class="logo" aria-hidden="true"></div>
            <div class="state-ok">[ok]</div>
            <h2>CLI Authentication Successful</h2>

            <p>You have been successfully authenticated with the Rise CLI.</p>
            <p>You can now close this window and return to your terminal.</p>

            <div class="mono-box">
                <p style="margin-top:0;">Next steps:</p>
                <ul style="margin:0 0 0 1rem; color: var(--muted);">
                    <li>Run <code class="mono-code">rise project list</code> to see your projects</li>
                    <li>Run <code class="mono-code">rise deploy</code> to deploy an application</li>
                </ul>
            </div>
        </div>
        {% else %}
        <div>
            <div class="logo" aria-hidden="true"></div>
            <div class="state-bad">[error]</div>
            <h2>CLI Authentication Failed</h2>

            <p>Failed to authenticate with the Rise CLI.</p>

            {% if error_message %}
            <p class="errbox">{{ error_message }}</p>
            {% endif %}

            <p>Please try running <code class="mono-code">rise login</code> again.</p>
        </div>
        {% endif %}
    </div>
</body>
</html>
