.personal-ai {
  max-width: 640px;
  margin: 0 auto 200px auto;
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 20px; /* spacing between chat log, input, and suggested buttons */
}

/* Chat log */
.chat-wrapper {
  position: relative;
  max-height: 600px;
  overflow: hidden; /* clip pseudo-elements outside */
  transition: max-height 0.3s ease; /* smooth height change */
}

/* Gradient overlays */
.chat-wrapper::before,
.chat-wrapper::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 12px;
  pointer-events: none;
  z-index: 2;
}

/* top fade */
.chat-wrapper::before {
  top: 0;
  background: linear-gradient(to bottom, #fff, rgba(255, 255, 255, 0));
}

/* bottom fade */
.chat-wrapper::after {
  bottom: 0;
  background: linear-gradient(to top, #fff, rgba(255, 255, 255, 0));
}

#chat-log {
  position: relative;
  max-height: 600px;
  padding: 20px;
  background: #fff;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Messages */
.msg {
  line-height: 1.4;
  padding: 12px 20px;
  border-radius: 12px;
  max-width: 75%;
  word-break: break-word;
}

.msg.user {
  text-align: right;
  background-color: var(--wp--preset--color--palette-color-1, #069494);
  color: var(--wp--preset--color--white, #fff);
  align-self: flex-end;
}

.msg.ai {
  text-align: left;
  color: #333;
  background-color: var(--wp--preset--color--palette-color-5, #edeff2);
  align-self: flex-start;
}

.msg.error {
  color: #c00;
}

/* Typing indicator */
.typing {
  display: flex;
  gap: 6px;
  align-items: center;
  color: #999;
  max-width: 35%;
  align-self: flex-start;
  font-style: italic;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.typing.show {
  opacity: 1;
  transform: translateY(0);
}

.typing span {
  width: 6px;
  height: 6px;
  background: #999;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }

.hidden { display: none; }

@keyframes bounce {
  0%, 80%, 100% { opacity: .2; }
  40% { opacity: 1; }
}

/* Chat input */
#chat-input {
  width: 100%;
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid #ddd;
  font: inherit;
  box-sizing: border-box;
  transition: transform 0.3s ease; /* smooth move when chat grows */
}

/* Suggested buttons */
.suggested {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.suggested button {
  background-color: #f3f3f3;
  border: none;
  border-radius: 50px;
  padding: 8px 12px;
  cursor: pointer;
  font: inherit;
  transition: background 0.2s;
}

.suggested button:hover {
  background-color: #e0e0e0;
}