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

:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #334155;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --primary: #3b82f6;
  --primary-glow: rgba(59,130,246,0.3);
  --accent: #10b981;
  --user-msg: #1d4ed8;
  --bot-msg: #334155;
  --radius: 12px;
  --radius-lg: 20px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ===== App Layout ===== */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg);
}

/* ===== Header ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 24px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.logo h1 {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.clear-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  border-color: rgba(255,255,255,0.2);
}

/* ===== Chat Container ===== */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

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

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

.welcome-icon {
  font-size: 56px;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.welcome-message h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.welcome-message p {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 400px;
  margin: 0 auto 24px;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 500px;
  margin: 0 auto;
}

.prompt-btn {
  padding: 10px 18px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50px;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.prompt-btn:hover {
  background: rgba(59,130,246,0.15);
  border-color: var(--primary);
  color: var(--text);
}

/* ===== Messages ===== */
.message {
  display: flex;
  gap: 12px;
  animation: messageIn 0.3s ease;
  max-width: 85%;
}

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

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

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.message.bot .msg-avatar {
  background: rgba(16,185,129,0.15);
}

.message.user .msg-avatar {
  background: rgba(59,130,246,0.15);
}

.msg-content {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.6;
}

.message.bot .msg-content {
  background: var(--bot-msg);
  border-bottom-left-radius: 4px;
  color: var(--text);
}

.message.user .msg-content {
  background: var(--user-msg);
  border-bottom-right-radius: 4px;
  color: #fff;
}

.msg-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

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

/* ===== Typing Indicator ===== */
.typing {
  display: flex;
  gap: 4px;
  padding: 16px 20px;
  align-items: center;
}

.typing span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

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

/* ===== Input Area ===== */
.input-area {
  padding: 16px 20px;
  background: var(--bg-card);
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.input-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 8px 12px;
  transition: all 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

#userInput {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  padding: 4px 0;
}

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

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.send-btn:hover {
  background: #2563eb;
  transform: scale(1.05);
}

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

.input-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .header { padding: 12px 16px; }
  .chat-container { padding: 16px 12px; gap: 12px; }
  .input-area { padding: 12px 16px; }
  .message { max-width: 90%; }
  .welcome-message { padding: 30px 16px; }
  .welcome-icon { font-size: 48px; }
  .welcome-message h2 { font-size: 20px; }
}

/* ===== Scrollbar ===== */
.chat-container::-webkit-scrollbar { width: 6px; }
.chat-container::-webkit-scrollbar-track { background: transparent; }
.chat-container::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }

/* ===== Selection ===== */
::selection { background: var(--primary); color: #fff; }
