* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #8b5cf6;
  --primary-light: #a78bfa;
  --primary-dark: #7c3aed;
  --bg: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-chat: #16162a;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --user-bubble: #8b5cf6;
  --bot-bubble: #1e1e3a;
  --border: #2d2d4a;
  --accent-pink: #f472b6;
  --accent-gradient: linear-gradient(135deg, #8b5cf6, #f472b6);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 900px;
  margin: 0 auto;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.header-info h1 {
  font-size: 18px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 2s ease-in-out infinite;
}

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

.clear-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.clear-btn:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--primary);
  color: var(--primary-light);
}

/* Chat Container */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
  background: var(--bg-chat);
}

.chat-container::-webkit-scrollbar {
  width: 6px;
}

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

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

/* Welcome Message */
.welcome-message {
  text-align: center;
  padding: 60px 20px;
  animation: fadeIn 0.6s ease;
}

.welcome-emoji {
  font-size: 48px;
  margin-bottom: 16px;
}

.welcome-message h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 10px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-message p {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
}

/* Message Bubbles */
.message {
  display: flex;
  gap: 12px;
  animation: slideUp 0.3s ease;
  max-width: 85%;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.bot {
  align-self: flex-start;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.message.bot .message-avatar {
  background: var(--accent-gradient);
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.2);
}

.message.user .message-avatar {
  background: linear-gradient(135deg, #f472b6, #fb923c);
  box-shadow: 0 2px 10px rgba(244, 114, 182, 0.2);
}

.message-content {
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 14.5px;
  line-height: 1.6;
  word-wrap: break-word;
}

.message.user .message-content {
  background: var(--user-bubble);
  color: white;
  border-bottom-right-radius: 6px;
}

.message.bot .message-content {
  background: var(--bot-bubble);
  color: var(--text);
  border-bottom-left-radius: 6px;
  border: 1px solid var(--border);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 12px;
  align-self: flex-start;
  animation: slideUp 0.3s ease;
}

.typing-indicator .message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 20px;
  background: var(--bot-bubble);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  border: 1px solid var(--border);
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-light);
  animation: bounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* Error Message */
.error-message {
  text-align: center;
  padding: 12px 20px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  color: #fca5a5;
  font-size: 14px;
  animation: slideUp 0.3s ease;
}

/* Input Area */
.input-area {
  padding: 16px 24px 12px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: var(--bg-chat);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px 8px 8px 18px;
  transition: border-color 0.2s ease;
}

.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  padding: 8px 0;
  outline: none;
}

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

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: var(--accent-gradient);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

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

.send-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.disclaimer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
  opacity: 0.6;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* Responsive */
@media (max-width: 768px) {
  .app {
    border: none;
  }

  .header {
    padding: 14px 16px;
  }

  .header-info h1 {
    font-size: 16px;
  }

  .clear-btn span {
    display: none;
  }

  .chat-container {
    padding: 16px;
  }

  .message {
    max-width: 92%;
  }

  .input-area {
    padding: 12px 16px 8px;
  }

  .welcome-message {
    padding: 40px 16px;
  }

  .welcome-message h2 {
    font-size: 24px;
  }
}

/* Selection color */
::selection {
  background: rgba(139, 92, 246, 0.3);
}
