/* styles.css - updated (chat height, gap, typing bubble fixes) */

/* Tokens */
:root {
  --accent: #2563eb;
  --bg: #ffffff;
  --surface: #f7f8fb;
  --card-border: #e6e6e9;
  --max-width: 900px;
  --bubble-radius: 12px;
  --user-bubble-bg: #2563eb;
  --assistant-bubble-bg: #f1f5f9;
  --user-text-color: #fff;
  --assistant-text-color: #0f172a;
  --transcript-padding: 18px;
  --chat-img-max-height: 45vh;
}

/* Page base */
html,
body {
  height: 100%;
  margin: 0;
  background: var(--surface);
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Arial;
  color: #0f172a;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.site {
  max-width: var(--max-width);
  margin: 36px auto;
  padding: 0 20px;
}
.site-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 18px;
}
.site-logo {
  height: 44px;
  object-fit: contain;
}

/* demo card fixed height */
.demo-card {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(12, 20, 40, 0.04);
  height: 80vh; /* fixed vertical size */
  display: flex;
  flex-direction: column;
}

/* chat root */
.chat-root {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

/* transcript area fills available space and scrolls */
.chat {
  flex: 1 1 auto;
  overflow: auto; /* ensures internal scrolling */
  background: #fff;
  border-radius: 8px;
  padding: var(--transcript-padding);
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid #eef2f6;
  display: flex;
  flex-direction: column;
  gap: 16px; /* doubled spacing between messages */
}

/* message wrapper / alignment */
.message {
  display: flex;
  max-width: 80%;
  align-items: flex-start;
}
.message.assistant {
  justify-content: flex-start;
  margin-right: auto;
}
.message.user {
  justify-content: flex-end;
  margin-left: auto;
}

/* bubble base */
.bubble {
  padding: 12px 16px;
  border-radius: var(--bubble-radius);
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
  box-shadow: 0 2px 6px rgba(12, 20, 40, 0.04);
  white-space: pre-wrap;
  overflow: visible;
}

/* assistant bubble */
.assistant-bubble {
  background: var(--assistant-bubble-bg);
  color: var(--assistant-text-color);
  border-top-left-radius: 6px;
  border-top-right-radius: var(--bubble-radius);
  border-bottom-right-radius: var(--bubble-radius);
  border-bottom-left-radius: var(--bubble-radius);
}

/* user bubble */
.user-bubble {
  background: var(--user-bubble-bg);
  color: var(--user-text-color);
  border-top-right-radius: 6px;
  border-top-left-radius: var(--bubble-radius);
  border-bottom-left-radius: var(--bubble-radius);
  border-bottom-right-radius: var(--bubble-radius);
}

/* images inside chat bubble */
.message img {
  display: block;
  max-width: 95%;
  max-height: var(--chat-img-max-height);
  border-radius: 8px;
  margin-top: 8px;
  object-fit: contain;
}

/* input bar */
.input-bar {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* input styling */
.text-input {
  flex: 1;
  border-radius: 999px;
  padding: 12px 16px;
  border: 1px solid #e6e7eb;
  background: #fff;
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.06);
  font-size: 15px;
  outline: none;
}
.text-input:focus {
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
  border-color: var(--accent);
}

/* send button */
.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
}
.send-btn svg {
  color: #fff;
}
.send-btn:active {
  transform: translateY(1px);
}

/* typing indicator (bigger padding to avoid cropping) */
.typing-bubble {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
}
.typing-bubble .dot {
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
  opacity: 0.35;
  animation: typing-bounce 1s infinite ease-in-out;
}
.typing-bubble .dot:nth-child(2) {
  animation-delay: 0.12s;
}
.typing-bubble .dot:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes typing-bounce {
  0% {
    transform: translateY(0);
    opacity: 0.35;
  }
  50% {
    transform: translateY(-6px);
    opacity: 1;
  }
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
}

/* caption (above images) */
.caption {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
}

/* small screens */
@media (max-width: 720px) {
  .site {
    margin: 18px 12px;
  }
  .demo-card {
    padding: 12px;
    height: 78vh;
  }
  .message {
    max-width: 92%;
  }
  .site-logo {
    height: 36px;
  }
}

/* Footer - prevent wrapping and keep items on one line */
footer {
  margin-top: 18px;
  color: #6b7280;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap; /* prevent the privacy link dropping */
  min-height: 36px;
  padding-bottom: 8px; /* provide small space under footer */
}
