<?php
require_once __DIR__ . '/../config/config.php';

// Redirect if not doctor
if (!isDoctor()) {
    header('Location: ../login.php');
    exit;
}

$user = getCurrentUser();
?>
<!DOCTYPE html>
<html>
<head>
    <title>Doctor Dashboard</title>
    <style>
        body { font-family: Arial; background: #f0f2f5; margin: 0; padding: 20px; }
        .header { background: #2c3e50; color: white; padding: 15px; margin-bottom: 20px; border-radius: 5px; }
        .card { background: white; padding: 20px; border-radius: 5px; margin-bottom: 15px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
        .btn { display: inline-block; padding: 8px 15px; background: #2ecc71; color: white; text-decoration: none; border-radius: 4px; }
        .btn:hover { background: #27ae60; }
    </style>
</head>
<body>
    <div class="header">
        <h2>Doctor Dashboard</h2>
        <p>Welcome, Dr. <?php echo escape($user['full_name'] ?? ''); ?> | <a href="../logout.php" style="color: white;">Logout</a></p>
    </div>
    <div class="card">
        <h3>Practice Management</h3>
        <a href="cases/new.php" class="btn">New Case</a>
        <a href="cases/list.php" class="btn">My Cases</a>
        <a href="repertory/index.php" class="btn">Browse Repertory</a>
        <a href="materia-medica/index.php" class="btn">Materia Medica</a>
    </div>
    <div class="card">
        <h3>Today's Overview</h3>
        <p>System ready. Use the buttons above to manage your practice.</p>
    </div>
</body>
</html>