
/* =====================================
   GLOBAL SETTINGS
===================================== */

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: #b5abab;
    font-family: Arial, Helvetica, sans-serif;
    color: #111;
}

/* =====================================
   RESPONSIVE A4 PAGE
===================================== */

.page {
    position: relative;
    isolation: isolate;
    container-type: inline-size;

    /* Always 90% of screen width */
    width: 90vw;
    max-width: none;

    /* Maintain exact A4 portrait ratio */
    height: calc(90vw * 297 / 210);
    min-height: 0;

    margin: 5vh auto;

    /* Responsive page padding */
    padding: 8.571% 8.095% 7.619%;

    background: #fff url('assets/border.png') center / 100% 100% no-repeat;

    overflow: hidden;
    box-shadow: 0 2px 12px #777;
}

/* =====================================
   HEADER LOGOS
===================================== */

.top-logos {
    height: 8.571cqw;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    position: relative;
    gap: 0.952cqw;
}

.left-logo {
    width: 42%;
    height: 100%;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 1.9cqw 4.76cqw;

    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.left-logo img {
    width: 100%;
    height: 90%;
    object-fit: contain;
    object-position: left center;
}

.right-logos {
    width: 58%;
    height: 100%;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 1.43cqw 3.81cqw;

    display: flex;
    align-items: center;
    justify-content: center;
}

.right-logos img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* =====================================
   HEADER LINE
===================================== */

.header-rule {
    border-top: 1px solid #999;
    margin-top: 0.952cqw;
}

/* =====================================
   STUDENT IDENTITY SECTION
===================================== */

.identity-row {
    height: 24.762cqw;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-top: 1.429cqw;

    position: relative;
    z-index: 1;
}

/* STUDENT PHOTO */

.photo-frame {
    width: 12.857cqw;
    height: 14.762cqw;
    border: 1.6px dashed rgb(136, 134, 207);
    padding: 0.476cqw;
    background: #f7f7f7;
}

.photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 1px solid #222;
}

/* =====================================
   GENERAL TABLE SETTINGS
===================================== */

table {
    border-collapse: collapse;
}

th, td {
    border: 1px solid #ccc;
    padding: 0.95cqw 1.14cqw;
    text-align: left;
    vertical-align: middle;
}

/* ENROLMENT TABLE */

.enrolment {
    width: 47%;
    font-size: 1.5cqw;
}

.enrolment th,
.details-table th {
    background: #eee;
    font-weight: 700;
}

.enrolment th {
    width: 43%;
}

.enrolment td {
    background: #fff;
}

/* =====================================
   PERSONAL DETAILS
===================================== */

.details {
    position: relative;
    z-index: 1;
    margin-top: 0.476cqw;
}

.details-table {
    width: 100%;
    table-layout: fixed;
    font-size: 1.43cqw;

    border-collapse: separate;
    border-spacing: 0.38cqw 0.38cqw;
}

.details-table th,
.details-table td {
    border: 1px solid #BBB;
    border-radius: 2px;
    padding: 1.14cqw 1.43cqw;
    vertical-align: middle;
}

.details-table th {
    background: rgba(238, 238, 238, 0.8);
    width: 20%;
    font-weight: 700;
}

.details-table td {
    width: 30%;
}

/* =====================================
   WATERMARK
===================================== */

.watermark {
    position: absolute;
    z-index: 0;

    top: 45%;
    left: 50%;

    width: 40%;

    transform: translate(-50%, -63%);
    opacity: 0.16;
    pointer-events: none;
}

.watermark img {
    display: block;
    width: 100%;
    height: auto;
}

/* CONTENT ABOVE WATERMARK */

.identity-row,
.details,
.marks-section,
.totals {
    position: relative;
    z-index: 1;
}

/* =====================================
   MARKS TABLE
===================================== */

.marks-section {
    position: relative;
    z-index: 1;

    /* Space before marks table */
    margin-top: 11.429cqw;
}

.marks {
    width: 100%;
    table-layout: fixed;
    font-size: 1.35cqw;
}

.marks th {
    background: rgb(233, 233, 233);
    font-weight: 700;
}

.marks th:nth-child(1) { width: 17%; }
.marks th:nth-child(2) { width: 24%; }
.marks th:nth-child(3) { width: 17%; }
.marks th:nth-child(4) { width: 17%; }
.marks th:nth-child(5) { width: 17%; }
.marks th:nth-child(6) { width: 18%; }

.marks td {
    height: 3.81cqw;
    background: rgba(255,255,255,0.3);
}

/* =====================================
   TOTALS SECTION
===================================== */

.totals {
    position: relative;
    z-index: 1;

    width: 43%;
    margin: 2.38cqw 0 0 auto;
    font-size: 1.35cqw;
}

.totals table {
    width: 100%;
}

.totals td {
    border-color: #ccc;
    height: 4.76cqw;
    background: rgba(255,255,255,.85);
}

.totals td:last-child {
    text-align: right;
    width: 30%;
}

/* =====================================
   FOOTER
===================================== */

footer {
    position: absolute;
    bottom: 4.76cqw;
    left: 0;
    right: 0;

    text-align: center;
    color: #777;
    font-size: 1.1cqw;
    letter-spacing: 0.19cqw;
}

/* =====================================
   SCREEN SETTINGS
===================================== */

@media screen {

    html, body {
        overflow-x: auto;
    }

    .page {
        flex-shrink: 0;
    }
}

/* =====================================
   PRINT SETTINGS
===================================== */

@page {
    size: A4;
    margin: 0;
}

@media print {

    html, body {
        margin: 0;
        padding: 0;
        width: 210mm;
        background: #fff;
        overflow: visible;
    }

    .page {
        width: 210mm;
        height: 297mm;
        min-height: 297mm;
        max-width: none;

        margin: 0;
        padding: 18mm 17mm 16mm;

        box-shadow: none;

        page-break-after: always;
        break-after: page;

        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
