﻿/* ================= PDF / PRINT OPTIMIZATION ================= */
@media print {

    /* -------- Page -------- */
    @page {
        size: A4;
        margin: 5mm;
    }

    html, body {
        background: #fff !important;
        color: #000 !important;
        font-size: 11pt;
        line-height: 1;
    }

    /* -------- Typography -------- */
    h1 {
        font-size: 20pt;
    }

    h2 {
        font-size: 14pt;
    }

    h3 {
        font-size: 12pt;
        margin-bottom: 5px;
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    p {
        color: #000 !important;
        orphans: 3;
        widows: 3;
    }

    a {
        color: #000 !important;
        text-decoration: underline;
    }

    /* -------- Hide UI -------- */
    header,
    nav,
    .logo-panel,
    .menu,
    .actions,
    .pdf-actions,
    .no-print {
        display: none !important;
    }

    /* -------- Cards -------- */
    .card {
        box-shadow: none !important;
    }

    /* 🔥 CORE FIX (NO EMPTY PAGES) */
    .figure-card {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .figure {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    img {
        display: block;
        margin: 0 auto;
        max-width: 90% !important;
        max-height: 175mm !important;
        height: auto !important;
        width: auto !important;
        object-fit: contain !important;
        padding: 4px;
        background: #fff;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* -------- Columns collapse -------- */
    .columns {
        display: block !important;
    }

    /* -------- Footer -------- */
    footer {
        font-size: 9pt;
        color: #555;
        text-align: center;
        page-break-before: avoid;
    }
}
