<div class="container py-4">
    <!-- Welcome Header -->
    <div class="row align-items-center mb-4">
        <div class="col-md-8">
            <h2 class="fw-bold font-outfit text-dark m-0">Welcome, <?= htmlspecialchars(Auth::user()['name']) ?>!</h2>
            <p class="text-muted mb-0">Academic Prep Tutoring dashboard.</p>
        </div>
        <div class="col-md-4 text-md-end mt-3 mt-md-0">
            <span class="badge rounded-pill px-3 py-2 text-uppercase"
                  style="background:var(--gradient-accent);color:var(--dark);font-family:var(--font-heading);">
                <i class="fa-solid fa-chalkboard-user me-1"></i> Academic Tutor
            </span>
        </div>
    </div>

    <!-- Tutor Statistics Cards Row -->
    <div class="row g-4 mb-4">
        <div class="col-md-6">
            <div class="boafo-card p-4">
                <div class="d-flex align-items-center">
                    <div class="d-flex align-items-center justify-content-center rounded-3 me-3"
                         style="width:48px;height:48px;background:rgba(244,161,29,0.15);">
                        <i class="fa-solid fa-book-open-reader" style="color:var(--accent-dark);font-size:1.2rem;"></i>
                    </div>
                    <div>
                        <h5 class="fw-bold font-outfit mb-1" style="color:var(--dark);"><?= htmlspecialchars($profile['specialization'] ?? 'General') ?></h5>
                        <small style="color:var(--muted);">Specialization Field</small>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="card border-0 shadow-sm p-4 card-hover-effect">
                <div class="d-flex align-items-center">
                    <div class="badge-icon-box bg-primary-subtle text-primary rounded-circle me-3"><i class="fa-solid fa-calendar-check fs-4"></i></div>
                    <div>
                        <h5 class="fw-bold font-outfit text-dark mb-1">Academic Sessions</h5>
                        <a href="<?= APP_URL ?>/sessions" class="text-xs text-primary text-decoration-none">Manage Scheduled Classes <i class="fa-solid fa-arrow-right ms-1"></i></a>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="row g-4">
        <!-- Tutor Schedule -->
        <div class="col-lg-7">
            <div class="card border-0 shadow-sm mb-4 h-100">
                <div class="card-header bg-white border-0 py-3 d-flex justify-content-between align-items-center">
                    <h5 class="fw-bold font-outfit text-dark m-0">Your Tutoring Classes</h5>
                    <a href="<?= APP_URL ?>/sessions" class="btn btn-xs btn-outline-primary rounded-pill px-3">View All</a>
                </div>
                <div class="card-body p-4">
                    <div class="text-center py-5">
                        <i class="fa-solid fa-chalkboard display-4 text-muted mb-3"></i>
                        <h6 class="fw-bold text-muted">No Classes Scheduled</h6>
                        <p class="text-muted text-xs mx-auto" style="max-width: 320px;">Your booked virtual tutoring classes will appear here once requested by students.</p>
                    </div>
                </div>
            </div>
        </div>

        <!-- Recent Activities -->
        <div class="col-lg-5">
            <div class="card border-0 shadow-sm mb-4 h-100">
                <div class="card-header bg-white border-0 py-3">
                    <h5 class="fw-bold font-outfit text-dark m-0">Recent Activity</h5>
                </div>
                <div class="card-body p-4">
                    <?php if (!empty($notifications)): ?>
                        <div class="timeline-activity">
                            <?php foreach ($notifications as $notif): ?>
                                <div class="timeline-item d-flex pb-3 position-relative">
                                    <div class="timeline-marker bg-primary rounded-circle me-3" style="width: 10px; height: 10px; margin-top: 6px; flex-shrink:0;"></div>
                                    <div>
                                        <p class="text-sm text-dark mb-1">
                                            <strong><?= htmlspecialchars($notif['title']) ?></strong>: <?= htmlspecialchars($notif['body']) ?>
                                        </p>
                                        <small class="text-muted text-xs"><?= timeAgo($notif['created_at']) ?></small>
                                    </div>
                                </div>
                            <?php endforeach; ?>
                        </div>
                    <?php else: ?>
                        <div class="text-center py-5">
                            <i class="fa-regular fa-bell-slash text-muted display-6 mb-3"></i>
                            <p class="text-muted text-xs">No recent notifications.</p>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
</div>
