.chat-input-box {
  background: var(--bg-color);
  border: 2px solid;
  border-image: linear-gradient(to right, var(--white), var(--blue-start)) 1;
  border-left: 4px solid var(--blue-start);
  /* bottom corners rounded, top corners remain square */
  border-radius: 0 0 25px 25px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.chat-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: 1rem;
  resize: none;
  flex-grow: 1;
  margin-bottom: 0;
}

.chat-input::placeholder {
  color: var(--text-color);
  opacity: 0.6;
}

.send-button {
  background: var(--white);
  color: #000;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0;
}

.send-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.send-button:active {
  transform: translateY(0);
}

.send-button svg {
  width: 16px;
  height: 16px;
}

.chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 150px; /* Adjust based on input box height */
}

.chat-message {
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 20px;
  line-height: 1.4;
  word-wrap: break-word;
  font-size: 0.95rem;
}

.user-message {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: #ffffff;
  align-self: flex-end;
  text-align: right;
  border-bottom-right-radius: 5px;
  font-weight: 500;
}

.ai-message {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-color);
  align-self: flex-start;
  text-align: left;
  border-bottom-left-radius: 5px;
  border: 2px solid;
  border-image: linear-gradient(135deg, var(--white), var(--blue-start)) 1;
}

.ai-message .message-content h1,
.ai-message .message-content h2,
.ai-message .message-content h3 {
  color: var(--text-color);
  background: var(--title-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.ai-message .message-content p {
  margin-bottom: 0.75rem;
  color: #e0e0e0;
}

.ai-message .message-content ul,
.ai-message .message-content ol {
  margin-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.ai-message .message-content li {
  margin-bottom: 0.25rem;
}

.ai-message .message-content strong {
  color: var(--blue-start);
  font-weight: 600;
}

.ai-message .message-content code {
  font-family: 'Courier New', Courier, monospace;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.ai-message .message-content pre {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.ai-message .message-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

.chat-message.ai-message {
    position: relative; /* enable positioning for download button */
}

.download-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.download-button svg {
    width: 16px;
    height: 16px;
    stroke: #ffffff;
    fill: none;
}

.typing-indicator {
  max-width: 80%;
  padding: 10px 0;
  align-self: flex-start;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  background: transparent;
  border: none;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(45deg, var(--white), var(--blue-start));
  animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: 0s;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingAnimation {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

.chat-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
}

.voice-button {
  background: #000;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.voice-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.voice-button:active {
  transform: translateY(0);
}

.voice-button svg {
  width: 16px;
  height: 16px;
  stroke: #ffffff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-add-button {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--white);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.menu-add-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.menu-add-button:active {
  transform: translateY(0);
}

.menu-add-button svg {
  width: 16px;
  height: 16px;
  stroke: var(--white);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

.copy-button,
.listen-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.copy-button:hover,
.listen-button:hover {
  transform: translateY(-1px);
}

.copy-button:active,
.listen-button:active {
  transform: translateY(0);
}

.copy-button svg,
.listen-button svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-color);
  fill: none;
}

.image-loading-indicator {
  width: 200px;
  height: 200px;
  margin: 0.5rem auto;
  background: linear-gradient(270deg, var(--blue-start), var(--white), var(--blue-start));
  background-size: 400% 400%;
  animation: gradientMove 2s ease infinite;
  border-radius: 12px;
}

@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.generated-image {
  width: 200px;
  height: 200px;
  object-fit: cover;
  margin: 0.5rem auto;
  border-radius: 12px;
}