/* ═══════════════════════════════════════
   SCHOOLMS — PRINT STYLESHEET
   Target: A4 paper, browser print dialog
   ═══════════════════════════════════════ */

@media print {

    /* ── Robust Layout Reset to Prevent Page Duplication & Truncation ── */
    html, body {
        position: static !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        display: block !important;
    }

    .print-wrapper,
    .print-wrapper-inner,
    .slip-container,
    .voucher-container,
    .expense-voucher-container,
    .noticeboard-container {
        position: static !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* ── Page Setup ── */
    @page {
        size: A4 portrait;
        margin: 12mm 12mm 8mm 12mm;
    }

    @page :first {
        margin-top: 10mm;
    }

    /* ── Hide everything not needed for print ── */
    .no-print,
    nav,
    .navbar,
    .sidebar,
    #sidebar,
    .sidebar-wrapper,
    footer,
    .footer,
    .btn,
    .btn-group,
    .dropdown,
    .breadcrumb,
    .pagination,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate,
    .dataTables_wrapper .dt-buttons,
    .filter-section,
    .card-footer,
    .alert-dismissible .btn-close,
    #filter-bar,
    .action-buttons,
    .fab,
    select,
    input[type="text"],
    input[type="date"],
    input[type="search"] {
        display: none !important;
    }

    /* ── Base reset for print ── */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    html, body:not(.voucher-print-body):not(.salary-print-body):not(.expense-print-body) {
        width: 100% !important;
        font-size: 11pt;
        font-family: 'Arial', sans-serif;
        color: #000 !important;
        background: #fff !important;
    }

    /* Prevent text elements from being split in half at page breaks */
    p, blockquote, address, h1, h2, h3, h4, h5, h6, tr, td, th {
        orphans: 3;
        widows: 3;
    }

    /* ── Remove Bootstrap shadows and borders for print ── */
    .print-wrapper .card {
        border: 0.5pt solid #bbb !important;
        box-shadow: none !important;
        break-inside: avoid;
    }

    .print-wrapper .card-header {
        background-color: #f8f9fa !important;
        border-bottom: 1.5pt solid #000 !important;
    }

    /* ── Layout: remove sidebar spacing ── */
    .main-content,
    .content-area,
    .wrapper,
    main {
        margin-left: 0 !important;
        padding-left: 0 !important;
        width: 100% !important;
    }

    /* ── Tables ── */
    .print-wrapper table,
    table.report-table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 10pt;
        overflow: visible !important;
        border-radius: 0 !important;
    }

    .print-wrapper th, .print-wrapper td {
        border: 0.5pt solid #ccc !important;
        padding: 5px 7px !important;
        text-align: left;
        vertical-align: top;
    }

    .print-wrapper thead {
        display: table-header-group; /* repeat header on every page */
    }

    .print-wrapper thead th {
        background-color: #343a40 !important;
        color: #fff !important;
        font-weight: bold;
        border: 0.5pt solid #343a40 !important;
    }

    .print-wrapper tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Alternating row colors on print */
    .print-wrapper tbody tr:nth-child(even) {
        background-color: #f8f9fa !important;
    }

    /* ── Page break controls ── */
    .page-break-before { page-break-before: always; }
    .page-break-after  { page-break-after: always;  }
    .no-page-break     { page-break-inside: avoid;  }



    /* ── Summary boxes / stat cards on print ── */
    .stat-box-print {
        display: inline-block;
        border: 1px solid #000;
        padding: 8px 15px;
        margin: 4px;
        min-width: 100px;
        text-align: center;
    }

    .stat-box-print .stat-value {
        font-size: 14pt;
        font-weight: bold;
        display: block;
    }

    .stat-box-print .stat-label {
        font-size: 8pt;
        display: block;
    }

    /* ── Hide charts on print (replace with data table) ── */
    canvas,
    .chart-container,
    .chartjs-render-monitor {
        display: none !important;
    }

    /* ── Show print-only elements ── */
    .print-only {
        display: block !important;
    }

    .screen-only {
        display: none !important;
    }

    /* ── Badges — readable on print ── */
    .badge {
        border: 1px solid #000 !important;
        color: #000 !important;
        background: transparent !important;
        padding: 2px 5px;
    }

    /* ── Links — no underline on print ── */
    a {
        color: #000 !important;
        text-decoration: none !important;
    }

    /* ── Fee voucher specific ── */
    .voucher-copy {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .tear-line {
        border-top: 1px dashed #000;
        margin: 8px 0;
        display: block !important;
    }

    /* ── @page binding margins (double-sided / booklet printing) ── */
    @page :left { margin-right: 18mm; }
    @page :right { margin-left: 18mm; }

    /* ── Prevent orphan headings stranded at page bottom ── */
    h3, h4, h5, h6 {
        break-after: avoid;
        page-break-after: avoid;
    }

    /* ── Ensure .text-muted is readable in draft/B&W print ── */
    .text-muted { color: #555 !important; }

    /* ── Bootstrap .table-striped even-row override ── */
    .table-striped > tbody > tr:nth-of-type(even) > * {
        background-color: #f8f9fa !important;
    }

    /* ── tfoot totals row: bold with top rule ── */
    .print-wrapper tfoot td,
    .print-wrapper tfoot th {
        border-top: 2pt solid #000 !important;
        font-weight: bold;
        background-color: #f0f0f0 !important;
    }

    /* ── th vertical centering ── */
    .print-wrapper th {
        vertical-align: middle !important;
    }

    /* ── Opt-in: render input/select as plain text on print ── */
    .print-show-value {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
        -webkit-appearance: none !important;
        appearance: none !important;
    }
}

/* ── Screen: hide print-only elements ── */
@media screen {
    body:not(.print-preview-page) .print-only { display: none !important; }
    body:not(.print-preview-page) .print-header { display: none !important; }
    body:not(.print-preview-page) .print-title { display: none !important; }
    body:not(.print-preview-page) .print-subtitle { display: none !important; }
    body:not(.print-preview-page) .print-footer { display: none !important; }
    body:not(.print-preview-page) .tear-line { display: none !important; }
}

/* ── Print Header, Title & Footer Styles (Global) ── */
.print-header {
    display: flex !important;
    align-items: center;
    gap: 20px;
    border-bottom: 2px solid #000;
    padding-bottom: 10px;
    margin-bottom: 15px;
    text-align: left;
}

.print-header-logo {
    flex-shrink: 0;
}

/* Global table header fill — applies on screen preview AND in print */
.print-wrapper thead th {
    background-color: #343a40 !important;
    color: #fff !important;
    font-weight: bold;
    border: 0.5pt solid #343a40 !important;
}

/* Align numeric values perfectly in columns */
.text-end, .text-right, .text-numeric, td.text-end, th.text-end,
.fee-financial-table td, .sal-financial-table td {
    font-variant-numeric: tabular-nums;
}

.print-header img {
    max-height: 65px;
    width: auto;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.print-header-info {
    flex-grow: 1;
}

/* Affiliation badge — top-right of every standard print header */
.print-header-affiliation {
    flex-shrink: 0;
    text-align: right;
    font-size: 8pt;
    color: #444;
    line-height: 1.4;
    border-left: 2px solid var(--theme-color, #1e3c72);
    padding-left: 8px;
    margin-left: 8px;
}

.print-header-affiliation strong {
    display: block;
    font-size: 7pt;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--theme-color, #1e3c72);
}

.print-header h2 {
    font-size: 12pt;
    font-weight: bold;
    margin: 0 0 2px 0;
    line-height: 1.2;
    text-wrap: balance;
}

.print-header p {
    font-size: 9pt;
    margin: 1px 0;
    color: #333 !important;
    line-height: 1.3;
}

.print-title {
    text-align: center;
    font-size: 13pt;
    font-weight: bold;
    margin: 10px 0 5px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-wrap: balance;
}

.print-subtitle {
    text-align: center;
    font-size: 10pt;
    color: #555 !important;
    margin-bottom: 12px;
}
.print-subtitle:empty {
    display: none;
    margin: 0;
    padding: 0;
}

.print-footer {
    display: block !important;
    border-top: 1px solid #ccc;
    padding-top: 8px;
    margin-top: auto !important;
    font-size: 8pt;
    color: #666 !important;
}

.print-page-num::after {
    content: "1";
}

.print-wrapper-inner {
    flex-grow: 1 !important;
}

.print-wrapper,
.slip-container,
.voucher-container,
.expense-voucher-container,
.noticeboard-container {
    display: flex !important;
    flex-direction: column !important;
}

@media print {
    html, body {
        height: 100% !important;
    }
    .print-wrapper,
    .slip-container,
    .voucher-container,
    .expense-voucher-container,
    .noticeboard-container {
        display: flex !important;
        flex-direction: column !important;
        min-height: 100vh !important;
        box-sizing: border-box !important;
    }
}

/* Fee Voucher Styles */
        
        body.voucher-print-body {
            font-family: 'Inter', Arial, sans-serif;
            margin: 0;
            padding: 0;
            background: #fff;
            color: #111;
            -webkit-print-color-adjust: exact;
            print-color-adjust: exact;
        }
        
        .voucher-container {
            width: 210mm;
            height: 297mm;
            padding: 8mm 10mm;
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }
        
        .fee-copy-section {
            height: 84mm;
            border: 1.2px solid #cbd5e1;
            border-radius: 8px;
            padding: 3mm 4mm;
            box-sizing: border-box;
            position: relative;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            font-size: 10px;
            background: #fff;
        }
        
        /* Copy watermark label */
        .fee-copy-label {
            position: absolute;
            top: 3.5mm;
            right: 4mm;
            background: var(--theme-color);
            color: #fff;
            font-weight: 700;
            font-size: 8px;
            padding: 1px 6px;
            border-radius: 3px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        
        /* Dashed Tear Line */
        .fee-tear-line {
            height: 8px;
            text-align: center;
            border-bottom: 1.2px dashed #64748b;
            position: relative;
            margin: 0.5mm 0;
            user-select: none;
        }
        .fee-tear-line span {
            position: absolute;
            top: 0px;
            left: 50%;
            transform: translateX(-50%);
            background: #fff;
            padding: 0 8px;
            font-size: 8px;
            color: #64748b;
            font-weight: 600;
        }
        
        /* Header styling inside each copy */
        .fee-copy-header {
            display: flex;
            align-items: center;
            border-bottom: 1.5px solid var(--theme-color);
            padding-bottom: 1mm;
            margin-bottom: 1.5mm;
        }
        .fee-copy-header img {
            width: 32px;
            height: 32px;
            object-fit: contain;
            margin-right: 8px;
            image-rendering: -webkit-optimize-contrast;
            image-rendering: crisp-edges;
        }
        .fee-school-info {
            flex: 1;
        }
        .fee-school-info h2 {
            font-size: 12px;
            font-weight: 700;
            margin: 0;
            color: var(--theme-color);
            line-height: 1.1;
        }
        .fee-school-info p {
            margin: 0;
            font-size: 8px;
            color: #475569;
            line-height: 1.1;
        }
        
        /* Tables inside copy */
        .fee-details-grid {
            display: flex;
            gap: 8px;
            margin-bottom: 1.5mm;
        }
        .fee-details-col {
            flex: 1;
        }
        
        .fee-copy-table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 0;
        }
        .fee-copy-table th, .fee-copy-table td {
            border: 1px solid #e2e8f0;
            padding: 1.5px 4px;
            text-align: left;
            font-size: 8.5px;
        }
        .fee-copy-table th {
            background: #f8fafc;
            font-weight: 600;
            color: #334155;
            width: 35%;
        }
        
        /* Financial breakdown table */
        .fee-financial-table {
            width: 100%;
            border-collapse: collapse;
        }
        .fee-financial-table th, .fee-financial-table td {
            border: 1px solid #cbd5e1;
            padding: 2px 5px;
            text-align: left;
            font-size: 8.5px;
        }
        .fee-financial-table th {
            background: var(--theme-color);
            color: #fff;
            font-weight: 600;
            padding: 3px 5px;
        }
        
        .fee-total-row {
            font-weight: 700;
            background: #f8fafc;
        }
        .fee-total-row td {
            font-size: 9px;
            color: #000;
        }
        
        /* Footer area with signatures */
        .fee-copy-footer {
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
            margin-top: 1mm;
        }
        .fee-remarks-text {
            font-size: 7.5px;
            color: #475569;
            max-width: 65%;
            line-height: 1.1;
        }
        .fee-signature-lines {
            display: flex;
            gap: 15px;
        }
        .fee-sig-box {
            border-top: 1px solid #334155;
            width: 65px;
            text-align: center;
            font-size: 7.5px;
            padding-top: 1px;
            margin-top: 6px;
        }
        
        /* Button style for top action bar */
        .fee-no-print-bar {
            background: #f8f9fa;
            border: 1px solid #ddd;
            border-radius: 8px;
            padding: 10px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 210mm;
            max-width: 100%;
            margin: 0 auto 20px auto;
        }
        
        @media print {
            .fee-no-print-bar {
                display: none !important;
            }
            body.voucher-print-body {
                background: none;
            }
        }

/* Salary Slip Styles */
        
        body.salary-print-body {
            font-family: 'Inter', Arial, sans-serif;
            margin: 0;
            padding: 0;
            background: #fff;
            color: #111;
            -webkit-print-color-adjust: exact;
            print-color-adjust: exact;
        }
        
        .slip-container {
            width: 210mm;
            height: 297mm;
            padding: 15mm;
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
            gap: 15mm;
        }
        
        .sal-copy-section {
            border: 1.5px solid #cbd5e1;
            border-radius: 8px;
            padding: 8mm;
            box-sizing: border-box;
            position: relative;
            font-size: 12px;
            background: #fff;
        }
        
        .sal-copy-label {
            position: absolute;
            top: 5mm;
            right: 5mm;
            background: var(--theme-color);
            color: #fff;
            font-weight: 700;
            font-size: 10px;
            padding: 2px 8px;
            border-radius: 4px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        
        .sal-tear-line {
            height: 10px;
            text-align: center;
            border-bottom: 1.5px dashed #64748b;
            position: relative;
            margin: 0;
            user-select: none;
        }
        .sal-tear-line span {
            position: absolute;
            top: -2px;
            left: 50%;
            transform: translateX(-50%);
            background: #fff;
            padding: 0 10px;
            font-size: 10px;
            color: #64748b;
            font-weight: 600;
        }
        
        .sal-copy-header {
            display: flex;
            align-items: center;
            border-bottom: 2px solid var(--theme-color);
            padding-bottom: 4mm;
            margin-bottom: 4mm;
        }
        .sal-copy-header img {
            width: 45px;
            height: 45px;
            object-fit: contain;
            margin-right: 12px;
            image-rendering: -webkit-optimize-contrast;
            image-rendering: crisp-edges;
        }
        .sal-school-info h2 {
            font-size: 18px;
            font-weight: 700;
            margin: 0 0 2px 0;
            color: var(--theme-color);
        }
        .sal-school-info p {
            margin: 0;
            font-size: 11px;
            color: #475569;
        }

        .sal-details-grid {
            display: flex;
            gap: 15px;
            margin-bottom: 4mm;
        }
        .sal-details-col {
            flex: 1;
        }
        
        .sal-copy-table {
            width: 100%;
            border-collapse: collapse;
        }
        .sal-copy-table th, .sal-copy-table td {
            border: 1px solid #e2e8f0;
            padding: 4px 8px;
            text-align: left;
            font-size: 11px;
        }
        .sal-copy-table th {
            background: #f8fafc;
            font-weight: 600;
            color: #334155;
            width: 40%;
        }

        .sal-financial-table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 4mm;
        }
        .sal-financial-table th, .sal-financial-table td {
            border: 1px solid #e2e8f0;
            padding: 6px 10px;
            text-align: right;
            font-size: 11px;
        }
        .sal-financial-table th.left-align, .sal-financial-table td.left-align {
            text-align: left;
        }
        .sal-financial-table th {
            background: #f1f5f9;
            font-weight: 600;
            color: #1e293b;
        }
        .sal-financial-table .grand-total {
            background: var(--theme-color);
            color: white;
            font-weight: bold;
            font-size: 13px;
        }
        .sal-financial-table .grand-total td {
            border-color: var(--theme-color);
        }
        
        .signatures {
            display: flex;
            justify-content: space-between;
            margin-top: 8mm;
            padding: 0 10mm;
        }
        .sal-sig-box {
            text-align: center;
            width: 40%;
            border-top: 1px solid #111;
            padding-top: 4px;
            font-size: 10px;
            font-weight: 600;
        }
        .centered-footer {
            text-align: center;
            font-size: 10px;
            color: #64748b;
            margin-top: 5mm;
        }
        
        @media screen {
            body.print-preview-page,
            body.salary-print-body,
            body.voucher-print-body,
            body.expense-print-body,
            body.noticeboard-print-body {
                background: #f1f5f9 !important;
                padding: 20px !important;
                display: flex !important;
                flex-direction: column !important;
                align-items: center !important;
                justify-content: flex-start !important;
                min-height: 100vh !important;
            }
            .slip-container,
            .voucher-container,
            .expense-voucher-container,
            .noticeboard-container {
                background: #fff !important;
                box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
                margin: 0 auto 20px auto !important;
                height: auto !important;
                border: 1px solid #cbd5e1 !important;
            }
            /* Only apply 210mm width + flex to .no-print on the dedicated print-body pages,
               NOT globally — otherwise profile page buttons become full-width */
            body.salary-print-body .no-print,
            body.voucher-print-body .no-print,
            body.expense-print-body .no-print,
            body.noticeboard-print-body .no-print,
            .fee-no-print-bar {
                text-align: center !important;
                margin-bottom: 20px !important;
                width: 210mm !important;
                max-width: 100% !important;
                margin-left: auto !important;
                margin-right: auto !important;
                display: flex !important;
                justify-content: center !important;
                gap: 10px !important;
            }
        }
        @media print {
            .no-print { display: none !important; }
        }

        /* True Print Preview Screen Layout */
        @media screen {
            body.print-preview-page {
                background-color: #f1f5f9 !important;
                padding: 20px !important;
                display: flex !important;
                flex-direction: column !important;
                align-items: center !important;
                justify-content: flex-start !important;
                min-height: 100vh !important;
            }

            body.print-preview-page .print-wrapper,
            body.print-preview-page .slip-container,
            body.print-preview-page .expense-voucher-container,
            body.print-preview-page .noticeboard-container {
                background: #fff !important;
                box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
                margin: 0 auto 20px auto !important;
                border: 1px solid #cbd5e1 !important;
                width: 210mm !important;
                min-height: 297mm !important;
                padding: 15mm 12mm 8mm 12mm !important;
                box-sizing: border-box !important;
                position: relative !important;
            }

            body.print-preview-page .slip-container,
            body.print-preview-page .expense-voucher-container {
                padding: 10mm 15mm !important;
            }

            body.print-preview-page .print-header {
                display: flex !important;
            }
            body.print-preview-page .print-footer {
                display: block !important;
            }

            /* Scope .no-print width to wrapper divs only, not inline btn elements */
            body.print-preview-page .no-print:not(.btn):not(button):not(a),
            body.print-preview-page .fee-no-print-bar {
                width: 210mm !important;
                max-width: 100% !important;
                margin: 0 auto 20px auto !important;
                display: flex !important;
                justify-content: center !important;
                gap: 10px !important;
            }
        }

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



.expense-voucher-container {
    width: 210mm;
    height: 297mm;
    padding: 10mm 15mm;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6mm;
}

.expense-header {
    display: flex;
    align-items: center;
    border-bottom: 2px solid #000;
    padding-bottom: 3mm;
    margin-bottom: 4mm;
}

.expense-logo {
    max-height: 45px;
    width: auto;
    margin-right: 12px;
}

.expense-school-info {
    flex-grow: 1;
}

.expense-school-info h2 {
    font-size: 11pt;
    font-weight: bold;
    margin: 0 0 2px 0;
    color: #000;
}

.expense-school-info p {
    font-size: 9pt;
    margin: 0;
    color: #475569;
}

.expense-title-block {
    text-align: right;
}

.expense-title {
    font-size: 11pt;
    font-weight: bold;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.expense-date {
    font-size: 9pt;
    color: #475569;
    margin-top: 2px;
}

.expense-body {
    margin-bottom: 5mm;
}

.expense-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 10mm;
}

.expense-sig-box {
    border-top: 1px solid #000;
    width: 45%;
    text-align: center;
    font-size: 9pt;
    padding-top: 4px;
}

/* Notice Board Print Styles */
.noticeboard-container {
    width: 100%;
    max-width: 210mm;
    margin: 0 auto;
    padding: 15mm;
    border: 4px double #1e3c72;
    border-radius: 12px;
    background: #fff;
    box-sizing: border-box;
    position: relative;
}

.noticeboard-banner {
    background-color: #1e3c72 !important;
    color: #fff !important;
    text-align: center;
    padding: 8px 0;
    font-size: 16pt;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8mm;
    border-radius: 4px;
}

.noticeboard-meta-table {
    width: 100%;
    margin-bottom: 8mm;
    border-collapse: collapse;
}

.noticeboard-meta-table td {
    padding: 8px 12px !important;
    border: 1px solid #cbd5e1 !important;
    font-size: 11pt;
}

.noticeboard-meta-label {
    font-weight: bold;
    background-color: #f8fafc !important;
    width: 20%;
    color: #1e3c72;
}

.noticeboard-title {
    font-size: 20pt;
    font-weight: 800;
    color: #1e3c72;
    text-align: center;
    margin: 8mm 0 6mm 0;
    line-height: 1.3;
}

.noticeboard-title span {
    border-bottom: 2.5px solid #1e3c72;
    padding-bottom: 4px;
    display: inline-block;
}

.noticeboard-body-text {
    font-size: 12pt;
    line-height: 1.8;
    color: #111;
    margin-bottom: 12mm;
    white-space: pre-wrap;
    text-align: justify;
}

.noticeboard-sign-section {
    display: flex;
    justify-content: flex-end;
    margin-top: 15mm;
}

.noticeboard-sig-block {
    width: 220px;
    text-align: center;
}

.noticeboard-sig-line {
    border-top: 1.5px solid #1e3c72;
    margin-bottom: 6px;
}

.noticeboard-sig-title {
    font-size: 10pt;
    font-weight: bold;
    color: #1e3c72;
}

.noticeboard-sig-sub {
    font-size: 9pt;
    color: #475569;
}

/* ═══════════════════════════════════════
   SCREEN ENHANCEMENTS
   ═══════════════════════════════════════ */

/* ── Sticky print action toolbar ── */
@media screen {
    .print-action-bar {
        position: sticky;
        top: 0;
        z-index: 200;
        background: rgba(248, 249, 250, 0.96);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        border-bottom: 1px solid #dee2e6;
        padding: 10px 20px !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 20px 0 !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
        box-sizing: border-box;
    }
}

/* ── Dark mode guard: keep print preview white regardless of OS theme ── */
@media screen and (prefers-color-scheme: dark) {
    body.print-preview-page {
        background: #b8bec6 !important;
    }
    body.print-preview-page .print-wrapper,
    body.print-preview-page .slip-container,
    body.print-preview-page .expense-voucher-container,
    body.print-preview-page .noticeboard-container {
        color: #000 !important;
        background: #fff !important;
    }
    body.print-preview-page .print-header,
    body.print-preview-page .print-header h2,
    body.print-preview-page .print-header p {
        color: #000 !important;
    }
    .print-action-bar {
        background: rgba(220, 224, 230, 0.97) !important;
        border-bottom-color: #aaa !important;
    }
}

/* ── Watermark overlay — activate by rendering .print-watermark-text inside {% block print_watermark %} ── */
.print-watermark-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-42deg);
    font-size: 72pt;
    font-weight: 900;
    color: rgba(0, 0, 0, 0.055);
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    z-index: 0;
    letter-spacing: 10px;
    text-transform: uppercase;
}

/* ═══════════════════════════════════════
   COMMON ENHANCEMENTS — ALL TEMPLATE TYPES
   Extends .print-wrapper rules to noticeboard, fee voucher,
   salary slip, and expense voucher containers
   ═══════════════════════════════════════ */

/* ── D: Communication / Noticeboard table header fill ── */
.noticeboard-container table thead th {
    background-color: #1e3c72 !important;
    color: #fff !important;
    font-weight: bold;
    vertical-align: middle;
}
.noticeboard-container table tfoot td,
.noticeboard-container table tfoot th {
    border-top: 2pt solid #1e3c72 !important;
    font-weight: bold;
    background-color: #f0f0f0 !important;
}
.noticeboard-container table td,
.noticeboard-container table th {
    font-variant-numeric: tabular-nums;
}

/* ── E: Fee Voucher table enhancements ── */
.fee-financial-table tfoot td,
.fee-financial-table tfoot th,
.fee-copy-table tfoot td,
.fee-copy-table tfoot th {
    border-top: 1.5pt solid #000 !important;
    font-weight: bold;
    background-color: #f8fafc !important;
}
.fee-financial-table td,
.fee-copy-table td {
    font-variant-numeric: tabular-nums;
}

/* ── F: Salary slip table enhancements ── */
.sal-financial-table tfoot td,
.sal-financial-table tfoot th,
.sal-copy-table tfoot td,
.sal-copy-table tfoot th {
    border-top: 2pt solid #000 !important;
    font-weight: bold;
    background-color: #f0f0f0 !important;
}
.sal-financial-table td,
.sal-copy-table td {
    font-variant-numeric: tabular-nums;
}

/* ── F: Expense voucher table enhancements ── */
.expense-voucher-container table thead th {
    background-color: #343a40 !important;
    color: #fff !important;
    font-weight: bold;
    vertical-align: middle;
}
.expense-voucher-container table tfoot td,
.expense-voucher-container table tfoot th {
    border-top: 2pt solid #000 !important;
    font-weight: bold;
    background-color: #f0f0f0 !important;
}
.expense-voucher-container table td,
.expense-voucher-container table th {
    font-variant-numeric: tabular-nums;
}

/* ── Page numbering ── */
@media print {
    .print-page-number {
        display: none !important;
    }
}
@media screen {
    .print-page-number {
        display: none !important;
    }
}

