/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #0511F2;
  --primary-dark: #030A8C;
  --accent: #F2E205;
  --destructive: #F24405;
  --dark: #0D0D0D;
  --background: #fafafa;
  --card: #ffffff;
  --muted: #f5f5f7;
  --border: #e5e5ea;
  --text: #0D0D0D;
  --text-muted: #6b6b6b;
  --radius: 0.75rem;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--background);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Override Bootstrap button focus/active defaults */
.btn:focus,
.btn:active,
.btn:focus-visible {
  box-shadow: none;
  outline: none;
}

/* Chat Container */
.chat-container {
  height: 100vh;
  max-width: 900px;
  box-shadow: 0 0 40px rgba(5, 17, 242, 0.08);
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background-color: var(--card);
}

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

.chat-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--primary);
  border-radius: 0.75rem;
  box-shadow: 0 4px 12px rgba(5, 17, 242, 0.25);
}

.chat-logo svg {
  width: 1.25rem;
  height: 1.25rem;
  color: white;
}

.chat-info h1 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-dot {
  width: 0.375rem;
  height: 0.375rem;
  background-color: var(--accent);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary);
  background-color: transparent;
  border: 1px solid rgba(5, 17, 242, 0.2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.new-chat-btn:hover {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.new-chat-btn svg {
  width: 1rem;
  height: 1rem;
}

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
}

.empty-state-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  background-color: var(--primary);
  border-radius: 1.25rem;
  box-shadow: 0 8px 24px rgba(5, 17, 242, 0.3);
  margin-bottom: 1.5rem;
}

.empty-state-icon svg {
  width: 2.5rem;
  height: 2.5rem;
  color: white;
}

.empty-state h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-wrap: balance;
}

.empty-state p {
  color: var(--text-muted);
  max-width: 28rem;
  margin-bottom: 2rem;
  text-wrap: pretty;
}

.suggestions {
  max-width: 32rem;
}

.suggestion-btn {
  padding: 1rem;
  font-size: 0.875rem;
  color: var(--text);
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestion-btn:hover {
  border-color: rgba(5, 17, 242, 0.5);
  background-color: rgba(5, 17, 242, 0.05);
  box-shadow: 0 4px 12px rgba(5, 17, 242, 0.1);
  color: var(--primary);
}

/* Message */
.message {
  display: flex;
  gap: 0.75rem;
  max-width: 85%;
}

.message.user {
  flex-direction: row-reverse;
  margin-left: auto;
}

.message-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.message-avatar svg {
  width: 1rem;
  height: 1rem;
  color: white;
}

.message.assistant .message-avatar {
  background-color: var(--primary);
  box-shadow: 0 4px 8px rgba(5, 17, 242, 0.2);
}

.message.user .message-avatar {
  background-color: var(--primary-dark);
}

.message-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.message-bubble {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
  border-radius: 1rem;
}

.message.assistant .message-bubble {
  background-color: var(--muted);
  color: var(--text);
  border-bottom-left-radius: 0.25rem;
  border: 1px solid var(--border);
}

.message.user .message-bubble {
  background-color: var(--primary);
  color: white;
  border-bottom-right-radius: 0.25rem;
  box-shadow: 0 4px 12px rgba(5, 17, 242, 0.2);
}

.message-time {
  font-size: 0.625rem;
  color: var(--text-muted);
  padding: 0 0.5rem;
}

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

/* Loading Dots */
.loading-dots {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0;
}

.loading-dots span {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) {
  background-color: var(--accent);
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  background-color: var(--primary);
  animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
  background-color: var(--destructive);
}

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Input Area */
.chat-input-area {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background-color: rgba(250, 250, 250, 0.95);
  backdrop-filter: blur(8px);
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.5rem;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  transition: all 0.2s ease;
}

.input-wrapper:focus-within {
  border-color: rgba(5, 17, 242, 0.5);
  box-shadow: 0 4px 16px rgba(5, 17, 242, 0.1);
}

.chat-textarea {
  flex: 1;
  min-height: 2.5rem;
  max-height: 8rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.5;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  resize: none;
}

.chat-textarea::placeholder {
  color: var(--text-muted);
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  background: transparent;
  border: none;
  border-radius: 0.625rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background-color: var(--muted);
  color: var(--text);
}

.icon-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

.send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  background-color: var(--primary);
  border: none;
  border-radius: 0.625rem;
  cursor: pointer;
  color: white;
  box-shadow: 0 4px 12px rgba(5, 17, 242, 0.25);
  transition: all 0.2s ease;
}

.send-btn:hover:not(:disabled) {
  background-color: var(--primary-dark);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.send-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

.stop-btn {
  background-color: var(--destructive);
  box-shadow: 0 4px 12px rgba(242, 68, 5, 0.25);
}

.stop-btn:hover {
  background-color: #d93d04;
}

.input-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-muted);
}

/* Hidden */
.hidden {
  display: none !important;
}
