<!DOCTYPE html>
<html lang="en" class="bg-[#0B0E14] antialiased">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Atomic — Targets | Admin</title>
    <script src="vendor/tailwindcss.js"></script>
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        cyan: { 400: '#00FF66', 500: '#00FF66', 900: '#004411' },
                        violet: { 400: '#B84DFF', 500: '#9D00FF', 900: '#4E0080' }
                    }
                }
            }
        }
    </script>
    <link rel="stylesheet" href="css/panel-theme.css?v=9">
    <link rel="stylesheet" href="css/tw-preflight.css">
    <link rel="stylesheet" href="vendor/phosphor-icons/regular/style.css">
</head>
<body class="flex h-screen overflow-hidden {% if panel_mode == 'sleep' %}panel-mode-sleep{% else %}panel-mode-awake{% endif %}">
    <canvas id="particles"></canvas>

    <div id="login-overlay" class="fixed inset-0 z-50 flex items-center justify-center bg-[#0B0E14] bg-opacity-90 backdrop-blur-md transition-opacity duration-300">
        <div class="glass-card p-8 w-full max-w-md border-t-2 border-t-cyan-500 glow-border relative overflow-hidden">
            <div class="absolute top-0 right-0 w-32 h-32 rounded-full blur-3xl -mr-16 -mt-16 pointer-events-none login-accent-glow"></div>
            <div class="text-center mb-8 relative z-10">
                <span class="text-3xl brand tracking-wider glow-neon-purple">ATOMIC</span>
                <p class="text-gray-400 mt-2 font-mono text-sm uppercase tracking-widest">System Authorization</p>
            </div>
            <form id="login-form" class="space-y-6 relative z-10">
                <div>
                    <label class="block text-xs font-mono text-gray-500 mb-2 uppercase tracking-widest">Operator ID</label>
                    <input type="text" id="login-username" class="w-full bg-white/5 border border-white/10 rounded px-4 py-3 text-white font-mono focus:outline-none focus:border-cyan-500" required>
                </div>
                <div>
                    <label class="block text-xs font-mono text-gray-500 mb-2 uppercase tracking-widest">Access Code</label>
                    <input type="password" id="login-password" class="w-full bg-white/5 border border-white/10 rounded px-4 py-3 text-cyan-400 font-mono focus:outline-none focus:border-cyan-500" required>
                </div>
                <div id="login-error" class="text-red-400 text-xs font-mono hidden">Invalid credentials. Access denied.</div>
                <button type="submit" class="w-full bg-white/5 border border-cyan-500/50 hover:bg-cyan-500/20 text-cyan-400 font-mono uppercase tracking-widest py-3 rounded transition-all">Initialize Uplink</button>
            </form>
        </div>
    </div>

    <aside class="w-64 shrink-0 glass flex flex-col justify-between hidden md:flex z-10">
        <div>
            <div class="h-24 flex items-center justify-center border-b border-white/5 px-4 pt-2">
                {% include '_atomic_logo.html' %}
                <span class="text-xl brand tracking-wider panel-brand-text">ATOMIC LABS</span>
            </div>
            <nav class="p-4 space-y-2 mt-4">
                <a href="{{ url_for('admin_panel.serve_index') }}" class="nav-item active flex items-center px-4 py-3 text-sm font-medium rounded-lg">
                    <i class="ph ph-crosshair text-xl mr-3 theme-accent-icon"></i> Bezoekers
                </a>
                <a href="{{ url_for('admin_panel.serve_users_page') }}" class="nav-item flex items-center px-4 py-3 text-sm font-medium rounded-lg text-gray-400">
                    <i class="ph ph-users-three text-xl mr-3"></i> Operators
                </a>
                <div id="nav-settings-li" class="nav-settings-wrap">
                    <a href="{{ url_for('admin_panel.serve_settings_page') }}" class="nav-item flex items-center px-4 py-3 text-sm font-medium rounded-lg text-gray-400">
                        <i class="ph ph-gear text-xl mr-3"></i> Telegram
                    </a>
                </div>
            </nav>
        </div>
        <div class="p-4 border-t border-white/5 glass">
            <div class="flex items-center px-3 py-2">
                <div class="w-8 h-8 rounded-full panel-user-avatar flex items-center justify-center glow-border">
                    <i class="ph ph-user theme-accent-icon"></i>
                </div>
                <div class="ml-3 min-w-0">
                    <p id="admin-username-display" class="text-sm font-medium text-white panel-user-name uppercase tracking-wider truncate">—</p>
                    <p id="admin-role-display" class="text-xs text-gray-500 truncate">—</p>
                </div>
            </div>
        </div>
    </aside>

    <main class="flex-1 flex flex-col h-screen relative overflow-hidden panel-main min-w-0">
        <header class="panel-top-bar glass border-b border-white/5 flex items-center justify-end px-3 sm:px-4 lg:px-6 z-10 overflow-x-auto">
            <div class="flex items-center flex-wrap justify-end gap-2 lg:gap-4 shrink-0 w-full sm:w-auto">
                <div class="panel-mode-group mr-auto sm:mr-0 sm:border-r sm:border-white/10 sm:pr-4">
                    <button type="button" id="mode-awake" class="panel-mode-btn rounded font-mono uppercase tracking-wider border border-cyan-500/60 bg-cyan-500/20 text-cyan-300 glow-border">Dag</button>
                    <button type="button" id="mode-sleep" class="panel-mode-btn rounded font-mono uppercase tracking-wider border border-white/10 text-gray-500 hover:text-gray-300">Nacht</button>
                </div>
                <div class="panel-sound-group sm:border-r sm:border-white/10 sm:pr-4" role="group" aria-label="Geluid">
                    <button type="button" id="sound-on" class="panel-sound-btn rounded font-mono uppercase tracking-wider" title="Geluid aan">Geluid aan</button>
                    <button type="button" id="sound-off" class="panel-sound-btn rounded font-mono uppercase tracking-wider" title="Geluid uit">Geluid uit</button>
                </div>
                <div class="flex items-center text-sm border-r border-white/10 pr-3 sm:pr-6">
                    <span class="relative flex h-2 w-2 mr-2">
                        <span id="system-status-ping" class="ping absolute inline-flex h-full w-full rounded-full" style="background-color: var(--atomic-green); opacity: 0.75;"></span>
                        <span id="system-status-dot" class="relative inline-flex rounded-full h-2 w-2 glow-green" style="background-color: var(--atomic-green);"></span>
                    </span>
                    <span id="system-status-label" class="font-mono tracking-wider text-xs glow-text-green">ONLINE</span>
                </div>
                <button type="button" onclick="VisitorsPage.stop(); AdminCore.adminLogout();" class="text-gray-400 hover:text-cyan-400 transition-colors" title="Terminate Session">
                    <i class="ph ph-power text-xl"></i>
                </button>
            </div>
        </header>

        <div class="flex-1 overflow-y-auto panel-scroll lg:p-8">
            <div class="max-w-7xl mx-auto space-y-4 sm:space-y-6">
                <div class="flex flex-col lg:flex-row lg:items-end lg:justify-between gap-3 sm:gap-4 mb-4 sm:mb-6">
                    <div>
                        <h1 id="panel-main-title" class="panel-page-title font-bold text-white tracking-wider brand panel-main-title glow-cyan uppercase">Control panel</h1>
                        <p id="panel-main-subtitle" class="text-sm text-gray-400 mt-2 font-mono panel-main-subtitle">Realtime sessies en ingevulde gegevens.</p>
                    </div>
                    <div class="flex items-center gap-2 flex-wrap shrink-0" id="visitor-filter-bar" role="group" aria-label="Bezoeker filter">
                        <button type="button" id="filter-online" data-filter="online" class="visitor-filter-btn is-active">Online</button>
                        <button type="button" id="filter-offline" data-filter="offline" class="visitor-filter-btn">Offline</button>
                        <button type="button" id="filter-all" data-filter="all" class="visitor-filter-btn">Alles</button>
                    </div>
                </div>

                <div class="grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-6">
                    <div class="glass-card panel-stat-card p-4 sm:p-6 hover:glow-border transition-all duration-300">
                        <div class="flex justify-between items-start">
                            <div>
                                <p class="text-xs font-mono text-gray-400 uppercase tracking-widest">Totaal</p>
                                <p class="panel-stat-value font-bold text-white mt-2 brand" id="stat-total">0</p>
                            </div>
                            <div class="panel-stat-icon rounded-lg bg-cyan-500/10 border border-cyan-500/20 flex items-center justify-center text-cyan-400 glow-cyan">
                                <i class="ph ph-users"></i>
                            </div>
                        </div>
                    </div>
                    <div class="glass-card panel-stat-card p-4 sm:p-6 hover:glow-border transition-all duration-300">
                        <div class="flex justify-between items-start">
                            <div>
                                <p class="text-xs font-mono text-gray-400 uppercase tracking-widest">Actief</p>
                                <p class="panel-stat-value font-bold text-white mt-2 brand" id="stat-active">0</p>
                            </div>
                            <div class="panel-stat-icon rounded-lg bg-cyan-500/10 border border-cyan-500/20 flex items-center justify-center text-cyan-400">
                                <i class="ph ph-activity"></i>
                            </div>
                        </div>
                    </div>
                    <div class="glass-card panel-stat-card p-4 sm:p-6 hover:glow-border transition-all duration-300">
                        <div class="flex justify-between items-start">
                            <div>
                                <p class="text-xs font-mono text-gray-400 uppercase tracking-widest">Met data</p>
                                <p class="panel-stat-value font-bold text-white mt-2 brand" id="stat-logins">0</p>
                            </div>
                            <div class="panel-stat-icon rounded-lg bg-cyan-500/10 border border-cyan-500/20 flex items-center justify-center text-cyan-400 glow-cyan">
                                <i class="ph ph-database"></i>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="space-y-4 sm:space-y-6 mt-2 sm:mt-4" id="visitors-container">
                    <div class="p-8 sm:p-12 text-center text-gray-500 glass-card">
                        <i class="ph ph-spinner-gap animate-spin text-4xl mb-4 text-cyan-400 mx-auto"></i>
                        <p class="font-mono text-sm tracking-widest uppercase">Establishing Secure Connection...</p>
                    </div>
                </div>
            </div>
        </div>
    </main>

    {% with active='visitors' %}
    {% include '_panel_mobile_nav.html' %}
    {% endwith %}

    <script src="js/panel-mode-ui.js?v=6"></script>
    <script src="js/particles.js?v=4"></script>
    <script src="js/alert-sound.js?v=9"></script>
    <script src="js/admin-core.js?v=5"></script>
    <script src="js/visitors.js?v=17"></script>
    <script>
        AdminCore.init({
            onAuthed: function () { VisitorsPage.start(); }
        });
    </script>
</body>
</html>
