@extends('layouts.app')

@section('title', 'Servers — TechCorp Manager')

@section('content')
<div data-tc-api-page="servers">
    <div class="tc-page-head-row">
        <div class="tc-page-head">
            <h2>Servers</h2>
            <p>Infrastructure inventory. Managed through the JSON API.</p>
        </div>
        <button type="button" class="tc-btn-primary" id="tc-add-server">+ Add server</button>
    </div>

    <div class="tc-card">
        <div class="tc-table-wrap">
            <table class="tc-table">
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Hostname</th>
                        <th>IP</th>
                        <th>Provider</th>
                        <th>Specs</th>
                        <th>Cost/mo</th>
                        <th>Status</th>
                        <th></th>
                    </tr>
                </thead>
                <tbody>
                    @forelse ($servers as $server)
                        <tr>
                            <td><strong>{{ $server->name }}</strong></td>
                            <td>{{ $server->hostname ?? '—' }}</td>
                            <td><code>{{ $server->ip_address ?? '—' }}</code></td>
                            <td>{{ $server->provider ?? '—' }}</td>
                            <td>{{ $server->specs ?? '—' }}</td>
                            <td>${{ number_format((float) $server->cost, 2) }}</td>
                            <td><span class="tc-badge {{ $server->status }}">{{ $server->status }}</span></td>
                            <td class="tc-table-actions">
                                <button type="button" class="tc-btn-sm tc-edit-server" data-id="{{ $server->id }}">Edit</button>
                                <button type="button" class="tc-btn-sm danger tc-del-server" data-id="{{ $server->id }}">Delete</button>
                            </td>
                        </tr>
                    @empty
                        <tr><td colspan="8" class="tc-empty">No servers yet.</td></tr>
                    @endforelse
                </tbody>
            </table>
        </div>
    </div>
</div>
@endsection
