/* team2 task 458 D3 (lane C): phones, zooming and printing on every layout page. Our own file: it loads only while
   tq_d3_settings.d3_mode = 'on', after the theme's css.
   Why: wide tables need a sideways scroll on narrow screens; the viewer needs its look; no shop page has a print layout,
        so a printed page carries the menus and buttons and comes out differently in each browser.
   How: only our own tq-d3 classes outside @media print; inside it, one layout for every layout page. */
.tq-d3-x {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 991.98px) {
    .tq-d3-x > table {
        white-space: nowrap;
    }
}

#tq-d3-viewer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2147483000;
    display: flex;
    flex-direction: column;
    background: #525659;
}

.tq-d3-bar {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: #2f3237;
}

.tq-d3-b {
    min-width: 38px;
    padding: 6px 10px;
    border: 1px solid #8a8d93;
    border-radius: 4px;
    background: #fff;
    color: #2f3237;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.tq-d3-z {
    min-width: 48px;
    color: #fff;
    font-size: 14px;
    text-align: center;
}

.tq-d3-note {
    display: none;
    flex: 0 0 auto;
    padding: 6px 10px;
    background: #fff3cd;
    color: #2f3237;
    font-size: 14px;
}

.tq-d3-box {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.tq-d3-box iframe {
    display: block;
    border: 0;
    background: #fff;
    transform-origin: 0 0;
}

@media print {
    @page {
        size: A4;
        margin: 12mm;
    }

    html,
    body {
        height: auto !important;
        min-width: 0 !important;
        background: #fff !important;
    }

    .main-menu,
    .header-navbar,
    .header-navbar-shadow,
    .content-overlay,
    .footer,
    .scroll-top,
    .sidenav-overlay,
    .drag-target,
    .btn,
    .dt-buttons,
    .dataTables_length,
    .dataTables_filter,
    .dataTables_paginate,
    .pagination,
    .modal-backdrop,
    #toast-container,
    #tq-d3-viewer {
        display: none !important;
    }

    .app-content,
    .content-wrapper,
    .content-body {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* A4 less the margins is 703 px, under the theme's 768 px line, so its phone rule puts 97 px above the title: this one outweighs it */
    html body .app-content.content {
        padding: 0 !important;
    }

    .card {
        border: 0 !important;
        box-shadow: none !important;
    }

    /* the theme holds a .table-responsive to 500 px: with only the overflow lifted, the words after a long table print over its rows */
    .table-responsive,
    .tq-d3-x {
        max-height: none !important;
        overflow: visible !important;
    }

    /* a wide table must fit the paper: without this the theme's cell padding pushes columns off the right edge, and a column
       that falls off the paper is lost without any sign */
    table {
        width: 100% !important;
        max-width: 100% !important;
        font-size: 9pt;
    }

    /* a cell never breaks inside a figure or a word: `anywhere` printed 20,000, over 00. It is set here because .card's own word-wrap reaches every cell */
    th,
    td {
        padding: 2px 4px !important;
        overflow-wrap: normal !important;
        white-space: normal !important;
    }

    /* many columns: smaller print keeps them on the paper. Chrome also shrinks a page to fit, but only up to a table about 1,054 px wide: past that, columns are cut
       without any sign. Under 10 columns nothing changes. A browser without :has() skips these rules */
    table:has(tr > :nth-child(10)) {
        font-size: 8pt;
    }

    table:has(tr > :nth-child(13)) {
        font-size: 6.5pt;
    }

    table:has(tr > :nth-child(17)) {
        font-size: 5pt;
    }

    table:has(tr > :nth-child(21)) {
        font-size: 4.5pt;
    }

    table:has(tr > :nth-child(10)) th,
    table:has(tr > :nth-child(10)) td {
        padding: 1px 2px !important;
        font-size: inherit !important;
        letter-spacing: 0 !important;
        text-transform: none !important;
    }

    thead {
        display: table-header-group;
    }

    tr {
        page-break-inside: avoid;
    }
}
