/**
 * CSS de ImpressÃ£o - INSPEFIRE
 * Corrige o layout de tabelas e garante exibiÃ§Ã£o de headers/legendas ao imprimir
 * CompatÃ­vel com todos os dispositivos e navegadores
 */

@media print {
    /* Remove elementos desnecessÃ¡rios da impressÃ£o */
    nav, .navbar, aside, .sidebar, #leftsidebar, 
    .overlay, .page-loader-wrapper, button, 
    .btn, .navbar-header, .notification {
        display: none !important;
    }

    /* Garante que o body e container principal ocupem toda a pÃ¡gina */
    body {
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: white !important;
        font-size: 12pt !important;
    }

    /* ForÃ§a layout de impressÃ£o em modo paisagem para tabelas grandes */
    @page {
        size: A4 landscape;
        margin: 1cm;
    }

    /* Corrige o problema de tabelas verticais em mobile */
    .table-responsive {
        display: block !important;
        overflow: visible !important;
        width: 100% !important;
        -webkit-overflow-scrolling: auto !important;
        border: none !important;
    }
    
    /* Garante que headers e legendas apareÃ§am */
    h1, h2, h3, h4, h5, h6, .header, .titulo, .legenda {
        display: block !important;
        page-break-after: avoid !important;
        margin-bottom: 10pt !important;
        font-weight: bold !important;
        color: #000 !important;
    }

    /* Legendas e informaÃ§Ãµes do relatÃ³rio */
    .info-relatorio, .cabecalho-relatorio, .dados-empresa {
        display: block !important;
        page-break-inside: avoid !important;
        margin-bottom: 10pt !important;
    }

    /* Remove transformaÃ§Ãµes CSS que podem afetar o layout (exceto em th/td) */
    body, section, div:not(th):not(td), p, span {
        animation: none !important;
        transition: none !important;
        box-shadow: none !important;
    }

    /* Garante visibilidade de todos os elementos importantes */
    .relatorio, .conteudo-relatorio, .dados-tabela,
    .informacoes, .detalhes {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Evita quebra de pÃ¡gina em elementos crÃ­ticos */
    .no-page-break {
        page-break-inside: avoid !important;
    }

    /* Cores de fundo para impressÃ£o (quando necessÃ¡rio) */
    .bg-primary, .bg-info, .bg-success, .bg-warning, .bg-danger {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Remove float e posicionamento absoluto que podem quebrar o layout */
    .float-right, .float-left {
        float: none !important;
    }

    .position-absolute, .position-fixed {
        position: static !important;
    }

    /* Garante que imagens sejam redimensionadas corretamente */
    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid !important;
    }

    /* Remove scrolls e overflow hidden */
    .overflow-auto, .overflow-scroll, .overflow-hidden {
        overflow: visible !important;
    }

    /* Corrige card/containers que podem ocultar conteÃºdo */
    .card, .panel, .container, .container-fluid {
        box-shadow: none !important;
        border: none !important;
        page-break-inside: avoid !important;
    }

    /* Garante que texto seja legÃ­vel */
    .text-white, .text-light {
        color: #000 !important;
    }

    /* Remove mÃ¡ximo de altura que pode cortar conteÃºdo */
    .max-height, .h-100 {
        max-height: none !important;
        height: auto !important;
    }
}
