<!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 — Operators | 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=8">
    <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 flex items-center px-4 py-3 text-sm font-medium rounded-lg text-gray-400">
                    <i class="ph ph-crosshair text-xl mr-3"></i> Bezoekers
                </a>
                <a href="{{ url_for('admin_panel.serve_users_page') }}" class="nav-item active flex items-center px-4 py-3 text-sm font-medium rounded-lg">
                    <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">
                    <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">
            <div class="flex items-center flex-wrap justify-end gap-2 shrink-0 w-full sm:w-auto">
                <span class="font-mono text-xs glow-text-green mr-auto sm:mr-4">OPERATORS</span>
                <button type="button" onclick="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 sm:flex-row sm:items-end justify-between gap-3 sm:gap-4 mb-4 sm:mb-8">
                    <div>
                        <h1 class="panel-page-title font-bold text-white tracking-wider brand panel-main-title glow-cyan uppercase">Operators</h1>
                        <p class="text-sm text-gray-400 mt-2 font-mono panel-main-subtitle">Beheer admin-accounts.</p>
                    </div>
                </div>

                <div class="grid grid-cols-1 lg:grid-cols-3 gap-4 sm:gap-6">
                    <div class="glass-card p-4 sm:p-6">
                        <h2 class="text-sm font-mono text-cyan-400 uppercase tracking-widest mb-4 sm:mb-6">Nieuwe operator</h2>
                        <form id="add-user-form" class="space-y-4">
                            <div>
                                <label class="block text-xs font-mono text-gray-500 mb-2 uppercase tracking-widest">Username</label>
                                <input type="text" id="new-username" class="w-full bg-white/5 border border-white/10 rounded px-3 py-2 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">Password</label>
                                <input type="password" id="new-password" class="w-full bg-white/5 border border-white/10 rounded px-3 py-2 text-cyan-400 font-mono focus:outline-none focus:border-cyan-500" required>
                            </div>
                            <button type="submit" class="w-full bg-cyan-500/10 border border-cyan-500/50 hover:bg-cyan-500/20 text-cyan-400 font-mono uppercase text-xs tracking-widest py-2 rounded transition-all mt-4">Aanmaken</button>
                        </form>
                    </div>
                    <div class="glass-card p-4 sm:p-6 lg:col-span-2 min-w-0">
                        <h2 class="text-sm font-mono text-cyan-400 uppercase tracking-widest mb-4 sm:mb-6">Actieve operators</h2>
                        <div class="overflow-x-auto -mx-1 px-1">
                            <table class="w-full min-w-[28rem] text-left font-mono text-sm">
                                <thead>
                                    <tr class="text-gray-500 border-b border-white/10">
                                        <th class="pb-3 font-normal uppercase tracking-wider">ID</th>
                                        <th class="pb-3 font-normal uppercase tracking-wider">Operator</th>
                                        <th class="pb-3 font-normal uppercase tracking-wider hidden sm:table-cell">Created</th>
                                        <th class="pb-3 font-normal uppercase tracking-wider text-right">Action</th>
                                    </tr>
                                </thead>
                                <tbody id="users-table-body" class="text-gray-300 divide-y divide-white/5"></tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>

    {% with active='users' %}
    {% 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/admin-core.js?v=5"></script>
    <script src="js/users.js?v=4"></script>
    <script>
        AdminCore.init({
            onAuthed: function (data) { UsersPage.onAuthed(data); }
        });
    </script>
</body>
</html>
