<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}Setup - Skrift{% endblock %}</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600&family=Lora:ital,wght@0,400;0,600;1,400;1,600&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="{{ static_url('css/skrift.css') }}">
    <style nonce="{{ csp_nonce() }}">
        .setup-container {
            max-width: 600px;
            margin: 2rem auto;
            padding: 0 1rem;
        }

        .setup-header {
            text-align: center;
            margin-bottom: 2rem;
        }

        .setup-header h1 {
            font-size: 2rem;
            margin-bottom: 0.5rem;
        }

        .setup-progress {
            display: flex;
            justify-content: center;
            gap: 0.5rem;
            margin-bottom: 2rem;
        }

        .setup-progress-step {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .setup-progress-dot {
            width: 2rem;
            height: 2rem;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: 0.875rem;
            background: var(--sk-color-surface);
            color: var(--sk-color-muted);
            border: 1px solid var(--sk-color-border);
        }

        .setup-progress-dot.active {
            background: var(--sk-color-accent);
            color: var(--sk-color-accent-text);
            border-color: var(--sk-color-accent);
        }

        .setup-progress-dot.completed {
            background: var(--sk-color-success);
            color: white;
            border-color: var(--sk-color-success);
        }

        .setup-progress-line {
            width: 2rem;
            height: 2px;
            background: var(--sk-color-border);
        }

        .setup-progress-line.completed {
            background: var(--sk-color-success);
        }

        .setup-card {
            background: var(--sk-color-surface);
            border-radius: var(--sk-radius-md);
            padding: 2rem;
            border: 1px solid var(--sk-color-border);
        }

        .setup-card h2 {
            margin-top: 0;
            margin-bottom: 0.5rem;
        }

        .setup-card p.description {
            color: var(--sk-color-muted);
            margin-bottom: 1.5rem;
        }

        .form-group {
            margin-bottom: 1.5rem;
        }

        .form-group label {
            display: block;
            margin-bottom: 0.5rem;
            font-weight: 500;
        }

        .form-group small {
            display: block;
            margin-top: 0.25rem;
            color: var(--sk-color-muted);
        }

        .form-group.env-toggle {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin-top: 0.5rem;
        }

        .form-group.env-toggle label {
            margin: 0;
            font-weight: normal;
            font-size: 0.875rem;
        }

        .form-group.env-toggle input[type="checkbox"] {
            margin: 0;
            width: 1.25rem;
            height: 1.25rem;
            flex-shrink: 0;
        }

        .radio-group {
            display: flex;
            gap: 1rem;
            margin-bottom: 1rem;
        }

        .radio-option {
            display: flex;
            align-items: flex-start;
            gap: 0.5rem;
            padding: 1rem;
            border: 2px solid var(--sk-color-border);
            border-radius: var(--sk-radius-md);
            cursor: pointer;
            flex: 1;
            background: var(--sk-color-bg);
        }

        .radio-option:hover {
            border-color: var(--sk-color-accent);
        }

        .radio-option.selected {
            border-color: var(--sk-color-accent);
            background: var(--sk-color-surface);
        }

        .radio-option input[type="radio"] {
            margin: 0;
        }

        .radio-option .radio-content {
            flex: 1;
        }

        .radio-option .radio-content strong {
            display: block;
            margin-bottom: 0.25rem;
        }

        .radio-option .radio-content small {
            color: var(--sk-color-muted);
        }

        .conditional-fields {
            display: none;
            margin-top: 1.5rem;
            padding-top: 1.5rem;
            border-top: 1px solid var(--sk-color-border);
        }

        .conditional-fields.visible {
            display: block;
        }

        .form-actions {
            display: flex;
            justify-content: space-between;
            margin-top: 2rem;
            gap: 1rem;
        }

        .form-actions button,
        .form-actions [role="button"] {
            flex: 1;
            margin-top: 0;
        }

        .alert {
            padding: 1rem;
            border-radius: var(--sk-radius-md);
            margin-bottom: 1rem;
        }

        .alert-error {
            background: rgba(239, 68, 68, 0.1);
            color: var(--sk-color-error);
            border: 1px solid var(--sk-color-error);
        }

        .alert-success {
            background: rgba(16, 185, 129, 0.1);
            color: var(--sk-color-success);
            border: 1px solid var(--sk-color-success);
        }

        .provider-card {
            border: 2px solid var(--sk-color-border);
            border-radius: var(--sk-radius-md);
            margin-bottom: 1rem;
            overflow: hidden;
            background: var(--sk-color-bg);
        }

        .provider-card.enabled {
            border-color: var(--sk-color-accent);
        }

        .provider-header {
            display: flex;
            align-items: center;
            gap: 1rem;
            padding: 1rem;
            cursor: pointer;
            background: var(--sk-color-surface);
        }

        .provider-header input[type="checkbox"] {
            margin: 0;
        }

        .provider-header h3 {
            margin: 0;
            flex: 1;
            font-size: 1rem;
        }

        .provider-fields {
            display: none;
            padding: 1rem;
            border-top: 1px solid var(--sk-color-border);
        }

        .provider-card.enabled .provider-fields {
            display: block;
        }

        .provider-instructions {
            margin-bottom: 1rem;
        }

        .provider-instructions details {
            background: var(--sk-color-surface);
            padding: 0.5rem 1rem;
            border-radius: var(--sk-radius-sm);
        }

        .provider-instructions summary {
            cursor: pointer;
            font-weight: 500;
        }

        .provider-instructions pre {
            white-space: pre-wrap;
            font-size: 0.875rem;
            margin: 0.5rem 0;
            background: var(--sk-color-bg);
            padding: 0.75rem;
            border-radius: var(--sk-radius-sm);
        }

        .redirect-url {
            background: var(--sk-color-bg);
            padding: 0.5rem;
            border-radius: var(--sk-radius-sm);
            font-family: var(--sk-font-mono);
            font-size: 0.875rem;
            word-break: break-all;
            margin: 0.5rem 0 1rem;
            border: 1px solid var(--sk-color-border);
        }

        .oauth-buttons {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        .oauth-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
            padding: 1rem 1.5rem;
            border-radius: var(--sk-radius-pill);
            font-size: 1rem;
            font-weight: 600;
            text-decoration: none;
            transition: opacity 0.2s, transform 0.1s;
        }

        .oauth-btn:hover {
            opacity: 0.9;
        }

        .oauth-btn:active {
            transform: translateY(1px);
        }

        .oauth-btn::after {
            display: none;
        }

        .oauth-btn-google {
            background: #4285f4;
            color: white;
        }

        .oauth-btn-github {
            background: #24292e;
            color: white;
        }

        .oauth-btn-microsoft {
            background: #00a4ef;
            color: white;
        }

        .oauth-btn-discord {
            background: #5865f2;
            color: white;
        }

        .oauth-btn-facebook {
            background: #1877f2;
            color: white;
        }

        .oauth-btn-twitter {
            background: #000000;
            color: white;
        }

        .complete-message {
            text-align: center;
            padding: 2rem;
        }

        .complete-message h2 {
            color: var(--sk-color-success);
        }

        .complete-icon {
            font-size: 4rem;
            margin-bottom: 1rem;
            color: var(--sk-color-success);
        }
    </style>
    {% block head %}{% endblock %}
</head>
<body>
    <main class="setup-container">
        <div class="setup-header">
            <h1>Skrift Setup</h1>
            <p>Configure your site in a few easy steps</p>
        </div>

        {% if step is defined %}
        <div class="setup-progress">
            {% for i in range(1, total_steps + 1) %}
                {% if i > 1 %}
                <div class="setup-progress-line{% if i <= step %} completed{% endif %}"></div>
                {% endif %}
                <div class="setup-progress-step">
                    <div class="setup-progress-dot{% if i < step %} completed{% elif i == step %} active{% endif %}">
                        {% if i < step %}&#10003;{% else %}{{ i }}{% endif %}
                    </div>
                </div>
            {% endfor %}
        </div>
        {% endif %}

        {% if flash %}
        <div class="alert alert-success">{{ flash }}</div>
        {% endif %}

        {% if error %}
        <div class="alert alert-error">{{ error }}</div>
        {% endif %}

        <div class="setup-card">
            {% block content %}{% endblock %}
        </div>
    </main>

    {% block scripts %}{% endblock %}
</body>
</html>
