/* =========================================================
   LENDORA AIA — RENDERIZADOR DE CONTEUDO
   13-renderizador-conteudo.css
   =========================================================
   Estilos dos componentes gerados por:
       js/componentes/renderizador_conteudo/

   Escopo: TUDO dentro de .message-text.
   Paleta alinhada com o chat.js:
       #303030  hover de botao / fundo de dropdown
       #3d3d3d  hover de item de menu
       #a7a7a7  cor base de botao
       #eeeeee  cor de hover / texto
       #8ec5ff  azul de destaque (ativo)
   ========================================================= */

/* ---------------------------------------------------------
   BASE: paragrafos, links, enfase
   --------------------------------------------------------- */

.message-text p {
    margin: 0 0 10px 0;
    line-height: 1.65;
    word-break: break-word;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text strong,
.message-text b {
    color: #ffffff;
    font-weight: 700;
}

.message-text em,
.message-text i {
    font-style: italic;
}

.message-text a {
    color: #8ec5ff;
    text-decoration: none;
    border-bottom: 1px solid rgba(142, 197, 255, .35);
    transition: border-color .15s ease;
}

.message-text a:hover {
    border-bottom-color: #8ec5ff;
}

/* code inline (dentro de texto corrido) */
.message-text code {
    font-family: "JetBrains Mono", "Fira Code", Consolas,
                 "Courier New", monospace;
    font-size: .9em;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .08);
    color: #ffd7a8;
    word-break: break-word;
}

/* ---------------------------------------------------------
   BLOCO DE CODIGO
   --------------------------------------------------------- */

.message-text .bloco-codigo {
    margin: 12px 0;
    border-radius: 9px;
    overflow: hidden;
    background: #242424;
    border: 1px solid rgba(255, 255, 255, .10);
}

.message-text .bloco-codigo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 34px;
    padding: 0 10px 0 12px;
    background: #2d2d2d;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    font-size: 12px;
    color: #a7a7a7;
}

.message-text .bloco-codigo-lang {
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: lowercase;
    color: #a7a7a7;
}

.message-text .bloco-codigo-copiar {
    appearance: none;
    -webkit-appearance: none;
    height: 24px;
    padding: 0 10px;
    margin: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #a7a7a7;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.message-text .bloco-codigo-copiar:hover {
    background: #303030;
    color: #eeeeee;
}

.message-text .bloco-codigo pre {
    margin: 0;
    padding: 12px 14px;
    overflow-x: auto;
    font-family: "JetBrains Mono", "Fira Code", Consolas,
                 "Courier New", monospace;
    font-size: 13px;
    line-height: 1.55;
    color: #e6e6e6;
    background: transparent;
    tab-size: 4;
}

.message-text .bloco-codigo pre code {
    display: block;
    padding: 0;
    background: transparent;
    color: inherit;
    font-size: inherit;
    white-space: pre;
}

/* Bloco de codigo ainda aberto (streaming) */
.message-text .bloco-codigo.aberto {
    border-color: rgba(142, 197, 255, .35);
}

/* Tokens de highlight (definidos em codigo.js) */
.message-text .tok-kw  { color: #c586c0; }
.message-text .tok-str { color: #ce9178; }
.message-text .tok-num { color: #b5cea8; }
.message-text .tok-com { color: #6a9955; font-style: italic; }

/* ---------------------------------------------------------
   CITACAO
   --------------------------------------------------------- */

.message-text .bloco-citacao {
    position:relative;
    margin:16px 0;
    padding:18px 22px;
    border:1px solid rgba(255,255,255,.10);
    border-left:0;
    border-radius:16px;
    background:#3a3a3a;
    color:#f0f0f0;
    box-shadow:0 8px 24px rgba(0,0,0,.18);
}

.message-text .bloco-citacao p {
    margin:0 0 9px 0;
    line-height:1.65;
}

.message-text .bloco-citacao p:first-child {
    color:#c9c9c9;
    font-size:13px;
    font-weight:650;
}

.message-text .bloco-citacao p:last-child { margin-bottom:0; }

.message-text .bloco-citacao strong { color:#ffffff; }

/* ---------------------------------------------------------
   LISTAS
   --------------------------------------------------------- */

.message-text .bloco-lista {
    margin: 10px 0;
    padding-left: 22px;
}

.message-text .bloco-lista li {
    margin: 4px 0;
    line-height: 1.6;
    color: #e6e6e6;
}

.message-text .bloco-lista-ul {
    list-style: disc outside;
}

.message-text .bloco-lista-ol {
    list-style: decimal outside;
}

/* ---------------------------------------------------------
   TABELA
   --------------------------------------------------------- */

.message-text .bloco-tabela-wrap {
    margin: 12px 0;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .10);
}

.message-text .bloco-tabela {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
}

.message-text .bloco-tabela th,
.message-text .bloco-tabela td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    border-right: 1px solid rgba(255, 255, 255, .05);
    color: #e6e6e6;
    vertical-align: top;
}

.message-text .bloco-tabela th {
    background: #262626;
    color: #ffffff;
    font-weight: 700;
    border-bottom-color: rgba(255, 255, 255, .15);
}

.message-text .bloco-tabela tr:last-child td {
    border-bottom: 0;
}

.message-text .bloco-tabela th:last-child,
.message-text .bloco-tabela td:last-child {
    border-right: 0;
}

.message-text .bloco-tabela tbody tr:hover {
    background: rgba(255, 255, 255, .03);
}

/* ---------------------------------------------------------
   IMAGEM
   --------------------------------------------------------- */

.message-text .bloco-imagem {
    margin: 12px 0;
    text-align: center;
}

.message-text .bloco-imagem img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .10);
    background: #1c1c1c;
}

.message-text .bloco-imagem-legenda {
    margin-top: 6px;
    font-size: 12px;
    color: #a7a7a7;
    font-style: italic;
}

/* ---------------------------------------------------------
   MATEMATICA (fallback enquanto KaTeX nao esta plugado)
   --------------------------------------------------------- */

.message-text .math-inline {
    font-family: "STIX Two Math", "Cambria Math",
                 "Latin Modern Math", serif;
    font-style: italic;
    color: #ffd7a8;
    padding: 0 2px;
}

.message-text .math-block {
    margin: 12px 0;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    font-family: "STIX Two Math", "Cambria Math",
                 "Latin Modern Math", serif;
    font-size: 14px;
    color: #e6e6e6;
    overflow-x: auto;
    white-space: pre-wrap;
}

/* Quando KaTeX estiver presente (wrapper do matematica.js) */
.message-text .bloco-math-block {
    margin: 12px 0;
    text-align: center;
    overflow-x: auto;
}

/* ---------------------------------------------------------
   AJUSTES FINOS
   --------------------------------------------------------- */

/* Espacamento entre blocos consecutivos */
.message-text > * + * {
    margin-top: 0;
}

.message-text > .bloco-codigo + .bloco-codigo,
.message-text > .bloco-citacao + .bloco-citacao,
.message-text > .bloco-lista + .bloco-lista,
.message-text > .bloco-tabela-wrap + .bloco-tabela-wrap {
    margin-top: 10px;
}

/* Scrollbar dos blocos de codigo (WebKit) */
.message-text .bloco-codigo pre::-webkit-scrollbar,
.message-text .bloco-tabela-wrap::-webkit-scrollbar,
.message-text .math-block::-webkit-scrollbar {
    height: 8px;
}

.message-text .bloco-codigo pre::-webkit-scrollbar-thumb,
.message-text .bloco-tabela-wrap::-webkit-scrollbar-thumb,
.message-text .math-block::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .15);
    border-radius: 4px;
}

.message-text .bloco-codigo pre::-webkit-scrollbar-thumb:hover,
.message-text .bloco-tabela-wrap::-webkit-scrollbar-thumb:hover,
.message-text .math-block::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, .25);
}

/* Firefox */
.message-text .bloco-codigo pre,
.message-text .bloco-tabela-wrap,
.message-text .math-block {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .15) transparent;
}


/* ---------------------------------------------------------
   HEADING (markdown #, ##, ###, ...)
   --------------------------------------------------------- */

.message-text .bloco-heading {
    margin: 16px 0 8px 0;
    color: #ffffff;
    font-weight: 700;
    line-height: 1.3;
    word-break: break-word;
}

.message-text .bloco-heading:first-child {
    margin-top: 0;
}

.message-text .bloco-heading-1 {
    font-size: 1.6em;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    padding-bottom: 4px;
}

.message-text .bloco-heading-2 {
    font-size: 1.4em;
}

.message-text .bloco-heading-3 {
    font-size: 1.2em;
}

.message-text .bloco-heading-4 {
    font-size: 1.1em;
}

.message-text .bloco-heading-5 {
    font-size: 1em;
}

.message-text .bloco-heading-6 {
    font-size: .95em;
    color: #a7a7a7;
}
/* =========================================================
   BLOCO VISUAL NOMEADO — :::bloco Titulo ... :::
   ========================================================= */
.message-text .bloco-lendora{
    margin:16px 0;
    padding:16px 20px;
    border-radius:16px;
    background:#3a3a3a;
    border:1px solid rgba(255,255,255,.10);
    box-shadow:0 8px 24px rgba(0,0,0,.18);
}
.message-text .bloco-lendora-titulo{
    margin:0 0 10px;
    color:#d0d0d0;
    font-size:13px;
    font-weight:650;
}
.message-text .bloco-lendora-conteudo p{
    margin:0 0 9px;
    color:#f0f0f0;
    line-height:1.65;
}
.message-text .bloco-lendora-conteudo p:last-child{margin-bottom:0;}


/* =========================================================
   PALETA DOS BLOCOS — DESTAQUES / CÓDIGO / COPIAR
   ========================================================= */
.message-text .bloco-codigo{
    background:#2b211b;
    border-color:rgba(186,139,98,.30);
}
.message-text .bloco-codigo-header{
    background:#3a2b22;
    border-bottom-color:rgba(186,139,98,.22);
}
.message-text .bloco-codigo-copiar:hover{
    background:#4a3428;
    color:#fff;
}
.message-text .bloco-citacao,
.message-text .bloco-lendora{
    background:#30231c;
    border-color:rgba(186,139,98,.28);
}
.message-text .bloco-citacao p:first-child,
.message-text .bloco-lendora-titulo{
    color:#d7b99e;
}
