@model OnboardingManuscriptBuildResult
@{
    ViewData["Title"] = "Chapters prepared";
}

<section class="onboarding-shell" aria-labelledby="build-complete-title">
    <div class="onboarding-panel onboarding-review-panel">
        <ol class="onboarding-stepper onboarding-stepper--complete" aria-label="Story setup journey">
            @foreach (var label in new[] { "Welcome", "Writing Preferences", "Project", "Book", "Connect Word", "Scan", "Review", "Prepare Chapters", "Complete" })
            {
                <li class="is-complete">
                    <span></span>
                    <strong>@label</strong>
                </li>
            }
        </ol>
        <div class="onboarding-copy">
            <p class="eyebrow">Prepare Chapters</p>
            <div class="onboarding-success-heading">
                <span aria-hidden="true">&check;</span>
                <h1 id="build-complete-title">Your chapters are ready.</h1>
            </div>
            <p>@(Model.AlreadyBuilt ? "These chapters have already been prepared in PlotDirector, so nothing was duplicated." : "PlotDirector prepared the approved chapters. Story Intelligence will create scenes after you review the analysis.")</p>
            @if (!string.IsNullOrWhiteSpace(Model.MarkerWarning))
            {
                <p class="text-warning">@Model.MarkerWarning</p>
            }
        </div>

        <div class="onboarding-scan-counts onboarding-review-counts">
            <div>
                <span>Chapters</span>
                <strong>@Model.ChaptersCreated</strong>
            </div>
            <div>
                <span>Scenes created now</span>
                <strong>@Model.ScenesCreated</strong>
            </div>
            <div>
                <span>Characters created now</span>
                <strong>@(Model.CharactersCreated + Model.CharactersReused)</strong>
            </div>
            <div>
                <span>Scene appearances now</span>
                <strong>@Model.SceneAppearancesCreated</strong>
            </div>
        </div>

        <section class="onboarding-complete-next">
            <h2>Next: analyse manuscript</h2>
            <p>Story Intelligence will detect scenes from the approved chapter text. You will review the results before PlotDirector creates scenes.</p>
        </section>

        <div class="onboarding-actions">
            <a class="btn btn-primary" asp-controller="Onboarding" asp-action="StoryIntelligence">Analyse manuscript</a>
            <a class="btn btn-outline-primary" asp-controller="Projects" asp-action="Details" asp-route-id="@Model.ProjectID">Open Project Overview</a>
            <a class="btn btn-outline-secondary" asp-controller="Writer" asp-action="Index" asp-route-projectId="@Model.ProjectID">Open Writer Workspace</a>
        </div>
    </div>
</section>
