/* ── MESSAGES ────────────────────────────────────────────────── */
.message {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.message.animate {
  animation: fadeUp 0.25s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.message.user      { align-items: flex-end; }
.message.assistant { align-items: flex-start; }

.msg-label {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
  padding: 0 4px;
  min-height: 14px;
}

.bubble {
  max-width: 86%;
  padding: 16px 20px;
  border-radius: var(--radius);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 0.01em;
}

.message.user .bubble {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-bottom-right-radius: 0;
  color: var(--text-dim);
  font-style: italic;
}

.message.assistant .bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 0;
  border-left: 2px solid var(--gold-dim);
  color: var(--text);
}

/* Markdown dentro das bolhas */
.bubble p         { margin-bottom: 12px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul,
.bubble ol        { margin: 10px 0 10px 20px; }
.bubble li        { margin-bottom: 5px; }
.bubble strong    { color: var(--gold); font-weight: 600; }
.bubble em        { color: var(--text-dim); }
.bubble h1,
.bubble h2,
.bubble h3 {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  margin: 16px 0 8px;
  line-height: 1.3;
}
.bubble h1:first-child,
.bubble h2:first-child,
.bubble h3:first-child { margin-top: 0; }
.bubble h1 { font-size: 20px; }
.bubble h2 { font-size: 17px; }
.bubble h3 { font-size: 15px; }
.bubble blockquote {
  border-left: 2px solid var(--gold-dim);
  padding: 6px 12px;
  margin: 10px 0;
  color: var(--text-dim);
  font-style: italic;
  background: var(--gold-glow);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.bubble code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  background: rgba(0,0,0,0.3);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text-dim);
}
.bubble pre { margin: 10px 0; }
.bubble pre code {
  display: block;
  padding: 12px;
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

[data-theme="light"] .bubble code { background: rgba(0,0,0,0.05); color: var(--text-dim); }

/* ── TYPING INDICATOR ────────────────────────────────────────── */
.typing-indicator {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 4px 0;
}
.typing-indicator span {
  width: 5px;
  height: 5px;
  background: var(--gold-dim);
  border-radius: 50%;
  animation: blink 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40%           { opacity: 1; }
}

/* ── REASONING / THOUGHTS ────────────────────────────────────── */
.thought-container {
  margin-bottom: 12px;
  max-width: 80%;
  align-self: flex-start;
  animation: fadeUp 0.3s ease both;
}

.thought-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--gold-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.thought-header::before {
  content: "✝";
  font-size: 12px;
}

.thought-bubble {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-left: 2px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-dim);
  font-style: italic;
  max-height: 72px; /* Aproximadamente 3 linhas */
  overflow-y: hidden; /* Scroll controlado via JS */
  position: relative;
}

.thought-content {
  /* Sem animação CSS, o scroll é feito via JS no script.js */
}

.thought-container.fade-out {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.5s ease, transform 0.5s ease;
}