@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #FFFFFF;
  --user-bubble: #EEF3FA;
  --user-text: #2B65C5;
  --border: #E5E5E5;
  --border-light: #F0F0F0;
  --text: #1A1A1A;
  --text-secondary: #666666;
  --text-muted: #999999;
  --text-link: #1A1A1A;
  --claude-coral: #E07050;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Menlo', monospace;
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}

.chat-window {
  max-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ── Top bar ── */
.chat-topbar {
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-light);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.topbar-chevron { font-size: 11px; color: var(--text-muted); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.topbar-btn:hover { background: var(--border-light); }

/* ── Messages area ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Message ── */
.message {
  max-width: 680px;
  margin: 0 auto 16px;
  padding: 0 32px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.message.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── User: right-aligned green bubble ── */
.message.user {
  display: flex;
  justify-content: flex-end;
}

.message.user .message-content {
  background: var(--user-bubble);
  border-radius: var(--radius);
  padding: 10px 16px;
  display: inline-block;
  max-width: 80%;
  font-size: 15px;
  line-height: 1.5;
  color: var(--user-text);
}

.message.user .message-content a { color: var(--user-text); text-decoration: underline; }

/* ── Assistant: left-aligned plain text ── */
.message.assistant .message-content {
  font-size: 15px;
  line-height: 1.65;
}

.message-content p { margin-bottom: 10px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content strong { font-weight: 600; }
.message.assistant .message-content a { color: var(--text); text-decoration: underline; }

.message-content ol {
  padding-left: 20px;
  margin: 6px 0;
}

.message-content ol li {
  margin-bottom: 4px;
  line-height: 1.55;
}

/* ── Tool call group (collapsed: "Used 2 tools ▸") ── */
.tool-group {
  max-width: 680px;
  margin: 0 auto 4px;
  padding: 0 32px;
}

.tool-group-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: var(--text-secondary);
  padding: 4px 0;
}

.tool-group-header:hover { color: var(--text); }

.tool-group-chevron {
  font-size: 10px;
  transition: transform 0.15s;
  display: inline-block;
}

.tool-group.expanded .tool-group-chevron { transform: rotate(90deg); }

.tool-group-body {
  display: none;
  margin: 4px 0 4px 18px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.tool-group.expanded .tool-group-body { display: block; }

.tool-group-body .tool-item {
  padding: 2px 0;
}

/* ── Reaction icons (bottom of last assistant message) ── */
.reactions {
  max-width: 680px;
  margin: 0 auto 16px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.reaction-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: default;
  border: none;
  background: none;
  padding: 0;
}

.reaction-btn svg { width: 16px; height: 16px; }

.reaction-btn.claude-icon { color: var(--claude-coral); }

/* ── Typing indicator ── */
.typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-indicator span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingDot 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.2; transform: translateY(0); }
  30% { opacity: 0.7; transform: translateY(-2px); }
}

/* ── Bottom input bar ── */
.chat-input-bar {
  padding: 12px 20px 16px;
  flex-shrink: 0;
}

.chat-input-outer {
  max-width: 680px;
  margin: 0 auto;
}

.chat-input-row {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px 6px 6px 16px;
  background: var(--bg);
}

.chat-input-text {
  font-family: var(--font);
  font-size: 15px;
  color: var(--text-muted);
  flex: 1;
  padding: 6px 0;
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.input-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  color: var(--text-muted);
}

.input-btn svg { width: 18px; height: 18px; }

.input-btn.send {
  background: var(--text);
  color: white;
  opacity: 0.25;
}

.input-btn.send svg { width: 14px; height: 14px; }

.input-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 0 4px;
}

.input-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-meta svg { width: 12px; height: 12px; }

.bypass-btn {
  font-family: var(--font);
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: default;
  display: flex;
  align-items: center;
  gap: 4px;
}

.bypass-btn svg { width: 14px; height: 14px; }

/* ── Embeddable ── */
.embed-mode .chat-topbar,
.embed-mode .chat-input-bar { display: none; }

@media (max-width: 600px) {
  .message, .tool-group, .reactions { padding: 0 16px; }
}
