@media print {
    /* Hide all UI elements */
    nav,
    .navbar,
    .sidebar,
    .breadcrumb,
    .header-actions,
    .module-actions,
    .action-buttons,
    .btn,
    button:not(.print-only),
    .filter-card,
    .no-print,
    [data-aos],
    footer,
    .pagination,
    .alert,
    .toast,
    .modal,
    .dropdown-menu,
    .tooltip,
    .popover {
        display: none !important;
    }

    /* Page setup */
    @page {
        size: A4;
        margin: 1.5cm;
    }

    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
        line-height: 1.4;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Remove backgrounds and shadows - but keep content visible */
    body > *:not(.profit-loss-report):not(.container):not(.container-fluid) {
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Ensure main content is visible */
    .profit-loss-report,
    .container,
    .container-fluid,
    .row,
    [class*="col-"] {
        display: block !important;
        visibility: visible !important;
    }

    /* Show content containers */
    .card-body,
    .card-content,
    .erp-card-body,
    .detail-card,
    .statement-card,
    .accounts-card,
    .financial-card {
        display: block !important;
        visibility: visible !important;
        background: white !important;
    }

    /* Headers */
    h1, h2, h3, h4, h5, h6 {
        color: black !important;
        page-break-after: avoid;
    }

    /* Links */
    a {
        color: black !important;
        text-decoration: underline !important;
    }

    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
    }

    /* Tables */
    table {
        border-collapse: collapse !important;
        width: 100% !important;
        page-break-inside: avoid;
    }

    table td,
    table th {
        border: 1px solid #ddd !important;
        padding: 0.5rem !important;
    }

    table thead {
        display: table-header-group;
    }

    table tfoot {
        display: table-footer-group;
    }

    /* Cards */
    .card,
    .erp-card,
    .detail-card {
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
        margin-bottom: 1rem !important;
    }

    .card-header,
    .erp-card-header {
        background: #f5f5f5 !important;
        border-bottom: 2px solid #000 !important;
    }

    /* Icons - hide in print */
    i.fas,
    i.far,
    i.fab,
    .fa,
    [class^="fa-"],
    [class*=" fa-"] {
        display: none !important;
    }

    /* Colors - convert to black/white */
    .text-primary,
    .text-success,
    .text-danger,
    .text-warning,
    .text-info {
        color: black !important;
    }

    .bg-primary,
    .bg-success,
    .bg-danger,
    .bg-warning,
    .bg-info {
        background: #f5f5f5 !important;
        color: black !important;
    }

    /* Remove animations */
    * {
        animation: none !important;
        transition: none !important;
    }

    /* Page breaks */
    .page-break-before {
        page-break-before: always;
    }

    .page-break-after {
        page-break-after: always;
    }

    .no-break {
        page-break-inside: avoid;
    }

    /* Print footer */
    .print-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 9pt;
        color: #666;
        border-top: 1px solid #ddd;
        padding: 0.5rem;
    }

    /* Print header */
    .print-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 10pt;
        color: #666;
        border-bottom: 1px solid #ddd;
        padding: 0.5rem;
    }

    /* Container adjustments */
    .container,
    .container-fluid {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Remove padding and margins */
    .row {
        margin: 0 !important;
        page-break-inside: avoid;
    }

    [class*="col-"] {
        padding: 0.5rem !important;
    }
}
