/* GenAI Essentials Chat — minimal styling, no frameworks. */

:root {
  --fg: #1a1a1a;
  --muted: #555;
  --bg: #fafafa;
  --border: #d0d0d0;
  --accent: #1f6feb;
  --user-bg: #1f6feb;
  --user-fg: #ffffff;
  --assistant-bg: #ececec;
  --assistant-fg: #1a1a1a;
  --error-fg: #b00020;
  --error-bg: #fdecea;
  --error-border: #f5c2c0;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1 { font-size: 1.4rem; margin: 0 0 1rem 0; }

/* ----- Login ----- */
.login { display: flex; flex-direction: column; gap: 1rem; max-width: 360px; margin: 4rem auto 0; }
.login label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; color: var(--muted); }
.login input {
  padding: 0.5rem 0.6rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}
.login button { align-self: flex-start; }

/* ----- Buttons ----- */
button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:disabled { opacity: 0.6; cursor: not-allowed; }
.link-button {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: underline;
}

/* ----- Chat layout ----- */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.transcript {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.message-row { display: flex; }
.message-row--user { justify-content: flex-end; }
.message-row--assistant { justify-content: flex-start; }

.message {
  max-width: 80%;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.message--user { background: var(--user-bg); color: var(--user-fg); border-bottom-right-radius: 2px; }
.message--assistant { background: var(--assistant-bg); color: var(--assistant-fg); border-bottom-left-radius: 2px; }

/* ----- Composer ----- */
.composer {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}
.composer textarea {
  flex: 1;
  resize: vertical;
  min-height: 2.5rem;
  max-height: 12rem;
  padding: 0.5rem 0.6rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}

/* ----- Errors ----- */
.error {
  color: var(--error-fg);
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
}
