﻿/* ==========================================
   PRINT OUTPUT (Cover + Summary Only)
   - Screen: hide cover + summary templates
   - Print: Page 1 = cover, Page 2 = summary
   ========================================== */

/* ---------- SCREEN MODE ---------- */
.print-cover,
.schedule-summary-print {
    display: none;
}

/* ---------- PRINT MODE ---------- */
@media print {

    /* Page box */
    @page {
        size: Letter; /* change to A4 if needed */
        margin: 12mm;
    }

    html, body {
        height: auto !important;
        overflow: visible !important;
        background: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

        /* Hide everything (reliable in SPA print preview) */
        body * {
            visibility: hidden !important;
        }

    /* IMPORTANT: override screen-mode display:none */
    #tpl-cover,
    .print-cover,
    #tpl-summary,
    .schedule-summary-print {
        display: block !important;
    }

        /* Reveal ONLY the report templates */
        #tpl-cover, #tpl-cover *,
        #tpl-summary, #tpl-summary *,
        .print-cover, .print-cover *,
        .schedule-summary-print, .schedule-summary-print * {
            visibility: visible !important;
        }

    /* ------------------------------------------
       COVER PAGE (Page 1) - fit fully on page
       ------------------------------------------ */

    /* Cover wrapper */
    #tpl-cover,
    .print-cover {
        /* force cover first page */
        height: 100vh !important;
        min-height: 100vh !important;
        display: block !important;
        break-after: page;
        page-break-after: always;
        background: #f39a2e !important;
        padding: 10mm; /* reduced for reliable fit */
        box-sizing: border-box;
        width: 100%;
        max-height: 100%;
        overflow: hidden;
    }

    /* Inner white page area */
    .cover-page {
        border: 10mm solid #f39a2e !important; /* match wrapper padding */
        background: #fff !important;
        /* Reserve space for footer by giving bottom padding */
        padding: 12mm 12mm 22mm 12mm;
        box-sizing: border-box;
        font-family: Arial, Helvetica, sans-serif;
        position: relative;
        width: 100%;
        overflow: hidden;
    }

    /* Header */
    .cover-head {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 14mm; /* reduced from 70px to fit */
    }

    .cover-title {
        font-size: 40px; /* slightly reduced to fit */
        font-weight: 800;
        text-decoration: underline;
        line-height: 1.05;
    }

    .cover-conf {
        font-size: 12px;
        font-weight: 700;
        margin-top: 6px;
        text-transform: uppercase;
    }

    /* Notes */
    .cover-notes p {
        font-size: 12px;
        margin: 0 0 8px 0;
    }

    .notes-label {
        font-size: 12px;
        text-decoration: underline;
        margin-bottom: 4px;
        font-weight: 600;
    }

    .notes-rule {
        border-top: 1px solid #222;
        margin-bottom: 10px;
        width: 100%;
    }

    .notes-link {
        color: #0b2b57 !important;
        text-decoration: none !important;
        font-weight: 600;
        display: inline-block;
        margin-top: 2px;
        font-size: 12px;
    }

    /* Footer */
    .cover-footer {
        background: #0b2b57 !important;
        color: #fff !important;
        /* keep footer compact so it fits */
        padding: 8mm 8mm;
        font-size: 10px;
        line-height: 1.35;
        margin: 0;
    }

    .cover-footer-fixed {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
    }

    /* ------------------------------------------
       SUMMARY PAGE (Page 2)
       ------------------------------------------ */
    #tpl-summary,
    .schedule-summary-print {
        break-before: page;
        page-break-before: always;
        padding: 10mm;
        box-sizing: border-box;
        background: #fff !important;
        font-family: Arial, Helvetica, sans-serif;
        width: 100%;
        min-height: 100vh;
        /* Ensure summary is not affected by absolute rules */
        position: static;
        overflow: visible;
    }

        .schedule-summary-print .title {
            font-size: 18px;
            font-weight: 700;
            margin-bottom: 10px;
        }

        .schedule-summary-print .row {
            font-size: 12px;
            margin: 4px 0;
        }

        .schedule-summary-print .label {
            font-weight: 600;
            display: inline-block;
            min-width: 120px;
        }

        .schedule-summary-print .muted {
            margin-top: 10px;
            font-size: 11px;
            opacity: 0.75;
        }
}
