<?php
$title='My Intelligence Hub';
?>

<div class="container-fluid py-4">

<h2 class="mb-4">
<i class="fa-solid fa-brain"></i>
My Intelligence Hub
</h2>

<div class="row g-3 mb-4">

<div class="col-lg-4">
<div class="card shadow h-100">
<div class="card-body text-center">
<h6>Overall Intelligence Index</h6>
<h1 class="display-4"><?= htmlspecialchars((string)$overall) ?></h1>
<p class="text-muted mb-0">
Role-scoped intelligence for the active session.
</p>
</div>
</div>
</div>

<?php if(!empty($showAuthor)): ?>

<div class="col-lg-4">
<div class="card shadow h-100">
<div class="card-body text-center">
<h6>Author Portfolio</h6>
<h2><?= htmlspecialchars((string)($authorPortfolio['portfolio_score'] ?? '0')) ?></h2>
<p><?= htmlspecialchars((string)($authorPortfolio['academic_level'] ?? 'No author portfolio yet')) ?></p>
<a class="btn btn-sm btn-outline-primary" href="/easychair/author/academic-portfolio">
Open Author Portfolio
</a>
</div>
</div>
</div>

<?php endif; ?>

<?php if(!empty($showReviewer)): ?>

<div class="col-lg-4">
<div class="card shadow h-100">
<div class="card-body text-center">
<h6>Reviewer Intelligence</h6>
<h2><?= htmlspecialchars((string)$reviewerScore) ?></h2>
<p><?= htmlspecialchars((string)($reviewerTwin['future_role'] ?? $reviewerReputation['reputation_tier'] ?? 'No reviewer profile yet')) ?></p>
<a class="btn btn-sm btn-outline-primary" href="/easychair/reviewer/development-center">
Open Reviewer Center
</a>
</div>
</div>
</div>

<?php endif; ?>

</div>

<div class="row g-3">

<?php if(!empty($showAuthor)): ?>

<div class="col-lg-6">
<div class="card shadow-sm h-100">
<div class="card-header">
Author Intelligence
</div>
<div class="card-body">

<p><strong>Success Score:</strong>
<?= htmlspecialchars((string)($authorSuccess['success_score'] ?? '-')) ?>
</p>

<p><strong>Acceptance Probability:</strong>
<?= htmlspecialchars((string)($authorSuccess['acceptance_probability'] ?? '-')) ?>
</p>

<p><strong>Portfolio Rank:</strong>
<?= htmlspecialchars((string)($authorPortfolio['portfolio_rank'] ?? '-')) ?>
</p>

<p><strong>Readiness:</strong>
<?= htmlspecialchars((string)($authorPortfolio['readiness_score'] ?? '-')) ?>
</p>

<p><strong>Recommendation:</strong>
<?= htmlspecialchars((string)($authorPortfolio['recommendation_text'] ?? '-')) ?>
</p>

</div>
</div>
</div>

<?php endif; ?>

<?php if(!empty($showReviewer)): ?>

<div class="col-lg-6">
<div class="card shadow-sm h-100">
<div class="card-header">
Reviewer Intelligence
</div>
<div class="card-body">

<p><strong>Digital Twin Score:</strong>
<?= htmlspecialchars((string)($reviewerTwin['digital_twin_score'] ?? '-')) ?>
</p>

<p><strong>Reputation Tier:</strong>
<?= htmlspecialchars((string)($reviewerReputation['reputation_tier'] ?? '-')) ?>
</p>

<p><strong>Leadership Role:</strong>
<?= htmlspecialchars((string)($reviewerLeadership['succession_role'] ?? '-')) ?>
</p>

<p><strong>Leadership Readiness:</strong>
<?= htmlspecialchars((string)($reviewerLeadership['readiness_score'] ?? '-')) ?>
</p>

<p><strong>Achievement:</strong>
<?= htmlspecialchars((string)($reviewerAchievement['achievement_level'] ?? '-')) ?>
</p>

</div>
</div>
</div>

<?php endif; ?>

<?php if(empty($showAuthor) && empty($showReviewer)): ?>

<div class="col-12">
<div class="alert alert-info">
No intelligence profile is available for your active role yet.
</div>
</div>

<?php endif; ?>

</div>

</div>
