:root {
  --bg: white;
  --text: black;
  --message-user: #f0f0f0;
  --message-assistant: #e3f2fd;
  --tool-card: #fafafa;
  --tool-status: #e0e0e0;
  --border: #ddd;
  --primary: #2196f3;
  --primary-hover: #1976d2;
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --text: white;
  --message-user: #333;
  --message-assistant: #1e3a5f;
  --tool-card: #2a2a2a;
  --tool-status: #3a3a3a;
  --border: #444;
  --primary: #2196f3;
  --primary-hover: #1976d2;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: background 0.3s, color 0.3s;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1 {
  margin-bottom: 2rem;
  font-size: 2rem;
  font-weight: 600;
}

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

.message {
  padding: 1rem;
  border-radius: 8px;
  max-width: 80%;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  background: var(--message-user);
  align-self: flex-end;
  margin-left: 20%;
}

.message.assistant {
  background: var(--message-assistant);
  align-self: flex-start;
  margin-right: 20%;
}

.tool-card {
  margin: 0.5rem 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--tool-card);
}

.message-content {
  margin-bottom: 8px;
}

.message-content:last-child {
  margin-bottom: 0;
}

.tool-card p {
  margin-bottom: 0.5rem;
}

.tool-card button {
  margin-right: 0.5rem;
}

.tool-status {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  margin: 0.25rem 0.25rem 0.25rem 0;
  background: var(--tool-status);
  border-radius: 4px;
  font-size: 0.875rem;
}

form {
  display: flex;
  gap: 0.5rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
}

input:focus {
  outline: none;
  border-color: var(--primary);
}

button {
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}

button:hover {
  background: var(--primary-hover);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.examples {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.examples p {
  width: 100%;
  font-size: 0.875rem;
  color: var(--text);
  opacity: 0.7;
  margin-bottom: 0.5rem;
}

.examples button {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.examples button:hover {
  background: var(--primary);
  color: white;
}

.loading {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  background: var(--text);
  border-radius: 50%;
  margin: 0 0.125rem;
  animation: bounce 1.4s infinite ease-in-out both;
}

.loading:nth-child(1) {
  animation-delay: -0.32s;
}

.loading:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}
