<?php
require_once dirname(__DIR__) . '/core/bootstrap.php';

try {
    $db    = \Core\Database::getInstance();
    $roles = $db->fetchAll("SELECT id, name, label FROM roles");
    echo "<h3 style='font-family:sans-serif;color:green'>✅ Database connected successfully!</h3>";
    echo "<pre>" . print_r($roles, true) . "</pre>";

    $userCount = $db->fetchValue("SELECT COUNT(*) FROM users");
    echo "<p style='font-family:sans-serif'>Users in DB: <strong>{$userCount}</strong></p>";
} catch (Exception $e) {
    echo "<h3 style='font-family:sans-serif;color:red'>❌ Connection failed: " . htmlspecialchars($e->getMessage()) . "</h3>";
}
