body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f5f5f5;
  color: #333;
  transition: background-color 0.3s, color 0.3s;
}

.dark {
  background-color: #1a1a1a;
  color: #e0e0e0;
}

#app {
  display: flex;
  height: 100vh;
}

#sidebar {
  width: 250px;
  background-color: #f0f0f0;
  padding: 10px;
  overflow-y: auto;
  border-right: 1px solid #ccc;
}

.dark #sidebar {
  background-color: #2a2a2a;
  border-right: 1px solid #555;
}

#chatList {
  margin-top: 10px;
}

.chatItem {
  padding: 10px;
  margin: 5px 0;
  background-color: #e0e0e0;
  cursor: pointer;
  border-radius: 5px;
  position: relative;
}

.dark .chatItem {
  background-color: #3a3a3a;
}

.chatItem.active {
  background-color: #007bff;
  color: white;
}

.deleteBtn {
  position: absolute;
  right: 5px;
  top: 5px;
  background: red;
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 12px;
  display: none;
}

.chatItem:hover .deleteBtn {
  display: block;
}

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#auth {
  text-align: center;
  margin: auto;
}

input, textarea {
  display: block;
  margin: 10px auto;
  padding: 10px;
  width: 100%;
  max-width: 300px;
}

textarea {
  resize: vertical;
  min-height: 40px;
}

button {
  padding: 10px 20px;
  margin: 5px;
  cursor: pointer;
}

#chat {
  height: 100%;
  display: flex;
  flex-direction: column;
}

#themeToggle {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 24px;
  cursor: pointer;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.message {
  margin: 10px 0;
  padding: 10px;
  border-radius: 10px;
  max-width: 70%;
  position: relative;
}

.user {
  background-color: #007bff;
  color: white;
  align-self: flex-end;
  margin-left: auto;
}

.ai {
  background-color: #e9ecef;
  color: #333;
}

.dark .ai {
  background-color: #333;
  color: #e0e0e0;
}

.message .content {
  margin-bottom: 5px;
}

.message .actions {
  font-size: 12px;
  opacity: 0.7;
}

.message:hover .actions {
  opacity: 1;
}

#inputArea {
  display: flex;
  padding: 10px;
  border-top: 1px solid #ccc;
}

#messageInput {
  flex: 1;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

#sendBtn {
  padding: 10px;
}

@media (max-width: 600px) {
  #sidebar {
    width: 200px;
  }
  .message {
    max-width: 90%;
  }
}

/* Markdown styles */
.message pre {
  background-color: #f4f4f4;
  padding: 10px;
  border-radius: 5px;
  overflow-x: auto;
  position: relative;
}

.dark .message pre {
  background-color: #2a2a2a;
}

.message code {
  background-color: #f4f4f4;
  padding: 2px 4px;
  border-radius: 3px;
}

.dark .message code {
  background-color: #2a2a2a;
}

.copy-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: #007bff;
  color: white;
  border: none;
  padding: 2px 5px;
  cursor: pointer;
  font-size: 10px;
}