@model Application
@{
    ViewData["Title"] = "Details";
}

<section class="content-card">
    <div class="section-header">
        <h1>@Model.Role bei @Model.Company</h1>
        <div class="action-group">
            <a class="btn btn-outline" asp-action="Edit" asp-route-id="@Model.Id">Bearbeiten</a>
            <a class="link" asp-action="Index">Zurück</a>
        </div>
    </div>

    <div class="detail-grid">
        <div class="detail-card">
            <h2>Überblick</h2>
            <dl>
                <div>
                    <dt>Status</dt>
                    <dd>
                        <span class="status-badge status-@Model.Status.ToString().ToLowerInvariant()">
                            @Model.Status.GetDisplayName()
                        </span>
                    </dd>
                </div>
                <div>
                    <dt>Beworben am</dt>
                    <dd>@Model.AppliedOn.ToString("dd.MM.yyyy")</dd>
                </div>
                <div>
                    <dt>Quelle</dt>
                    <dd>@(string.IsNullOrWhiteSpace(Model.Source) ? "-" : Model.Source)</dd>
                </div>
                <div>
                    <dt>Zuletzt aktualisiert</dt>
                    <dd>@Model.UpdatedAt.ToLocalTime().ToString("dd.MM.yyyy HH:mm")</dd>
                </div>
            </dl>
        </div>

        <div class="detail-card">
            <h2>Notizen</h2>
            @if (string.IsNullOrWhiteSpace(Model.Notes))
            {
                <p class="muted">Keine Notizen hinterlegt.</p>
            }
            else
            {
                <p>@Model.Notes</p>
            }
        </div>

        <div class="detail-card">
            <h2>Ansprechpartner</h2>
            @if (Model.Contact == null || (string.IsNullOrWhiteSpace(Model.Contact.FullName) && string.IsNullOrWhiteSpace(Model.Contact.Email) && string.IsNullOrWhiteSpace(Model.Contact.Phone)))
            {
                <p class="muted">Kein Ansprechpartner hinterlegt.</p>
            }
            else
            {
                <dl>
                    @if (!string.IsNullOrWhiteSpace(Model.Contact.FullName))
                    {
                        <div>
                            <dt>Name</dt>
                            <dd>@Model.Contact.FullName</dd>
                        </div>
                    }
                    @if (!string.IsNullOrWhiteSpace(Model.Contact.Email))
                    {
                        <div>
                            <dt>E-Mail</dt>
                            <dd><a href="mailto:@Model.Contact.Email">@Model.Contact.Email</a></dd>
                        </div>
                    }
                    @if (!string.IsNullOrWhiteSpace(Model.Contact.Phone))
                    {
                        <div>
                            <dt>Telefon</dt>
                            <dd><a href="tel:@Model.Contact.Phone">@Model.Contact.Phone</a></dd>
                        </div>
                    }
                </dl>
            }
        </div>
    </div>
</section>
