@tailwind base;
@tailwind components;
@tailwind utilities;

/* Custom styles for the Talk Box React Chat */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.message-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.message-item {
  margin-bottom: 1rem;
}

.message-user {
  text-align: right;
}

.message-assistant {
  text-align: left;
}

.message-bubble {
  display: inline-block;
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  word-wrap: break-word;
}

.message-bubble.user {
  background-color: #3b82f6;
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.message-bubble.assistant {
  background-color: #f3f4f6;
  color: #374151;
  border-bottom-left-radius: 0.25rem;
}

.chat-input-container {
  border-top: 1px solid #e5e7eb;
  padding: 1rem;
  background-color: white;
}

.chat-input {
  width: 100%;
  min-height: 2.5rem;
  max-height: 120px;
  resize: none;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.send-button {
  background-color: #3b82f6;
  color: white;
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  margin-left: 0.75rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.send-button:hover {
  background-color: #2563eb;
}

.send-button:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

/* Floating chat styles */
.chat-float {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 1000;
}

.chat-popup-button {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background-color: #3b82f6;
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: background-color 0.2s, transform 0.2s;
}

.chat-popup-button:hover {
  background-color: #2563eb;
  transform: scale(1.05);
}

.chat-window {
  width: 400px;
  height: 600px;
  background-color: white;
  border-radius: 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  margin-bottom: 1rem;
}

@media (max-width: 640px) {
  .chat-window {
    width: 320px;
    height: 500px;
  }
}

/* Loading spinner */
.loading-spinner {
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
  display: inline-block;
  margin-right: 0.5rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Code blocks in markdown */
.message-content pre {
  background-color: #1f2937;
  color: #f9fafb;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}

.message-content code {
  background-color: #f3f4f6;
  color: #374151;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
}

.message-content pre code {
  background: none;
  color: inherit;
  padding: 0;
}
