<?php
/**
 * ULTRA MINIMAL DASHBOARD - Guaranteed to display
 */

error_reporting(E_ALL);
ini_set('display_errors', 1);

define('BASE_PATH', dirname(__DIR__));
require_once BASE_PATH . '/config/config.php';
require_once BASE_PATH . '/config/database.php';
require_once BASE_PATH . '/config/auth.php';

require_auth();
$current_user = current_user();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dashboard</title>
    <!-- Bootstrap CSS - using exact same as test page -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Simple inline styles -->
    <style>
        body { 
            font-family: Arial, sans-serif; 
            margin: 20px; 
            background: #f0f0f0;
        }
        .container { max-width: 1200px; margin: 0 auto; }
        .header { 
            background: #007bff; 
            color: white; 
            padding: 15px; 
            border-radius: 5px;
            margin-bottom: 20px;
        }
        .card { 
            background: white; 
            border: 1px solid #ddd; 
            border-radius: 5px; 
            padding: 20px; 
            margin-bottom: 20px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .stat-box { 
            background: #007bff; 
            color: white; 
            padding: 20px; 
            border-radius: 5px; 
            text-align: center;
        }
        .stat-box h2 { margin: 0; font-size: 2em; }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1><?php echo defined('APP_NAME') ? APP_NAME : 'Ruhondo Resort'; ?> - Dashboard</h1>
            <p>Welcome, <?php echo htmlspecialchars($current_user['username'] ?? 'User'); ?>!</p>
        </div>

        <div class="row">
            <div class="col-md-3">
                <div class="stat-box">
                    <h2>✓</h2>
                    <p>System Working</p>
                </div>
            </div>
            <div class="col-md-3">
                <div class="stat-box" style="background: #28a745;">
                    <h2><?php echo date('H:i'); ?></h2>
                    <p>Current Time</p>
                </div>
            </div>
            <div class="col-md-3">
                <div class="stat-box" style="background: #ffc107; color: #000;">
                    <h2><?php echo date('Y-m-d'); ?></h2>
                    <p>Today's Date</p>
                </div>
            </div>
            <div class="col-md-3">
                <div class="stat-box" style="background: #dc3545;">
                    <h2>✓</h2>
                    <p>Logged In</p>
                </div>
            </div>
        </div>

        <div class="card">
            <h3>Debug Information</h3>
            <table class="table table-bordered">
                <tr><th>User ID:</th><td><?php echo $current_user['user_id'] ?? 'N/A'; ?></td></tr>
                <tr><th>Username:</th><td><?php echo htmlspecialchars($current_user['username'] ?? 'N/A'); ?></td></tr>
                <tr><th>Session ID:</th><td><?php echo session_id(); ?></td></tr>
                <tr><th>Base Path:</th><td><?php echo BASE_PATH; ?></td></tr>
                <tr><th>Script:</th><td><?php echo $_SERVER['SCRIPT_NAME']; ?></td></tr>
                <tr><th>Request URI:</th><td><?php echo $_SERVER['REQUEST_URI']; ?></td></tr>
                <tr><th>PHP Version:</th><td><?php echo phpversion(); ?></td></tr>
            </table>
        </div>

        <div class="card">
            <h3>Session Data</h3>
            <pre><?php print_r($_SESSION); ?></pre>
        </div>

        <div class="card">
            <h3>Navigation</h3>
            <p>
                <a href="dashboard.php" class="btn btn-primary">Original Dashboard</a>
                <a href="dashboard_debug.php" class="btn btn-info">Debug Dashboard</a>
                <a href="logout.php" class="btn btn-danger">Logout</a>
            </p>
        </div>
    </div>
</body>
</html>