<style>
    td, th { padding: 5px; }
    body { font-family: Arial, sans-serif; }
    .title { font-size: 16pt; font-weight: bold; text-align: center; margin: 10px 0 15px 0; }
    .section-header { font-size: 12pt; font-weight: bold; text-align: center; padding: 6px; background-color: #e8e8e8; border: 1px solid #999; }
    table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
    th, td { border: 1px solid #555; text-align: center; }
    th { background-color: #f5f5f5; font-size: 10pt; }
    td { font-size: 10pt; }
    td.text-left { text-align: left; }
    .page { width: 100%; }
</style>
<div class="page">
    {% if additionalDetails.collegeData.collegeHeader %}
    <div style="text-align:center; margin-bottom:10px;">
        <img src="{{ additionalDetails.collegeData.collegeHeader }}" alt="College Header" style="width:100%; max-height:130px; object-fit:contain;">
    </div>
    {% else %}
    <div style="font-size:18pt; font-weight:bold; text-align:center; margin-bottom:6px;">{{ additionalDetails.collageName }}</div>
    {% endif %}

    <div class="title">
        POSITION LIST {{ additionalDetails.courseType }} {{ additionalDetails.batchStartYear }} - {{ additionalDetails.batchEndYear }} BATCH
    </div>

    {% for batch in batches %}
    <div class="section-header">{{ batch.programName }}</div>
    <table>
        <thead>
            <tr>
                <th style="width:7%;">Sl.No</th>
                <th style="width:28%;">Student Name</th>
                <th style="width:16%;">Reg. No</th>
                <th style="width:14%;">CGPA For Rank</th>
                {% if additionalDetails.isHideLetterGrade != true %}
                <th style="width:10%;">Letter Grade</th>
                {% endif %}
                {% if additionalDetails.isHideOrgCgpa != true %}
                <th style="width:14%;">ORG-CGPA</th>
                {% endif %}
                <th style="width:10%;">Rank</th>
            </tr>
        </thead>
        <tbody>
        {% set slno = 0 %}
        {% for student in batch.students %}
        {% set slno = slno + 1 %}
            <tr>
                <td>{{ slno }}</td>
                <td class="text-left">{{ student.studentName }}</td>
                <td>{{ student.regNo }}</td>
                <td>{{ student.cgpa }}</td>
                {% if additionalDetails.isHideLetterGrade != true %}
                <td>{{ student.grade }}</td>
                {% endif %}
                {% if additionalDetails.isHideOrgCgpa != true %}
                <td>{{ student.importedRawCgpa }}</td>
                {% endif %}
                <td>{{ student.positionRank }}</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    {% endfor %}
</div>
