@page
@model QuantEngine.Web.Pages.Admin.Dashboard.IndexModel
@{
    ViewData["Title"] = "대시보드";
}

<!-- Page Header -->
<div class="page-header">
    <h1 class="page-title">대시보드</h1>
    <p class="page-subtitle">QuantEngine 시스템 개요 및 상태</p>
</div>

<!-- Stats Row -->
<div class="row mb-4">
    <div class="col-md-3">
        <div class="stat-card">
            <div class="stat-card-label">활성 사용자</div>
            <div class="stat-card-number">@(Model.ActiveUsersCount ?? 0)</div>
            <small class="text-muted">등록된 관리자</small>
        </div>
    </div>
    <div class="col-md-3">
        <div class="stat-card">
            <div class="stat-card-label">최근 수집</div>
            <div class="stat-card-number">@(Model.RecentRunsCount ?? 0)</div>
            <small class="text-muted">데이터 수집 실행</small>
        </div>
    </div>
    <div class="col-md-3">
        <div class="stat-card">
            <div class="stat-card-label">시스템 상태</div>
            <div class="stat-card-number">
                <span class="status-dot active"></span>정상
            </div>
            <small class="text-muted">모든 서비스 운영 중</small>
        </div>
    </div>
    <div class="col-md-3">
        <div class="stat-card">
            <div class="stat-card-label">데이터베이스</div>
            <div class="stat-card-number">
                <span class="status-dot active"></span>연결됨
            </div>
            <small class="text-muted">PostgreSQL 정상</small>
        </div>
    </div>
</div>

<!-- Main Content Row -->
<div class="row">
    <!-- System Events Card -->
    <div class="col-lg-8">
        <div class="card">
            <div class="card-header">
                <h3 class="card-title">최근 시스템 이벤트</h3>
            </div>
            <div class="table-responsive">
                <table class="table card-table table-vcenter">
                    <thead>
                        <tr>
                            <th>시간</th>
                            <th>이벤트</th>
                            <th>유형</th>
                            <th>상태</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>@DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")</td>
                            <td>시스템 초기화</td>
                            <td><span class="badge badge-info">INFO</span></td>
                            <td><span class="badge badge-success">완료</span></td>
                        </tr>
                        <tr>
                            <td>@DateTime.Now.AddHours(-1).ToString("yyyy-MM-dd HH:mm:ss")</td>
                            <td>데이터 수집 완료</td>
                            <td><span class="badge badge-info">INFO</span></td>
                            <td><span class="badge badge-success">완료</span></td>
                        </tr>
                        <tr>
                            <td>@DateTime.Now.AddHours(-2).ToString("yyyy-MM-dd HH:mm:ss")</td>
                            <td>데이터베이스 백업</td>
                            <td><span class="badge badge-secondary">SYSTEM</span></td>
                            <td><span class="badge badge-success">완료</span></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <!-- Quick Actions Card -->
    <div class="col-lg-4">
        <div class="card">
            <div class="card-header">
                <h3 class="card-title">빠른 작업</h3>
            </div>
            <div class="card-body">
                <div class="mb-3">
                    <a href="/Admin/Collection" class="btn btn-sm btn-primary w-100">
                        <i class="ti ti-database me-1"></i> 데이터 수집 시작
                    </a>
                </div>
                <div class="mb-3">
                    <a href="/Admin/Users" class="btn btn-sm btn-outline-primary w-100">
                        <i class="ti ti-users me-1"></i> 사용자 관리
                    </a>
                </div>
                <div class="mb-3">
                    <a href="/Admin/Monitoring" class="btn btn-sm btn-outline-primary w-100">
                        <i class="ti ti-eye me-1"></i> 모니터링 보기
                    </a>
                </div>
                <hr>
                <div class="text-center">
                    <small class="text-muted">마지막 갱신: @DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")</small>
                </div>
            </div>
        </div>

        <!-- System Info Card -->
        <div class="card mt-3">
            <div class="card-header">
                <h3 class="card-title">시스템 정보</h3>
            </div>
            <div class="card-body">
                <div class="mb-2">
                    <span class="text-muted">버전:</span>
                    <strong>v0.1.0</strong>
                </div>
                <div class="mb-2">
                    <span class="text-muted">환경:</span>
                    <strong>Production</strong>
                </div>
                <div>
                    <span class="text-muted">업타임:</span>
                    <strong>정상</strong>
                </div>
            </div>
        </div>
    </div>
</div>
