
body {
  font-family: Arial, sans-serif;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: var(--bg);
  color: var(--text);
}

:root {
  --bg: #f5f5f5;
  --text: #000;
  --card: #ffffff;
  --bubble-user: #007bff;
  --bubble-ai: #e5e5ea;
}

.dark {
  --bg: #1e1e1e;
  --text: #fff;
  --card: #2c2c2c;
  --bubble-user: #4f8cff;
  --bubble-ai: #3b3b3b;
}

.theme-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--card);
  border: none;
  padding: 10px;
  border-radius: 50%;
  cursor: pointer;
}

.chat-container {
  background: var(--card);
  width: 500px;
  max-width: 95%;
  height: 600px;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  overflow: hidden;
}

#chat {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.message {
  padding: 12px 16px;
  border-radius: 18px;
  margin-bottom: 12px;
  max-width: 80%;
  word-wrap: break-word;
  animation: fadeIn 0.3s ease;
}

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

.user {
  background: var(--bubble-user);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 0;
}

.ai {
  background: var(--bubble-ai);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 0;
}

/* Typing Indicator */
.typing {
  display: flex;
  gap: 6px;
  padding: 10px;
  margin: 0 20px 10px;
}

.typing.hidden {
  display: none;
}

.dot {
  width: 10px;
  height: 10px;
  background: gray;
  border-radius: 50%;
  animation: blink 1.4s infinite both;
}

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

@keyframes blink {
  0% { opacity: .2; }
  20% { opacity: 1; }
  100% { opacity: .2; }
}

.input-area {
  display: flex;
  border-top: 1px solid #444;
  padding: 10px;
  background: var(--card);
}

#input {
  flex: 1;
  padding: 10px;
  border-radius: 20px;
  border: 1px solid #777;
  background: var(--bg);
  color: var(--text);
}

#sendBtn {
  padding: 10px 20px;
  margin-left: 10px;
  border: none;
  border-radius: 20px;
  background: var(--bubble-user);
  color: #fff;
  cursor: pointer;
}
