<!DOCTYPE html>
<html lang="en" data-theme="<?= e(get_theme_slug_for_scope('student')) ?>">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Student Portal - <?= get_setting('academy_name', 'CIX Orbit Academy') ?></title>
    <link rel="manifest" href="/public/assets/manifest.json">
    <meta name="theme-color" content="#000000">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="<?= asset_url('css/style.css') ?>" rel="stylesheet">
    <?= render_theme_css('student') ?>
</head>
<body>
<aside class="sidebar-cix" id="sidebar">
    <div class="sidebar-brand">
        <i class="fas fa-orbit" style="color:var(--secondary);font-size:1.3rem"></i>
        <div>
            <h5>CIX <span style="color:var(--secondary)">Orbit</span></h5>
            <small>Student Portal</small>
        </div>
    </div>
    <?php $uri = $_SERVER['REQUEST_URI'] ?? ''; ?>
    <ul class="sidebar-nav">
        <li><a href="<?= base_url('student/dashboard') ?>" class="<?= str_contains($uri, '/student/dashboard') ? 'active' : '' ?>"><i class="fas fa-th-large"></i> Dashboard</a></li>
        <li><a href="<?= base_url('student/profile') ?>" class="<?= str_contains($uri, '/student/profile') ? 'active' : '' ?>"><i class="fas fa-user"></i> My Profile</a></li>
        <li><a href="<?= base_url('student/courses') ?>" class="<?= str_contains($uri, '/student/course') ? 'active' : '' ?>"><i class="fas fa-book"></i> My Courses</a></li>
        <li><a href="<?= base_url('student/tests') ?>" class="<?= str_contains($uri, '/student/test') ? 'active' : '' ?>"><i class="fas fa-laptop-code"></i> Tests</a></li>
        <li><a href="<?= base_url('student/results') ?>" class="<?= str_contains($uri, '/student/result') ? 'active' : '' ?>"><i class="fas fa-chart-line"></i> My Results</a></li>
        <li><a href="<?= base_url('student/certificates') ?>" class="<?= str_contains($uri, '/student/certificate') ? 'active' : '' ?>"><i class="fas fa-award"></i> Certificates</a></li>
        <li><a href="<?= base_url('student/payments') ?>" class="<?= str_contains($uri, '/student/payment') ? 'active' : '' ?>"><i class="fas fa-credit-card"></i> Payments</a></li>
        <li><a href="<?= base_url('student/announcements') ?>" class="<?= str_contains($uri, '/student/announcement') ? 'active' : '' ?>"><i class="fas fa-bullhorn"></i> Announcements</a></li>
        <li><a href="<?= base_url('student/support') ?>" class="<?= str_contains($uri, '/student/support') ? 'active' : '' ?>"><i class="fas fa-headset"></i> Support</a></li>
        <li><a href="<?= base_url('/') ?>"><i class="fas fa-home"></i> Back to Site</a></li>
    </ul>
</aside>
<div class="main-content">
    <div class="top-bar">
        <div class="d-flex align-center gap-2">
            <button id="sidebarToggle" class="btn btn-outline-light d-lg-none"><i class="fas fa-bars"></i></button>
            <h4><?= $pageTitle ?? 'Dashboard' ?></h4>
        </div>
        <div class="d-flex align-center gap-2">
            <button id="pwaInstallBtn" class="btn-cix btn-cix-sm btn-cix-accent" style="display:none"><i class="fas fa-download"></i> Install App</button>
            <span class="text-secondary"><i class="fas fa-user-graduate me-1"></i> <?= e(current_user()['first_name'] ?? 'Student') ?></span>
            <a href="<?= base_url('logout') ?>" class="btn-cix btn-cix-sm btn-cix-danger"><i class="fas fa-sign-out-alt"></i></a>
        </div>
    </div>
    <?php if ($flash = flash('success')): ?><div class="alert-cix alert-cix-success"><i class="fas fa-check-circle"></i> <?= $flash ?></div><?php endif; ?>
    <?php if ($flash = flash('error')): ?><div class="alert-cix alert-cix-error"><i class="fas fa-exclamation-circle"></i> <?= $flash ?></div><?php endif; ?>
