/* CSS - Estilos do Custo Total */

:root {
    --primary-color: #0056b3;
    --text-color-main: #333333;
    --text-color-muted: #555555;
    --bg-card: #ffffff;
    --bg-header: #f8f9fa;
    --bg-zebra: #fafafa;
    --border-color: #e0e0e0;
    --focus-ring: #0056b3;
}

*, 
*::before, 
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #fcfcfc;
    color: var(--text-color-main);
}

/* Utilitário para leitores de tela (Acessibilidade WCAG) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Seção Principal */
.ctf-section {
    width: 100%;
    max-width: 1000px; 
    margin: 2rem auto;
    padding: 20px;
}

/* Títulos e Textos */
.ctf-title {
    font-size: 1.6rem;
    color: var(--text-color-main);
    margin-top: 0;
    margin-bottom: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.ctf-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color-muted);
    margin-bottom: 2rem;
}

.ctf-text a {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 600;
}

.ctf-text a:focus,
.ctf-text a:hover {
    color: #003d80;
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

/* Container Responsivo de Tabela */
.ctf-table-container {
    margin-bottom: 2.5rem;
}

.ctf-table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.ctf-table-responsive:focus {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

/* Estilização das Tabelas Padrão (Desktop / Telas Médias) */
.ctf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.ctf-caption {
    padding: 14px 16px;
    font-weight: 700;
    text-align: left;
    font-size: 1rem;
    color: var(--text-color-main);
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
}

.ctf-table th, 
.ctf-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eeeeee;
    color: #444444;
}

.ctf-table th {
    background-color: #f4f6f8;
    font-weight: 600;
    color: var(--text-color-main);
}

.ctf-total-row {
    background-color: #f0f4f8 !important;
    font-weight: bold;
}

.ctf-total-row td {
    color: #000000;
}

.ctf-table tbody tr:nth-child(even):not(.ctf-total-row) {
    background-color: var(--bg-zebra);
}

/* -------------------------------------------------------------
   RESPONSIVIDADE VIA CARDS PARA TELAS PEQUENAS DE CELULAR (<= 600px)
   ------------------------------------------------------------- */
@media screen and (max-width: 600px) {
    .ctf-section {
        padding: 12px;
        margin: 1rem auto;
    }

    .ctf-title {
        font-size: 1.35rem;
    }

    /* Oculta o cabeçalho tradicional da tabela mantendo acessibilidade para leitores de tela */
    .ctf-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        border: 0;
    }

    .ctf-table, 
    .ctf-table tbody, 
    .ctf-table tr, 
    .ctf-table td {
        display: block;
        width: 100%;
    }

    /* Transforma cada linha da tabela em um Card destacado */
    .ctf-table tbody tr {
        margin: 12px;
        padding: 12px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background-color: var(--bg-card) !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    }

    .ctf-table tbody tr.ctf-total-row {
        border: 2px solid var(--primary-color);
        background-color: #f0f7ff !important;
    }

    /* Ajuste de cada célula dentro do Card */
    .ctf-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px dashed #e5e5e5;
        text-align: right;
        white-space: normal;
        font-size: 0.95rem;
    }

    .ctf-table td:last-child {
        border-bottom: none;
    }

    /* Adiciona a etiqueta do cabeçalho correspondente usando data-label */
    .ctf-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-color-main);
        text-align: left;
        padding-right: 15px;
        flex: 1;
    }
}