/* ============ BuildRite AI Assistant — chat window ============ */
.braia-chat {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 99990;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 60px);
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 30px 80px -12px rgba(0,0,0,0.45), 0 0 0 3px rgba(255,215,0,0.7), 0 0 40px rgba(255,215,0,0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: inherit;
}
.braia-chat.is-open { display: flex; }
.braia-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #1a1d23;
  color: #fff;
}
.braia-chat-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: contain;
  background: radial-gradient(circle, rgba(255,215,0,0.5), transparent 70%);
}
.braia-chat-title { flex: 1; display: flex; flex-direction: column; }
.braia-chat-title strong { font-size: 0.95rem; }
.braia-chat-status { font-size: 0.75rem; color: #7ee2a8; }
.braia-chat-close {
  background: none; border: 0; color: #b9c2c9; cursor: pointer; padding: 6px; line-height: 0;
}
.braia-chat-close:hover { color: #fff; }
.braia-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f7f5f0;
}
.braia-msg { display: flex; }
.braia-msg-user { justify-content: flex-end; }
.braia-msg-model { justify-content: flex-start; }
.braia-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.45;
  word-wrap: break-word;
}
.braia-msg-user .braia-bubble { background: #1a1d23; color: #fff; border-bottom-right-radius: 4px; }
.braia-msg-model .braia-bubble { background: #fff; color: #1a1d23; border: 1px solid #e8e2d5; border-bottom-left-radius: 4px; box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.braia-chat-lead {
  padding: 14px;
  background: #fffbe8;
  border-top: 2px solid #FFD700;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.braia-chat-lead[hidden] { display: none; }
.braia-chat-lead strong { font-size: 0.9rem; color: #1a1d23; }
.braia-chat-lead input, .braia-chat-lead textarea {
  padding: 9px 12px;
  border: 1px solid #ddd6c2;
  border-radius: 10px;
  font-size: 0.88rem;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}
.braia-chat-lead textarea { min-height: 64px; resize: vertical; }
.braia-chat-lead button {
  padding: 10px;
  border: 0;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.braia-chat-lead [data-braia-lead-send] { background: #FFD700; color: #1a1d23; }
.braia-chat-lead [data-braia-lead-send]:disabled { opacity: 0.6; }
.braia-chat-lead .braia-lead-cancel { background: #eee9da; color: #5a5344; }
.braia-chat-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #eee9da;
}
.braia-chat-input input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd6c2;
  border-radius: 999px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}
.braia-chat-input input:focus { border-color: #FFD700; }
.braia-mic, .braia-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.braia-mic { background: #f0ebdc; color: #5a5344; }
.braia-mic:hover { background: #e8e0c8; }
.braia-mic.is-recording { background: #e5484d; color: #fff; animation: braia-mic-pulse 1.2s ease-in-out infinite; }
@keyframes braia-mic-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.braia-send { background: #FFD700; color: #1a1d23; }
.braia-send:hover { background: #f5c900; }
.braia-chat-actions { padding: 0 12px 12px; background: #fff; }
.braia-chat-actions button {
  width: 100%;
  padding: 10px;
  border: 2px solid #FFD700;
  background: #fff;
  color: #1a1d23;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}
.braia-chat-actions button:hover { background: #FFF8DC; }
@media (max-width: 640px) {
  .braia-chat { right: 16px; bottom: 16px; width: calc(100vw - 32px); height: 70vh; }
}
