:root {
  --bg:          #f0eef8;
  --surface:     #ffffff;
  --border:      #dcdaf0;
  --text:        #1c1a2e;
  --muted:       #8f8caa;
  --accent:      #7c6af7;
  --accent-glow: rgba(124, 106, 247, 0.10);
  --user-bg:     #7c6af7;
  --user-text:   #fff;
  --bot-bg:      #f8f7fc;
  --err:         #c0392b;
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 17px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Layout ─────────────────────────────────────── */
.layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

/* ─── Header ─────────────────────────────────────── */
.chat-header {
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 24px 16px;
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

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

.header-badge {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid rgba(124, 106, 247, 0.35);
  border-radius: 4px;
  padding: 2px 7px;
}

.header-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.header-desc {
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1;
}

/* ─── Messages ───────────────────────────────────── */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ─── Welcome ────────────────────────────────────── */
.welcome {
  margin: auto 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome-prompt {
  font-size: 1.05rem;
  color: var(--muted);
  font-weight: 300;
}

.suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 11px 15px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.suggestion:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}

/* ─── Message rows ───────────────────────────────── */
.msg {
  display: flex;
  animation: msg-in 0.2s ease;
}

.msg--user      { justify-content: flex-end; }
.msg--assistant { justify-content: flex-start; }

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bubble {
  max-width: 80%;
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 1rem;
  line-height: 1.65;
}

.msg--user .bubble {
  background: var(--user-bg);
  color: var(--user-text);
  border-bottom-right-radius: 3px;
}

.msg--assistant .bubble {
  background: var(--bot-bg);
  border: 1px solid var(--border);
  border-bottom-left-radius: 3px;
}

/* Loading dots */
.bubble--loading {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 15px 16px;
}

.bubble--loading span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: dot 1.4s infinite ease-in-out;
}

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

@keyframes dot {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%            { transform: scale(1);   opacity: 1; }
}

.err { color: var(--err); }

/* ─── Input row ──────────────────────────────────── */
.input-row {
  padding: 14px 24px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 8px 7px 20px;
  transition: border-color 0.15s;
}

.input-wrap:focus-within {
  border-color: var(--accent);
}

input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}

input::placeholder { color: var(--muted); }
input:disabled     { opacity: 0.5; }

#send {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: #fff;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.1s;
}

#send:hover    { opacity: 0.85; }
#send:active   { transform: scale(0.94); }
#send:disabled { opacity: 0.35; cursor: not-allowed; }
