﻿@media print {
    body * {
        visibility: hidden;
        font-size: 7pt;
    }

    body.dashboard-print-mode,
    html.dashboard-print-mode {
        background: #ffffff !important;
    }

    body.dashboard-print-mode * {
        visibility: hidden !important;
    }

    body.dashboard-print-mode * {
        display: none !important;
    }

    body.dashboard-print-mode #dashboard-print-host,
    body.dashboard-print-mode #dashboard-print-host * {
        visibility: visible !important;
        display: revert !important;
    }

    body.dashboard-print-mode #dashboard-print-host {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        display: block !important;
        background: #ffffff !important;
        color-scheme: light !important;
    }

    body.dashboard-print-mode #dashboard-print-host > * {
        position: static;
        width: 100%;
        padding: 12mm;
        box-sizing: border-box;
        background: #ffffff !important;
        color: #111827 !important;
        font-size: 12px;
        display: block !important;
        --bs-body-bg: #ffffff;
        --bs-body-color: #111827;
        --bs-secondary-color: #4b5563;
        --bs-border-color: #d0d7de;
        --kfx-input-bg: #ffffff;
        --kfx-input-border: #d0d7de;
        --kfx-text-primary: #111827;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body.dashboard-print-mode #dashboard-print-host .card,
    body.dashboard-print-mode #dashboard-print-host .card-body,
    body.dashboard-print-mode #dashboard-print-host .dashboard-chart-card,
    body.dashboard-print-mode #dashboard-print-host .dashboard-empty-state,
    body.dashboard-print-mode #dashboard-print-host .dashboard-forecast-tile {
        background: #ffffff !important;
        color: #111827 !important;
        border-color: #d0d7de !important;
    }

    body.dashboard-print-mode #dashboard-print-host .dashboard-chart-card__meta,
    body.dashboard-print-mode #dashboard-print-host .dashboard-print-header__eyebrow,
    body.dashboard-print-mode #dashboard-print-host .dashboard-print-header__subtitle,
    body.dashboard-print-mode #dashboard-print-host .dashboard-empty-state__content p {
        color: #4b5563 !important;
    }

    body.dashboard-print-mode #dashboard-print-host svg text {
        fill: #111827 !important;
    }

    body.dashboard-print-mode .dashboard-print-area {
        display: flex !important;
        flex-direction: column;
        gap: 1rem;
    }

    body.dashboard-print-mode .dashboard-print-header {
        display: flex !important;
        flex-direction: column;
        gap: 0.25rem;
        padding-bottom: 0.85rem;
        margin-bottom: 1rem;
        border-bottom: 1px solid #d0d7de;
    }

    body.dashboard-print-mode .dashboard-chart-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
        align-items: start;
    }

    body.dashboard-print-mode .dashboard-chart-card,
    body.dashboard-print-mode .dashboard-empty-state,
    body.dashboard-print-mode .dashboard-forecast-tile {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    body.dashboard-print-mode .dashboard-chart-card {
        min-height: auto !important;
        border: 1px solid #d0d7de !important;
        box-shadow: none !important;
    }

    body.dashboard-print-mode .dashboard-chart-card__body {
        gap: 0.9rem;
    }

    body.dashboard-print-mode .dashboard-chart-card .rz-chart,
    body.dashboard-print-mode .dashboard-chart-card svg {
        max-width: 100%;
    }

    body.dashboard-print-mode .dashboard-empty-state .btn,
    body.dashboard-print-mode #DashboardExportButton,
    body.dashboard-print-mode #DashboardManageReportsButton,
    body.dashboard-print-mode .dashboard-chart-toggle {
        display: none !important;
    }

    @page {
        size: A4 landscape;
        margin: 12mm;
    }

    #printThis, #printThis * {
        visibility: visible;
    }

    #printThis {
        position: absolute;
        left: 0;
        top: 0;
    }
    .table-responsive {
        width: 100%;
        height: 100%;
        overflow: unset;
        overflow-y: unset;
        margin: 0 0;
        padding: 0;
    }
    .col-6 {
        display: block; /* Force columns to stack */
        width: 100%; /* Take full width */
        page-break-before: always; /* Force a new page break before each column */
    }
    .row {
        display: block;
        margin: 0;
    }

    .container, .row {
        width: 90%;
        max-width: none; /* Remove any max-width restrictions */
        padding: 0;
        margin: 0;
    }

}
