
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #0b0c10;
  --panel: #111319;
  --panel-hover: #1b1e27;
  --text: #f4f5f8;
  --muted: #969baa;
  --accent: #8b5cf6;
  --accent-light: #a78bfa;
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  background:
    radial-gradient(ellipse at 70% 0%, rgba(104, 64, 180, 0.12), transparent 40%),
    var(--bg);
  color: var(--text);
}

button,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app,
#app {
  min-height: 100vh;
}

/* Main layout */
body {
  display: flex;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: rgba(15, 16, 22, 0.92);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.7px;
  margin: 8px 10px;
}

.sidebar button,
.new-chat,
#newChat {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  transition: 0.2s ease;
}

.sidebar button:hover,
.new-chat:hover,
#newChat:hover {
  background: var(--panel-hover);
  border-color: rgba(167, 139, 250, 0.4);
}

.sidebar .bottom {
  margin-top: auto;
  color: var(--muted);
  font-size: 13px;
}

/* Chat area */
main,
.chat-main,
#chat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

header,
.topbar {
  height: 64px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 12, 16, 0.65);
  backdrop-filter: blur(16px);
}

header h2,
.topbar h2 {
  font-size: 15px;
  font-weight: 600;
}

select {
  background: #1a1c24;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
}

/* Messages */
#messages,
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  scroll-behavior: smooth;
}

.message {
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  line-height: 1.75;
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: appear 0.25s ease;
}

.message.user {
  align-self: flex-end;
  max-width: 780px;
  width: fit-content;
  margin-right: max(0px, calc((100% - 780px) / 2));
  background: #252733;
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 13px 18px;
  border-radius: 20px 20px 5px 20px;
}

.message.assistant {
  color: #e7e8ee;
}

.message.assistant::before {
  content: "✦";
  color: var(--accent-light);
  margin-right: 10px;
  font-size: 16px;
}

/* Welcome screen */
.welcome {
  margin: auto;
  text-align: center;
  max-width: 650px;
  padding: 30px;
}

.welcome h1 {
  font-size: clamp(30px, 5vw, 48px);
  letter-spacing: -2px;
  margin-bottom: 12px;
}

.welcome p {
  color: var(--muted);
  font-size: 15px;
}

/* Prompt area */
#chatForm,
.chat-form,
form {
  width: min(850px, calc(100% - 40px));
  margin: 0 auto 24px;
}

#chatForm,
.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(167, 139, 250, 0.22);
  border-radius: 22px;
  background: rgba(25, 27, 36, 0.92);
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.08);
  transition: 0.2s ease;
}

#chatForm:focus-within,
.chat-form:focus-within {
  border-color: rgba(167, 139, 250, 0.65);
  box-shadow: 0 0 35px rgba(139, 92, 246, 0.15);
}

textarea,
#prompt {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  min-height: 44px;
  max-height: 180px;
  font-size: 15px;
}

textarea::placeholder,
#prompt::placeholder {
  color: #777d8e;
}

#chatForm button,
.chat-form button,
button[type="submit"] {
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #8b5cf6, #6d4aff);
  color: white;
  padding: 12px 17px;
  font-weight: 600;
  transition: 0.2s ease;
}

#chatForm button:hover,
.chat-form button:hover,
button[type="submit"]:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
}

#status {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 0 10px 16px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 7px;
}

::-webkit-scrollbar-thumb {
  background: #343643;
  border-radius: 10px;
}

/* Animation */
@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile */
@media (max-width: 700px) {
  .sidebar {
    display: none;
  }

  header,
  .topbar {
    padding: 0 16px;
  }

  #messages,
  .messages {
    padding: 24px 16px;
  }

  #chatForm,
  .chat-form,
  form {
    width: calc(100% - 24px);
    margin-bottom: 12px;
  }

  .welcome h1 {
    letter-spacing: -1px;
  }
}
