/**
 * @file print.css
 * @brief Estilos para impressão do ChronoStages
 * 
 * Formata a página para impressão, garantindo clareza e legibilidade.
 * 
 * @author Antonio Todo Bom
 * @date 2025-01-16
 * @version 2.0.0
 * 
 * @copyright (c) 2025 ChronoSat Brasil
 */

@charset "UTF-8";

@media print {
    body {
        background-color: white !important; color: black !important;
        font-family: 'Lucida Sans', Geneva, Verdana, sans-serif !important;
    }

    .w3-table, .w3-table th, .CS-table-all tr, .CS-total-time { color: black !important; }

    .title-box { color: black !important; margin-top:10px; text-align: left !important; }
    
    .title-box .subtitle { font-size: 18px; font-weight: 300; }
    
    .title-box .title { font-size: 28px; font-weight: bold; }
    
    .title-box .description { font-size: 16px; }

    .header-content { flex-direction: row; align-items: flex-start; height: inherit; }
    
    .logo-box { margin-right: 20px; zoom: 0.8; }


    .CS-top-subtitle {
        background-color: white !important;
        color: black !important;
        font-size: 12px !important;
    }

    .CS-signatures {
        background-color: white !important;
    }

    .CS-signature-title {
        background-color: #333;
        color: white;
        margin-bottom: 2px;
    }
    
    .CS-signatures img {
        height: 10mm !important;
    }

    .CS-crew { color: black; }

    .CS-SubHeader {
        padding: 2px 5px !important;
        border: none;
        text-shadow: none !important;
        background: none !important;
        background-color: black !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .header-bar, .CS-info-dialog-box, .CS-RaceHorse, .CS-no-print,
    .tinycarousel, .CS-Details { display: none !important; }

    .CS-print, .CS-print-logo { display: block; }

    .CS-CarNr { color: black !important; font-size: 1.8em !important; }

    .CS-table-container {
        overflow: unset !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        transform: none !important;
        -webkit-overflow-scrolling: unset !important;
        scrollbar-width: unset !important;
        scrollbar-color: unset !important;
        background: white !important;
        border: none !important;
        box-shadow: none !important;
    }

    .CS-table-all tbody tr:nth-child(odd) {
        background-color: #CCC;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .CS-table-all tbody tr:nth-child(even) { background-color: unset; }

    .CS-crewfaces img { background-color: rgba(250, 250, 250, 0.2) !important; }
    
    .CS-crewfaces { height: 64px; }

    .CS-page-title { color: black !important; font-size: 18px !important; }

    .CS-table-container, .CS-table-all {
        zoom:unset; transform: none !important;
        overflow: visible !important;
    }

    .CS-table-all table {
        display: table !important;
        width: 100% !important; 
        table-layout: auto !important;
        border-collapse: collapse !important;
    }

    .CS-table-all thead { display: table-header-group !important; }
    
    .CS-table-all tfoot { display: table-footer-group !important; }
    
    .CS-table-all thead th, .CS-table-all thead td,
    .CS-table-sticky-left,.CS-table-sticky-left-2,.CS-table-sticky-left-3, .CS-scrollable-col,
    .CS-penais, .CS-total {
        left:unset; right: unset;
        width: unset; min-width: unset; max-width: unset;
        position: relative !important;
    }

    .CS-table-sticky-left {
        padding-left: 5px !important;
    }

    .CS-penais, .CS-total {
        padding: 0 20px 0 20px !important;
    }
    
    table, thead, tbody { break-inside: auto !important; }
    
    tr { break-inside: avoid !important; break-after: auto !important; page-break-inside: avoid !important; }
    
    td, th { break-inside: avoid !important; page-break-inside: avoid !important; }
    
    .CS-table-all td, .CS-table-all th { padding: 0 2px 0 2px; }
    
    .w3-table th:first-child, .w3-table td:first-child, .w3-table-all th:first-child,
    .w3-table-all td:first-child {padding-left: 0;}
    
    .CS-table-sticky-left-3 {padding-left:20px;}

    /* Fundo amarelo clarinho no cabeçalho, garantido na impressão */
    .CS-table-all thead tr {
        background-color: #ff5 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .CS-footer {
        display: inline-flex;
    }
    .CS-credits {
        display: none !important;
    }
}

@page {
    /* size: A4 portrait; */
    margin: 10mm 5mm 10mm 5mm;

    @top-left {
        content: "CRONOMETRAGEM E APURAÇÃO";
        font-size: 8pt; font-weight: bold; color: #333;
        border-bottom: 1pt solid #888;
        margin-bottom: 2mm;
    }

    @top-center {
        content: "RESULTADOS POR MODALIDADE/CATEGORIA";
        font-size: 8pt; font-weight: normal; color: #333;
        border-bottom: 1pt solid #888;
        margin-bottom: 2mm;
    }

    @top-right {
        content: "RESULTADOS POR MODALIDADE/CATEGORIA";
        font-size: 8pt; font-weight: normal; color: #333;
        border-bottom: 1pt solid #888;
        margin-bottom: 2mm;
    }


    @bottom-left {
        content: "www.chronosat.com.br";
        font-weight: bold; font-size: 8pt; color: #333;
        border-top: 1pt solid #888;
        margin-top: 2mm;
    }

    @bottom-right {
        content: "ChronoStages @2025 - Página " counter(page) " de " counter(pages);
        font-size: 8pt; color: black; font-weight: normal;
        border-top: 1pt solid #888;
        margin-top: 2mm;
    }

}

/* Remove o topo apenas da primeira página */
@page :first {
    @top-left { content: ""; border-bottom: none; margin-bottom: 0; }
    @top-center { content: ""; border-bottom: none; margin-bottom: 0; }
    @top-right { content: ""; border-bottom: none; margin-bottom: 0; }
}
