* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, sans-serif;
}

body {
  background-color: #1f2937;
  color: #18181b;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* =========================================================
   BOTÃO FLUTUANTE
   ========================================================= */

.chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #2563eb;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.launcher-icon svg {
  width: 24px;
  height: 24px;
}

/* =========================================================
   JANELA DO CHAT
   ========================================================= */

.chat-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 400px;
  height: 600px;
  max-height: calc(100vh - 48px);
  background-color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}

.chat-window.hidden {
  display: none;
}

/* =========================================================
   FULLSCREEN
   ========================================================= */

.chat-window.fullscreen {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  bottom: 0;
  right: 0;
  border-radius: 0;
}

/* =========================================================
   HEADER
   ========================================================= */

.chat-header {
  flex-shrink: 0;
  height: 68px;
  padding: 16px 20px;
  border-bottom: 1px solid #f4f4f5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  z-index: 2;
}

.assistant-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.assistant-avatar {
  width: 36px;
  height: 36px;
  background-color: #2563eb;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.assistant-info strong {
  display: block;
  font-size: 14px;
}

.assistant-info span {
  font-size: 12px;
  color: #22c55e;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.header-button {
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-button:hover {
  background-color: #f4f4f5;
}

.header-button svg {
  width: 18px;
  height: 18px;
}

/* =========================================================
   CORPO
   ========================================================= */

.chat-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

/* =========================================================
   SIDEBAR
   ========================================================= */

.chat-sidebar {
  width: 260px;
  flex-shrink: 0;
  background-color: #fafafa;
  border-right: 1px solid #e4e4e7;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.new-chat-button {
  width: 100%;
  height: 42px;
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  background-color: #ffffff;
  color: #18181b;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.new-chat-button:hover {
  background-color: #f4f4f5;
}

.new-chat-button span {
  font-size: 20px;
  line-height: 1;
}

.chat-history {
  flex: 1;
  overflow-y: auto;
}

.history-section {
  margin-bottom: 20px;
}

.history-title {
  display: block;
  padding: 0 10px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #a1a1aa;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px;
  border-radius: 7px;
  cursor: pointer;
  color: #3f3f46;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.history-item:hover {
  background-color: #f4f4f5;
}

.history-item.active {
  background-color: #e4e4e7;
  color: #18181b;
  font-weight: 500;
}

/* =========================================================
   CONTEÚDO PRINCIPAL
   ========================================================= */

.chat-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
}

.messages-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 32px;
}

/* =========================================================
   WELCOME
   ========================================================= */

.welcome {
  width: min(720px, 100%);
  margin: 80px auto 40px;
  text-align: center;
}

.welcome-avatar {
  font-size: 28px;
  margin-bottom: 12px;
}

.welcome h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.welcome p {
  color: #71717a;
  font-size: 14px;
  line-height: 1.6;
}

/* =========================================================
   MENSAGENS
   ========================================================= */

.messages {
  width: min(720px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  max-width: 85%;
  line-height: 1.5;
}

.assistant-message {
  background-color: #f4f4f5;
  align-self: flex-start;
}

/* =========================================================
   FOOTER / INPUT
   ========================================================= */

.chat-footer {
  flex-shrink: 0;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 12px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background-color: #ffffff;
}

.input-wrapper {
  display: flex;
  gap: 8px;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  padding: 5px;
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.input-wrapper input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: none;
  outline: none;
  font-size: 14px;
  background: transparent;
}

.send-button {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background-color: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-button:hover {
  background-color: #1d4ed8;
}

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

small {
  font-size: 11px;
  color: #a1a1aa;
  text-align: center;
}

/* =========================================================
   MODO JANELA PEQUENA
   ========================================================= */

.chat-window:not(.fullscreen) .chat-sidebar {
  display: none;
}

.chat-window:not(.fullscreen) .messages-area {
  padding: 16px;
}

.chat-window:not(.fullscreen) .welcome {
  margin: 40px auto 24px;
}

.chat-window:not(.fullscreen) .chat-footer {
  padding: 12px 16px 16px;
}

/* =========================================================
   RESPONSIVO
   ========================================================= */

@media (max-width: 700px) {
  .chat-sidebar {
    width: 200px;
  }

  .messages-area {
    padding: 24px 16px;
  }
}

/* =========================================================
   Volts Avatar Chat
   ========================================================= */

/* Container da mensagem que ocupa toda a largura */
.volts-msg {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
  margin-bottom: 20px;
}

/* Coluna da Esquerda: Avatar e Hora centralizada abaixo */
.volts-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  width: 44px;
}

.volts-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #f4f4f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.volts-time {
  font-size: 11px;
  color: #71717a;
  font-family: inherit;
}

/* Coluna da Direita: Balão que se estende de ponta a ponta */
.volts-bubble {
  flex: 1;
  background-color: transparent;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 14px;
  line-height: 1.5;
  color: inherit;
  word-break: break-word;
}

/* Caso seu tema seja escuro como o da imagem (dark mode) */
body.dark .volts-bubble,
.chat-window.dark .volts-bubble {
  border-color: #27272a;
  background-color: #09090b;
}

#VoltsAiChat, .messages-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.messages-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

#VoltsAiChat {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}
.messages-area {
  flex: 1;
  min-height: 0; 
  overflow-y: auto;
}

/* Animação do Loading */
.volts-loading-bubble {
  color: #a1a1aa;
  font-style: italic;
}

.volts-dots span {
  animation: voltsBlink 1.4s infinite both;
  display: inline-block;
  font-weight: bold;
}

.volts-dots span:nth-child(1) { animation-delay: 0.0s; }
.volts-dots span:nth-child(2) { animation-delay: 0.2s; }
.volts-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes voltsBlink {
  0%   { opacity: 0.2; transform: translateY(0px); }
  20%  { opacity: 1;   transform: translateY(-2px); }
  100% { opacity: 0.2; transform: translateY(0px); }
}

/* Estado visual do Input e Botão desabilitados durante a requisição */
#chatInput:disabled,
#sendMessage:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}