/* chat.css — Phase 10 */

/* chat-wrap fills the content-fixed area exactly */
.chat-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  padding: 0 22px 16px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0; /* critical — allows flex child to shrink below content size */
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 14px;
  padding: 20px;
  min-height: 0;
}
.chat-empty-icon  { font-size: 28px; color: var(--txt3); }
.chat-empty-title { font-size: 14px; font-weight: 500; color: var(--txt2); }
.chat-empty-sub   { font-size: 12px; color: var(--txt3); text-align: center; max-width: 340px; line-height: 1.5; }
.suggested-prompts { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 4px; }
.suggested-prompt {
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--s1);
  color: var(--txt2);
  cursor: pointer;
  transition: border-color 0.1s, color 0.1s;
}
.suggested-prompt:hover { border-color: var(--blue); color: var(--txt); }

/* messages */
.msg-row { display: flex; align-items: flex-end; gap: 8px; }
.msg-row.user { flex-direction: row-reverse; }
.msg-bubble {
  max-width: 72%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.msg-row.user .msg-bubble {
  background: var(--blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-row.model .msg-bubble {
  background: var(--s1);
  border: 1px solid var(--border);
  color: var(--txt);
  border-bottom-left-radius: 4px;
}
.msg-bubble p            { margin-bottom: 6px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble ul, .msg-bubble ol { padding-left: 18px; margin: 4px 0; }
.msg-bubble li           { margin-bottom: 3px; }
.msg-bubble strong       { font-weight: 600; }
.msg-bubble code {
  font-size: 11px;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 4px;
}

/* typing indicator */
.typing-indicator { display: flex; gap: 4px; padding: 10px 14px; }
.typing-indicator span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--txt3);
  animation: bounce 1s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-5px); }
}

/* input area — always pinned to bottom */
.chat-input-area {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  flex-shrink: 0;
}
.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 8px 8px 14px;
  transition: border-color 0.1s;
}
.chat-input-row:focus-within { border-color: var(--blue); }
.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--txt);
  font-size: 13px;
  resize: none;
  max-height: 120px;
  min-height: 20px;
  line-height: 1.5;
  font-family: var(--font);
}
.chat-input::placeholder { color: var(--txt3); }
.send-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--blue);
  border: none;
  color: #fff;
  font-size: 14px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.1s;
}
.send-btn:disabled { opacity: 0.35; cursor: default; }

@media (max-width: 860px) {
  .chat-wrap { padding: 0 16px 14px; }
}
@media (max-width: 520px) {
  .chat-wrap { padding: 0 14px 14px; }
  .msg-bubble { max-width: 88%; }
}
