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

:root {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  font-family: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
  background-color: #ffffff;
  color: #111827;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  max-height: 100vh;
}

/* Loader Styles */
.loader-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  color: #374151;
}

.loader {
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

#loader-text {
  margin: 1rem 0 0.5rem 0;
  font-weight: 500;
}

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

.header {
  background-color: #ffffff;
  padding: 1.25rem 1.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  height: 32px;
  width: auto;
}

.header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: #111827;
}

.new-conversation-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background-color: #ffffff;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.new-conversation-btn:hover {
  background-color: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  background-color: #ffffff;
}

.chat-wrapper {
  max-width: 48rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 0.5rem;
  color: #0d0d0d;
}

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

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

.message-content {
  white-space: pre-wrap;
  line-height: 1.6;
  max-width: 100%;
}

.message.assistant .message-content {
  background: transparent;
  border: none;
  padding: 0.25rem 0;
  cursor: pointer;
  border-radius: 0.5rem;
  padding: 0.5rem;
  margin-left: -0.5rem;
  transition: background-color 0.2s ease;
}

.message.assistant .message-content:hover {
  background-color: #f9fafb;
}

.message.user .message-content {
  background-color: #f3f4f6;
  border-radius: 1.25rem;
  padding: 0.8rem 1rem;
  max-width: 65%;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.message.user .message-content:hover {
  background-color: #e5e7eb;
}

.message.console .message-content {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Courier New', monospace;
  font-size: 0.875rem;
  background-color: #fafafa;
  padding: 0.75rem 1rem;
  color: #374151;
  max-width: 80%;
}

.input-container {
  background-color: #ffffff;
  padding: 1rem;
}

.input-wrapper {
  max-width: 48rem;
  margin: 0 auto;
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 0.8rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.75rem;
  background-color: #ffffff;
  color: #111827;
  font-size: 1rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  min-height: 54px;
  max-height: 200px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input::placeholder {
  color: #9ca3af;
}

.chat-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.send-button {
  flex-shrink: 0;
  padding: 0;
  width: 54px;
  height: 54px;
  border: 1px solid #111827;
  border-radius: 0.75rem;
  background-color: #111827;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.send-button:hover:not(:disabled) {
  background-color: #2563eb;
  border-color: #2563eb;
}

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

.error-message {
  background-color: #fee2e2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  margin-top: 0.5rem;
}

.progress {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Courier New', monospace;
  text-align: center;
}