@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Inter:wght@300;400;500;600&display=swap');

:root {
  --background: hsl(36, 33%, 97%);
  --foreground: hsl(220, 20%, 15%);
  --card: hsl(36, 30%, 95%);
  --card-foreground: hsl(220, 20%, 15%);
  --primary: hsl(220, 35%, 22%);
  --primary-foreground: hsl(36, 33%, 97%);
  --secondary: hsl(36, 25%, 88%);
  --muted: hsl(36, 20%, 92%);
  --muted-foreground: hsl(220, 10%, 45%);
  --accent: hsl(38, 65%, 55%);
  --border: hsl(36, 20%, 88%);
  --ring: hsl(38, 65%, 55%);
  --gold: hsl(38, 65%, 55%);
  --gold-light: hsl(38, 60%, 75%);
  --gold-dark: hsl(38, 70%, 45%);
  --navy: hsl(220, 35%, 22%);
  --navy-deep: hsl(220, 40%, 14%);
  --cream: hsl(36, 33%, 97%);
  --chat-user: hsl(220, 35%, 22%);
  --chat-user-fg: hsl(36, 33%, 97%);
  --chat-ai: hsl(36, 30%, 93%);
  --chat-ai-fg: hsl(220, 20%, 15%);
  --radius: 0.75rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-color: var(--border);
}

html, body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background-color: var(--background);
  color: var(--foreground);
}

.font-display {
  font-family: 'Cormorant Garamond', serif;
}

/* Gradient gold */
.bg-gradient-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
}

/* Shadows */
.shadow-gold {
  box-shadow: 0 4px 20px -4px hsl(38 65% 55% / 0.3);
}

.shadow-soft {
  box-shadow: 0 4px 24px -4px hsl(220 35% 22% / 0.08);
}

/* Scrollbar */
.scrollbar-thin::-webkit-scrollbar {
  width: 4px;
}
.scrollbar-thin::-webkit-scrollbar-track {
  background: transparent;
}
.scrollbar-thin::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 4px;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@keyframes pulseGold {
  0%, 100% {
    box-shadow: 0 0 0 0 hsl(38 65% 55% / 0.4);
  }
  50% {
    box-shadow: 0 0 0 6px hsl(38 65% 55% / 0);
  }
}

.animate-fade-in {
  animation: fadeInUp 0.3s ease-out;
}

.animate-typing {
  animation: typing 1.4s ease-in-out infinite;
}

.animate-pulse-gold {
  animation: pulseGold 2s ease-in-out infinite;
}

/* Chat layout */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background-color: rgb(251 248 244 / 0.8);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.header-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background-color: var(--secondary);
  color: var(--foreground);
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  transition: background-color 0.15s;
}
.header-btn:hover {
  background-color: var(--muted);
}

/* Messages area */
#messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1rem;
}

.messages-inner {
  max-width: 48rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Welcome screen */
#welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 3rem 1.5rem;
  text-align: center;
  animation: fadeInUp 0.4s ease-out;
}

.welcome-avatar {
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 1.5rem;
  box-shadow: 0 4px 20px -4px hsl(38 65% 55% / 0.3);
  position: relative;
}

.welcome-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.welcome-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
}

.suggestion-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background-color: var(--card);
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: var(--foreground);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.suggestion-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 24px -4px hsl(220 35% 22% / 0.08);
}
.suggestion-btn svg {
  flex-shrink: 0;
  color: var(--accent);
  width: 1rem;
  height: 1rem;
}

/* Chat messages */
.message-row {
  display: flex;
  gap: 0.75rem;
  animation: fadeInUp 0.3s ease-out;
}
.message-row.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.25rem;
}
.message-avatar.user {
  background-color: var(--primary);
  color: var(--primary-foreground);
}
.message-avatar.assistant {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  box-shadow: 0 4px 20px -4px hsl(38 65% 55% / 0.3);
}
.message-avatar svg {
  width: 1rem;
  height: 1rem;
}

.message-bubble {
  max-width: 80%;
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.message-bubble.user {
  background-color: var(--chat-user);
  color: var(--chat-user-fg);
  border-top-right-radius: 0.25rem;
}
.message-bubble.assistant {
  background-color: var(--chat-ai);
  color: var(--chat-ai-fg);
  border-top-left-radius: 0.25rem;
  box-shadow: 0 4px 24px -4px hsl(220 35% 22% / 0.08);
}
.message-time {
  font-size: 0.625rem;
  opacity: 0.5;
  margin-top: 0.25rem;
  display: block;
  text-align: right;
}

/* Typing indicator */
#typing-indicator {
  display: none;
  gap: 0.75rem;
  animation: fadeInUp 0.3s ease-out;
  align-items: flex-start;
}
#typing-indicator.visible {
  display: flex;
}

.typing-bubble {
  background-color: var(--chat-ai);
  border-radius: 1rem;
  border-top-left-radius: 0.25rem;
  padding: 0.75rem 1rem;
  box-shadow: 0 4px 24px -4px hsl(220 35% 22% / 0.08);
  display: flex;
  align-items: center;
  gap: 0.375rem;
  height: 2.75rem;
}
.typing-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: hsl(220, 10%, 55%);
  animation: typing 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* Input area */
.chat-input-area {
  border-top: 1px solid var(--border);
  background-color: rgb(251 248 244 / 0.8);
  backdrop-filter: blur(8px);
  padding: 1rem;
  flex-shrink: 0;
}

.chat-input-inner {
  max-width: 48rem;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
}

#message-input {
  flex: 1;
  resize: none;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background-color: var(--card);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  color: var(--foreground);
  outline: none;
  transition: box-shadow 0.15s, border-color 0.15s;
  line-height: 1.5;
  max-height: 7.5rem;
  overflow-y: auto;
  min-height: 2.75rem;
}
#message-input::placeholder {
  color: var(--muted-foreground);
}
#message-input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px hsl(38 65% 55% / 0.15);
}
#message-input:disabled {
  opacity: 0.5;
}

#send-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 0.125rem;
  transition: box-shadow 0.15s, opacity 0.15s;
  color: white;
}
#send-btn:hover:not(:disabled) {
  box-shadow: 0 4px 20px -4px hsl(38 65% 55% / 0.4);
}
#send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* Responsive */
@media (max-width: 640px) {
  .chat-header { padding: 0.75rem 1rem; }
  .header-btn span { display: none; }
  #messages-area { padding: 1rem 0.75rem; }
}
