<?php
function template34($institutions, $branch, $students_array, $examination, $array, $result, $class_id, $section_id)
{
    
    
require_once $GLOBALS['base_path_to_learning'] . '/resources/marksheet_template/template34/function.php';


$late_p1 = (($array[39] ?? '') === 'LT');
$late_p2 = (($array[40] ?? '') === 'LT');


$late_p3 = ($array[1] ?? '') === 'LT';   // Periodic-3
$late_p4 = ($array[2] ?? '') === 'LT';   // Periodic-4
?>
    <!DOCTYPE html>
    <html lang="en">

    <head>
        <meta charset="UTF-8">
        <title>Holistic Progress Report</title>
         <link href="https://fonts.googleapis.com/css2?family=Jost:wght@300;400;500;600;700&display=swap" rel="stylesheet">

        <style>
            /* =====================================================
               GLOBAL COMMON CSS (All Pages)
            ===================================================== */
            @page {
                size: A4 landscape;
                margin: 0;
            }

            * {
                margin: 0;
                padding: 0;
                box-sizing: border-box;
            }

            body {
                font-family: Arial, Helvetica, sans-serif;
                background: #fff;
                padding: 20px;
            }

            .wrapper {
                display: flex;
                width: 100%;
                gap: 20px;
            }

            .page,
            .left-section,
            .right-section {
                flex: 1;
                width: 50%;
                border: 3px solid #c4161c;
                padding: 18px;
                box-sizing: border-box;
                background: #fff;
                display: flex;
                flex-direction: column;
            }

            table {
                width: 100%;
                border-collapse: collapse;
                font-size: 11pt;
            }

            th,
            td {
                border: 1px solid #000;
                padding: 6px;
                text-align: center;
                vertical-align: middle;
            }

            th {
                font-weight: bold;
            }

            .left {
                text-align: left;
                padding-left: 8px;
            }

            .center {
                text-align: center;
            }

            .diamond::before {
                content: "◆ ";
            }

            .page-break {
                page-break-after: always;
            }

            /* PAGE 1 LEFT — INCREASED */
            .p1-title {
                text-align: center;
                font-size: 30px;
                font-weight: bold;
                color: #c4161c;
                margin-bottom: 22px;
            }

            .paragraph {
                font-size: 16px;
                line-height: 1.6;
                color: #000;
                text-align: justify;
                margin-bottom: 26px;
            }

            .sub-title {
                text-align: center;
                font-size: 22px;
                color: #c4161c;
                font-weight: bold;
                margin-bottom: 12px;
            }

            .grading-note {
                text-align: center;
                margin-bottom: 16px;
                font-size: 11pt;
            }

            .grading-table {
                width: 65%;
                margin: 0 auto 16px auto;
                font-size: 16px;
            }

            .grading-table th {
                background: #c4161c;
                color: #fff;
                padding: 7px;
            }

            .grading-table td {
                padding: 6px;
                background: #f6e7b0;
                font-weight: bold;
            }

            .grading-table td.range {
                background: #fff;
                color: #0066cc;
                font-weight: normal;
            }

            .min-note {
                text-align: center;
                margin-bottom: 16px;
                font-size: 11pt;
            }

            .blue-note {
                color: #00a2e8;
                margin-bottom: 12px;
                font-size: 11pt;
            }

            .rules {
                border: 2px solid #9bbad1;
                font-size: 13pt;
                border-radius: 10px;
                padding: 12px;
                line-height: 1.6;
                color: #1b3c73;
                margin-bottom: 20px;
            }

            .footer-note {
                margin-top: auto;
                padding: 12px 14px;
                font-size: 14px;
                text-align: center;
                background: #f1f1f1;
                border: 1px solid #cfcfcf;
                line-height: 1.4;
            }

            /* PAGE 1 RIGHT — INCREASED */
            .school-header {
                text-align: center;
                margin-top: 3px;
            }

            .school-logo {
                text-align: center;
                margin-bottom: 3px;
            }

            .school-logo img {
                width: 210px;
                height: 120px;
                object-fit: contain;
            }

            .school-name {
                font-family: 'Cinzel', serif;
                font-size: 46px;
                font-weight: 700;
                color: #2c2f83;
                letter-spacing: 1.5px;
                margin-top: 2px;
            }

            /* Address line */
            .school-address {
                font-size: 20px;
                line-height: 1.3;
                text-align: center;
            }

            /* Second line: contact + email + city + pincode */
            .school-meta-main {
                font-size: 20px;
                white-space: nowrap;
                /* stay on ONE line */
                text-align: center;
            }

            /* Third line: affiliation only */
            .school-meta-aff {
                font-size: 20px;
                text-align: center;
            }

            .photo-box {
                width: 185px;
                height: 220px;
                border: 3px solid #c4161c;
                border-radius: 18px;
                margin: 16px auto 10px auto;
                display: flex;
                align-items: center;
                justify-content: center;
            }

            .student-photo {
                width: 92%;
                height: 92%;
                object-fit: cover;
                border-radius: 12px;
            }

            .report-title {
                text-align: center;
                font-size: 24pt;
                font-weight: 900;
                margin: 10px 0 4px 0;
                letter-spacing: 0.5px;
            }

            .year {
                text-align: center;
                font-size: 32px;
                color: #c4161c;
                font-weight: 900;
                margin-bottom: 22px;
            }

            .info-table {
                width: 85%;
                margin: 0 auto;
                border-collapse: collapse;
                font-family: 'Jost', sans-serif !important;
            }

            .info-table td {
                border: none;
                background: transparent;
                padding: 13px 2px;
                text-align: left;
                /*font-size: 16px;*/
                font-size: 12pt;
                vertical-align: middle;
                font-family: 'Jost', sans-serif !important;
            }

            .info-table td:first-child {
                width: 30%;
                font-weight: 600;
            }

            .line {
                display: inline-block;
                width: 340px;
                /*height: 18px;*/
                font-family: 'Jost', sans-serif !important;
                letter-spacing: 1px;
                border-bottom: 3px dotted rgba(0, 0, 0, 0.5);
                vertical-align: middle;
            }

            /* PAGE 2 LEFT */
            .header {
                background: #fff;
                padding: 0;
            }

            .p2-title {
                background: #c41e3a;
                color: #fff;
                padding: 10px 15px;
                text-align: center;
                font-size: 22px;
                font-weight: bold;
                letter-spacing: 2px;
                margin-bottom: 8px;
            }

            .content {
                padding: 0;
                flex: 1;
                display: flex;
                flex-direction: column;
            }

            .description {
                font-size: 11pt;
                line-height: 1.6;
                margin-bottom: 10px;
            }

            .diagram {
                width: 100%;
                flex: 1;
                min-height: 0;
                margin: 6px 0 10px 0;
                text-align: center;
                display: flex;
                align-items: center;
                justify-content: center;
            }

            .mi-diagram {
                width: 100%;
                max-width: 100%;
                height: 100%;
                max-height: 100%;
                display: block;
                margin: 0 auto;
                object-fit: contain;
            }

            .subject-title {
                background: #c41e3a;
                color: #fff;
                padding: 10px 12px;
                text-align: center;
                font-size: 18px;
                font-weight: bold;
                letter-spacing: 1px;
                margin: 10px 0 8px 0;
            }

            .levels-title {
                color: #c41e3a;
                font-size: 17px;
                font-weight: bold;
                margin: 0 0 8px 0;
            }

            .levels-table td {
                border: 1px solid #333;
                padding: 10px 12px;
                font-size: 14px;
            }

            .levels-table td:first-child {
                font-weight: bold;
                width: 75px;
            }

            /* PAGE 2 RIGHT */
            .p2-right-title {
                font-weight: bold;
                font-size: 15px;
                text-align: center !important;
            }

            .bar-title {
                background: #9fa8d4;
                border: 1px solid #000;
                font-weight: bold;
                font-size: 15px;
                text-align: center;
                padding: 9px 0;
                margin: 0;
                
            }

            .marks-table {
                width: 100%;
                border-collapse: collapse;
                table-layout: fixed;
                margin-top: 0;
                font-family: 'Jost', sans-serif !important;
                font-size: 11pt;
            }

            .marks-table th,
            .marks-table td {
                border: 1px solid #000;
                text-align: center;
                vertical-align: middle;
            }

            .marks-table thead tr:first-child th {
                background: #9fa8d4;
                /*font-size: 14px;*/
                font-weight: bold;
                padding: 2px 0;

            }

            .marks-table thead tr:nth-child(2) th {
                background: #c8d3e8;
                /*font-size: 13px;*/
                padding: 2px;
                font-family: 'Arial';
                font-weight: bold;
                /*line-height: 1.3;*/
            }

            .marks-table tbody td {
                /*font-size: 13px;*/
                padding: 2px;
            }

            /* LEFT ALIGN FIRST COLUMN (ALL ROWS, INCLUDING PERCENTAGE) */
            .marks-table th:first-child,
            .marks-table td:first-child {
                /*text-align: left !important;*/
                padding-left: 2px !important;
            }

            .support-table,
            .assessment-table {
                width: 100%;
                border-collapse: collapse;
                table-layout: fixed;
                margin-top: 0;
            }

            .support-table td,
            .assessment-table td {
                border: 1px solid #000;
                font-size: 14px;
                padding: 9px 10px;
                vertical-align: middle;
            }

            .support-table td:first-child,
            .assessment-table td:first-child {
                background: #e9e9e9;
                text-align: left;
                width: 45%;
            }

            .support-legend {
                background: #c4161c;
                color: #fff;
                font-weight: bold;
                text-align: center;
                font-size: 13px;
                font-size: 9pt !important;
                padding: 8px 10px;
                margin: 8px 0 8px;
                border: 1px solid #c4161c;
            }

            .remarks-box {
                border: 1px solid #000;
                padding: 8px;
                height: 135px;
                margin-top: 8px;
                font-size: 14px;
            }


            .promotion-section {
                margin: 2px 0px 24px;
                font-size: 15px;
                font-weight: bold;
            }

            .signature-section {
                display: flex;
                justify-content: space-between;
                margin-top: auto;
                padding-top: 10px;
                font-size: 15px;
                font-weight: bold;
            }

            .signature-item {
                flex: 1;
                text-align: center;
            }

            /* PAGE 3 + 4 */
            .page-title {
                font-weight: bold;
                font-size: 11pt;
                text-align: center !important;
            }

            .term-head {
                background: #b4b4d6;
                font-weight: bold;
            }

            .sub-head {
                font-weight: bold;
                font-size: 11pt;
                margin: 15px 0 6px;
            }

            .health th,
            .attendance th {
                background: #b4b4d6;
            }

            .blank-box {
                height: 70px;
            }

            .portfolio-title {
                font-weight: bold !important;
                font-size: 18px;
                margin-bottom: 6px !important;
            }

            .remarks-line {
                height: 30px;
            }

            .remarks-heading {
                margin-top: 6px !important;
                margin-bottom: 4px !important;
                display: block !important;
                font-weight: bold;
                font-size: 11pt;
            }


            .skill-table,
            .rounded {
                width: 100%;
                border-collapse: separate !important;
                border-spacing: 0 !important;
                table-layout: fixed;
                margin: 10px 0 10px;
                border: 1px solid #000;
                border-radius: 12px;
                overflow: hidden;
                background: #fff;
            }

            .skill-table th,
            .rounded th {
                background: #ffffff !important;
                color: #000 !important;
                font-weight: bold;
                font-size: 13px;
                text-transform: uppercase;
                padding: 6px !important;
                border-bottom: 1px solid #000 !important;
            }

            .skill-table td,
            .rounded td {
                font-size: 11pt;
                font-family: 'Jost', sans-serif !important;
                padding: 6px 8px !important;
                vertical-align: middle !important;
                border-top: 1px solid #000 !important;
            }

            .skill-table th,
            .skill-table td,
            .rounded th,
            .rounded td {
                border-right: 1px solid #000;
            }

            .skill-table th:last-child,
            .skill-table td:last-child,
            .rounded th:last-child,
            .rounded td:last-child {
                border-right: none;
            }

            .skill-table th:nth-child(1),
            .skill-table td:nth-child(1),
            .rounded th:nth-child(1),
            .rounded td:nth-child(1) {
                width: 72%;
                text-align: left !important;
                padding-left: 12px !important;
            }

            .skill-table th:nth-child(2),
            .skill-table td:nth-child(2),
            .skill-table th:nth-child(3),
            .skill-table td:nth-child(3),
            .rounded th:nth-child(2),
            .rounded td:nth-child(2),
            .rounded th:nth-child(3),
            .rounded td:nth-child(3) {
                width: 14%;
                text-align: center !important;
                white-space: nowrap;
            }

            .skill-table tr,
            .rounded tr {
                /*height: 28px;*/
            }

            .skill-table td.left.diamond,
            .rounded td.left.diamond {
                padding-left: 12px !important;
            }

            .p4-photo-box {
                width: 120px;
                height: 150px;
                border: 1px solid #000;
                display: flex;
                align-items: center;
                justify-content: center;
            }
            
             .p4-children-footer{
                margin-top: auto;        /* pushes it to bottom */
                text-align: center;
            }
            
            .p4-children-footer img{
                max-width: 100%;
                height: auto;
            }
            
            .flex-column {
                flex-direction: column !important;
                justify-content: space-between !important;
            }
            
            .section-title {
                font-size: 12pt !important;
                font-weight: bold;
            }



            /* =====================================================
               PRINT — NO EMPTY PAGES, FULL A4 LANDSCAPE
            ===================================================== */
            @media print {

                @page {
                    size: 297mm 210mm landscape;
                    margin: 0;
                }

                html,
                body {
                    margin: 0 !important;
                    padding: 0 !important;
                    width: 297mm !important;
                    -webkit-print-color-adjust: exact !important;
                    print-color-adjust: exact !important;
                    color-adjust: exact !important;
                    font-family: 'Arial' !important;
                    font-size: 11pt !important;
                }


                .wrapper {
                    display: flex !important;
                    flex-direction: row !important;
                    /*width: 297mm !important;*/
                    /*height: 210mm !important;*/
                    /*min-height: 210mm !important;*/
                    /*max-height: 210mm !important;*/
                    /*padding: 4mm !important;*/
                    /*gap: 4mm !important;*/
                    width: 100% !important;
                    height: 100% !important;
                    padding: 6mm !important;
                    /* equal margin from all sides */
                    gap: 6mm !important;

                    margin: 0 !important;
                    box-sizing: border-box !important;
                    overflow: hidden !important;
                    page-break-inside: avoid !important;
                    break-inside: avoid !important;
                }

                .page-break {
                    display: block !important;
                    height: 0 !important;
                    margin: 0 !important;
                    padding: 0 !important;
                    page-break-after: always !important;
                    break-after: page !important;
                    page-break-before: avoid !important;
                    break-before: avoid !important;
                }

                .page,
                .left-section,
                .right-section {
                    flex: 1 !important;
                    width: calc(50% - 3mm) !important;
                    /*height: 202mm !important;*/
                    /*height: 100% !important;*/
                    height: 198mm !important;
                    /* key line */
                    /*min-height: 202mm !important;*/
                    /*max-height: 202mm !important;*/
                    padding: 8px 10px !important;
                    border: 2px solid #c4161c !important;
                    box-sizing: border-box !important;
                    overflow: hidden !important;
                    display: flex !important;
                    flex-direction: column !important;
                    page-break-inside: avoid !important;
                    break-inside: avoid !important;
                }


                th,
                td {
                    padding: 2px 4px !important;
                    line-height: 1.2 !important;
                    font-size: 11pt !important;
                }

                /* PAGE 1 LEFT — PRINT */
                .p1-title {
                    font-size: 20px !important;
                    margin-bottom: 10px !important;
                    color: #c4161c !important;
                }

                .paragraph {
                    font-size: 15px !important;
                    line-height: 1.5 !important;
                    margin-bottom: 12px !important;
                    color: #000 !important;
                }

                .sub-title {
                    font-size: 15px !important;
                    margin-bottom: 8px !important;
                    color: #c4161c !important;
                }

                .grading-note {
                    margin-bottom: 8px !important;
                    font-size: 11pt !important;
                }

                .grading-table {
                    width: 72% !important;
                    margin: 0 auto 10px auto !important;
                }

                .grading-table th {
                    background: #c4161c !important;
                    color: #fff !important;
                    padding: 5px 6px !important;
                    font-size: 15px !important;
                }

                .grading-table td {
                    padding: 5px 6px !important;
                    font-size: 15px !important;
                    background: #f6e7b0 !important;
                    font-weight: bold !important;
                }

                .grading-table td.range {
                    background: #fff !important;
                    color: #0066cc !important;
                    font-weight: normal !important;
                }

                .min-note {
                    font-size: 11pt !important;
                    margin-bottom: 8px !important;
                }

                .blue-note {
                    font-size: 11pt !important;
                    margin-bottom: 7px !important;
                    color: #00a2e8 !important;
                    padding-left: 55px;
                    /* space for "Note :" */
                    text-indent: -55px;
                    /* pull first line back */
                }

                .blue-note .label {
                    font-size: 11pt !important;
                    margin-bottom: 7px !important;
                    color: #00a2e8 !important;
                    font-weight: bold;
                }

                .rules {
                    font-size: 11pt !important;
                    padding: 8px 10px !important;
                    line-height: 1.45 !important;
                    margin-bottom: 10px !important;
                    border: 2px solid #9bbad1 !important;
                    color: #1b3c73 !important;
                }

                .footer-note {
                    padding: 6px 8px !important;
                    margin-top: auto !important;
                    background: #f1f1f1 !important;
                    border: 1px solid #cfcfcf !important;
                }

                /* PAGE 1 RIGHT — PRINT */
                .school-logo img {
                    width: 120px !important;
                    height: 65px !important;
                }

                .school-name {
                    font-size: 24pt !important;
                    color: #2c2f83 !important;
                    margin-bottom: 10px;
                }

                /* SCHOOL ADDRESS & META — INCREASED */
                .school-address {
                    font-size: 11pt !important;
                    margin-top: 2px !important;
                }

                .school-meta-main {
                    font-size: 11pt !important;
                }

                .school-meta-aff {
                    font-size: 11pt !important;
                    margin-top: 10px;
                }

                .school-meta {
                    font-size: 11pt !important;
                }

                .photo-box {
                    width: 37mm !important;
                    height: 42mm !important;
                    margin: 15px auto 6px auto !important;
                    border-radius: 10px !important;
                    border: 2px solid #c4161c !important;
                }

                .report-title {
                    font-size: 20pt !important;
                    margin: 5px 0 3px !important;
                }

                .year {
                    font-size: 18px !important;
                    margin-bottom: 10px !important;
                    color: #c4161c !important;
                }

                .info-table {
                    width: 98% !important;
                }

                .info-table td {
                    padding: 8px 2px !important;
                    font-size: 11pt !important;
                    /*font-size: 20px !important;*/
                }

                .info-table td:first-child {
                    width: 32% !important;
                }

                .line {
                    display: inline-block;
                    width: 260px !important;
                    /* ⬅ longer line */
                    /*height: 20px !important;*/
                    /* ⬅ taller */
                    border-bottom: 1.5px dotted #888 !important;
                    vertical-align: middle;
                    margin-left: 6px;
                    font-size: 11pt !important;

                    /*font-size: 20px !important;*/
                    /* text sits nicely on line 
                }

                /* PAGE 2 LEFT — PRINT */
                    .p2-title {
                        font-size: 14px !important;
                        padding: 6px 8px !important;
                        letter-spacing: 1px !important;
                        background: #c41e3a !important;
                        color: #fff !important;
                        margin-bottom: 5px !important;
                    }

                    .content {
                        padding: 0 !important;
                        flex: 1 !important;
                        display: flex !important;
                        flex-direction: column !important;
                        min-height: 0 !important;
                    }

                    .description {
                        font-size: 11pt !important;
                        line-height: 1.5 !important;
                        margin-bottom: 6px !important;
                    }

                    .diagram {
                        flex: 1 !important;
                        min-height: 0 !important;
                        width: 100% !important;
                        margin: 4px 0 6px 0 !important;
                        display: flex !important;
                        align-items: center !important;
                        justify-content: center !important;
                    }

                    .mi-diagram {
                        width: 100% !important;
                        height: 100% !important;
                        max-width: 100% !important;
                        display: block !important;
                        margin: 0 auto !important;
                        object-fit: contain !important;
                    }

                    .subject-title {
                        font-size: 12px !important;
                        padding: 6px 8px !important;
                        margin: 5px 0 4px 0 !important;
                        background: #c41e3a !important;
                        color: #fff !important;
                        flex-shrink: 0 !important;
                    }

                    .levels-title {
                        font-size: 12px !important;
                        margin: 0 0 4px 0 !important;
                        color: #c41e3a !important;
                        flex-shrink: 0 !important;
                    }

                    .levels-table td {
                        padding: 5px 8px !important;
                        font-size: 12px !important;
                        border: 1px solid #333 !important;
                    }

                    .levels-table td:first-child {
                        width: 60px !important;
                        font-weight: bold !important;
                    }

                    /* PAGE 2 RIGHT — unchanged except marks table */
                    .p2-right-title {
                        font-size: 12px !important;
                        margin-bottom: 3px !important;
                    }

                    .bar-title {
                        font-size: 11pt !important;
                        padding: 3px 0 !important;
                        margin: 0 !important;
                        background: #9fa8d4 !important;
                    }

                    /* ── ONLY MARKS TABLE: slightly bigger than before ── */
                    /* before: height 17px / font 12.5px / padding 2px  */
                    /* now:    height 20px / font 13px   / padding 3px  */



                    /* support & assessment — unchanged from last version */
                    .support-table td,
                    .assessment-table td {
                        padding: 4px 5px !important;
                        font-size: 12px !important;
                        line-height: 1.2 !important;
                    }

                    .support-table td:first-child,
                    .assessment-table td:first-child {
                        width: 45% !important;
                        background: #e9e9e9 !important;
                    }

                    .support-legend {
                        padding: 4px 5px !important;
                        font-size: 10px !important;
                        margin: 3px 0 5px !important;
                        background: #c4161c !important;
                        color: #fffff !important;
                    }

                    /* remarks — unchanged */
                    .remarks-box {
                        min-height: 20px !important;
                        max-height: 42px !important;
                        padding: 4px 6px !important;
                        margin-top: 5px !important;
                        font-size: 11pt !important;
                        border: 1px solid #000 !important;
                        flex-shrink: 0 !important;
                    }

                    .promotion-section {
                        margin: 5px 0px 5px !important;
                        font-size: 11pt !important;
                        font-family: 'arial' !important;
                        flex-shrink: 0 !important;
                    }

                    .signature-section {
                        margin-top: auto !important;
                        padding-top: 6px !important;
                        font-size: 11pt !important;
                        font-family: 'arial' !important;
                        flex-shrink: 0 !important;
                    }

                    /* PAGE 3 + 4 */
                    .page-title {
                        margin-bottom: 6px !important;
                    }

                    .section-title {
                        font-size: 11pt !important;
                        margin: 7px 0 5px !important;
                        font-weight: bold !important;
                    }

                    .sub-head {
                        margin: 7px 0 5px !important;
                    }

                    .blank-box {
                        height: 44px !important;
                    }

                    .remarks-line {
                        font-size: 11pt !important;
                        height: 22px !important;
                    }

                    .remarks-heading {
                        font-size: 11pt !important;
                        font-weight: bold !important;
                        margin-top: 6px !important;
                        margin-bottom: 4px !important;
                        display: block !important;
                    }


                    .p4-photo-box {
                        width: 78px !important;
                        height: 95px !important;
                    }

                    .portfolio-title {
                        font-weight: bold !important;
                        font-size: 11pt !important;
                        margin-bottom: 6px !important;
                    }

                    .term-head {
                        background: #b4b4d6 !important;
                    }

                    .health th,
                    .attendance th {
                        background: #b4b4d6 !important;
                    }

                    .skill-table,
                    .rounded {
                        margin: 6px 0 9px !important;
                        border-radius: 8px !important;
                    }

                    .skill-table th,
                    .rounded th {
                        font-size: 12px !important;
                        padding: 3px 4px !important;
                        line-height: 1.3 !important;
                        background: #ffffff !important;
                        color: #000 !important;
                    }

                    .skill-table td,
                    .rounded td {
                        font-size: 12px !important;
                        padding: 2px 5px !important;
                        line-height: 1.3 !important;
                    }

                    /*.skill-table tr,*/
                    /*.rounded tr {*/
                    /*    height: 24px !important;*/
                    /*}*/

                    .skill-table td.left.diamond,
                    .rounded td.left.diamond {
                        padding-left: 14px !important;
                    }

                    .skill-table th:nth-child(1),
                    .skill-table td:nth-child(1),
                    .rounded th:nth-child(1),
                    .rounded td:nth-child(1) {
                        width: 72% !important;
                    }

                    /* NO BREAKS INSIDE ELEMENTS */
                    .page,
                    .left-section,
                    .right-section,
                    table,
                    thead,
                    tbody,
                    tr,
                    td,
                    th,
                    .diagram,
                    .remarks-box,
                    .signature-section,
                    .skill-table,
                    .rounded,
                    .marks-table,
                    .support-table,
                    .assessment-table {
                        page-break-inside: avoid !important;
                        break-inside: avoid !important;
                    }


                }
        </style>

    </head>

    <body>

        <!-- ================= PAGE 1 ================= -->
        <div class="wrapper">

            <!-- LEFT PAGE -->
            <div class="page">
                <div class="p1-title">PERIOD ASSESSMENT</div>

                <div class="paragraph">
                    The report card is designed to assess the various areas of ability of the student.
                    Apart from his/her academic achievements, behavioural, mental and physical skills
                    are minutely examined for the overall holistic development of the students.
                </div>

                <div class="sub-title">Grading Scale</div>

                <div class="grading-note">
                    The nine point grading scale for measuring Scholastic achievements
                </div>

                <table class="grading-table">
                    <tr>
                        <th>GRADE</th>
                        <th>MARKS RANGE</th>
                    </tr>
                    <tr>
                        <td>A1</td>
                        <td class="range">91 - 100</td>
                    </tr>
                    <tr>
                        <td>A2</td>
                        <td class="range">81 - 90</td>
                    </tr>
                    <tr>
                        <td>B1</td>
                        <td class="range">71 - 80</td>
                    </tr>
                    <tr>
                        <td>B2</td>
                        <td class="range">61 - 70</td>
                    </tr>
                    <tr>
                        <td>C1</td>
                        <td class="range">51 - 60</td>
                    </tr>
                    <tr>
                        <td>C2</td>
                        <td class="range">41 - 50</td>
                    </tr>
                    <tr>
                        <td>D</td>
                        <td class="range">33 - 40</td>
                    </tr>
                    <tr>
                        <td>E1</td>
                        <td class="range">21 - 32</td>
                    </tr>
                    <tr>
                        <td>E2</td>
                        <td class="range">00 - 20</td>
                    </tr>
                </table>

                <div class="min-note">
                    Minimum qualifying grade in all subjects under Scholastic Domain is D<br>
                    and minimum qualifying marks are 33
                </div>

                <div class="blue-note">
                    Note : All assessment with regard to the academic status of the students
                    shall be done in marks and the
                </div>

                <div class="rules">
                    1. If a student is absent for an assessment whether Examination/Unit Test/Evaluation/Project,
                    he or she cannot appear for it at a later date.<br>
                    2. Promotion depends on the student's performance throughout the year.<br>
                    3. The decision of the Principal with regard to promotion is final.
                </div>

                <div class="footer-note">
                    <b>Note:</b> This Progress Report is the property of the school. Any tear,
                    mutilation or unauthorized alteration of this Report could lead to serious consequences.
                </div>
            </div>

            <!-- RIGHT PAGE -->
            <div class="page">

                <div class="school-header">

                    <div class="school-logo">
                        <?php if (!empty($institutions['logo'])): ?>
                            <img src="<?= htmlspecialchars($institutions['logo']) ?>" alt="School Logo">
                        <?php endif; ?>
                    </div>

                 <div class="school-name">
                    <?= strtoupper(htmlspecialchars($institutions['institution_name'] ?? '')) ?>
                </div>

                <!-- LINE 1 : ADDRESS -->
                <div class="school-address">
                    <?= !empty($branch['address'])
                        ? ucfirst(htmlspecialchars($branch['address']))
                        : '' ?>
                </div>
                
                <!-- LINE 2 : CONTACT + EMAIL + CITY + PINCODE -->
               <div class="school-meta school-meta-main">

                    <?php if (!empty($branch['city'])): ?>
                        <?= htmlspecialchars($branch['city']) ?>
                    <?php endif; ?>
                
                    <?php if (!empty($branch['pincode'])): ?>
                        - <?= htmlspecialchars($branch['pincode']) ?>
                    <?php endif; ?>
                
                    <?php if (!empty($branch['contact_number'])): ?>
                        &nbsp; | ☎ <?= htmlspecialchars($branch['contact_number']) ?>
                    <?php endif; ?>
                
                    <?php if (!empty($branch['email'])): ?>
                        &nbsp; | ✉ <?= htmlspecialchars($branch['email']) ?>
                    <?php endif; ?>
                
                </div>
                
                <!-- LINE 3 : AFFILIATION ONLY -->
                <div class="school-meta school-meta-aff">
                    Affiliation No:
                    <?php if (!empty($branch['affiliation_code'])): ?>
                        <?= htmlspecialchars($branch['affiliation_code']) ?>
                    <?php endif; ?>
                </div>

                </div>


                <div class="photo-box">
                    <?php if (!empty($students_array[0]['student_image']['filepath'])): ?>
                        <img src="<?= htmlspecialchars($students_array[0]['student_image']['filepath']) ?>" class="student-photo" alt="Student Photo">
                    <?php else: ?>
                        <span>No Photo</span>
                    <?php endif; ?>
                </div>

                <div class="report-title">HOLISTIC PROGRESS REPORT</div>
                <div class="year">2025-2026</div>

                <table class="info-table">
                    <tr>
                        <td width="35%">Name</td>
                        <td>: <span class="line"><?= $students_array[0]['name'] ?? '' ?></span></td>
                    </tr>
                    <tr>
                        <td>Class & Sec.</td>
                        <td>: <span class="line"><?= ($class_id ?? '') . ' ' . ($section_id ?? '') ?></span></td>
                    </tr>
                    <tr>
                        <td>PEN No.</td>
                        <td>: <span class="line"><?= $students_array[0]['penn'] ?? '' ?></span></td>
                    </tr>
                    <tr>
                        <td>Admission No.</td>
                        <td>: <span class="line"><?= $students_array[0]['admission_number'] ?? '' ?></span></td>
                    </tr>
                    <tr>
                        <td>Date of Birth</td>
                        <td>: <span class="line">
                                <?= !empty($students_array[0]['dob'])
                                    ? date('d-m-Y', strtotime($students_array[0]['dob']))
                                    : '' ?>
                            </span></td>
                    </tr>
                    <tr>
                        <td>Father’s Name</td>
                        <td>: <span class="line"><?= $students_array[0]['fathername'] ?? '' ?></span></td>
                    </tr>
                    <tr>
                        <td>Mother’s Name</td>
                        <td>: <span class="line"><?= $students_array[0]['mothername'] ?? '' ?></span></td>
                    </tr>
                </table>

            </div>
        </div>

        <div class="page-break"></div>

        <!-- ================= PAGE 2 ================= -->
        <div class="wrapper">

            <!-- LEFT SECTION -->
            <div class="left-section">
                <div class="header"></div>
                <div class="p2-title">HOLISTIC LEARNING</div>

                <div class="content">
                    <div class="description">
                        An approach that seeks to fully activate all aspects of the learner's personality (intellect, emotions, imaginations, body) for more effective and comprehensive learning. It includes the following:
                    </div>

                    <div class="diagram">
                        <img
                            src="https://rejoicebilldesk.in/rjllearning_development/resources/assets/Multiple_Intelligence_Model.svg"
                            alt="Multiple Intelligence Model"
                            class="mi-diagram">
                    </div>


                    <div class="subject-title">SUBJECT WISE PERFORMANCE</div>

                    <div class="levels-title">Levels of performance</div>

                    <table class="levels-table">
                        <tr>
                            <td class="left">Level 1</td>
                            <td class="left">Needs a lot of support of teacher and peers.</td>
                        </tr>
                        <tr>
                            <td class="left">Level 2</td>
                            <td class="left">Able to do with support of teacher/peers.</td>
                        </tr>
                        <tr>
                            <td class="left">Level 3</td>
                            <td class="left">Able to perform expected skills</td>
                        </tr>
                    </table>
                </div>
            </div>

            <!-- RIGHT SECTION -->
            <!-- Right Section -->
            <div class="right-section">
                <div class="header"></div>

                <div class="content">

                    <!-- ✅ MAIN TITLE LIKE PDF -->
                    <div class="p2-right-title">ACADEMIC PERFORMANCE: SCHOLASTIC AREAS</div>

<table class="marks-table">
    <thead>
        <tr>
            <th colspan="2" class="ms29-term-head">TERM - II</th>
        </tr>
        <tr>
            <!--<th colspan="2">Subject</th>-->
            <th>Periodic -3</th>
            <th>Periodic -4</th>
        </tr>
    </thead>

    <tbody>

        <!-- English -->
        <tr>
            <!--<td rowspan="2">English</td>-->
            <!--<td>Oral</td>-->

            <?php if ($late_p3): ?>
                <td rowspan="10" style="position:relative;">
                    <div style="position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
                        transform:rotate(-75deg);font-size:25px;font-weight:800;
                        color:rgba(0,0,0,0.15);white-space:nowrap;">
                        LATE ADMISSION
                    </div>
                </td>
            <?php else: ?>
                <td><?= is_numeric($array[1]) ? gradeOutOf50($array[1]) : '-' ?></td>
            <?php endif; ?>

            <?php if ($late_p4): ?>
                <td rowspan="10" style="position:relative;">
                    <div style="position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
                        transform:rotate(-75deg);font-size:25px;font-weight:800;
                        color:rgba(0,0,0,0.15);white-space:nowrap;">
                        LATE ADMISSION
                    </div>
                </td>
            <?php else: ?>
                <td><?= is_numeric($array[2]) ? gradeOutOf50($array[2]) : '-' ?></td>
            <?php endif; ?>
        </tr>

        <tr>
            <!--<td>Written</td>-->
            <?php if (!$late_p3): ?><td><?= is_numeric($array[3]) ? gradeOutOf50($array[3]) : '-' ?></td><?php endif; ?>
            <?php if (!$late_p4): ?><td><?= is_numeric($array[4]) ? gradeOutOf50($array[4]) : '-' ?></td><?php endif; ?>
        </tr>

        <!-- Hindi -->
<?php if (($array[5] ?? '') !== 'NA'): ?>

<tr>
    <?php if (!$late_p3): ?><td><?= is_numeric($array[5]) ? gradeOutOf50($array[5]) : '-' ?></td><?php endif; ?>
    <?php if (!$late_p4): ?><td><?= is_numeric($array[6]) ? gradeOutOf50($array[6]) : '-' ?></td><?php endif; ?>
</tr>
<tr>
    <?php if (!$late_p3): ?><td><?= is_numeric($array[7]) ? gradeOutOf50($array[7]) : '-' ?></td><?php endif; ?>
    <?php if (!$late_p4): ?><td><?= is_numeric($array[8]) ? gradeOutOf50($array[8]) : '-' ?></td><?php endif; ?>
</tr>

<?php endif; ?>

        <!-- Maths -->
<?php if (($array[9] ?? '') !== 'NA'): ?>

<tr>
    <?php if (!$late_p3): ?><td><?= is_numeric($array[9]) ? gradeOutOf50($array[9]) : '-' ?></td><?php endif; ?>
    <?php if (!$late_p4): ?><td><?= is_numeric($array[10]) ? gradeOutOf50($array[10]) : '-' ?></td><?php endif; ?>
</tr>
<tr>
    <?php if (!$late_p3): ?><td><?= is_numeric($array[11]) ? gradeOutOf50($array[11]) : '-' ?></td><?php endif; ?>
    <?php if (!$late_p4): ?><td><?= is_numeric($array[12]) ? gradeOutOf50($array[12]) : '-' ?></td><?php endif; ?>
</tr>

<?php endif; ?>

        <!-- EVS -->
<?php if (($array[13] ?? '') !== 'NA'): ?>

<tr>
    <?php if (!$late_p3): ?><td><?= is_numeric($array[13]) ? gradeOutOf50($array[13]) : '-' ?></td><?php endif; ?>
    <?php if (!$late_p4): ?><td><?= is_numeric($array[14]) ? gradeOutOf50($array[14]) : '-' ?></td><?php endif; ?>
</tr>

<?php endif; ?>

        <!-- GK -->
<?php if (($array[15] ?? '') !== 'NA'): ?>

<tr>
    <?php if (!$late_p3): ?><td><?= is_numeric($array[15]) ? gradeOutOf50($array[15]) : '-' ?></td><?php endif; ?>
    <?php if (!$late_p4): ?><td><?= is_numeric($array[16]) ? gradeOutOf50($array[16]) : '-' ?></td><?php endif; ?>
</tr>

<?php endif; ?>
        <!-- Drawing -->
<?php if (($array[17] ?? '') !== 'NA'): ?>

<tr>
    <?php if (!$late_p3): ?><td><?= is_numeric($array[17]) ? gradeOutOf50($array[17]) : '-' ?></td><?php endif; ?>
    <?php if (!$late_p4): ?><td><?= is_numeric($array[18]) ? gradeOutOf50($array[18]) : '-' ?></td><?php endif; ?>
</tr>

<?php endif; ?>

        <!-- Overall -->
        <tr>
            <!--<td colspan="2">Overall Grade</td>-->
            <?php if (!$late_p3): ?><td><?= $array[19] ?? '' ?></td><?php endif; ?>
            <?php if (!$late_p4): ?><td><?= $array[20] ?? '' ?></td><?php endif; ?>
        </tr>

    </tbody>
</table>
<div class="support-legend">
                        A - Very Supportive | B - Show Support in Some Areas | C - Need to be involved
                    </div>
                    <!-- ✅ PARENTAL SUPPORT BAR -->
                    <div class="bar-title" style="margin-top: 2px !important;">PARENTAL SUPPORT</div>
                    <table class="support-table">
                        <tr>
                            <td>Uniform</td>
                            <td><?= $array[21] ?? '' ?></td>
                            <td><?= $array[22] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td>Circular Follow Up</td>
                            <td><?= $array[23] ?? '' ?></td>
                            <td><?= $array[24] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td>Home Work/Act. Submission</td>
                            <td><?= $array[25] ?? '' ?></td>
                            <td><?= $array[26] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td>PTM/Attendance</td>
                            <td><?= $array[27] ?? '' ?></td>
                            <td><?= $array[28] ?? '' ?></td>
                        </tr>
                    </table>



                    

                    <!-- ✅ TEACHERS ASSESSMENT BAR -->
                    <div class="bar-title">TEACHERS ASSESSMENT</div>
                    <table class="assessment-table">
                        <tr>
                            <td>Personal Hygiene</td>
                            <td><?= $array[29] ?? '' ?></td>
                            <td><?= $array[30] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td>Punctuality</td>
                            <td><?= $array[31] ?? '' ?></td>
                            <td><?= $array[32] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td>Value System</td>
                            <td><?= $array[33] ?? '' ?></td>
                            <td><?= $array[34] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td>Self-confidence</td>
                            <td><?= $array[35] ?? '' ?></td>
                            <td><?= $array[36] ?? '' ?></td>
                        </tr>
                    </table>



                    <!-- ✅ REMARKS BOX LIKE PDF -->
                    <div class="remarks-box">
                        <div class="remarks-heading">Class Teacher's Remarks:</div>
                        <div class="remarks-line"><?= $array[37] ?? '' ?></div>
                        
                        <div class="promotion-section">
                            Promoted to Class: <?= $array[38] ?? '' ?>
                        </div>
    
    
                        <div class="signature-section">
                            <div class="signature-item">Class Teacher Signature</div>
                            <div class="signature-item">Headmistress Signature</div>
                            <div class="signature-item">Parents Signature</div>
                        </div>
                    </div>


                </div>
            </div>

        </div>

        <div class="page-break"></div>


        <!-- ================= PAGE 3 ================= -->
        <div class="wrapper">

            <!-- LEFT PAGE -->
            <div class="page">

                <div class="page-title">ACADEMIC PERFORMANCE: SCHOLASTIC AREAS</div>

                <table class="marks-table">
    <thead>
        <tr>
            <th colspan="4" class="ms29-term-head">TERM - I</th>
        </tr>
        <tr>
            <th colspan="2">Subject</th>
            <th>Periodic -1</th>
            <th>Periodic -2</th>
        </tr>
    </thead>

    <tbody>

        <!-- English -->
        <tr>
            <td rowspan="2">English</td>
            <td>Oral</td>

            <?php if ($late_p1): ?>
                <td rowspan="10" style="position:relative;">
                    <div style="position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
                        transform:rotate(-75deg);font-size:25px;font-weight:800;
                        color:rgba(0,0,0,0.15);white-space:nowrap;">
                        LATE ADMISSION
                    </div>
                </td>
            <?php else: ?>
                <td><?= is_numeric($array[39]) ? gradeOutOf50($array[39]) : '-' ?></td>
            <?php endif; ?>

            <?php if ($late_p2): ?>
                <td rowspan="10" style="position:relative;">
                    <div style="position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
                        transform:rotate(-75deg);font-size:25px;font-weight:800;
                        color:rgba(0,0,0,0.15);white-space:nowrap;">
                        LATE ADMISSION
                    </div>
                </td>
            <?php else: ?>
                <td><?= is_numeric($array[40]) ? gradeOutOf50($array[40]) : '-' ?></td>
            <?php endif; ?>
        </tr>

        <tr>
            <td>Written</td>
            <?php if (!$late_p1): ?><td><?= is_numeric($array[41]) ? gradeOutOf50($array[41]) : '-' ?></td><?php endif; ?>
            <?php if (!$late_p2): ?><td><?= is_numeric($array[42]) ? gradeOutOf50($array[42]) : '-' ?></td><?php endif; ?>
        </tr>

        <!-- Hindi -->
<?php if (($array[43] ?? '') !== 'NA'): ?>

<tr>
    <td rowspan="2">Hindi</td>
    <td>Oral</td>
    <?php if (!$late_p1): ?><td><?= is_numeric($array[43]) ? gradeOutOf50($array[43]) : '-' ?></td><?php endif; ?>
    <?php if (!$late_p2): ?><td><?= is_numeric($array[44]) ? gradeOutOf50($array[44]) : '-' ?></td><?php endif; ?>
</tr>
<tr>
    <td>Written</td>
    <?php if (!$late_p1): ?><td><?= is_numeric($array[45]) ? gradeOutOf50($array[45]) : '-' ?></td><?php endif; ?>
    <?php if (!$late_p2): ?><td><?= is_numeric($array[46]) ? gradeOutOf50($array[46]) : '-' ?></td><?php endif; ?>
</tr>

<?php endif; ?>

        <!-- Maths -->
<?php if (($array[47] ?? '') !== 'NA'): ?>

<tr>
    <td rowspan="2">Maths</td>
    <td>Oral</td>
    <?php if (!$late_p1): ?><td><?= is_numeric($array[47]) ? gradeOutOf50($array[47]) : '-' ?></td><?php endif; ?>
    <?php if (!$late_p2): ?><td><?= is_numeric($array[48]) ? gradeOutOf50($array[48]) : '-' ?></td><?php endif; ?>
</tr>
<tr>
    <td>Written</td>
    <?php if (!$late_p1): ?><td><?= is_numeric($array[49]) ? gradeOutOf50($array[49]) : '-' ?></td><?php endif; ?>
    <?php if (!$late_p2): ?><td><?= is_numeric($array[50]) ? gradeOutOf50($array[50]) : '-' ?></td><?php endif; ?>
</tr>

<?php endif; ?>

        <!-- EVS -->
<?php if (($array[51] ?? '') !== 'NA'): ?>

<tr>
    <td>EVS (Oral)</td>
    <td></td>
    <?php if (!$late_p1): ?><td><?= is_numeric($array[51]) ? gradeOutOf50($array[51]) : '-' ?></td><?php endif; ?>
    <?php if (!$late_p2): ?><td><?= is_numeric($array[52]) ? gradeOutOf50($array[52]) : '-' ?></td><?php endif; ?>
</tr>

<?php endif; ?>

        <!-- GK & Rhymes -->
<?php if (($array[53] ?? '') !== 'NA'): ?>

<tr>
    <td>GK & Rhymes</td>
    <td></td>
    <?php if (!$late_p1): ?><td><?= is_numeric($array[53]) ? gradeOutOf50($array[53]) : '-' ?></td><?php endif; ?>
    <?php if (!$late_p2): ?><td><?= is_numeric($array[54]) ? gradeOutOf50($array[54]) : '-' ?></td><?php endif; ?>
</tr>

<?php endif; ?>

        <!-- Drawing -->
<?php if (($array[55] ?? '') !== 'NA'): ?>

<tr>
    <td>Drawing</td>
    <td></td>
    <?php if (!$late_p1): ?><td><?= is_numeric($array[55]) ? gradeOutOf50($array[55]) : '-' ?></td><?php endif; ?>
    <?php if (!$late_p2): ?><td><?= is_numeric($array[56]) ? gradeOutOf50($array[56]) : '-' ?></td><?php endif; ?>
</tr>

<?php endif; ?>

        <!-- Overall -->
        <tr>
            <td>Overall Grade</td>
                                <td></td>
            <?php if (!$late_p1): ?><td><?= $array[57] ?? '' ?></td><?php endif; ?>
            <?php if (!$late_p2): ?><td><?= $array[58] ?? '' ?></td><?php endif; ?>
        </tr>

    </tbody>
</table>




                <div style="height:18px;"></div>

                <div class="sub-head">CO-SCHOLASTICS AREAS</div>

                <table class="health">
                    <tr>
                        <th colspan="4" class="left">HEALTH STATUS</th>
                    </tr>
                    <tr>
                        <td class="left">Height</td>
                        <td><?= $array[59] ?? '' ?></td>
                        <td class="left">Weight</td>
                        <td><?= $array[60] ?? '' ?></td>
                    </tr>
                    <tr>
                        <td class="left">Blood Group</td>
                        <td colspan="3"><?= $array[61] ?? '' ?></td>
                    </tr>
                </table>


                <div style="height:18px;"></div>

                <table class="attendance">
                    <tr>
                        <th class="left">ATTENDANCE</th>
                        <th>TERM I</th>
                        <th>TERM II</th>
                        <th>TOTAL</th>
                    </tr>
                    <tr>
                        <td class="left">No of Working Days</td>
                        <td><?= $array[62] ?? '' ?></td>
                        <td><?= $array[63] ?? '' ?></td>
                        <td><?= $array[64] ?? '' ?></td>
                    </tr>
                    <tr>
                        <td class="left">Days Attended</td>
                        <td><?= $array[65] ?? '' ?></td>
                        <td><?= $array[66] ?? '' ?></td>
                        <td><?= $array[67] ?? '' ?></td>
                    </tr>
                    <tr>
                        <td class="left">Attendance %</td>
                        <td><?= $array[68] ?? '' ?></td>
                        <td><?= $array[69] ?? '' ?></td>
                        <td><?= $array[70] ?? '' ?></td>
                    </tr>
                </table>



                <div style="height:18px;"></div>
<table>
    <tr>
        <th class="left">Competition</th>
    </tr>
    <tr>
        <td class="blank-box" style="text-align:left !important;">
            <?= ($array[71] ?? '') ?>
            <?= !empty($array[72]) ? '<br>' . $array[72] : '' ?>
        </td>
    </tr>
</table>
<div class="remarks-box">
                    <div class="remarks-heading">Class Teacher's Remarks:</div>
                    <div class="remarks-line"><?= $array[73] ?? '' ?></div>
                </div>

            </div>

            <!-- RIGHT PAGE -->
            <!-- RIGHT PAGE -->
            <div class="page fle-column">

                <div class="portfolio-title">
                    BASED ON PORTFOLIO, SUBJECT ENRICHMENT<br>
                    Activities and Class Activities
                </div>

                <div>
                    <div class="section-title">1. Verbal-Linguistic Intelligence</div>
                    <!-- ENGLISH -->
                    <table class="skill-table">
                        <tr>
                            <th class="left">ENGLISH</th>
                            <th>TERM I</th>
                            <th>TERM II</th>
                        </tr>
                        <tr>
                            <td class="left diamond">Understands what he/she reads.</td>
                            <td><?= $array[74] ?? '' ?></td>
                            <td><?= $array[75] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td class="left diamond">Can spell Correctly.</td>
                            <td><?= $array[76] ?? '' ?></td>
                            <td><?= $array[77] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td class="left diamond">Has good listening skills</td>
                            <td><?= $array[78] ?? '' ?></td>
                            <td><?= $array[79] ?? '' ?></td>
                        </tr>
                    </table>
                </div>
                <?php
                $show_hindi = (
                    // TERM I / TERM II Hindi
                    ($array[5]  ?? '') !== '' ||
                    ($array[6]  ?? '') !== '' ||
                    ($array[7]  ?? '') !== '' ||
                    ($array[8]  ?? '') !== '' ||
                
                    // PERIODIC Hindi (P3 / P4)
                    ($array[43] ?? '') !== '' ||
                    ($array[44] ?? '') !== '' ||
                    ($array[45] ?? '') !== '' ||
                    ($array[46] ?? '') !== ''
                );
                ?>
                                <!-- HINDI -->
                               <?php if ($show_hindi): ?>
                <!-- HINDI -->
                <table class="skill-table">
                    <tr>
                        <th class="left">HINDI</th>
                        <th>TERM I</th>
                        <th>TERM II</th>
                    </tr>
                    <tr>
                        <td class="left diamond">Able to express himself clearly</td>
                        <td><?= $array[80] ?? '' ?></td>
                        <td><?= $array[81] ?? '' ?></td>
                    </tr>
                    <tr>
                        <td class="left diamond">Is able to read the text easily</td>
                        <td><?= $array[82] ?? '' ?></td>
                        <td><?= $array[83] ?? '' ?></td>
                    </tr>
                    <tr>
                        <td class="left diamond">Has good listening skills.</td>
                        <td><?= $array[84] ?? '' ?></td>
                        <td><?= $array[85] ?? '' ?></td>
                    </tr>
                </table>
                <?php endif; ?>

                <div>
                    <div class="section-title">2. Logical Mathematical Intelligence</div>
                    <!-- MATHEMATICS -->
                    <table class="skill-table">
                        <tr>
                            <th class="left">MATHEMATICS</th>
                            <th>TERM I</th>
                            <th>TERM II</th>
                        </tr>
                        <tr>
                            <td class="left diamond">Enjoy puzzles and mathematics activities</td>
                            <td><?= $array[86] ?? '' ?></td>
                            <td><?= $array[87] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td class="left diamond">Likes working with numbers</td>
                            <td><?= $array[88] ?? '' ?></td>
                            <td><?= $array[89] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td class="left diamond">Works systematically</td>
                            <td><?= $array[90] ?? '' ?></td>
                            <td><?= $array[91] ?? '' ?></td>
                        </tr>
                    </table>
                </div>
                
                <div>
                    <div class="section-title">3. MUSICAL RHYTHMIC INTELLIGENCE</div>
    
                    <!-- MUSIC / DANCE -->
                    <table class="skill-table">
                        <tr>
                            <th class="left">MUSIC / DANCE</th>
                            <th>TERM I</th>
                            <th>TERM II</th>
                        </tr>
                        <tr>
                            <td class="left diamond">Participate in school Assembly</td>
                            <td><?= $array[92] ?? '' ?></td>
                            <td><?= $array[93] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td class="left diamond">Learn and Recite Rhymes Well</td>
                            <td><?= $array[94] ?? '' ?></td>
                            <td><?= $array[95] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td class="left diamond">Follow Dance Steps Well</td>
                            <td><?= $array[96] ?? '' ?></td>
                            <td><?= $array[97] ?? '' ?></td>
                        </tr>
                    </table>
                </div>

                
                    <?php if (!$show_hindi): ?>
    <!-- CHILDREN PLAYING FOOTER — only when Hindi table is hidden -->
    <div class="p4-children-footer">
        <img src="https://rejoicebilldesk.in/rjllearning_development/resources/assets/Pre_nursery_image.png" alt="children playing" />
    </div>
    <?php endif; ?>

            </div>
             

        </div>

        <div class="page-break"></div>

    <!-- ================= PAGE 4 ================= -->
        <div class="wrapper">

            <!-- LEFT PAGE -->
            <div class="page flex-column">

                <div>
                    <div class="section-title">4. BODILY KINESTHETICS INTELLIGENCE</div>
                    <table class="rounded">
                        <tr>
                            <th class="left">HEALTH AND FITNES</th>
                            <th>TERM I</th>
                            <th>TERM II</th>
                        </tr>
                        <tr>
                            <td class="left diamond">Participate in sports Day and Class games</td>
                            <td><?= $array[98] ?? '' ?></td>
                            <td><?= $array[99] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td class="left diamond">Understand and Follow Instructions</td>
                            <td><?= $array[100] ?? '' ?></td>
                            <td><?= $array[101] ?? '' ?></td>
                        </tr>
                    </table>
                </div>

                <table class="rounded">
                    <tr>
                        <th class="left">NEATNESS AND WORK HABITS</th>
                        <th>TERM I</th>
                        <th>TERM II</th>
                    </tr>
                    <tr>
                        <td class="left diamond">Write neatly and legibly</td>
                        <td><?= $array[102] ?? '' ?></td>
                        <td><?= $array[103] ?? '' ?></td>
                    </tr>
                    <tr>
                        <td class="left diamond">Dresses well and its tidy</td>
                        <td><?= $array[104] ?? '' ?></td>
                        <td><?= $array[105] ?? '' ?></td>
                    </tr>
                </table>

                <div>
                    <div class="section-title">5. Visual - Spatial Intelligence</div>
                    <table class="rounded">
                        <tr>
                            <th class="left">ART</th>
                            <th>TERM I</th>
                            <th>TERM II</th>
                        </tr>
                        <tr>
                            <td class="left diamond">Able to draw and colour picture.</td>
                            <td><?= $array[106] ?? '' ?></td>
                            <td><?= $array[107] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td class="left diamond">Enjoying craft activities.</td>
                            <td><?= $array[108] ?? '' ?></td>
                            <td><?= $array[109] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td class="left diamond">Able to learn through multimedia.</td>
                            <td><?= $array[110] ?? '' ?></td>
                            <td><?= $array[111] ?? '' ?></td>
                        </tr>
                    </table>
                </div>

                <div>
                    <div class="section-title">6. INTERPERSONAL INTELLIGENCE</div>
                    <table class="rounded">
                        <tr>
                            <th class="left"></th>
                            <th>TERM I</th>
                            <th>TERM II</th>
                        </tr>
                        <tr>
                            <td class="left diamond">Is friendly and Co operative.</td>
                            <td><?= $array[112] ?? '' ?></td>
                            <td><?= $array[113] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td class="left diamond">Listen to others.</td>
                            <td><?= $array[114] ?? '' ?></td>
                            <td><?= $array[115] ?? '' ?></td>
                        </tr>
                    </table>
                </div>

                <!-- CHILDREN PLAYING FOOTER -->
                <div class="p4-children-footer">
                    <img src="https://rejoicebilldesk.in/rjllearning_development/resources/assets/Pre_nursery_image.png" alt="children playing" />
                </div>

            </div>


            <!-- RIGHT PAGE -->
            <div class="page flex-column">

                <div>
                    <div class="section-title">7. INTRAPERSONAL INTELLIGENCE</div>
                    <table class="rounded">
                        <tr>
                            <th class="left"></th>
                            <th>TERM I</th>
                            <th>TERM II</th>
                        </tr>
                        <tr>
                            <td class="left diamond">Can do things independently.</td>
                            <td><?= $array[116] ?? '' ?></td>
                            <td><?= $array[117] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td class="left diamond">Complete task without being distracted.</td>
                            <td><?= $array[118] ?? '' ?></td>
                            <td><?= $array[119] ?? '' ?></td>
                        </tr>
                    </table>
                </div>
                
                <div>
                    <div class="section-title">8. NATURAL INTELLIGENCE AWARENESS</div>
                    <table class="rounded">
                        <tr>
                            <th class="left"></th>
                            <th>TERM I</th>
                            <th>TERM II</th>
                        </tr>
                        <tr>
                            <td class="left diamond">Enjoy and exploring outdoor trips.</td>
                            <td><?= $array[120] ?? '' ?></td>
                            <td><?= $array[121] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td class="left diamond">Show concern for environmental issues.</td>
                            <td><?= $array[122] ?? '' ?></td>
                            <td><?= $array[123] ?? '' ?></td>
                        </tr>
                    </table>
                </div>
                
                <div>
                    <div class="section-title">9. EXISTENTIAL INTELLIGENCE</div>
                    <table class="rounded">
                        <tr>
                            <th class="left"></th>
                            <th>TERM I</th>
                            <th>TERM II</th>
                        </tr>
                        <tr>
                            <td class="left diamond">Learn values taught in the class.</td>
                            <td><?= $array[124] ?? '' ?></td>
                            <td><?= $array[125] ?? '' ?></td>
                        </tr>
                        <tr>
                            <td class="left diamond">Meditates regularly and enjoy yoga practice.</td>
                            <td><?= $array[126] ?? '' ?></td>
                            <td><?= $array[127] ?? '' ?></td>
                        </tr>
                    </table>
                </div>

                <!-- CHILDREN PLAYING FOOTER -->
                <div class="p4-children-footer">
                    <img src="https://rejoicebilldesk.in/rjllearning_development/resources/assets/Pre_nursery_image.png" alt="children playing" />
                </div>

            </div>

        </div>

    </body>

    </html>
<?php
}
?>