.ai-chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  background: var(--bg-white);
  border: 1px solid var(--border-gray);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.ai-chat-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-light);
  font-size: 14px;
}

.ai-chat-message {
  display: flex;
}

.ai-chat-message--user {
  justify-content: flex-end;
}

.ai-chat-message--assistant {
  justify-content: flex-start;
}

.ai-chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.ai-chat-bubble--user {
  background: var(--primary);
  color: #fff;
}

.ai-chat-bubble--assistant {
  background: var(--bg-gray-light);
  color: var(--text-dark);
}

.ai-chat-bubble p {
  margin: 0 0 4px 0;
}

.ai-chat-bubble p:last-child {
  margin-bottom: 0;
}

.ai-chat-bubble strong {
  font-weight: 600;
}

.ai-chat-bubble a {
  color: var(--secondary);
  text-decoration: underline;
}

.ai-chat-table-wrap {
  overflow-x: auto;
  margin: 8px 0;
}

.ai-chat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ai-chat-table th,
.ai-chat-table td {
  border: 1px solid var(--border-gray);
  padding: 4px 8px;
  text-align: left;
}

.ai-chat-table th {
  font-weight: 600;
  background: var(--bg-gray);
}

.ai-chat-code {
  background: var(--bg-gray);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 12px;
  overflow-x: auto;
}

.ai-chat-inline-code {
  background: var(--bg-gray);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 12px;
}

/* Input form */
.ai-chat-form {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--border-gray);
  background: var(--bg-white);
  align-items: flex-end;
}

.ai-chat-form textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border-gray);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.4;
  min-height: 40px;
  max-height: 120px;
  outline: none;
  transition: border-color var(--transition);
}

.ai-chat-form textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-ring);
}

.ai-chat-form button {
  padding: 10px 20px;
  font-size: 14px;
  white-space: nowrap;
}

/* Loading animation */
.ai-chat-loading {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.ai-chat-loading span {
  width: 6px;
  height: 6px;
  background: var(--text-light);
  border-radius: 50%;
  animation: ai-chat-bounce 1.4s ease-in-out infinite;
}

.ai-chat-loading span:nth-child(2) {
  animation-delay: 0.2s;
}

.ai-chat-loading span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes ai-chat-bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
