*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #FD6263;
  --primary-dark: #d5494d;
  --primary-soft: #ffe5e6;
  --primary-border: #f6b1b4;
  --primary-dot: #ffb3b3;

  --contrast: #1D2129;
  --contrast-soft: #3d4555;
  --surface: #f5f7fb;
  --surface-strong: #ffffff;
  --surface-muted: #e8edf4;

  --bg-page: #f4f6fb;
  --bg-shell: #ffffff;
  --bg-messages: #f7f9fd;
  --bg-bubble-bot: #ffffff;
  --bg-input: #f7f9fd;

  --text-primary: #1D2129;
  --text-secondary: #5f6576;
  --text-muted: #8b95a8;

  --border-light: #dfe4ed;
  --border-input: #d3dbe7;
  --chip-bg: var(--primary-soft);
  --chip-text: var(--contrast);

  --shadow: 0 12px 40px rgba(29,33,41,0.08);
}

body.dark {
  --bg-page: #121822;
  --bg-shell: #1D2129;
  --bg-messages: #19202d;
  --bg-bubble-bot: #232b3a;
  --bg-input: #212a39;
  --surface-strong: #232b3a;

  --text-primary: #f4f6fb;
  --text-secondary: #a1acc8;
  --text-muted: #7f8ba3;

  --border-light: #2c3545;
  --border-input: #314158;
  --chip-bg: #2d3650;
  --chip-text: #f4f6fb;

  --shadow: 0 12px 40px rgba(0,0,0,0.45);
}

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--text-primary);
  background: var(--bg-page);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  transition: background 0.3s, color 0.3s;
}

.chat-shell {
  background: var(--bg-shell);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: min(90vh, 600px);
  width: min(460px, 100%);
  transition: background 0.3s;
}

.chat-header {
  background: var(--primary);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.chat-header-info {
  flex: 1;
  min-width: 0;
}

.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(29,33,41,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}

.chat-header-info { flex: 1; }

.chat-header-info p:first-child {
  font-size: 14px;
  font-weight: 500;
  color: #fff;
}

.chat-header-info p:last-child {
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  gap: 4px;
}

.online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary-dot);
  display: inline-block;
}

.theme-btn {
  background: rgba(255,255,255,0.18);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.theme-btn:hover { background: rgba(255,255,255,0.28); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-messages);
  transition: background 0.3s;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--contrast-soft); border-radius: 4px; }

.msg { display: flex; flex-direction: column; max-width: 82%; }
.msg.bot { align-self: flex-start; }
.msg.user { align-self: flex-end; }

.msg-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
}

.msg.bot .msg-bubble {
  background: var(--surface-strong);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-light);
}

.msg.user .msg-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 8px 20px rgba(253,98,99,0.14);
}

.msg-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  padding: 0 4px;
}

.msg.user .msg-time { text-align: right; }

.typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg-bubble-bot);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: bounce 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.suggestions {
  padding: 8px 14px 4px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--bg-messages);
  flex-shrink: 0;
  transition: background 0.3s;
}

.chip {
  font-size: 11.5px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--primary-border);
  color: var(--chip-text);
  background: var(--chip-bg);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
  font-family: 'DM Sans', sans-serif;
}

.chip:hover { background: var(--primary); color: #fff; }

.chat-input-area {
  padding: 12px 14px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-shell);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.chat-input {
  flex: 1;
  border: 1px solid var(--border-input);
  border-radius: 20px;
  padding: 12px 16px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-input);
  color: var(--text-primary);
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 90px;
  overflow-y: auto;
  transition: background 0.3s, border 0.3s;
}

.chat-input:focus { border-color: var(--primary); background: var(--bg-shell); }

.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

.send-btn:hover { background: var(--primary-dark); }
.send-btn:active { transform: scale(0.95); }
.send-btn:disabled { background: var(--primary-border); cursor: not-allowed; }

.send-btn svg { width: 16px; height: 16px; fill: #fff; }