@model AdminDashboardViewModel
@{
    ViewData["Title"] = "Admin";
    var summary = Model.FeatureRequestSummary;
}

<div class="page-heading compact">
    <div>
        <p class="eyebrow">Admin</p>
        <h1>Dashboard</h1>
        <p class="lead-text">Operational tools for PlotDirector administrators.</p>
    </div>
</div>

<nav class="mb-3" aria-label="Breadcrumb">
    <a asp-controller="Projects" asp-action="Index">Projects</a>
    <span class="muted"> / Admin</span>
</nav>

<section class="edit-panel">
    <div class="row g-3">
        <div class="col-md-4">
            <a class="text-decoration-none" asp-action="FeatureRequests">
                <div class="border rounded p-3 h-100">
                    <p class="eyebrow">Open requests</p>
                    <h2 class="mb-0">@summary.TotalOpenRequests.ToString("N0")</h2>
                </div>
            </a>
        </div>
        <div class="col-md-4">
            <a class="text-decoration-none" asp-action="FeatureRequests">
                <div class="border rounded p-3 h-100">
                    <p class="eyebrow">Awaiting admin reply</p>
                    <h2 class="mb-0">@summary.AwaitingAdminReply.ToString("N0")</h2>
                </div>
            </a>
        </div>
        <div class="col-md-4">
            <a class="text-decoration-none" asp-action="FeatureRequests" asp-route-status="@FeatureRequestStatuses.NeedsDetail">
                <div class="border rounded p-3 h-100">
                    <p class="eyebrow">Awaiting user reply</p>
                    <h2 class="mb-0">@summary.AwaitingUserReply.ToString("N0")</h2>
                </div>
            </a>
        </div>
    </div>
</section>

<section class="edit-panel">
    <h2>Feature request status</h2>
    <div class="row g-3">
        @foreach (var status in summary.Statuses)
        {
            <div class="col-sm-6 col-lg-3">
                <a class="text-decoration-none" asp-action="FeatureRequests" asp-route-status="@status.Status">
                    <div class="border rounded p-3 h-100">
                        <p class="eyebrow">@status.Status</p>
                        <h3 class="mb-0">@status.Count.ToString("N0")</h3>
                    </div>
                </a>
            </div>
        }
    </div>
</section>

<section class="project-card-grid">
    <article class="project-card">
        <div class="project-card__body">
            <p class="eyebrow">User feedback</p>
            <h2>Feature Requests</h2>
            <p class="project-card__description">Review suggestions, update status and reply privately.</p>
        </div>
        <div class="project-card__actions">
            <a class="btn btn-primary btn-sm" asp-action="FeatureRequests">Open</a>
        </div>
    </article>
    <article class="project-card">
        <div class="project-card__body">
            <p class="eyebrow">Story Intelligence</p>
            <h2>AI Diagnostics</h2>
            <p class="project-card__description">Check prompt loading and OpenAI configuration without making API calls.</p>
        </div>
        <div class="project-card__actions">
            <a class="btn btn-primary btn-sm" asp-action="StoryIntelligenceDiagnostics">Open</a>
            <a class="btn btn-outline-primary btn-sm" asp-action="StoryIntelligenceTest">Dry run</a>
            <a class="btn btn-outline-primary btn-sm" asp-action="ChapterStructureTest">Chapter test</a>
            <a class="btn btn-outline-primary btn-sm" asp-action="ChapterStoryIntelligenceTest">Pipeline test</a>
            <a class="btn btn-outline-primary btn-sm" asp-action="StoryIntelligenceFullChapterTest">Full chapter test</a>
            <a class="btn btn-outline-primary btn-sm" asp-action="StoryIntelligenceExistingChapter">Queue chapter</a>
            <a class="btn btn-outline-primary btn-sm" asp-action="StoryIntelligenceRuns">Saved runs</a>
        </div>
    </article>
    <article class="project-card">
        <div class="project-card__body">
            <p class="eyebrow">Placeholder</p>
            <h2>Subscriptions</h2>
            <p class="project-card__description">Subscription management tools will be added later.</p>
        </div>
    </article>
</section>
