/* ==========================================================================
   Viapol Custom Rich Text Styles (Design Editorial)
   Sempre envolva o conteúdo em: <div class="rte"> @Html.Raw(Model.Content) </div>
   ========================================================================== */

.rte {
    font-family: "Sora", system-ui, sans-serif;
    color: #4A4A4A; /* Cinza escuro suave para leitura confortável */
    line-height: 1.6;
    font-size: 15px;
    max-width: 800px;
}

/* --- 1. Parágrafo Introdutório (Texto Azul e Capitular/Drop Cap) --- */
.rte > p:first-of-type {
    color: #0128B3; /* Azul Viapol */
    font-weight: 500;
    font-size: 16px;
    margin-bottom: 2.5em;
    line-height: 1.5;
}

/* A primeira letra gigante */
.rte > p:first-of-type::first-letter {
    color: #0128B3;
    float: left;
    font-size: 3rem; /* Tamanho da letra M na imagem */
    line-height: 0.8;
    margin-right: 12px;
    margin-top: 4px;
    font-weight: 400;
}

/* Parágrafos Padrão */
.rte p {
    margin-top: 0;
    margin-bottom: 1.5em;
}

/* --- 2. Títulos (Com o Traço Verde Lateral) --- */
.rte h2, .rte h3, .rte h4 {
    color: #1A1A1A;
    font-weight: 800;
    line-height: 1.3;
    margin-top: 2.5em;
    margin-bottom: 1em;
    display: flex;
    align-items: flex-start;
    gap: 16px; /* Espaço entre o traço e o texto */
}

.rte h2 { font-size: 22px; }
.rte h3 { font-size: 18px; }

/* O traço verde injetado via CSS */
.rte h2::before, .rte h3::before, .rte h4::before {
    content: "";
    display: block;
    width: 24px;
    height: 3px;
    background-color: #68BA4F; /* Verde Viapol */
    margin-top: 13px; /* Alinha o traço verticalmente com o centro da primeira linha */
    flex-shrink: 0; /* Impede que o traço esmague no mobile */
}

/* --- 3. Listas (Com Ícones de Checkmark Verde) --- */
.rte ul {
    list-style: none; /* Remove a bolinha preta padrão */
    padding-left: 0;
    margin-top: 1.5em;
    margin-bottom: 2.5em;
}

.rte ul li {
    position: relative;
    padding-left: 36px;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* O checkmark injetado via CSS */
.rte ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 2px;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2368BA4F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

.rte ul li strong, .rte ul li b {
    color: #1A1A1A; /* Destaca bem a parte em negrito (ex: Betume Modificado) */
}

/* Listas numeradas normais */
.rte ol {
    padding-left: 1.5em;
    margin-bottom: 2em;
}
.rte ol li {
    margin-bottom: 12px;
}

/* --- 4. O Card de KPI (Usando Blockquote) --- */
.rte blockquote {
    background-color: #F8F9FA; /* Fundo cinza clarinho */
    border-radius: 16px;
    padding: 24px 32px;
    margin: 2.5em 0;
    border: none;
}

/* A primeira linha vira o título azul com o ícone de Pin */
.rte blockquote p:first-child {
    color: #0128B3;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rte blockquote p:first-child::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230128B3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

/* O texto restante dentro do bloco */
.rte blockquote p:not(:first-child) {
    color: #4A4A4A;
    font-size: 14px;
    margin-bottom: 0;
    font-style: normal; /* Remove o itálico padrão do HTML para blockquotes */
}

/* --- 5. Imagens e Legendas (Com Sobreposição de Texto) --- */
.rte figure {
    position: relative;
    margin: 3em 0;
    border-radius: 16px;
    overflow: hidden; /* Mantém a imagem contida nas bordas arredondadas */
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.rte figure img {
    width: 100%;
    display: block;
    margin: 0; /* Remove margens padrões para encaixar perfeitamente */
}

/* Máscara de gradiente escuro na parte inferior para o texto branco aparecer */
.rte figure::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
    pointer-events: none; /* Deixa a imagem clicável por baixo do gradiente */
    z-index: 1;
}

/* Posiciona o texto da legenda em branco sobre a imagem */
.rte figcaption {
    position: absolute;
    bottom: 20px;
    left: 24px;
    right: 24px;
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 500;
    z-index: 2;
    text-align: left;
}

/* Fallback para imagens soltas sem a tag <figure> */
.rte > img {
    max-width: 100%;
    height: auto;
    border-radius: 16px;
    display: block;
    margin: 2.5em auto;
}

/* --- 6. Links e Negrito Padrão --- */
.rte a {
    color: #0128B3;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s ease;
}

.rte a:hover {
    color: #68BA4F;
}

.rte strong, .rte b {
    font-weight: 700;
    color: #1A1A1A;
}

/* --- 7. Tabelas (Proteção para não quebrar o layout) --- */
.rte table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
}

.rte th, .rte td {
    border: 1px solid #E4E4E4;
    padding: 12px 16px;
    font-size: 14px;
}

.rte th {
    background-color: #F4F5F7;
    font-weight: 700;
    color: #1A1A1A;
}

/* --- 8. Responsividade --- */
@media (max-width: 768px) {
    .rte > p:first-of-type::first-letter {
        font-size: 2.5rem;
    }
    
    .rte h2 { font-size: 20px; }
    
    .rte blockquote {
        padding: 20px;
    }
    
    .rte figcaption {
        bottom: 16px;
        left: 16px;
        right: 16px;
    }
    
    /* Adiciona scroll horizontal em tabelas grandes no celular */
    .rte table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
