{% extends "base.html" %}

{% block content %}
<section class="page-header">
	<div>
		<p class="eyebrow">LumiNESK</p>
		<h1>Server Control Panel</h1>
		<p class="subtitle">Simple overview of registered servers, their core, state and quick access to management actions.</p>
	</div>
</section>
<section class="summary-grid">
	<article class="summary-card">
		<span class="summary-label">Total</span>
		<strong>{{ total }}</strong>
	</article>
	<article class="summary-card">
		<span class="summary-label">Running</span>
		<strong>{{ running }}</strong>
	</article>
	<article class="summary-card">
		<span class="summary-label">Stopped</span>
		<strong>{{ stopped }}</strong>
	</article>
</section>
<section class="panel">
	<div class="panel-header">
		<h2>Servers</h2>
		<a class="secondary-link" href="/servers">Refresh</a>
	</div>
	<div class="table-wrap">
		<table>
			<thead>
				<tr>
					<th>Name</th>
					<th>Tag</th>
					<th>Core</th>
					<th>Status</th>
					<th>PID</th>
					<th>Uptime</th>
					<th>Last Start</th>
					<th>Open</th>
				</tr>
			</thead>
			<tbody>
				{% if servers %}
					{% for server in servers %}
						<tr>
							<td>
								<a class="server-link" href="/servers/{{ server.tag }}">{{ server.name }}</a>
								<div class="muted">{{ server.path_name }}</div>
							</td>
							<td><code>{{ server.tag }}</code></td>
							<td>
								<div>{{ server.core_id }}</div>
								<div class="muted">{{ server.core_version }}</div>
							</td>
							<td>
								<span class="badge {{ server.status_class }}">{{ server.status_label }}</span>
							</td>
							<td>{{ server.pid }}</td>
							<td>{{ server.uptime }}</td>
							<td>{{ server.last_started_at }}</td>
							<td><a class="table-action" href="/servers/{{ server.tag }}">Open</a></td>
						</tr>
					{% endfor %}
				{% else %}
					<tr>
						<td colspan="8" class="empty-state">No servers are registered yet.</td>
					</tr>
				{% endif %}
			</tbody>
		</table>
	</div>
</section>
{% endblock %}
