/* ==========================================================
   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
   ========================================================== */

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%;
}

/* === Container principal do chat === */
._chatContainer_1hd2z_14 {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh; /* ocupa a altura total do widget */
  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_1hd2z_32 {
  background-color: #004aad;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  flex-shrink: 0;
  z-index: 2;
}

._headerLeft_1hd2z_43 {
  display: flex;
  align-items: center;
  gap: 10px;
}

._headerIcon_1hd2z_49 {
  width: 30px;
  height: 30px;
}

._headerTitle_1hd2z_54 {
  font-size: var(--font-size-xxl);
  font-weight: var(--weight-semibold);
  margin: 0;
  color: white;
}

._minimizeButton_1hd2z_61 {
  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_1hd2z_61:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================
   ÁREA DE MENSAGENS — Scroll apenas aqui
   ========================================================== */
._chatMessages_1hd2z_82 {
  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_1hd2z_82::-webkit-scrollbar {
  width: 8px;
}
._chatMessages_1hd2z_82::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

/* ==========================================================
   MENSAGENS
   ========================================================== */
._messageRow_1hd2z_107 {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  margin-bottom: 6px;
}

._messageRow_1hd2z_107._bot_1hd2z_115 {
  justify-content: flex-start;
}

._messageRow_1hd2z_107._user_1hd2z_119 {
  justify-content: flex-end;
}

._messageAvatar_1hd2z_123 {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  align-self: flex-start; /* avatar alinhado ao topo */
}

._messageBlock_1hd2z_132 {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

._messageBubble_1hd2z_138 {
  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_1hd2z_107._bot_1hd2z_115 ._messageBubble_1hd2z_138 {
  background-color: #f2f2f2;
  color: #222;
  border-top-left-radius: 0;
  text-align: left;
}

._messageRow_1hd2z_107._user_1hd2z_119 ._messageBubble_1hd2z_138 {
  background-color: #004aad;
  color: white;
  border-top-right-radius: 0;
  align-self: flex-end;
}

/* Hora da mensagem — abaixo, à direita */
._messageTime_1hd2z_163 {
  font-size: var(--font-size-xs);
  color: #777;
  text-align: right;
  margin-top: 4px;
  padding-right: 4px;
}

/* Fontes (links/sources) dentro do balão */
._messageSources_1hd2z_172 {
  margin-top: 10px;
  border-left: 3px solid #004aad;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: var(--font-size-sm);
}

._messageSources_1hd2z_172 h4 {
  margin: 0 0 4px 0;
  font-size: var(--font-size-sm);
  color: #004aad;
}

._sourceItem_1hd2z_186 {
  margin-bottom: 4px;
}

._sourceItem_1hd2z_186 a {
  color: #004aad;
  text-decoration: underline;
}

/* ==========================================================
   YOUTUBE EMBED
   ========================================================== */
._youtube-container_1hd2z_198,
._youtubeContainer_1hd2z_199 {
  margin-top: 8px;
  width: 100%;
  display: flex;
  justify-content: center;
}

._youtube-container_1hd2z_198 iframe,
._youtubeContainer_1hd2z_199 iframe {
  width: 100%;
  max-width: 100%;
  height: 220px;
  border-radius: 8px;
}

/* ==========================================================
   INPUT FIXO (RODAPÉ)
   ========================================================== */
._chatInput_1hd2z_217 {
  border-top: 1px solid #e0e0e0;
  padding: 12px 16px;
  background-color: #fff;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 3;
}

._chatInput_1hd2z_217._disabled_1hd2z_227 {
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.3s ease;
  cursor: wait;
}

/* === ChatGPT-style Input === */
._inputWrapper_1hd2z_235 {
  display: flex;
  align-items: flex-end;
  background-color: #f8f8f8;
  border: 1px solid #ccc;
  border-radius: 22px;
  padding: 6px 50px 6px 14px;
  position: relative;
  transition: border 0.2s ease;
}

._inputWrapper_1hd2z_235 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_1hd2z_261 {
  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_1hd2z_261:hover {
  background-color: #00368c;
}

._sendInside_1hd2z_261:disabled {
  background-color: #bbb;
  cursor: not-allowed;
}

._sendIcon_1hd2z_286 {
  width: 18px;
  height: 18px;
}

/* ==========================================================
   ANIMAÇÕES
   ========================================================== */
._sendingDots_1hd2z_294 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

._sendingDots_1hd2z_294 span {
  width: 4px;
  height: 4px;
  background-color: #fff;
  border-radius: 50%;
  opacity: 0.7;
  animation: _bounceDots_1hd2z_1 1.2s infinite ease-in-out;
}

._sendingDots_1hd2z_294 span:nth-child(1) { animation-delay: 0s; }
._sendingDots_1hd2z_294 span:nth-child(2) { animation-delay: 0.2s; }
._sendingDots_1hd2z_294 span:nth-child(3) { animation-delay: 0.4s; }

@keyframes _bounceDots_1hd2z_1 {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.7; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* Indicador de escrita */
._typingIndicator_1hd2z_320 {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  height: 18px;
}

._typingIndicator_1hd2z_320 span {
  width: 6px;
  height: 6px;
  background-color: #999;
  border-radius: 50%;
  opacity: 0.6;
  animation: _typingBounce_1hd2z_1 1.2s infinite ease-in-out;
}

._typingIndicator_1hd2z_320 span:nth-child(1) { animation-delay: 0s; }
._typingIndicator_1hd2z_320 span:nth-child(2) { animation-delay: 0.2s; }
._typingIndicator_1hd2z_320 span:nth-child(3) { animation-delay: 0.4s; }

@keyframes _typingBounce_1hd2z_1 {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.6; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* ==========================================================
   RODAPÉ — Powered by INSIA
   ========================================================== */

._poweredBy_1hd2z_350 {
  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_1hd2z_362 {
  width: 16px;
  height: 16px;
  object-fit: contain;
  opacity: 0.75;
  filter: grayscale(100%);
  transition: opacity 0.2s ease;
}

._poweredByLogo_1hd2z_362:hover {
  opacity: 1;
  filter: none;
}

