﻿/* =========================================================
   GigBroker Print / PDF Styles
   - Hides app chrome
   - Fixes blank pages caused by flex/viewport heights
   - Keeps color in PDF
   - Supports printScope hiding via .gb-print-hide
   ========================================================= */

/* Screen-only: when ?print=1, hide chrome in the print tab */
body.gb-print header,
body.gb-print nav,
body.gb-print .sidebar,
body.gb-print .topbar,
body.gb-print .gb-topbar,
body.gb-print .gb-sidebar,
body.gb-print .navbar,
body.gb-print .workspace-tabs,
body.gb-print .menu-row,
body.gb-print .app-menu,
body.gb-print .gb-menu,
body.gb-print .no-print {
    display: none !important;
}

body.gb-print .container,
body.gb-print .container-fluid {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0.5rem 1rem !important;
    margin: 0 !important;
}

body.gb-print .gb-print-hide {
    display: none !important;
}

/* Print/PDF */
@media print {

    @page {
        margin: 10mm;
    }

    /* Preserve colors (requires "Background graphics" enabled in browser print dialog) */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Hide app chrome + controls */
    header,
    nav,
    .sidebar,
    .topbar,
    .gb-topbar,
    .gb-sidebar,
    .navbar,
    .workspace-tabs,
    .menu-row,
    .app-menu,
    .gb-menu,
    .nav-tabs,
    .btn,
    .btn-group,
    .pagination,
    .js-toggle-btn,
    .no-print,
    .gb-print-hide {
        display: none !important;
    }

    html, body {
        background: #fff !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Remove container spacing that can create top whitespace */
    .container,
    .container-fluid {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    h1, h2, h3, h4, h5 {
        margin-top: 0 !important;
        margin-bottom: .35rem !important;
    }

    /* Print-friendly tables */
    table {
        font-size: 11pt;
    }

    /* Avoid page breaks inside common blocks */
    .card,
    .table,
    .table-responsive {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Fix blank pages caused by flex/viewport height + scroll containers */
    .d-flex {
        display: block !important;
    }

    .flex-fill {
        flex: none !important;
    }

    .gb-cal,
    .gb-cal-toolbar,
    .flex-fill,
    .overflow-auto,
    .table-scroll,
    .lane-scroller,
    .day-frame {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        position: static !important;
    }

    /* Prevent scrollbars forcing pages */
    * {
        overflow: visible !important;
    }

    /* Fit calendar to a single page more reliably (tweak as needed) */
    body.gb-print .gb-cal {
        zoom: 0.86;
        transform-origin: top left;
    }
}
