﻿
@media print {
    body > #wrapper > *:not(.content-page),
    .content-page > *:not(.content),
    .content-page > .content > *:not(.page-content-wrapper),
    .content-page .page-content-wrapper > .container-fluid > *:not(.tab-content),
    .content-page .page-content-wrapper > .container-fluid > *:not(.tab-content) *:not(#custom-dashboard-wrapper),
    #custom-dashboard > *:not(#dashboard-tabs-wrapper),
    #dashboard-tabs-wrapper > *:not(#dashboard-pane-wrapper),
    #dashboard-pane-wrapper .page-content > *:not(.dashboard-page-wrapper),
    #dashboard-pane-wrapper .dashboard-page-wrapper > *:not(.export-page-wrapper, .automatic, .fixed, .dashboard-pane-components-container),
    #dashboard-pane-wrapper .export-page-wrapper > *:not(.dashboard-pane-components-container, .automatic, .fixed) {
        display: none !important;
    }

    body > #wrapper > .content-page,
    .content-page .page-content-wrapper,
    .content-page .page-content-wrapper > .container-fluid,
    #custom-dashboard-wrapper,
    #dashboard-tabs-wrapper,
    #dashboard-pane-wrapper .page-content,
    .dashboard-page-wrapper,
    .export-page-wrapper {
        margin: 0 !important;
        padding: 0 !important;
    }

    #custom-dashboard {
        overflow-x: clip;
        overflow-y: visible;
        zoom: 50%;
    }

    #custom-dashboard.landscape.LETTER {
        width: 22in !important;
        page: letter-landscape;
    }

    #custom-dashboard.portrait.LETTER {
        width: 17in !important;
        page: letter-portrait;
    }

    #custom-dashboard.landscape.WIDESCREEN {
        width: 32in !important;
        page: widescreen-landscape;
    }

    #custom-dashboard.portrait.WIDESCREEN {
        width: 18in !important;
        page: widescreen-portrait;
    }

    #custom-dashboard .dashboard-page-wrapper > .dashboard-pane-components-container .dashboard-component:not([component-type="CONTAINER"]) {
        break-inside: avoid;
    }

    .dashboard-component, .dashboard-component * {
        overflow: clip;
    }

    #custom-dashboard.landscape *:not(.export-page-wrapper) .dashboard-component {
        max-height: 16in !important;
    }

    #custom-dashboard.portrait *:not(.export-page-wrapper) .dashboard-component {
        max-height: 21in !important;
    }

    #custom-dashboard.landscape.WIDESCREEN *:not(.export-page-wrapper) .dashboard-component {
        max-height: 17in !important;
    }

    #custom-dashboard.portrait.WIDESCREEN *:not(.export-page-wrapper) .dashboard-component {
        max-height: 31in !important;
    }

    #custom-dashboard .export-page-wrapper-landscape .dashboard-component,
    #custom-dashboard .export-page-wrapper-landscape .dashboard-component .dashboard-element-chart {
        max-height: 17in !important;
    }

    #custom-dashboard.WIDESCREEN .export-page-wrapper-landscape .dashboard-component,
    #custom-dashboard.WIDESCREEN .export-page-wrapper-landscape .dashboard-component .dashboard-element-chart {
        max-height: 18in !important;
        zoom: 50%
    }

    #custom-dashboard.WIDESCREEN .export-page-wrapper-landscape .dashboard-component .dashboard-element-chart > canvas {
        transform: scale(0.75);
    }

    #custom-dashboard .export-page-wrapper-portrait .dashboard-component,
    #custom-dashboard .export-page-wrapper-portrait .dashboard-component .dashboard-element-chart {
        max-height: 22in !important;
    }

    #custom-dashboard.WIDESCREEN .export-page-wrapper-portrait .dashboard-component,
    #custom-dashboard.WIDESCREEN .export-page-wrapper-portrait .dashboard-component .dashboard-element-chart {
        max-height: 32in !important;
        zoom: 50%;
    }

    #custom-dashboard.WIDESCREEN .export-page-wrapper-portrait .dashboard-component .dashboard-element-chart > canvas {
        transform: scale(0.75);
    }

    @page letter-landscape {
        size: letter landscape;
        height: 8.5in;
    }

    @page letter-portrait {
        size: letter portrait;
        height: 11in;
    }

    @page widescreen-landscape {
        size: 16in 9in;
        height: 9in;
    }

    @page widescreen-portrait {
        size: 9in 16in;
        height: 16in;
    }

    @page export-page-wrapper-landscape {
        size: letter landscape;
        height: 8.5in;
        break-before: page;
        margin-top: .5rem;
    }

    @page export-page-wrapper-portrait {
        size: letter portrait;
        height: 11in;
        break-before: page;
        margin-top: .5rem;
    }

    #custom-dashboard.landscape.LETTER .page-content[page-type="Automatic"],
    #custom-dashboard.LETTER .export-page-wrapper-landscape {
        height: calc(17in - 40px) !important;
        padding: 15px 0px !important;
        justify-self: center;
        aspect-ratio: 11 / 8.5;
    }

    #custom-dashboard.portrait.LETTER .page-content[page-type="Automatic"],
    #custom-dashboard.LETTER .export-page-wrapper-portrait {
        height: calc(22in - 40px) !important;
        padding: 15px 0px !important;
        justify-self: center;
        aspect-ratio: 8.5 / 11;
    }

    #custom-dashboard.landscape.WIDESCREEN .page-content[page-type="Automatic"],
    #custom-dashboard.WIDESCREEN .export-page-wrapper-landscape {
        height: calc(18in - 40px) !important;
        padding: 15px 0px !important;
        justify-self: center;
        aspect-ratio: 16 / 9;
    }

    #custom-dashboard.portrait.WIDESCREEN .page-content[page-type="Automatic"],
    #custom-dashboard.WIDESCREEN .export-page-wrapper-portrait {
        height: calc(32in - 40px) !important;
        padding: 15px 0px !important;
        justify-self: center;
        aspect-ratio: 9 / 16;
    }

    #custom-dashboard .dashboard-page-wrapper {
        height: inherit !important;
        width: inherit !important;
        display: unset !important;
        flex: unset !important;
        flex-direction: unset !important;
    }

    #custom-dashboard .export-page-wrapper {
        justify-content: unset !important;
    }

    #custom-dashboard .dashboard-pane-components-container.fixed {
        height: inherit;
        aspect-ratio: inherit;
    }

    #custom-dashboard.print-preview .dashboard-pane-components-container.fixed,
    #custom-dashboard.print-preview .dashboard-pane-components-container.fixed .dashboard-component {
        zoom: unset;
    }

    .page-content, .dashboard-pane-components-container {
        border: none !important;
        box-shadow: none !important;
        -webkit-box-shadow: none !important;
    }

    /*Base layer html background to be that of Aperture content; first part of stopping full page whitespace at end of content*/
    html {
        background-color: rgb(var(--background-content-dark)) !important;
    }

    /*Moves .dashboard-pane-components-container background styling to be filter on page, second part stopping full page whitespace at end of content*/
    @page {
        background-color: rgb(var(--background-main)) !important;
    }

    /* Makes .dashboard-pane-components-container background styling transparent, third part of stopping full page whitespace at end of content*/
    .page-content, .dashboard-pane-components-container {
        background-color: transparent !important;
        /*display: table !important;*/
    }

    table.grid-table {
        width: unset !important; 
        max-width: 100%;
        min-width: 50%;
    }
}

@media screen {
    body.print-preview > #wrapper > *:not(.content-page),
    body.print.preview .content-page > *:not(.content),
    body.print.preview .topbar,
    body.print.preview .footer,
    body.print.preview .content-page > .content > *:not(.page-content-wrapper),
    body.print-preview .content-page .page-content-wrapper > .container-fluid > *:not(.tab-content),
    body.print-preview .content-page .page-content-wrapper > .container-fluid > *:not(.tab-content) *:not(#custom-dashboard-wrapper),
    #custom-dashboard.print-preview > *:not(#dashboard-tabs-wrapper),
    #custom-dashboard.print-preview #dashboard-pane-wrapper .page-content > *:not(.dashboard-page-wrapper),
    #custom-dashboard.print-preview .dashboard-page-wrapper > *:not(.export-page-wrapper, .automatic, .fixed, .dashboard-pane-components-container),
    #custom-dashboard.print-preview .export-page-wrapper > *:not(.dashboard-pane-components-container, .automatic, .fixed) {
        display: none !important;
    }

    body.print-preview > #wrapper > .content-page,
    body.print-preview .content-page .page-content-wrapper,
    body.print-preview .content-page .page-content-wrapper > .container-fluid,
    #custom-dashboard.print-preview #custom-dashboard-wrapper,
    #custom-dashboard.print-preview #dashboard-tabs-wrapper,
    #custom-dashboard.print-preview #dashboard-pane-wrapper .page-content,
    #custom-dashboard.print-preview .dashboard-page-wrapper,
    #custom-dashboard.print-preview .export-page-wrapper {
        margin: 0 !important;
        padding: 0 !important;
    }

    #print-preview-controls {
        display: none;
        /*position: relative;
        top: 1in;
        right: 1in;*/
    }

    #custom-dashboard.print-preview #print-preview-controls {
        display: block !important;
    }

    body.print-preview #custom-dashboard-wrapper {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    #custom-dashboard.print-preview #dashboard-tabs {
        zoom: 150% !important;
    }

    #custom-dashboard.print-preview {
        zoom: 50%; /*Important for scaling of canvas elements; reduce blurring*/
        margin: 0;
    }

    #custom-dashboard.print-preview.landscape.LETTER {
        width: 22in !important; /*Important for scaling of page, especially canvas elements; sets preview to page ratio instead of screen*/
    }

    #custom-dashboard.print-preview.portrait.LETTER {
        width: 17in !important; /*Important for scaling of page, especially canvas elements; sets preview to page ratio instead of screen*/
    }

    #custom-dashboard.print-preview.landscape.WIDESCREEN {
        width: 32in !important; /*Important for scaling of page, especially canvas elements; sets preview to page ratio instead of screen*/
    }

    #custom-dashboard.print-preview.portrait.WIDESCREEN {
        width: 18in !important; /*Important for scaling of page, especially canvas elements; sets preview to page ratio instead of screen*/
    }

    #custom-dashboard.print-preview .dashboard-page-wrapper > .dashboard-pane-components-container .dashboard-component:not([component-type="CONTAINER"]) {
        break-inside: avoid;
    }

    #custom-dashboard.print-preview.landscape.LETTER .dashboard-component {
        max-height: 16in !important;
    }

    #custom-dashboard.print-preview.landscape.WIDESCREEN .dashboard-component {
        max-height: 17in !important;
    }

    #custom-dashboard.print-preview.portrait.LETTER .dashboard-component {
        max-height: 21in !important;
    }

    #custom-dashboard.print-preview.portrait.WIDESCREEN .dashboard-component {
        max-height: 31in !important;
    }

    #custom-dashboard.LETTER .export-page-wrapper-landscape .dashboard-component,
    #custom-dashboard.LETTER .export-page-wrapper-landscape .dashboard-component .dashboard-element-chart {
        max-height: 17in !important;
        zoom: 50%;
    }

    #custom-dashboard.LETTER .export-page-wrapper-landscape .dashboard-component .dashboard-element-chart > canvas {
        transform: scale(0.75);
    }

    #custom-dashboard.LETTER .export-page-wrapper-portrait .dashboard-component,
    #custom-dashboard.LETTER .export-page-wrapper-portrait .dashboard-component .dashboard-element-chart {
        max-height: 22in !important;
        zoom: 50%;
    }

    #custom-dashboard.LETTER .export-page-wrapper-portrait .dashboard-component .dashboard-element-chart > canvas {
        transform: scale(0.75);
    }

    #custom-dashboard.WIDESCREEN .export-page-wrapper-landscape .dashboard-component,
    #custom-dashboard.WIDESCREEN .export-page-wrapper-landscape .dashboard-component .dashboard-element-chart {
        max-height: 18in !important;
        zoom: 50%;
    }

    #custom-dashboard.WIDESCREEN .export-page-wrapper-landscape .dashboard-component .dashboard-element-chart > canvas {
        transform: scale(0.75);
    }

    #custom-dashboard.WIDESCREEN .export-page-wrapper-portrait .dashboard-component,
    #custom-dashboard.WIDESCREEN .export-page-wrapper-portrait .dashboard-component .dashboard-element-chart {
        max-height: 32in !important;
        zoom: 50%;
    }

    #custom-dashboard.WIDESCREEN .export-page-wrapper-portrait .dashboard-component .dashboard-element-chart > canvas {
        transform: scale(0.75);
    }

    #custom-dashboard.print-preview.landscape.LETTER .export-page-wrapper {
        width: 22in !important;
        aspect-ratio: 11 / 8.5;
    }

    #custom-dashboard.print-preview.portrait.LETTER .export-page-wrapper {
        height: 22in !important;
        aspect-ratio: 8.5 / 11;
    }

    #custom-dashboard.print-preview.landscape.WIDESCREEN .export-page-wrapper {
        width: 32in !important;
        aspect-ratio: 16 / 9;
    }

    #custom-dashboard.print-preview.portrait.WIDESCREEN .export-page-wrapper {
        height: 32in !important;
        aspect-ratio: 9 / 16;
    }

    #custom-dashboard.print-preview .dashboard-page-wrapper {
        height: unset !important;
        width: unset !important;
        display: unset !important;
        flex: unset !important;
        flex-direction: unset !important;
    }

    #custom-dashboard.print-preview .export-page-wrapper {
        justify-content: unset !important;
    }

    #custom-dashboard.print-preview .dashboard-pane-components-container.fixed {
        height: inherit;
        aspect-ratio: inherit;
    }

    #custom-dashboard.print-preview .export-page-wrapper::before {
        content: "\a";
        white-space: pre;
        background: rgb(var(--background-main));
    }

    #custom-dashboard.print-preview .dashboard-pane-components-container.fixed,
    #custom-dashboard.print-preview .dashboard-pane-components-container.fixed .dashboard-component {
        zoom: unset;
    }

    #custom-dashboard.print-preview .dashboard-pane-components-container.fixed .dashboard-component canvas {
        transform: scale(1);
    }

    #custom-dashboard.print-preview.landscape.LETTER .page-content[page-type="Automatic"],
    #custom-dashboard.print-preview.LETTER .export-page-wrapper-landscape {
        height: calc(17in - 40px) !important;
        padding: 15px 0px !important;
        justify-self: center;
        aspect-ratio: 11 / 8.5;
    }

    #custom-dashboard.print-preview.portrait.LETTER .page-content[page-type="Automatic"],
    #custom-dashboard.print-preview.LETTER .export-page-wrapper-portrait {
        height: calc(22in - 40px) !important;
        padding: 15px 0px !important;
        justify-self: center;
        aspect-ratio: 8.5 / 11;
    }

    #custom-dashboard.print-preview.landscape.WIDESCREEN .page-content[page-type="Automatic"],
    #custom-dashboard.print-preview.WIDESCREEN .export-page-wrapper-landscape {
        height: calc(18in - 40px) !important;
        padding: 15px 0px !important;
        justify-self: center;
        aspect-ratio: 16 / 9;
    }

    #custom-dashboard.print-preview.portrait.WIDESCREEN .page-content[page-type="Automatic"],
    #custom-dashboard.print-preview.WIDESCREEN .export-page-wrapper-portrait {
        height: calc(32in - 40px) !important;
        padding: 15px 0px !important;
        justify-self: center;
        aspect-ratio: 9 / 16;
    }
}
