/* 
 * S10 PRINT STYLES
 * Reportes de alta fidelidad tipo S10 Desktop
 * [AGENTE 4] S10 Web 300%
 */

@media print {
    /* Ocultar elementos de la interfaz web */
    nav, 
    .sidebar, 
    .toolbar, 
    .bg-white.border-b.shadow-sm.sticky.top-0, /* Header de S10 */
    #apu-pane,
    #s10-tree,
    button,
    .btn,
    .lock-badge,
    #ia-anomaly-badge,
    .ml-auto.flex.items-center.gap-2,
    .bg-slate-200\/80.px-2.pt-2.rounded-t-xl, /* Tabs de secciones */
    [onclick] { 
        display: none !important; 
    }

    /* Reset de contenedores */
    #app-container, 
    #s10-wrapper, 
    #s10-budget-view {
        display: block !important;
        position: static !important;
        overflow: visible !important;
        height: auto !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }

    /* Configuración de página */
    @page {
        size: A4 landscape;
        margin: 1.5cm 1cm;
    }

    body {
        font-family: "Segoe UI", Arial, sans-serif;
        font-size: 8pt;
        line-height: 1.2;
        color: #000;
        background: white !important;
    }

    /* Tabla principal */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    th {
        background: #1e293b !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-weight: bold;
        text-transform: uppercase;
        font-size: 7pt;
        border: 1px solid #000 !important;
        padding: 6px 4px !important;
    }

    td {
        border: 1px solid #94a3b8 !important;
        padding: 4px 6px !important;
        font-size: 7.5pt;
    }

    /* Estilos para títulos (Secciones del S10) */
    .s10-row-title,
    tr.is-title {
        background: #f1f5f9 !important;
        font-weight: bold !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    tr.is-title td {
        text-transform: uppercase;
    }

    /* Alineaciones */
    .text-right { text-align: right !important; }
    .text-center { text-align: center !important; }
    .font-mono { font-family: "Courier New", monospace !important; }

    /* Forzar visibilidad de bordes */
    table, th, td {
        border: 1px solid #000 !important;
    }

    /* Pie de página de reporte */
    .print-footer {
        display: block !important;
        position: fixed;
        bottom: 0;
        width: 100%;
        font-size: 7pt;
        border-top: 1px solid #ccc;
        text-align: right;
        padding-top: 5px;
        color: #666;
    }

    .print-footer::after {
        content: "Generado por Tensor ERP S10 Cloud - Página " counter(page);
    }
}

/* Clases auxiliares para el modo impresión disparado por JS */
.printing-mode .flex-1.overflow-auto {
    overflow: visible !important;
    height: auto !important;
}
