/* ==========================================================
   FORINSIA — Sistema tipográfico global do Chat Widget
   Compatível com modos WIDGET e FULLSCREEN
   ========================================================== */

:root {
  /* === Fontes === */
  --font-primary: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* === Tamanhos compactos (ajustados ao widget) === */
  --font-size-xs: 11px;
  --font-size-sm: 12.5px;
  --font-size-md: 14px;   /* Texto principal */
  --font-size-lg: 15.5px; /* Subtítulos */
  --font-size-xl: 17px;   /* Títulos no conteúdo */
  --font-size-xxl: 18px;  /* Header principal */

  /* === Pesos === */
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* === Cores === */
  --color-text-primary: #222;
  --color-text-secondary: #555;
  --color-text-muted: #777;
  --color-link: #004aad;
  --color-link-hover: #00368c;
  --color-bg: #ffffff;
  --color-bg-alt: #f8f8f8;
  --color-border: #e0e0e0;

  /* === Line height === */
  --line-height-base: 1.35;
}

/* ==========================================================
   BASE — Reset e tipografia principal
   ========================================================== */

html,
body {
  font-family: var(--font-primary);
  font-size: var(--font-size-md);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  line-height: var(--line-height-base);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Permite o chat ocupar o container pai */
#chatbot-widget-container,
#root {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

/* ==========================================================
   LINKS
   ========================================================== */

a {
  color: var(--color-link);
  text-decoration: underline;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--color-link-hover);
}

/* ==========================================================
   PLACEHOLDERS
   ========================================================== */

textarea::placeholder,
input::placeholder {
  color: var(--color-text-muted);
}

/* ==========================================================
   HEADERS (Markdown)
   ========================================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--color-text-primary);
  font-family: var(--font-primary);
  line-height: 1.3;
  margin: 0.4em 0 0.25em;
}

h1 {
  font-size: var(--font-size-xxl);
  font-weight: var(--weight-bold);
}

h2 {
  font-size: var(--font-size-xl);
  font-weight: var(--weight-semibold);
}

h3 {
  font-size: var(--font-size-lg);
  font-weight: var(--weight-medium);
}

h4,
h5,
h6 {
  font-size: var(--font-size-md);
  font-weight: var(--weight-medium);
}

/* ==========================================================
   LISTAS (Markdown)
   ========================================================== */

ul,
ol {
  margin: 0.3em 0 0.3em 1.2em;
  padding: 0;
}

li {
  margin-bottom: 0.15em;
  line-height: var(--line-height-base);
}

/* ==========================================================
   CÓDIGO (Markdown)
   ========================================================== */

code {
  background: var(--color-bg-alt);
  padding: 1px 3px;
  border-radius: 4px;
  font-size: var(--font-size-sm);
  font-family: monospace;
}

pre {
  background: var(--color-bg-alt);
  padding: 6px;
  border-radius: 6px;
  overflow-x: auto;
  font-family: monospace;
  font-size: var(--font-size-sm);
  line-height: 1.3;
}

/* ==========================================================
   TEXTO PEQUENO (Rodapé)
   ========================================================== */

.poweredBy {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 4px;
}

/* ==========================================================
   AJUSTES GERAIS DE RENDERIZAÇÃO
   ========================================================== */

/* NOTA (Forinsia): o bloco global img { max-width: 100%; display: block; } da build
   original foi removido - este ficheiro e carregado na MasterPage e afetaria as
   imagens de toda a aplicacao, nao apenas o widget. */

button {
  font-family: inherit;
  font-size: inherit;
}

textarea {
  font-family: inherit;
  resize: none;
}

/* ==========================================================
   DIFERENCIAÇÃO ENTRE MODOS (Full vs Widget)
   ========================================================== */

:root[data-chat-mode="widget"] body {
  overflow: hidden;
  height: 100%;
}

:root[data-chat-mode="full"] body {
  overflow: auto;
  height: 100vh;
}
/* ==========================================================
   CHAT WIDGET — Compact + Fixed Layout
   ========================================================== */

/* === Base (garantir reset global quando usado standalone) === */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  /* NOTA (Forinsia): o overflow: hidden da build original foi removido - retirava
     o scroll a todas as paginas da aplicacao. O widget tem altura fixa definida
     no #chatbot-widget-container, por isso nao depende dele. */
}

/* === Container principal do chat === */
._chatContainer_7nkxb_27 {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%; /* ocupa a altura do container onde o widget é colocado (não a viewport) */
  font-family: var(--font-primary);
  font-size: var(--font-size-md);
  line-height: var(--line-height-base);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  border-radius: 12px;
  overflow: hidden;
  box-sizing: border-box;
}

/* ==========================================================
   HEADER FIXO
   ========================================================== */
._chatHeader_7nkxb_63 {
  background-color: #004aad;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  flex-shrink: 0;
  z-index: 2;
}

._headerLeft_7nkxb_85 {
  display: flex;
  align-items: center;
  gap: 10px;
}

._headerIcon_7nkxb_97 {
  width: 30px;
  height: 30px;
}

._headerTitle_7nkxb_107 {
  font-size: var(--font-size-xxl);
  font-weight: var(--weight-semibold);
  margin: 0;
  color: white;
}

._minimizeButton_7nkxb_121 {
  background: transparent;
  border: 2px solid white;
  border-radius: 50%;
  color: white;
  font-size: 18px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  line-height: 22px;
  text-align: center;
  transition: background 0.2s ease;
}

._minimizeButton_7nkxb_121:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================
   ÁREA DE MENSAGENS — Scroll apenas aqui
   ========================================================== */
._chatMessages_7nkxb_163 {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 80px 16px; /* espaço inferior igual ao input */
  display: flex;
  flex-direction: column;
  gap: 16px;
  background-color: #fff;
  position: relative;
  z-index: 1;
  scrollbar-gutter: stable both-edges;
}

/* Scrollbar visual */
._chatMessages_7nkxb_163::-webkit-scrollbar {
  width: 8px;
}
._chatMessages_7nkxb_163::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

/* ==========================================================
   MENSAGENS
   ========================================================== */
._messageRow_7nkxb_213 {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  margin-bottom: 6px;
}

._messageRow_7nkxb_213._bot_7nkxb_229 {
  justify-content: flex-start;
}

._messageRow_7nkxb_213._user_7nkxb_237 {
  justify-content: flex-end;
}

._messageAvatar_7nkxb_245 {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  align-self: flex-start; /* avatar alinhado ao topo */
}

._messageBlock_7nkxb_263 {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

._messageBubble_7nkxb_275 {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: var(--font-size-md);
  line-height: var(--line-height-base);
  word-wrap: break-word;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-family: inherit;
}

._messageRow_7nkxb_213._bot_7nkxb_229 ._messageBubble_7nkxb_275 {
  background-color: #f2f2f2;
  color: #222;
  border-top-left-radius: 0;
  text-align: left;
}

._messageRow_7nkxb_213._user_7nkxb_237 ._messageBubble_7nkxb_275 {
  background-color: #004aad;
  color: white;
  border-top-right-radius: 0;
  align-self: flex-end;
}

/* Hora da mensagem — abaixo, à direita */
._messageTime_7nkxb_325 {
  font-size: var(--font-size-xs);
  color: #777;
  text-align: right;
  margin-top: 4px;
  padding-right: 4px;
}

/* === Recording row (waveform + cancel/confirm) replaces textarea+mic+send while recording === */
._inputWrapperRecording_7nkxb_343 {
  padding: 6px 10px;
}

._recordingTimer_7nkxb_351 {
  flex-shrink: 0;
  font-size: var(--font-size-xs);
  color: #666;
  font-variant-numeric: tabular-nums;
  min-width: 34px;
}

._audioWaveform_7nkxb_367 {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  height: 28px;
  padding: 0 8px;
  overflow: hidden;
}

._audioWaveformBar_7nkxb_389 {
  flex: 0 0 auto;
  width: 3px;
  height: 8%;
  border-radius: 2px;
  background-color: #999;
  /* height is written directly per animation frame from real mic input — no CSS transition/animation */
}

._recordingCancelButton_7nkxb_407,
._recordingConfirmButton_7nkxb_409 {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

._recordingCancelButton_7nkxb_407 {
  background-color: transparent;
  color: #666;
}

._recordingCancelButton_7nkxb_407:hover {
  background-color: #ececec;
  color: #333;
}

._recordingConfirmButton_7nkxb_409 {
  background-color: #004aad;
  color: white;
}

._recordingConfirmButton_7nkxb_409:hover {
  background-color: #00368c;
}

/* Fontes (links/sources) dentro do balão */
._messageSources_7nkxb_473 {
  margin-top: 10px;
  border-left: 3px solid #004aad;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: var(--font-size-sm);
}

._messageSources_7nkxb_473 h4 {
  margin: 0 0 4px 0;
  font-size: var(--font-size-sm);
  color: #004aad;
}

._sourceItem_7nkxb_501 {
  margin-bottom: 4px;
}

._sourceItem_7nkxb_501 a {
  color: #004aad;
  text-decoration: underline;
}

/* ==========================================================
   YOUTUBE EMBED
   ========================================================== */
._youtube-container_7nkxb_525,
._youtubeContainer_7nkxb_527 {
  margin-top: 8px;
  width: 100%;
  display: flex;
  justify-content: center;
}

._youtube-container_7nkxb_525 iframe,
._youtubeContainer_7nkxb_527 iframe {
  width: 100%;
  max-width: 100%;
  height: 220px;
  border-radius: 8px;
}

/* ==========================================================
   INPUT FIXO (RODAPÉ)
   ========================================================== */
._chatInput_7nkxb_563 {
  border-top: 1px solid #e0e0e0;
  padding: 12px 16px;
  background-color: #fff;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 3;
}

/* === ChatGPT-style Input === */
._inputWrapper_7nkxb_343 {
  display: flex;
  align-items: flex-end;
  background-color: #f8f8f8;
  border: 1px solid #ccc;
  border-radius: 22px;
  padding: 6px 14px 6px 14px;
  position: relative;
  transition: border 0.2s ease;
}

._inputWrapper_7nkxb_343 textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  outline: none;
  font-size: var(--font-size-md);
  font-family: inherit;
  line-height: 1.6;
  color: #222;
  min-height: 24px;
  max-height: 120px;
  overflow-y: auto;
}

._sendInside_7nkxb_637 {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background-color: #004aad;
  border: none;
  border-radius: 18px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

._sendInside_7nkxb_637:hover {
  background-color: #00368c;
}

._sendInside_7nkxb_637:disabled {
  background-color: #bbb;
  cursor: not-allowed;
}

._sendIcon_7nkxb_687 {
  width: 18px;
  height: 18px;
}

/* === Mic button (voice input) — sits to the left of the send button === */
._micButton_7nkxb_699 {
  position: absolute;
  right: 42px;
  bottom: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background-color: transparent;
  color: #666;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

._micButton_7nkxb_699:hover:not(:disabled) {
  background-color: #ececec;
  color: #004aad;
}

._micButton_7nkxb_699:disabled {
  color: #bbb;
  cursor: not-allowed;
}

._micButtonRecording_7nkxb_755 {
  color: #fff;
  background-color: #e53935;
  animation: _micPulse_7nkxb_1 1.2s infinite ease-in-out;
}

@keyframes _micPulse_7nkxb_1 {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(229, 57, 53, 0.15); }
}

._micTranscribingDot_7nkxb_777 {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #999;
  animation: _bounceDots_7nkxb_1 1.2s infinite ease-in-out;
}

/* ==========================================================
   ANIMAÇÕES
   ========================================================== */
._sendingDots_7nkxb_799 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

._sendingDots_7nkxb_799 span {
  width: 4px;
  height: 4px;
  background-color: #fff;
  border-radius: 50%;
  opacity: 0.7;
  animation: _bounceDots_7nkxb_1 1.2s infinite ease-in-out;
}

._sendingDots_7nkxb_799 span:nth-child(1) { animation-delay: 0s; }
._sendingDots_7nkxb_799 span:nth-child(2) { animation-delay: 0.2s; }
._sendingDots_7nkxb_799 span:nth-child(3) { animation-delay: 0.4s; }

@keyframes _bounceDots_7nkxb_1 {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.7; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* Indicador de escrita */
._typingIndicator_7nkxb_851 {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  height: 18px;
}

._typingIndicator_7nkxb_851 span {
  width: 6px;
  height: 6px;
  background-color: #999;
  border-radius: 50%;
  opacity: 0.6;
  animation: _typingBounce_7nkxb_1 1.2s infinite ease-in-out;
}

._typingIndicator_7nkxb_851 span:nth-child(1) { animation-delay: 0s; }
._typingIndicator_7nkxb_851 span:nth-child(2) { animation-delay: 0.2s; }
._typingIndicator_7nkxb_851 span:nth-child(3) { animation-delay: 0.4s; }

@keyframes _typingBounce_7nkxb_1 {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.6; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* ==========================================================
   RODAPÉ — Powered by INSIA
   ========================================================== */

._poweredBy_7nkxb_911 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-align: center;
  user-select: none;
}

._poweredByLogo_7nkxb_935 {
  width: 16px;
  height: 16px;
  object-fit: contain;
  opacity: 0.75;
  filter: grayscale(100%);
  transition: opacity 0.2s ease;
}

._poweredByLogo_7nkxb_935:hover {
  opacity: 1;
  filter: none;
}

