@{
    Layout = null;
}

<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - QuantEngine</title>

    <!-- Tabler CSS -->
    <link href="https://cdn.jsdelivr.net/npm/@@tabler/core@1.0.0/dist/css/tabler.min.css" rel="stylesheet" />
    <link href="https://cdn.jsdelivr.net/npm/@@tabler/core@1.0.0/dist/css/tabler-vendors.min.css" rel="stylesheet" />
    <link href="https://cdn.jsdelivr.net/npm/@@tabler/icons@latest/tabler-icons.css" rel="stylesheet" />

    <!-- Custom Admin CSS -->
    <link rel="stylesheet" href="~/css/admin.css" asp-append-version="true" />

    <style>
        html, body {
            height: 100%;
            margin: 0;
            padding: 0;
        }

        .wrapper {
            display: flex;
            flex-direction: column;
            height: 100vh;
        }

        .page {
            display: flex;
            flex: 1;
            overflow: hidden;
        }

        .sidebar {
            width: 260px;
            background-color: #2c3e50;
            color: white;
            overflow-y: auto;
            flex-shrink: 0;
        }

        .sidebar-brand {
            padding: 1.5rem;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        }

        .sidebar-brand a {
            color: white;
            text-decoration: none;
            font-weight: 600;
            font-size: 1.25rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .sidebar-nav {
            padding: 1rem 0;
        }

        .sidebar-nav .nav-link {
            padding: 0.75rem 1.5rem;
            color: rgba(255, 255, 255, 0.8);
            text-decoration: none;
            display: flex;
            align-items: center;
            gap: 0.75rem;
            transition: all 0.2s;
        }

        .sidebar-nav .nav-link:hover,
        .sidebar-nav .nav-link.active {
            color: white;
            background-color: rgba(255, 255, 255, 0.1);
        }

        .sidebar-nav .nav-link i {
            width: 1.25rem;
            text-align: center;
        }

        .main-content {
            display: flex;
            flex-direction: column;
            flex: 1;
            overflow: hidden;
        }

        .topbar {
            background-color: white;
            border-bottom: 1px solid #e0e0e0;
            padding: 1rem 1.5rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-shrink: 0;
            height: 64px;
        }

        .topbar-left {
            font-weight: 600;
            color: #2c3e50;
        }

        .topbar-right {
            display: flex;
            gap: 1rem;
            align-items: center;
        }

        .topbar-right .btn {
            padding: 0.375rem 0.75rem;
            font-size: 0.875rem;
        }

        .page-content {
            flex: 1;
            overflow-y: auto;
            padding: 2rem;
            background-color: #f5f7fa;
        }

        .container-xl {
            max-width: 1400px;
            margin: 0 auto;
            width: 100%;
        }

        .page-header {
            margin-bottom: 2rem;
        }

        .page-header .page-title {
            font-size: 1.75rem;
            font-weight: 600;
            color: #2c3e50;
            margin: 0;
        }

        .page-header .page-subtitle {
            color: #7a8a99;
            font-size: 0.875rem;
        }

        @@media (max-width: 768px) {
            .sidebar {
                position: fixed;
                left: -260px;
                height: 100vh;
                z-index: 999;
                transition: left 0.3s;
            }

            .sidebar.show {
                left: 0;
            }

            .main-content {
                width: 100%;
            }
        }
    </style>
</head>
<body>
    <div class="wrapper">
        <!-- Topbar -->
        <div class="topbar">
            <div class="topbar-left">
                <span id="page-title">QuantEngine Admin</span>
            </div>
            <div class="topbar-right">
                <a href="/Account/Logout" class="btn btn-sm btn-outline-danger">
                    <i class="ti ti-logout me-1"></i> 로그아웃
                </a>
            </div>
        </div>

        <!-- Main -->
        <div class="page">
            <!-- Sidebar -->
            <nav class="sidebar">
                <div class="sidebar-brand">
                    <a href="/Admin/Dashboard">
                        <i class="ti ti-chart-line" style="font-size: 1.5rem;"></i>
                        <span>QuantEngine</span>
                    </a>
                </div>

                <div class="sidebar-nav">
                    <a href="/Admin/Dashboard" class="nav-link">
                        <i class="ti ti-dashboard"></i>
                        <span>대시보드</span>
                    </a>
                    <a href="/Admin/Collection" class="nav-link">
                        <i class="ti ti-database"></i>
                        <span>데이터 수집</span>
                    </a>
                    <a href="/Admin/Monitoring" class="nav-link">
                        <i class="ti ti-eye"></i>
                        <span>모니터링</span>
                    </a>
                    <a href="/Admin/Users" class="nav-link">
                        <i class="ti ti-users"></i>
                        <span>사용자 관리</span>
                    </a>
                    <a href="/Admin/Operations" class="nav-link">
                        <i class="ti ti-settings"></i>
                        <span>운영 관리</span>
                    </a>
                </div>
            </nav>

            <!-- Page Content -->
            <div class="main-content">
                <div class="page-content">
                    <div class="container-xl">
                        @RenderBody()
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Tabler JS -->
    <script src="https://cdn.jsdelivr.net/npm/@@tabler/core@1.0.0/dist/js/tabler.min.js"></script>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const links = document.querySelectorAll('.sidebar-nav .nav-link');
            const currentPath = window.location.pathname.toLowerCase();

            links.forEach(link => {
                const href = link.getAttribute('href').toLowerCase();
                if (currentPath.startsWith(href)) {
                    link.classList.add('active');
                } else {
                    link.classList.remove('active');
                }
            });
        });
    </script>
</body>
</html>
