:root {
  --primary-color: #6366f1;
  --gradient-start: #6366f1;
  --gradient-end: #8b5cf6;
  --bg-color: #f8fafc;
  --user-bg: #ffffff;
  --bot-bg: #f1f5f9;
  --text-color: #1e293b;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

body {
  background: var(--bg-color);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.chat-container {
  width: 100%;
  max-width: 900px; /* Increased from 700px */
  height: 80vh;
  background: white;
  border-radius: 1rem;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-header {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  padding: 1.5rem;
  color: white;
}

.header-content h1 {
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1;
}

.subtitle {
  font-size: 0.875rem;
  opacity: 0.9;
  margin-top: 0.25rem;
}

.chat-messages {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--bg-color);
  scroll-behavior: smooth;
  overflow-anchor: none;
}

.message {
  max-width: 85%;
  padding: 1rem;
  border-radius: 1rem;
  line-height: 1.5;
  position: relative;
  animation: messageAppear 0.3s ease-out;
  word-wrap: break-word;
}

/* --- Styles for formatted content --- */
.message strong {
  font-weight: 600;
}

.message em {
  font-style: italic;
}

.message code {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 0.2em 0.4em;
  margin: 0;
  font-size: 85%;
  border-radius: 3px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.message ul,
.message ol {
  padding-left: 20px;
  margin-top: 0.5rem;
}

.message li {
  margin-bottom: 0.25rem;
}

.message p {
  margin-bottom: 0.5rem;
}

.message p:last-child {
  margin-bottom: 0;
}
/* --- End new styles --- */

.user-message {
  background: var(--user-bg);
  margin-left: auto;
  box-shadow: var(--shadow);
  border-bottom-right-radius: 0.25rem;
}

.bot-message {
  background: var(--bot-bg);
  margin-right: auto;
  border-bottom-left-radius: 0.25rem;
}

.chat-input {
  display: flex;
  gap: 0.5rem;
  padding: 1.5rem;
  background: white;
  border-top: 1px solid #e2e8f0;
}

#message-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: var(--bg-color);
  transition: all 0.2s ease;
}

#message-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

#send-button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: grid;
  place-items: center;
}

#send-button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

#send-button:active {
  transform: translateY(0);
}

.typing-indicator {
  padding: 1rem 1.5rem;
  background: var(--bot-bg);
  display: none;
}

.dots {
  display: flex;
  gap: 0.5rem;
}

.dot {
  width: 8px;
  height: 8px;
  background: #64748b;
  border-radius: 50%;
  animation: dotPulse 1.4s infinite ease-in-out;
}

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

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

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

@media (max-width: 480px) {
  .chat-container {
    border-radius: 0;
    height: 100vh;
  }
}