:root {
  --bg-primary: #FDF6EE;
  --bg-secondary: #F5EDD8;
  --navy: #2B3A8C;
  --navy-dark: #1E2B6B;
  --yellow: #F5C518;
  --text-primary: #1A1A2E;
  --text-secondary: #5A5A7A;
  --border: #E8DCC8;
  --white: #FFFFFF;
  --shadow: 0 2px 12px rgba(43, 58, 140, 0.08);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 800px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Header */
header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

header .logo {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
}

header .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--navy);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--yellow);
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 18px;
}

header .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-left: auto;
}

/* Chat container */
#chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Welcome screen */
#welcome {
  text-align: center;
  padding: 40px 20px;
}

#welcome h2 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  color: var(--navy);
  margin-bottom: 8px;
}

#welcome p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 32px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.suggested-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.suggested-question {
  background: var(--bg-primary);
  border: 1.5px solid var(--navy);
  color: var(--navy);
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.suggested-question:hover {
  background: var(--navy);
  color: var(--white);
}

/* Messages */
#messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  max-width: 80%;
  line-height: 1.6;
  font-size: 15px;
}

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

.message.user .bubble {
  background: var(--navy);
  color: var(--white);
  border-radius: 20px 20px 4px 20px;
  padding: 12px 18px;
}

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

.message.assistant .bubble {
  background: var(--white);
  border-radius: 4px 20px 20px 20px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.message.assistant .bubble p {
  margin-bottom: 12px;
}

.message.assistant .bubble p:last-child {
  margin-bottom: 0;
}

.message.assistant .bubble ul,
.message.assistant .bubble ol {
  margin: 8px 0;
  padding-left: 20px;
}

.message.assistant .bubble li {
  margin-bottom: 4px;
}

.message.assistant .bubble h3 {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  color: var(--navy);
  margin: 16px 0 8px;
}

.message.assistant .bubble h3:first-child {
  margin-top: 0;
}

.message.assistant .bubble strong {
  color: var(--navy-dark);
}

/* Sources section in AI messages */
.message.assistant .sources {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.message.assistant .sources a {
  color: var(--navy);
  text-decoration: underline;
}

.message.assistant .sources a:hover {
  color: var(--navy-dark);
}

/* Error message */
.message.error .bubble {
  background: #FFF0F0;
  border: 1px solid #FFD0D0;
  border-radius: 20px;
  padding: 12px 18px;
  color: #CC3333;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 0;
  align-items: center;
}

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

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
.typing-indicator span:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Input bar */
#input-bar {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  background: var(--white);
  border-top: 1px solid var(--border);
  align-items: flex-end;
}

#input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  resize: none;
  min-height: 48px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.2s;
  background: var(--bg-primary);
}

#input:focus {
  border-color: var(--navy);
}

#input::placeholder {
  color: var(--text-secondary);
}

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

#send-btn:hover {
  background: var(--navy-dark);
}

#send-btn svg {
  width: 20px;
  height: 20px;
  fill: var(--white);
}

#send-btn:disabled {
  background: #B0B0C0;
  cursor: not-allowed;
}

/* Status text */
#status-text {
  padding: 4px 24px;
  font-size: 12px;
  color: var(--text-secondary);
  min-height: 20px;
  text-align: center;
}

/* Footer */
footer {
  padding: 12px 24px;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  border-top: 1px solid var(--border);
  line-height: 1.5;
}

/* Scrollbar styling */
#chat-container::-webkit-scrollbar {
  width: 6px;
}

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

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

/* Mobile responsive */
@media (max-width: 600px) {
  header {
    padding: 12px 16px;
  }

  header .subtitle {
    display: none;
  }

  #chat-container {
    padding: 16px;
  }

  #welcome h2 {
    font-size: 22px;
  }

  #welcome p {
    font-size: 14px;
  }

  .message {
    max-width: 90%;
  }

  #input-bar {
    padding: 12px 16px;
  }

  #input {
    font-size: 14px;
    padding: 10px 14px;
  }
}
