/* Chat surface styles */

.chat-layout {
  display: grid;
  grid-template-columns: 208px 1fr;
  min-height: 100%;
  position: relative;
}
.chat-history {
  border-right: 1px solid var(--border-subtle);
  padding: 16px 10px 100px;
  display: flex; flex-direction: column; gap: 8px;
  background: rgba(255,255,255,.4);
  position: sticky; top: 0;
  max-height: 100%;
  overflow-y: auto;
}
.chat-history-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 6px 8px;
}
.chat-history-list { display: flex; flex-direction: column; gap: 2px; }
.chat-history-item {
  padding: 8px 10px; border-radius: 8px;
  cursor: pointer;
  transition: background 140ms var(--ease-out-expo);
}
.chat-history-item:hover { background: rgba(15,23,42,.04); }
.chat-history-item[data-active="true"] {
  background: var(--accent-tint);
  box-shadow: inset 2px 0 0 var(--accent);
}
.chat-history-title {
  font-size: 12.5px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-history-meta {
  font-size: 10.5px; font-family: var(--font-mono);
  color: var(--text-faint); margin-top: 2px;
}

.chat-answer {
  padding: 28px 36px 180px;
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
}
.chat-query {
  display: flex; gap: 10px; align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 18px;
}
.chat-query-user {
  width: 26px; height: 26px; border-radius: 999px; flex-shrink: 0;
  background: linear-gradient(135deg,#D97757,#5E6AD2);
  color: #fff; font-weight: 700; font-size: 10.5px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0.04em;
}
.chat-query-text {
  font-size: 16px; font-weight: 600; letter-spacing: -0.015em;
  color: var(--text-primary); line-height: 1.4; padding-top: 3px;
}

.chat-runbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.chat-body {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text-primary);
}
.chat-title {
  font-size: 26px; font-weight: 700; letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0 0 18px;
  text-wrap: pretty;
  background: linear-gradient(180deg, #111827 78%, #374151 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.chat-body p { margin: 0 0 14px; }
.chat-body strong { font-weight: 700; color: var(--text-primary); }

.chat-callout {
  margin: 18px 0 22px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(217,119,87,.05), rgba(217,119,87,.02));
  border: 1px solid var(--accent-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
}
.chat-callout-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--accent-ink);
  margin-bottom: 6px;
}

.chat-strip { margin: 28px 0 24px; }
.chat-strip-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 10px;
}
.chat-strip-more {
  font-size: 12px; color: var(--accent-ink); font-weight: 600; cursor: pointer;
}
.chat-strip-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}

.chat-sources { margin: 24px 0; }
.chat-sources-list {
  display: flex; flex-direction: column;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
}
.chat-source-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto auto;
  gap: 12px; align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 140ms var(--ease-out-expo);
}
.chat-source-row:last-child { border-bottom: 0; }
.chat-source-row:hover { background: var(--bg-muted); }
.chat-source-title {
  font-weight: 600; letter-spacing: -0.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-source-meta {
  font-size: 11px; font-family: var(--font-mono); color: var(--text-muted);
}

.chat-followups {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  margin: 18px 0 40px;
}
.chat-followup {
  padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  font-size: 12.5px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer;
  transition: all 160ms var(--ease-out-expo);
}
.chat-followup:hover {
  border-color: var(--accent-border);
  background: var(--accent-tint);
  color: var(--accent-ink);
}

.chat-thinking {
  display: inline-flex; gap: 3px; align-items: center; margin-right: 2px;
}
.chat-thinking i {
  width: 4px; height: 4px; border-radius: 50%; background: currentColor;
  animation: chat-bounce 900ms ease-in-out infinite;
}
.chat-thinking i:nth-child(2) { animation-delay: 150ms; }
.chat-thinking i:nth-child(3) { animation-delay: 300ms; }
@keyframes chat-bounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40%           { opacity: 1;   transform: translateY(-2px); }
}

/* Composer variants */
.chat-composer {
  position: absolute;
  z-index: 20;
  pointer-events: none;
}
.chat-composer > * { pointer-events: auto; }

.chat-composer--dock {
  left: 208px; right: 0; bottom: 0;
  padding: 18px 36px 22px;
  background: linear-gradient(180deg, transparent, rgba(251,249,246,.92) 30%, var(--bg-app));
}
.chat-composer--dock .composer { max-width: 820px; margin: 0 auto; }

.chat-composer--floating {
  left: 50%; bottom: 28px;
  transform: translateX(calc(-50% + 104px));
  width: min(720px, calc(100% - 260px));
}
.chat-composer--floating .composer {
  border-radius: 999px;
  padding: 6px 10px 6px 16px;
  box-shadow: var(--shadow-lg);
}
.chat-composer--floating .composer-input { min-height: 28px; }

.chat-composer--inline {
  position: static;
  padding: 0 36px 60px 36px;
  max-width: 920px;
  margin: -140px auto 0;
}
