@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Cinzel:wght@400;700&display=swap');

.professional-marksheet-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;

    /* Adjustable Layout Tokens */
    --table-left-base: 65px;
    /* Subject name column */
    --marks-left-base: 555px;
    /* First marks column (Theory Obt) */
    --marks-col-step: 45px;
    /* Gap between columns */
    --marks-row-top: 55px;
    /* Vertical alignment within row */
    --qr-top: 980px;
    --qr-right: 75px;
    --qr-size: 85px;
}

.marksheet-outer-container {
    width: 794px;
    height: 1123px;
    background-image: url('secure_marksheet_template.php');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: relative;
    background-color: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transform-origin: top center;
    transition: transform 0.3s ease;
}

@media screen and (max-width: 820px) {
    .professional-marksheet-wrapper {
        padding: 20px 0;
        width: 100%;
        overflow-x: auto !important;
        overflow-y: hidden;
        display: block !important;
        -webkit-overflow-scrolling: touch;
        background: #f0f2f5;
        box-sizing: border-box;
    }

    .marksheet-outer-container {
        margin: 0 auto !important;
        width: 794px !important;
        height: 1123px !important;
        flex-shrink: 0;
        transform: none !important;
        zoom: 1 !important;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }



    /* Custom Scrollbar */
    .professional-marksheet-wrapper::-webkit-scrollbar {
        height: 6px;
    }

    .professional-marksheet-wrapper::-webkit-scrollbar-thumb {
        background: #2c3e50;
        border-radius: 10px;
    }
}

.m-overlay {
    position: absolute;
    z-index: 10;
    color: #000;
    font-family: 'Roboto', sans-serif;
    display: flex;
    align-items: center;
    font-size: 13px;
    white-space: nowrap;
}

/* High-fidelity layout for the revised blue template (Removed Mother's Name) */
.mo-name {
    top: 230px;
    left: 168px;
    width: 300px;
    font-size: 13px;
}

.mo-father {
    top: 248px;
    left: 168px;
    width: 300px;
}

.mo-atc {
    top: 264px;
    left: 168px;
    width: 450px;
    font-size: 13px;
}

.mo-course {
    top: 281px;
    left: 168px;
    font-size: 13px;
}

.mo-photo {
    top: 207px;
    right: 73px;
    width: 70px;
    height: 85px;
    border: 1px dashed #ccc;
    object-fit: cover;
}

/* 4-Box grid across the width */
.mo-course-code {
    top: 357px;
    left: 49px;
    width: 162px;
    height: 35px;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.mo-student-id {
    top: 357px;
    left: 231px;
    width: 162px;
    height: 35px;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.mo-dob {
    top: 357px;
    left: 399px;
    width: 162px;
    height: 35px;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.mo-marksheet-id {
    top: 357px;
    left: 588px;
    width: 162px;
    height: 35px;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.m-table-row {
    position: absolute;
    width: 100%;
    height: 25px;
    display: flex;
}

/* Table positioning - Adjusted for 794px container */
.mo-subject {
    top: var(--marks-row-top);
    position: absolute;
    left: var(--table-left-base);
    width: 380px;
    font-size: 12px;
    font-weight: 500;
}

.mo-th-obt,
.mo-th-max,
.mo-pr-obt,
.mo-pr-max {
    position: absolute;
    top: var(--marks-row-top);
    width: 55px;
    justify-content: center;
    font-weight: 700;
}

/* Calculated column positions */
.mo-th-obt {
    left: var(--marks-left-base);
}

.mo-th-max {
    left: calc(var(--marks-left-base) + var(--marks-col-step) * 1);
}

.mo-pr-obt {
    left: calc(var(--marks-left-base) + var(--marks-col-step) * 2);
}

.mo-pr-max {
    left: calc(var(--marks-left-base) + var(--marks-col-step) * 3);
}

/* Bottom Summary Row Styles */
.mo-sum-th-obt,
.mo-sum-th-max,
.mo-sum-pr-obt,
.mo-sum-pr-max {
    position: absolute;
    top: var(--marks-row-top);
    width: 55px;
    justify-content: center;
    font-weight: 800;
}

.mo-sum-th-obt {
    left: var(--marks-left-base);
}

.mo-sum-th-max {
    left: calc(var(--marks-left-base) + var(--marks-col-step) * 1);
}

.mo-sum-pr-obt {
    left: calc(var(--marks-left-base) + var(--marks-col-step) * 2);
}

.mo-sum-pr-max {
    left: calc(var(--marks-left-base) + var(--marks-col-step) * 3);
}

/* Summary area - moved down to match new template */
.mo-result {
    top: 800px;
    left: 45px;
    width: 108px;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.mo-percentage {
    top: 800px;
    left: 140px;
    width: 108px;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.mo-total-max {
    top: 804px;
    left: 235px;
    width: 100px;
    justify-content: center;
}

.mo-total-obt {
    top: 804px;
    left: 315px;
    width: 100px;
    justify-content: center;
    font-weight: 700;
}



.mo-date {
    top: 928px;
    left: 144px;
    font-size: 13px;
}

.mo-checked {
    top: 815px;
    left: 460px;
    font-size: 12px;
}

.mo-qr {
    top: var(--qr-top);
    right: var(--qr-right);
    width: var(--qr-size);
    height: var(--qr-size);
}

.mo-qr .qr-img {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    border: 1px solid #000;
    display: block;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }

    header,
    footer,
    nav,
    .no-print {
        display: none !important;
    }

    body {
        margin: 0;
        padding: 0;
    }

    .professional-marksheet-wrapper {
        padding: 0;
        overflow: visible !important;
    }

    .marksheet-outer-container {
        box-shadow: none;
        margin: 0;
        transform: none !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* Action Container Styles */
.action-container {
    padding: 20px;
    display: flex;
    justify-content: center;
    background: #fff;
    width: 100%;
}

.btn-marksheet {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: #3498db;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn-marksheet:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

@media screen and (max-width: 600px) {
    .btn-marksheet {
        width: 100%;
        justify-content: center;
        padding: 15px;
    }
}

/* Desktop/Monitor view - center button below marksheet */
@media screen and (min-width: 821px) {
    .professional-marksheet-wrapper {
        display: block !important;
        width: 100%;
    }

    .student-corner-container {
        display: flex !important;
        justify-content: center !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .marksheet-outer-container {
        margin: 0 auto;
    }

    .action-container {
        display: flex !important;
        justify-content: center;
        align-items: center;
        width: 100% !important;
        max-width: 794px;
        margin: 20px auto;
        padding: 20px 0;
        background: transparent !important;
    }

    .btn-marksheet {
        min-width: 200px;
    }
}