/* ══════════════════════════════════════════════════════════════
   EliChat — Torad Labs Light Theme
   Adapted from eli-chat.css for light-background posts.
   ══════════════════════════════════════════════════════════════ */

.eli-chat {
  display: flex;
  flex-direction: column;
  font-family: 'Syne', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* ── Messages area ── */
.eli-chat__messages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 0.5rem;
  margin-bottom: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}
.eli-chat__messages::-webkit-scrollbar { width: 4px; }
.eli-chat__messages::-webkit-scrollbar-track { background: transparent; }
.eli-chat__messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

/* ── Message bubbles ── */
.eli-chat__msg {
  max-width: 88%;
  padding: 0.65rem 0.9rem;
  font-size: 0.82rem;
  line-height: 1.6;
  color: #1A1917;
  border-radius: 12px;
  animation: eli-chat-fade-up 0.25s ease-out forwards;
}

.eli-chat__msg--eli {
  align-self: flex-start;
  background: rgba(0, 0, 0, 0.02);
  border: none;
  padding: 0.5rem 0;
  border-radius: 0;
  max-width: 100%;
}

.eli-chat__msg--user {
  align-self: flex-end;
  background: rgba(43, 45, 110, 0.06);
  border: none;
  max-width: 75%;
}

.eli-chat__msg--system {
  align-self: center;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: #9B9890;
  text-align: center;
  padding: 0.3rem 0.6rem;
  background: none;
  border: none;
}

/* ── Markdown ── */
.eli-chat__msg--eli p {
  margin: 0 0 0.6em;
}
.eli-chat__msg--eli p:last-child {
  margin-bottom: 0;
}
.eli-chat__msg--eli strong {
  color: #1A1917;
  font-weight: 600;
}
.eli-chat__msg--eli em {
  font-style: italic;
  color: #6B6860;
}
.eli-chat__msg--eli code {
  font-family: 'DM Mono', 'SF Mono', monospace;
  font-size: 0.8em;
  background: rgba(0, 0, 0, 0.04);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: #2B2D6E;
}
.eli-chat__msg--eli pre {
  background: #F5F5F3;
  border: 1px solid #E0DDD8;
  padding: 0.75em 1em;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0.6em 0;
  line-height: 1.5;
}
.eli-chat__msg--eli pre code {
  background: none;
  padding: 0;
  font-size: 0.78em;
  color: #1A1917;
}
.eli-chat__msg--eli ul,
.eli-chat__msg--eli ol {
  margin: 0.4em 0;
  padding-left: 1.4em;
}
.eli-chat__msg--eli ul { list-style: disc; }
.eli-chat__msg--eli ol { list-style: decimal; }
.eli-chat__msg--eli li {
  margin: 0.25em 0;
}
.eli-chat__msg--eli blockquote {
  border-left: 2px solid #E0DDD8;
  margin: 0.5em 0;
  padding: 0.2em 0.8em;
  color: #6B6860;
}
.eli-chat__msg--eli a {
  color: #2B2D6E;
  text-decoration: none;
}
.eli-chat__msg--eli a:hover {
  text-decoration: underline;
}

/* ── Tables ── */
.eli-chat__msg--eli table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75em 0;
  font-size: 0.78em;
  background: #FFFFFF;
  border: 1px solid #E0DDD8;
  border-radius: 8px;
  overflow: hidden;
}
.eli-chat__msg--eli thead {
  background: #F5F5F3;
}
.eli-chat__msg--eli th {
  font-weight: 600;
  color: #1A1917;
  text-align: left;
  padding: 0.5em 0.75em;
  border-bottom: 1px solid #E0DDD8;
}
.eli-chat__msg--eli td {
  padding: 0.45em 0.75em;
  border-bottom: 1px solid rgba(224, 221, 216, 0.5);
  vertical-align: top;
}
.eli-chat__msg--eli tr:last-child td {
  border-bottom: none;
}
.eli-chat__msg--eli tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

/* ── Headings ── */
.eli-chat__msg--eli h1,
.eli-chat__msg--eli h2,
.eli-chat__msg--eli h3,
.eli-chat__msg--eli h4 {
  color: #1A1917;
  font-weight: 600;
  margin: 0.8em 0 0.4em;
  line-height: 1.3;
}
.eli-chat__msg--eli h1 { font-size: 1.1em; }
.eli-chat__msg--eli h2 { font-size: 1em; }
.eli-chat__msg--eli h3 { font-size: 0.95em; }
.eli-chat__msg--eli h4 { font-size: 0.9em; color: #6B6860; }
.eli-chat__msg--eli h1:first-child,
.eli-chat__msg--eli h2:first-child,
.eli-chat__msg--eli h3:first-child {
  margin-top: 0;
}

/* ── Horizontal rules ── */
.eli-chat__msg--eli hr {
  border: none;
  border-top: 1px solid #E0DDD8;
  margin: 0.8em 0;
}

/* ── Images ── */
.eli-chat__msg--eli img {
  max-width: 100%;
  border-radius: 6px;
  margin: 0.5em 0;
}

/* ── Loading dots ── */
.eli-chat__loading {
  display: flex;
  gap: 5px;
  padding: 0.5rem 0;
}
.eli-chat__loading span {
  width: 4px;
  height: 4px;
  background: #9B9890;
  border-radius: 50%;
  animation: eli-chat-dot-pulse 1.2s infinite;
}
.eli-chat__loading span:nth-child(2) { animation-delay: 0.15s; }
.eli-chat__loading span:nth-child(3) { animation-delay: 0.3s; }

@keyframes eli-chat-dot-pulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ── Status indicator ── */
.eli-chat__status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #9B9890;
  padding: 0.4rem 0;
  animation: eli-chat-fade-up 0.2s ease-out forwards;
}
.eli-chat__status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2B2D6E;
  animation: eli-chat-status-pulse 1.5s ease-in-out infinite;
}
@keyframes eli-chat-status-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* ── Input row ── */
.eli-chat__input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.eli-chat__input {
  flex: 1;
  padding: 0.6rem 0.85rem;
  font-family: 'Syne', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.84rem;
  color: #1A1917;
  background: #FFFFFF;
  border: 1px solid #E0DDD8;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: none;
  overflow-y: hidden;
  min-height: 2.4rem;
  max-height: 6.5rem;
  line-height: 1.5;
  field-sizing: content;
}
.eli-chat__input:focus {
  border-color: #2B2D6E;
  box-shadow: 0 0 0 3px rgba(43, 45, 110, 0.08);
}
.eli-chat__input::placeholder {
  color: #9B9890;
}
.eli-chat__input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.eli-chat__send {
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 0.9rem;
  color: #6B6860;
  background: transparent;
  border: 1px solid #E0DDD8;
  width: 2.4rem;
  height: 2.4rem;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.eli-chat__send:hover {
  border-color: #2B2D6E;
  color: #2B2D6E;
  background: rgba(43, 45, 110, 0.04);
}
.eli-chat__send:disabled {
  cursor: not-allowed;
  opacity: 0.25;
}

@keyframes eli-chat-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .eli-chat__msg {
    font-size: 0.84rem;
    line-height: 1.55;
    max-width: 95%;
  }
  .eli-chat__msg--user {
    max-width: 85%;
    padding: 0.6rem 0.85rem;
  }
  .eli-chat__msg--eli {
    max-width: 100%;
  }
  .eli-chat__msg--eli pre {
    padding: 0.6em 0.75em;
    font-size: 0.74rem;
    -webkit-overflow-scrolling: touch;
  }
  .eli-chat__msg--eli pre code {
    font-size: 0.74rem;
  }
  .eli-chat__msg--eli table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.72rem;
  }
  .eli-chat__input {
    font-size: 16px;
    padding: 0.55rem 0.75rem;
    min-height: 2.4rem;
  }
  .eli-chat__send {
    width: 2.6rem;
    height: 2.6rem;
    min-width: 2.6rem;
  }
  .eli-chat__msg--eli code {
    font-size: 0.78em;
    padding: 0.2em 0.4em;
  }
}
/* v2 */
