<!DOCTYPE html>
<html>
<head>
    <title>Report Materia</title>
    <link rel="stylesheet" href="<?= base_url('assets/css/bootstrap.min.css'); ?>">
    <style>
        body { font-size: 12px; font-family: sans-serif; }
        .header { text-align: center; margin-bottom: 20px; }
        .logo { width: 90px; margin-bottom: 5px; }
        .garis-pembatas { border-top: 5px solid #000; margin-top: 5px; width: 100%; }
        
        table { width: 100%; border-collapse: collapse; margin-top: 10px; }
        th, td { border: 1px solid #000 !important; padding: 5px; text-align: center; vertical-align: middle; }
        th { background-color: #555555 !important; color: white !important; }
        
        @media print { .no-print { display: none !important; } }
    </style>
</head>
<body>

<div class="header" style="text-align: center; margin-bottom: 25px;">
    <img src="<?= base_url('template/img/tci.png') ?>" class="logo" style="width: 100px; margin-bottom: 10px;">
    
    <h4 style="margin: 0; font-weight: bold; font-size: 18px; color: #000;">
        DEPARTAMENTO TÉCNICAS DE COMPUTAÇÃO E INFORMÁTICA
    </h4>
    
    <h5 style="margin: 8px 0 0 0; font-size: 16px; font-weight: bold; text-decoration: underline;">
        RELATÓRIO DADUS MATERIA
    </h5>
    
    <div class="garis-pembatas" style="border-top: 4px solid #000; margin: 12px auto 0 auto; width: 100%;"></div>
</div>

    <table class="table table-bordered">
        <thead>
            <tr>
                <th>Nu</th>
                <th>ID</th>
                <th>Kode Materia</th>
                <th>Naran Materia</th>
                <th>Credito</th>
                <th>Semestre</th>
                <th>Total Credito</th>
                <th>Total Materia</th>
                <th>Tipu</th>
                <th>Departamentu</th>
            </tr>
        </thead>
        <tbody>
            <?php if (!empty($materia)): $no=1; foreach($materia as $m): ?>
            <tr>
                <td><?= $no++ ?></td>
                <td><?= htmlspecialchars($m->id) ?></td>
                <td><?= htmlspecialchars($m->kode_materia) ?></td>
                <td style="text-align:left;"><?= htmlspecialchars($m->naran_materia) ?></td>
                <td><?= htmlspecialchars($m->credito) ?></td>
                <td><?= htmlspecialchars($m->semestre) ?></td>
                <td><?= htmlspecialchars($m->total_credito) ?></td>
                <td><?= htmlspecialchars($m->total_materia) ?></td>
                <td><?= htmlspecialchars($m->tipu) ?></td>
                <td><?= htmlspecialchars($m->departamentu) ?></td>
            </tr>
            <?php endforeach; else: ?>
            <tr><td colspan="10">Dadus la iha</td></tr>
            <?php endif; ?>
        </tbody>
    </table>

    <div style="margin-top:30px; text-align:right;">
        <p>Dili, <?= date('d-m-Y') ?></p>
    </div>
</div>

<script>
    window.onload = function() {
        window.print();
    };
</script>

</body>
</html>