/* ── Base ─────────────────────────────────────────── */
:root {
  color-scheme: dark;
  font-family: Inter, system-ui, sans-serif;
}

body { margin: 0; }
button, input, select, textarea { font: inherit; }

/* ── Config panel collapse ───────────────────────── */
#configPanel.hidden { display: none; }
#configChevron { transition: transform 0.2s ease; }

/* ── Chat area ───────────────────────────────────── */
#chatArea {
  scrollbar-width: thin;
  scrollbar-color: rgba(100,116,139,0.35) transparent;
}
#chatArea::-webkit-scrollbar { width: 6px; }
#chatArea::-webkit-scrollbar-thumb {
  background: rgba(100,116,139,0.35);
  border-radius: 9999px;
}

/* ── Message bubbles ─────────────────────────────── */
.message-bubble {
  max-width: 85%;
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.message-bubble.user {
  background: rgba(6,182,212,0.18);
  border: 1px solid rgba(6,182,212,0.25);
  color: #e2e8f0;
}
.message-bubble.assistant {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: #cbd5e1;
}

/* ── Markdown inside assistant bubbles ───────────── */
.message-content h1,
.message-content h2,
.message-content h3 {
  color: #f1f5f9;
  font-weight: 700;
  margin: 0.75em 0 0.35em;
}
.message-content h1 { font-size: 1.3em; }
.message-content h2 { font-size: 1.15em; }
.message-content h3 { font-size: 1.05em; }

.message-content p { margin: 0.4em 0; line-height: 1.65; }

.message-content ul,
.message-content ol {
  padding-left: 1.4em;
  margin: 0.4em 0;
}
.message-content li { margin: 0.15em 0; }
.message-content li::marker { color: #64748b; }

.message-content a {
  color: #22d3ee;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-content blockquote {
  margin: 0.5em 0;
  padding: 0.5em 0.75em;
  border-left: 3px solid rgba(34,211,238,0.4);
  background: rgba(34,211,238,0.05);
  border-radius: 0.25rem;
  color: #94a3b8;
}

.message-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5em 0;
  font-size: 0.875em;
}
.message-content th,
.message-content td {
  border: 1px solid rgba(255,255,255,0.1);
  padding: 0.4em 0.6em;
  text-align: left;
}
.message-content th {
  background: rgba(255,255,255,0.04);
  color: #e2e8f0;
  font-weight: 600;
}

.message-content code:not(pre code) {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 0.25rem;
  padding: 0.1em 0.35em;
  font-size: 0.88em;
  color: #e2e8f0;
}

.message-content pre {
  margin: 0.6em 0;
  border-radius: 0.75rem;
  overflow-x: auto;
  border: 1px solid rgba(255,255,255,0.08);
}
.message-content pre code {
  display: block;
  padding: 0.85em 1em;
  font-size: 0.82em;
  line-height: 1.6;
  background: transparent;
  border: none;
}

/* ── Translation block ───────────────────────────── */
.translation-block {
  margin-top: 0.65em;
  padding-top: 0.55em;
  border-top: 1px solid rgba(255,255,255,0.08);
  color: #94a3b8;
  font-size: 0.9em;
  line-height: 1.65;
  white-space: pre-wrap;
}

/* ── Typing indicator ────────────────────────────── */
@keyframes dot-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-4px); }
}
.typing-dot:nth-child(1) { animation: dot-bounce 1.2s infinite 0s; }
.typing-dot:nth-child(2) { animation: dot-bounce 1.2s infinite 0.15s; }
.typing-dot:nth-child(3) { animation: dot-bounce 1.2s infinite 0.3s; }

/* ── Toast ────────────────────────────────────────── */
#toastContainer { pointer-events: none; }
#toastContainer > * {
  pointer-events: auto;
  animation: toast-in 0.25s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Textarea auto-resize ────────────────────────── */
#userInput {
  resize: none;
  field-sizing: content;
  min-height: 44px;
  max-height: 40vh;
}

/* ── highlight.js dark tweak ─────────────────────── */
.hljs {
  background: transparent !important;
  color: #e2e8f0 !important;
}
