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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f1117;
  color: #e2e8f0;
  height: 100vh;
  overflow: hidden;
}

.layout {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: #1a1d27;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 20px;
  border-right: 1px solid #2d3148;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  color: #a78bfa;
  padding: 4px 0;
}

.model-badge {
  font-size: 11px;
  background: #2d3148;
  color: #94a3b8;
  padding: 4px 8px;
  border-radius: 4px;
  font-family: monospace;
}

.sidebar-section { display: flex; flex-direction: column; gap: 6px; }

.sidebar-label {
  font-size: 10px;
  text-transform: uppercase;
  color: #4b5563;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}

.tool-item {
  font-size: 12px;
  color: #6ee7b7;
  padding: 3px 6px;
  background: #0d1f18;
  border-radius: 4px;
  font-family: monospace;
}

.example {
  font-size: 12px;
  color: #94a3b8;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1.4;
}
.example:hover { background: #252840; color: #e2e8f0; }

.new-chat-btn {
  margin-top: auto;
  background: #4f46e5;
  color: white;
  border: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.new-chat-btn:hover { background: #4338ca; }

/* Chat area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome {
  text-align: center;
  margin: auto;
  padding: 40px 20px;
}
.welcome-icon { font-size: 48px; margin-bottom: 16px; }
.welcome-title { font-size: 22px; font-weight: 700; color: #c4b5fd; margin-bottom: 8px; }
.welcome-desc { font-size: 14px; color: #6b7280; line-height: 1.6; }

/* Messages */
.msg {
  display: flex;
  padding: 0 24px;
  gap: 12px;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}

.msg.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}
.msg.user .msg-avatar { background: #4f46e5; }
.msg.assistant .msg-avatar { background: #1e293b; }

.msg-content {
  max-width: 75%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.user .msg-bubble {
  background: #4f46e5;
  color: white;
  border-bottom-right-radius: 4px;
}
.msg.assistant .msg-bubble {
  background: #1e293b;
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
}

/* Tool events */
.tool-event {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  background: #0d1f18;
  border: 1px solid #1a3a2a;
  border-radius: 8px;
  font-size: 12px;
  color: #6ee7b7;
  font-family: monospace;
}
.tool-event-icon { flex-shrink: 0; margin-top: 1px; }
.tool-event-body { display: flex; flex-direction: column; gap: 2px; }
.tool-event-name { font-weight: 700; }
.tool-event-args { color: #94a3b8; font-size: 11px; word-break: break-all; }
.tool-event-result { color: #64748b; font-size: 11px; word-break: break-all; margin-top: 2px; }

/* Thinking indicator */
.thinking {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #6b7280;
  padding: 8px 14px;
}
.dot {
  width: 6px; height: 6px;
  background: #4f46e5;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* Code blocks in messages */
.msg-bubble code {
  background: #0f172a;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 12px;
}
.msg-bubble pre {
  background: #0f172a;
  padding: 10px 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 6px 0;
}
.msg-bubble pre code { background: none; padding: 0; }

/* Input */
.input-area {
  padding: 16px 24px 20px;
  border-top: 1px solid #1e293b;
}

.input-box {
  display: flex;
  gap: 10px;
  background: #1e293b;
  border: 1px solid #2d3748;
  border-radius: 12px;
  padding: 10px 12px;
  max-width: 860px;
  margin: 0 auto;
  transition: border-color 0.15s;
}
.input-box:focus-within { border-color: #4f46e5; }

textarea {
  flex: 1;
  background: none;
  border: none;
  color: #e2e8f0;
  font-size: 14px;
  resize: none;
  outline: none;
  max-height: 160px;
  font-family: inherit;
  line-height: 1.5;
}
textarea::placeholder { color: #4b5563; }

#send-btn {
  background: #4f46e5;
  color: white;
  border: none;
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  align-self: flex-end;
  transition: background 0.15s;
  white-space: nowrap;
}
#send-btn:hover:not(:disabled) { background: #4338ca; }
#send-btn:disabled { background: #2d3748; color: #4b5563; cursor: not-allowed; }
