@model IEnumerable<Watcher.Models.Server>

<div class="container py-4">
    <div class="row g-4">
        @foreach (var s in Model)
        {
            <div class="col-12">
                <div class="card h-100 border-secondary shadow-sm">
                    <div class="card-body d-flex flex-column gap-3">
                        <div class="d-flex justify-content-between align-items-center mb-3">
                            <h5 class="card-title text-text mb-0">
                                <i class="bi bi-pc-display me-2 text-text"></i>(#@s.Id) @s.Name
                            </h5>

                            <div class="col-md-4 text-text small">
                                <div><i class="bi bi-globe me-1"></i><strong>IP:</strong> @s.IPAddress</div>
                                <div><i class="bi bi-pc-display me-1"></i><strong>Typ:</strong> @s.Type</div>
                            </div>

                            <span class="badge @(s.IsOnline ? "bg-success text-light" : "bg-danger text-light")">
                                <i class="bi @(s.IsOnline ? "bi-check-circle" : "bi-x-circle") me-1"></i>
                                @(s.IsOnline ? "Online" : "Offline")
                            </span>
                            <div class="d-flex flex-wrap gap-4">

                                <a asp-action="EditServer" asp-route-id="@s.Id" class="btn btn-outline-primary">
                                    <i class="bi bi-pencil-square me-1"></i> Bearbeiten
                                </a>

                                <a asp-asp-controller="Server" asp-action="Details" asp-route-id="@s.Id"
                                    class="btn btn-outline-primary">
                                    <i class="bi bi-bar-chart-fill me-1"></i> Metrics
                                </a>

                                <form asp-action="Delete" asp-controller="Server" asp-route-id="@s.Id" method="post"
                                    onsubmit="return confirm('Diesen Server wirklich löschen?');" class="m-0">
                                    <button type="submit" class="btn btn-outline-danger">
                                        <i class="bi bi-trash me-1"></i> Löschen
                                    </button>
                                </form>

                            </div>
                        </div>


                    </div>
                </div>
            </div>
        }
    </div>
</div>