/* Exportar PDF — botão, modal e layout de impressão do relatório
   (design system "Race Engineer Brasil — Relatórios"). Usado por pdf-export.js. */

@font-face {
    font-family: "REB Vast XL";
    font-style: normal;
    font-weight: 300;
    font-display: block;
    src: url("VastXL-Light.otf") format("opentype");
}

/* ------------------------------------------------------------------ */
/* Botão na página do evento                                           */
/* ------------------------------------------------------------------ */

.reb-pdf-export-auto {
    float: right;
    margin: 0 0 0 .8rem;
}

.md-typeset .reb-pdf-btn {
    margin: 0;
    font-size: .7rem;
    cursor: pointer;
}

/* ------------------------------------------------------------------ */
/* Modal                                                               */
/* ------------------------------------------------------------------ */

.reb-pdf-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, .55);
}

.reb-pdf-modal {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 32px);
    background: #fff;
    border-top: 6px solid #cc0000;
    border-radius: 0;
    color: #1a1a1a;
    font: 15px/21px Calibri, Carlito, "Segoe UI", Arial, sans-serif;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}

.reb-pdf-modal *,
.reb-pdf-modal *::before,
.reb-pdf-modal *::after {
    box-sizing: border-box;
}

.reb-pdf-modal h2 {
    margin: 0;
    padding: 20px 24px 12px;
    font: 300 22px/28px "REB Vast XL", "Segoe UI", Arial, sans-serif;
    color: #1a1a1a;
}

.reb-pdf-modal .reb-pdf-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    align-items: center;
    padding: 0 24px 10px;
    border-bottom: 1px solid #d9d9d9;
}

.reb-pdf-modal .reb-pdf-link {
    padding: 0;
    border: 0;
    background: none;
    color: #cc0000;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.reb-pdf-modal .reb-pdf-cover {
    margin-left: auto;
}

.reb-pdf-modal .reb-pdf-list {
    flex: 1 1 auto;
    min-height: 60px;
    margin: 0;
    padding: 8px 24px;
    overflow-y: auto;
    list-style: none;
}

.reb-pdf-modal .reb-pdf-list li {
    margin: 0;
    padding: 0;
}

.reb-pdf-modal label {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 5px 0;
    cursor: pointer;
}

.reb-pdf-modal input[type="checkbox"] {
    flex: none;
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: #cc0000;
}

.reb-pdf-modal .reb-pdf-status {
    padding: 0 24px;
    color: #1a1a1a;
}

.reb-pdf-modal .reb-pdf-status:not(:empty) {
    padding-top: 10px;
    padding-bottom: 4px;
    border-top: 1px solid #d9d9d9;
}

.reb-pdf-modal .reb-pdf-status p {
    margin: 0 0 6px;
}

.reb-pdf-modal .reb-pdf-status .reb-pdf-warn {
    color: #cc0000;
}

.reb-pdf-modal .reb-pdf-status .reb-pdf-note {
    padding: 8px 10px;
    background: #f5f5f5;
    border-left: 3px solid #cc0000;
}

.reb-pdf-modal .reb-pdf-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 14px 24px 20px;
}

.reb-pdf-modal .reb-pdf-actions button {
    min-width: 110px;
    padding: 8px 16px;
    border: 1px solid #1a1a1a;
    border-radius: 0;
    background: #fff;
    color: #1a1a1a;
    font: 600 14px/18px Calibri, Carlito, "Segoe UI", Arial, sans-serif;
    cursor: pointer;
}

.reb-pdf-modal .reb-pdf-actions .reb-pdf-confirm {
    border-color: #cc0000;
    background: #cc0000;
    color: #fff;
}

.reb-pdf-modal .reb-pdf-actions button:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.reb-pdf-modal button:focus-visible,
.reb-pdf-modal input:focus-visible {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
}

/* Iframes ocultos usados para carregar as seções */
.reb-pdf-frame {
    position: fixed;
    left: -20000px;
    top: 0;
    width: 1500px;
    height: 900px;
    border: 0;
    visibility: hidden;
}

/* Durante a captura: mostrar todas as abas para os gráficos ganharem tamanho */
.reb-pdf-reveal .tabbed-set > .tabbed-content > .tabbed-block {
    display: block !important;
}

/* ------------------------------------------------------------------ */
/* Páginas do relatório (16:9, quadro de 1600 × 900 escalado a 0,8)     */
/* ------------------------------------------------------------------ */

#reb-print-root {
    position: absolute;
    left: -20000px;
    top: 0;
    width: 1280px;
    margin: 0;
    padding: 0;
    background: #fff;
}

#reb-print-root .pg {
    position: relative;
    width: 1280px;
    height: 720px;
    overflow: hidden;
    break-after: page;
    page-break-after: always;
    background: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

#reb-print-root .pg:last-child {
    break-after: auto;
    page-break-after: auto;
}

#reb-print-root .canvas {
    position: relative;
    width: 1600px;
    height: 900px;
    background: #fff;
    transform: scale(.8);
    transform-origin: 0 0;
}

#reb-print-root .frame {
    position: absolute;
    inset: 0;
    width: 1600px;
    height: 900px;
}

#reb-print-root .logo {
    position: absolute;
    top: 12px;
    right: 8px;
    width: 87px;
    height: auto;
    max-width: none;
}

#reb-print-root .num {
    position: absolute;
    left: 57px;
    bottom: 12px;
    font: 15px/18px Cambria, Georgia, serif;
    color: #898989;
}

#reb-print-root .content {
    position: absolute;
    left: 110px;
    right: 40px;
    top: 30px;
    bottom: 39px;
    font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif;
    color: #1a1a1a;
}

#reb-print-root .content > h1 {
    margin: 0;
    padding: 0;
    max-width: 1374px;
    overflow: hidden;
    white-space: nowrap;
    border: 0;
    font: 300 30px/36px "REB Vast XL", "Vast XL", "Segoe UI", Arial, sans-serif;
    letter-spacing: normal;
    color: #1a1a1a;
}

/* Área de corpo: y = 110 → 861 no quadro, x = 110 → 1560 */
#reb-print-root .pg-body {
    position: absolute;
    left: 0;
    right: 0;
    top: 80px;
    height: 751px;
    overflow: hidden;
}

/* Capa */
#reb-print-root .cover {
    position: absolute;
    left: 110px;
    right: 120px;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif;
    color: #1a1a1a;
}

#reb-print-root .cover h1 {
    margin: 0 0 28px;
    padding: 0 0 22px;
    border-bottom: 4px solid #cc0000;
    font: 300 64px/76px "REB Vast XL", "Vast XL", "Segoe UI", Arial, sans-serif;
    color: #1a1a1a;
}

#reb-print-root .cover p {
    margin: 0 0 6px;
    font-size: 26px;
    line-height: 34px;
    color: #1a1a1a;
}

#reb-print-root .cover .cover-team {
    font: 300 28px/36px "REB Vast XL", "Vast XL", "Segoe UI", Arial, sans-serif;
}

#reb-print-root .cover .cover-date {
    margin-top: 18px;
    font-size: 18px;
    color: #555;
}

/* ------------------------------------------------------------------ */
/* Reset do Material dentro do corpo das páginas                        */
/* ------------------------------------------------------------------ */

#reb-print-root,
#reb-print-root .md-typeset {
    --md-default-fg-color: #1a1a1a;
    --md-default-fg-color--light: #555;
    --md-default-fg-color--lighter: #898989;
    --md-default-fg-color--lightest: #d9d9d9;
    --md-default-bg-color: #fff;
    --md-typeset-color: #1a1a1a;
    --md-typeset-a-color: #cc0000;
    --md-typeset-table-color: #d9d9d9;
    --md-typeset-table-color--light: #f5f5f5;
    --md-code-bg-color: #f5f5f5;
    --md-code-fg-color: #1a1a1a;
    --md-accent-fg-color: #cc0000;
}

#reb-print-root .md-typeset {
    font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif;
    font-size: 16px;
    line-height: 22px;
    color: #1a1a1a;
    background: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

#reb-print-root .md-typeset > :first-child {
    margin-top: 0 !important;
}

#reb-print-root .md-typeset p,
#reb-print-root .md-typeset ul,
#reb-print-root .md-typeset ol,
#reb-print-root .md-typeset blockquote {
    margin: 0 0 10px;
}

#reb-print-root .md-typeset li {
    margin-bottom: 2px;
}

#reb-print-root .md-typeset h2,
#reb-print-root .md-typeset h3,
#reb-print-root .md-typeset h4,
#reb-print-root .md-typeset h5,
#reb-print-root .md-typeset h6 {
    margin: 14px 0 8px;
    padding: 0;
    border: 0;
    font: 300 18px/24px "REB Vast XL", "Vast XL", "Segoe UI", Arial, sans-serif;
    letter-spacing: normal;
    color: #1a1a1a;
}

#reb-print-root .md-typeset h4,
#reb-print-root .md-typeset h5,
#reb-print-root .md-typeset h6,
#reb-print-root .md-typeset .reb-tab-label {
    font-size: 15px;
    line-height: 20px;
}

#reb-print-root .md-typeset .reb-tab-label {
    padding-left: 8px;
    border-left: 3px solid #cc0000;
}

#reb-print-root .md-typeset a {
    color: #cc0000;
}

#reb-print-root .md-typeset hr {
    margin: 12px 0;
    border: 0;
    border-bottom: 1px solid #d9d9d9;
}

#reb-print-root .md-typeset img,
#reb-print-root .md-typeset svg {
    max-width: 100%;
    height: auto;
}

#reb-print-root .md-typeset figcaption,
#reb-print-root .md-typeset .caption {
    font-size: 12px;
    line-height: 16px;
    color: #555;
}

/* Tabelas */
#reb-print-root .md-typeset__scrollwrap,
#reb-print-root .md-typeset__table {
    display: block;
    margin: 0 0 12px;
    padding: 0;
    overflow: visible;
}

#reb-print-root .md-typeset table,
#reb-print-root .md-typeset table:not([class]) {
    display: table;
    border-collapse: collapse;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    max-width: 100%;
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 18px;
    color: #1a1a1a;
    background: #fff;
}

#reb-print-root .md-typeset table th,
#reb-print-root .md-typeset table:not([class]) th {
    padding: 5px 8px;
    border: 0;
    background: #1a1a1a;
    color: #fff;
    font-weight: 700;
    min-width: 0;
    vertical-align: top;
}

#reb-print-root .md-typeset table td,
#reb-print-root .md-typeset table:not([class]) td {
    padding: 4px 8px;
    border: 0;
    border-top: 1px solid #d9d9d9;
    vertical-align: top;
}

#reb-print-root .md-typeset table tbody tr:nth-child(even) {
    background: #f5f5f5;
}

#reb-print-root .md-typeset table tbody tr:hover {
    background: inherit;
    box-shadow: none;
}

/* Código */
#reb-print-root .md-typeset pre,
#reb-print-root .md-typeset code {
    border-radius: 0;
    font-size: 12px;
    line-height: 16px;
    white-space: pre-wrap;
    word-break: break-word;
}

#reb-print-root .md-typeset pre {
    margin: 0 0 12px;
}

#reb-print-root .md-typeset pre > code {
    padding: 8px 10px;
}

/* Admonitions, cards etc. */
#reb-print-root .md-typeset .admonition,
#reb-print-root .md-typeset details {
    margin: 0 0 12px;
    border-radius: 0;
    box-shadow: none;
    font-size: 15px;
    line-height: 21px;
    break-inside: auto;
}

#reb-print-root .md-typeset .admonition-title,
#reb-print-root .md-typeset summary {
    font-size: 15px;
    line-height: 21px;
}

#reb-print-root .md-typeset .grid.cards > ul > li,
#reb-print-root .md-typeset .grid > .card {
    border-radius: 0;
    box-shadow: none;
}

#reb-print-root .md-typeset .md-button {
    border-radius: 0;
}

/* Gráficos convertidos em imagem */
#reb-print-root .md-typeset img.reb-chart {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Embeds substituídos */
#reb-print-root .md-typeset .reb-embed {
    margin: 0 0 12px;
    padding: 12px 14px;
    border: 1px solid #d9d9d9;
    border-left: 3px solid #cc0000;
    background: #f5f5f5;
    font-size: 14px;
    line-height: 20px;
}

#reb-print-root .md-typeset .reb-embed strong {
    display: block;
    margin-bottom: 2px;
}

#reb-print-root .md-typeset .reb-embed-video {
    display: flex;
    gap: 20px;
    align-items: center;
}

#reb-print-root .md-typeset .reb-embed-thumb {
    position: relative;
    display: block;
    flex: none;
    width: 480px;
    height: 270px;
    overflow: hidden;
    background: #1a1a1a;
}

#reb-print-root .md-typeset .reb-embed-thumb img {
    display: block;
    width: 480px;
    height: 360px;
    max-width: none;
    margin-top: -45px; /* hqdefault é 4:3 com faixas pretas: recorta para 16:9 */
}

#reb-print-root .md-typeset .reb-embed-play {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 72px;
    height: 50px;
    margin: -25px 0 0 -36px;
    background: #cc0000;
    color: #fff;
    font: 26px/50px Arial, sans-serif;
    text-align: center;
}

#reb-print-root .md-typeset .reb-embed-text a {
    word-break: break-all;
}

/* Bloco reduzido para caber */
#reb-print-root .reb-scale {
    overflow: hidden;
    margin: 0 0 12px;
}

#reb-print-root .reb-scale > .reb-scale-inner {
    transform-origin: 0 0;
}

#reb-print-root .reb-scale > .reb-scale-inner > :last-child {
    margin-bottom: 0;
}

/* ------------------------------------------------------------------ */
/* Impressão                                                           */
/* ------------------------------------------------------------------ */

@media print {
    html.reb-printing,
    html.reb-printing body {
        width: auto !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #fff !important;
    }

    html.reb-printing body {
        display: block !important;
    }

    html.reb-printing body > *:not(#reb-print-root) {
        display: none !important;
    }

    html.reb-printing #reb-print-root {
        position: static !important;
        left: auto !important;
        display: block !important;
    }
}
