/* Pele BIF para o LibreChat (tema escuro). Só estilo: o navegador desenha uma vez, sem custo por quadro.
   Os únicos movimentos são em transform/opacity (placa de vídeo) e só em momentos: passar o mouse, enviar, IA escrevendo.
   Se uma atualização do LibreChat mudar a página, o pior caso é algum detalhe voltar ao visual comum. */
html.dark {
  --bif-ouro: 227 162 26;
  --bif-luz: inset 0 1px 0 rgb(255 255 255 / .07);
  --bif-sombra: 0 1px 2px rgb(0 0 0 / .45), 0 6px 16px -6px rgb(0 0 0 / .55);
  --bif-sombra-alta: 0 2px 4px rgb(0 0 0 / .45), 0 12px 26px -8px rgb(0 0 0 / .65);
  --bif-mola: cubic-bezier(.2, .9, .3, 1.2);
}

/* ---------- fundo: a mesma matéria do logo, parada ---------- */
html.dark [data-testid="chat-column"] {
  background:
    radial-gradient(ellipse 70% 45% at 50% -8%, rgb(var(--bif-ouro) / .07), transparent 70%),
    radial-gradient(rgb(242 238 229 / .045) 1px, transparent 1.3px) 0 0 / 28px 28px;
}

/* ---------- detalhes em ouro ---------- */
html.dark ::selection { background: rgb(var(--bif-ouro) / .32); }
html.dark #prompt-textarea { caret-color: rgb(var(--bif-ouro)); }
html.dark .message-content a { color: rgb(var(--bif-ouro)); text-decoration-color: rgb(var(--bif-ouro) / .4); }
html.dark * { scrollbar-width: thin; scrollbar-color: rgb(var(--bif-ouro) / .28) transparent; }

/* títulos das respostas e nome do assistente com a letra do logo */
html.dark .message-content :is(h1, h2, h3) { font-family: Fraunces, Georgia, serif; font-weight: 600; letter-spacing: -.01em; }
html.dark .agent-turn > h2, html.dark .agent-turn h2.font-semibold { font-family: Fraunces, Georgia, serif; font-weight: 600; letter-spacing: .01em; }

/* ---------- caixa de mensagem: peça sólida, com luz em cima e sombra embaixo ---------- */
html.dark [data-testid="composer-surface"] {
  background: linear-gradient(180deg, rgb(52 50 44), rgb(38 37 33));
  border-color: rgb(255 255 255 / .06);
  box-shadow: var(--bif-luz), var(--bif-sombra-alta);
  transition: box-shadow .25s, border-color .25s;
}
html.dark [data-testid="composer-surface"]:focus-within {
  border-color: rgb(var(--bif-ouro) / .45);
  box-shadow: var(--bif-luz), var(--bif-sombra-alta), 0 0 0 3px rgb(var(--bif-ouro) / .08);
}

/* ---------- botões em relevo: sobem no mouse, afundam no clique ---------- */
html.dark :is(.bif-atalho, [data-testid="model-selector-button"], [data-testid="header-new-chat-button"], [data-testid="composer-palette-button"]) {
  background: linear-gradient(180deg, rgb(255 255 255 / .065), rgb(255 255 255 / .02));
  border: 1px solid rgb(255 255 255 / .07);
  box-shadow: var(--bif-luz), var(--bif-sombra);
  transition: transform .18s var(--bif-mola), box-shadow .18s, border-color .18s;
}
html.dark :is(.bif-atalho, [data-testid="model-selector-button"], [data-testid="header-new-chat-button"], [data-testid="composer-palette-button"]):hover {
  transform: translateY(-1px);
  border-color: rgb(var(--bif-ouro) / .35);
  box-shadow: var(--bif-luz), var(--bif-sombra-alta);
}
html.dark :is(.bif-atalho, [data-testid="model-selector-button"], [data-testid="header-new-chat-button"], [data-testid="composer-palette-button"]):active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgb(0 0 0 / .45);
  transition-duration: .06s;
}

/* enviar: a única peça em ouro, como um botão físico */
html.dark [data-testid="send-button"]:not(:disabled) {
  background: radial-gradient(circle at 50% 30%, rgb(250 200 90), rgb(var(--bif-ouro)) 55%, rgb(170 112 8));
  color: rgb(28 24 14);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .35), 0 2px 6px rgb(var(--bif-ouro) / .35), 0 8px 18px -6px rgb(0 0 0 / .7);
  transition: transform .18s var(--bif-mola), box-shadow .18s;
}
html.dark [data-testid="send-button"]:not(:disabled):hover { transform: translateY(-1px) scale(1.04); }
html.dark [data-testid="send-button"]:not(:disabled):active { transform: translateY(1px) scale(.96); box-shadow: inset 0 2px 5px rgb(0 0 0 / .4); transition-duration: .06s; }

/* ---------- mensagens ---------- */
html.dark .user-turn [data-testid="message-body"] {
  background: linear-gradient(180deg, rgb(50 48 42), rgb(40 39 35));
  border: 1px solid rgb(var(--bif-ouro) / .18);
  box-shadow: var(--bif-luz), var(--bif-sombra);
}
html.dark .message-content pre { border: 1px solid rgb(255 255 255 / .06); box-shadow: var(--bif-sombra); }
/* mensagem nova chega subindo de leve */
html.dark .message-render { animation: bif-chega .35s ease-out both; }
@keyframes bif-chega { from { opacity: 0; transform: translateY(6px); } }

/* ---------- barra lateral ---------- */
html.dark [data-testid="convo-list-row"] { transition: transform .15s; }
html.dark [data-testid="convo-list-row"]:hover { transform: translateX(2px); }

/* ---------- momento: IA escrevendo (classe posta pela materia.js) ---------- */
/* luz de ouro passando pela borda da caixa, e o nome do assistente respirando */
html.dark.bif-gerando [data-testid="composer-surface"] { position: relative; }
html.dark.bif-gerando [data-testid="composer-surface"]::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: linear-gradient(90deg, transparent 0 35%, rgb(var(--bif-ouro) / .9) 50%, transparent 65% 100%) 0 0 / 300% 100%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; padding: 1px;
  animation: bif-varre 1.6s linear infinite;
}
@keyframes bif-varre { from { background-position: 100% 0; } to { background-position: -50% 0; } }
html.dark .bif-vivo { animation: bif-respira 1.4s ease-in-out infinite; }
@keyframes bif-respira { 50% { opacity: .45; } }

@media (prefers-reduced-motion: reduce) {
  html.dark *, html.dark *::after { animation: none !important; transition: none !important; }
}
