/* Lori Widget (Loggi palette) */

/* Reset e base (escopado no widget) */
.lori-widget,
.lori-widget *,
.lori-widget *::before,
.lori-widget *::after {
  margin: 0;
  padding: 0;
  border: 0;
  box-sizing: border-box;
}

.lori-widget {
  --lw-interaction-primary: #0055ff;
  --lw-interaction-primary-hover: #0040e6;
  --lw-interaction-primary-container: #eaf2ff;
  --lw-interaction-primary-container-alpha: rgba(0, 85, 255, 0.08);
  --lw-interaction-primary-container-hover-alpha: rgba(0, 85, 255, 0.16);
  --lw-interaction-on-primary: #ffffff;

  --lw-brand-main: #00baff;
  --lw-brand-on-main: #ffffff;

  --lw-neutrals-outline-high:#cccbcd;

  --lw-surface: #ffffff;
  --lw-surface-low: #f2f2f2;
  --lw-surface-container: #e6e6e6;
  --lw-on-surface: #1a1a1a;
  --lw-on-surface-variant: #666666;
  --lw-outline: rgba(0, 85, 255, 0.08);
  --lw-outline-high: #cccbcd;

  --lw-feedback-positive: #1bb84b;
  --lw-feedback-alert: #fcb121;
  --lw-feedback-negative: #eb2727;

  --lw-shadow: rgba(26, 26, 26, 0.16);
  --lw-shadow-strong: rgba(26, 26, 26, 0.22);
  --lw-radius: 12px;

  font-family: Montserrat, sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,
    "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  color: var(--lw-on-surface);
  font-size: 14px;
  line-height: 1.5;

  position: fixed;
  width: 380px;
  height: 600px;

  background: var(--lw-surface);
  border-radius: var(--lw-radius);
  box-shadow: 0 8px 40px var(--lw-shadow);
  border: 1px solid var(--lw-outline);

  display: flex;
  flex-direction: column;

  z-index: 9999;
  transition: all 0.3s ease;

  bottom: 20px;
  right: 20px;
}

/* Posições */
.lori-widget.position-bottom-left {
  bottom: 20px;
  right: auto;
  left: 20px;
}

.lori-widget.position-top-right {
  bottom: auto;
  top: 20px;
  right: 20px;
}

.lori-widget.position-top-left {
  bottom: auto;
  top: 20px;
  right: auto;
  left: 20px;
}

/* Minimized */
/* Estado Minimizado (Botão Flutuante) */
.lori-widget.minimized {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: visible !important;
  cursor: pointer;
  background: var(--lw-interaction-primary);
  box-shadow: 0 4px 12px var(--lw-shadow-strong);
  border: none;
  resize: none;
}

.lori-widget.minimized:hover {
  transform: scale(1.1);
}

/* Esconder header padrão quando minimizado */
.lori-widget.minimized .lori-widget-header,
.lori-widget.minimized .lori-widget-setup,
.lori-widget.minimized .lori-widget-chat,
.lori-widget.minimized .lori-input-container {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Novo container para os ícones do botão flutuante */
.lori-fab-content {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  position: relative;
  color: #ffffff;
}

.lori-widget.minimized .lori-fab-content {
  display: flex !important;
}

/* Ícone de Chat Principal */
.lori-fab-icon-chat {
  font-size: 28px;
}

/* Ícone de IA (Diamantes) dentro do chat */
.lori-fab-icon-ai {
  font-size: 14px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -40%);
  color: #ffffff;
}

/* Header */
.lori-widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;

  background: var(--lw-interaction-primary);
  color: var(--lw-interaction-on-primary);
  box-shadow: 0px 5px 8px 0px rgba(0, 0, 0, 0.14);
  z-index: 1;
  border-radius: var(--lw-radius) var(--lw-radius) 0 0;
  flex-shrink: 0;
}

.lori-widget-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.2px;
}

.lori-icon {
  font-size: 22px;
  line-height: 1;
}

.lori-title {
  letter-spacing: 0.2px;
}

.lori-title-setup {
  margin: 0px 0px 8px;
  font-family: Montserrat, sans-serif;
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
  color: var(--lw-interaction-primary);
  text-align: center;
}

.lori-minimize-btn {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--lw-interaction-on-primary);

  font-size: 22px;
  cursor: pointer;

  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.lori-minimize-btn:hover {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.26);
}

.lori-minimize-btn:active {
  transform: scale(0.98);
}

/* Setup Section */
.lori-widget-setup {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.lori-setup-content h2 {
  margin: 0px 0px 8px;
  font-family: Montserrat, sans-serif;
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
  text-align: center;
  color: var(--lw-interaction-primary);
}

.lori-setup-content > p {
  margin: 0px 0px 16px;
  font-family: Montserrat, sans-serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 14px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--lw-on-surface-variant);
}

.lori-title-description{
  margin: 0px 0px 60px;
  font-size: 14px;
  font-weight: 500;
  line-height: 16px;
  color: rgb(26, 26, 26);
  text-align: center;
}

.lori-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 16px;
}

.lori-typing span {
  width: 6px;
  height: 6px;
  background: var(--lw-on-surface-variant);
  border-radius: 50%;
  opacity: 0.35;
  animation: loriTyping 1.2s infinite ease-in-out;
}

.lori-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.lori-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes loriTyping {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.customer-type-selector {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  padding: 12px 16px;

  border: 1px solid var(--lw-outline);
  border-radius: 16px;

  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--lw-surface);
}

.radio-option:hover {
  border-color: var(--lw-interaction-primary);
  transform: translateY(-1px);
  box-shadow: rgba(25, 118, 210, 0.1) 0px 4px 12px;
}

.lori-radio-text-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.radio-description {
  display: block;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  color: var(--lw-on-surface-variant);
  margin-top: 6px;
  line-height: 1.4;
}

.radio-option:active {
  transform: translateY(1px);
}

.radio-option input[type="radio"] {
  margin-right: 12px;
  margin-top: 2px;
  cursor: pointer;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--lw-interaction-primary);
}

.radio-option input[type="radio"]:checked + .radio-label {
  font-weight: 700;
  color: var(--lw-interaction-primary);
}

.radio-label {
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  color: var(--lw-on-surface);
  transition: color 0.15s ease;
}

.lori-start-btn {
  background: var(--lw-interaction-primary);
  color: var(--lw-interaction-on-primary);
  border: none;

  padding: 12px 24px;
  border-radius: 10px;

  font-size: 14px;
  font-weight: 800;

  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;

  box-shadow: 0 8px 20px rgba(0, 85, 255, 0.18);
}

.lori-start-btn:hover {
  background: var(--lw-interaction-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 85, 255, 0.22);
}

.lori-start-btn:active {
  transform: translateY(0);
}

/* Chat Section */
.lori-widget-chat {
  display: none; /* o JS alterna para flex */
  flex: 1;
  flex-direction: column;
  background: var(--lw-surface);
  min-height: 0;
}

.lori-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Messages */
.lori-message {
  display: flex;
  animation: fadeIn 0.22s ease;
  word-wrap: break-word;
  word-break: break-word;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lori-message-user {
  justify-content: flex-end;
  align-items: flex-end;
  flex-direction: column; /* Adicionar esta linha */
  gap: 8px;
}

.lori-message-user .lori-message-content {
  background: var(--lw-interaction-primary);
  color: var(--lw-interaction-on-primary);

  padding: 14px;
  border-radius: 20px 20px 6px 20px;

  max-width: 85%;
 
  align-self: flex-end;
}

.lori-message-user .lori-message-timestamp {
  font-size: 11px;
  color: var(--lw-on-surface-variant);
  align-self: flex-end;
  padding: 0 4px;
}

.lori-message-assistant {
  justify-content: flex-start;
  align-items: flex-end;
  gap: 8px;
}

.lori-tool-status {
  font-size: 12px;
  margin: 0 0 6px 2px;
  opacity: 0.92;
  transition: opacity 0.25s ease;
  color: var(--lw-interaction-primary);
}

.lori-tool-status.toolstatus-start {
  color: var(--lw-interaction-primary);
}

.lori-tool-status.toolstatus-end {
  color: var(--lw-feedback-positive);
}

.lori-tool-status.toolstatus-error {
  color: var(--lw-feedback-negative);
}

.lori-message-avatar {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.lori-message-body {
  flex: 1;
  max-width: 90%;
}

.lori-message-assistant .lori-message-content {
  background: var(--lw-surface);
  color: var(--lw-on-surface);

  padding: 14px;
  border-radius: 20px 20px 20px 6px;

  max-width: 85%;

  border: 1px solid var(--lw-outline);
}

.lori-message-assistant .lori-message-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  padding: 0 4px;
}

.lori-message-assistant .lori-message-timestamp {
  font-size: 11px;
  color: var(--lw-on-surface-variant);
}

.lori-message-system {
  justify-content: center;
}

.lori-message-system .lori-message-content {
  background: var(--lw-interaction-primary-container-alpha);
  color: var(--lw-interaction-primary);

  padding: 8px 12px;
  border-radius: 10px;

  font-size: 12px;
  font-weight: 700;

  text-align: center;
  max-width: 80%;
  border: 1px solid rgba(0, 85, 255, 0.15);
}

/* Feedback: botões + comentário opcional */
.lori-feedback-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lori-feedback-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.lori-feedback-label {
  font-size: 12px;
  color: var(--lw-on-surface-variant);
  margin-right: 6px;
  user-select: none;
}

.lori-feedback-comment {
  width: 100%;
  max-width: 280px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.35;
  border: 1px solid var(--lw-outline);
  border-radius: 8px;
  background: var(--lw-surface, #fff);
  color: var(--lw-on-surface, #1a1a1a);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lori-feedback-comment::placeholder {
  color: var(--lw-on-surface-variant, #666);
}

.lori-feedback-comment:focus {
  border-color: var(--lw-primary, #0055ff);
  box-shadow: 0 0 0 2px rgba(0, 85, 255, 0.15);
}

.lori-feedback-comment-step {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lori-feedback-comment-step .lori-feedback-comment {
  flex: 1;
  min-width: 0;
}

.lori-feedback-submit {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  background: var(--lw-primary, #0055ff);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.lori-feedback-submit:hover {
  opacity: 0.9;
}

.lori-feedback-submit:active {
  transform: scale(0.98);
}

.lori-feedback-btn {
  background: transparent;
  border: 1px solid transparent;

  font-size: 14px;
  cursor: pointer;

  padding: 4px 8px;
  border-radius: 8px;

  transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  opacity: 0.72;
}

.lori-feedback-btn:hover {
  opacity: 1;
  transform: scale(1.06);
  background: rgba(26, 26, 26, 0.05);
  border-color: rgba(0, 0, 0, 0.06);
}

.lori-feedback-btn:active {
  transform: scale(0.98);
}

/* Input Container */
.lori-input-container {
  display: flex;
  gap: 8px;
  padding: 12px 16px;

  background: var(--lw-surface);
  border-top: 1px solid var(--lw-outline);

  flex-shrink: 0;
}

.lori-input {
  flex: 1;
  padding: 10px 12px;

  border: 1px solid var(--lw-outline);
  border-radius: 10px;

  font-size: 14px;
  font-family: inherit;

  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;

  color: var(--lw-on-surface);
  background: var(--lw-surface);
  caret-color: var(--lw-interaction-primary);
}

.lori-input:focus {
  border-color: rgba(0, 85, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 85, 255, 0.16);
}

.lori-input:disabled {
  background: var(--lw-surface-low);
  color: var(--lw-on-surface-variant);
  cursor: not-allowed;
}

.lori-send-btn {
  background: var(--lw-interaction-primary);
  color: var(--lw-interaction-on-primary);
  border: none;

  padding: 10px 16px;
  border-radius: 10px;

  font-size: 14px;
  font-weight: 800;

  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;

  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 85, 255, 0.18);

  align-self: flex-end;
}

.lori-send-btn:hover:not(:disabled) {
  background: var(--lw-interaction-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 85, 255, 0.22);
}

.lori-send-btn:active:not(:disabled) {
  transform: translateY(0);
}

.lori-send-btn:disabled,
.lori-send-btn-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

/* Scrollbar */
.lori-messages::-webkit-scrollbar {
  width: 6px;
}

.lori-messages::-webkit-scrollbar-track {
  background: transparent;
}

.lori-messages::-webkit-scrollbar-thumb {
  background: var(--lw-outline-high);
  border-radius: 999px;
}

.lori-messages::-webkit-scrollbar-thumb:hover {
  background: var(--lw-on-surface-variant);
}

/* Mobile */
@media (max-width: 480px) {
  .lori-widget {
    width: 100%;
    height: 100%;
    right: 0;
    bottom: 0;
    border-radius: 0;
    left: auto;
    top: auto;
  }

  .lori-widget.position-bottom-left,
  .lori-widget.position-top-left,
  .lori-widget.position-top-right {
    width: 100%;
    height: 100%;
    right: 0;
    bottom: 0;
    left: auto;
    top: auto;
    border-radius: 0;
  }

  .lori-widget-header {
    border-radius: 0;
  }

  .lori-message-user .lori-message-content,
  .lori-message-assistant .lori-message-body {
    max-width: 90%;
  }
}

/* Melhor tipografia dentro dos balões (Markdown -> HTML) */
.lori-message-content {
  overflow: visible; /* evita qualquer clipping acidental de marcadores */
}

/* Parágrafos do Markdown */
.lori-message-content p {
  margin: 0 0 8px;
}
.lori-message-content p:last-child {
  margin-bottom: 0;
}

/* Listas do Markdown */
.lori-message-content ul,
.lori-message-content ol {
  margin: 8px 0;
  padding-left: 18px;            /* espaço pro marcador */
  list-style-position: inside;   /* mantém a “bolinha” dentro do balão */
}

.lori-message-content li {
  margin: 4px 0;
}


.lori-avatar-bg {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-image: var(--lw-avatar-url);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-block;
}

.lori-fab-icon-chat {
    width: 85%;
    height: 85%;
    background-image: var(--lw-ia-icon-url);
    background-size: contain;
}

.lori-avatar-setup {
  background-image: var(--lw-avatar-url);
  background-size: cover;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background-color: rgba(26, 26, 26, 0.05);
  margin: 0 auto;
  margin-bottom: 32px;
}


/* Textareas auto-expansíveis (mensagem e comentário de feedback) */
.lori-input,
.lori-feedback-comment {
  resize: none;
  overflow-y: hidden;   /* o JS pode trocar para auto quando passar do limite */
  min-height: 40px;
  max-height: 120px;    /* mantenha consistente com o max do JS */
  height: auto;
}

/* Quando a mensagem cresce, não deixe o botão "Enviar" esticar junto */
.lori-input-container {
  align-items: flex-end;
}

/* Idem no passo do comentário do feedback */
.lori-feedback-comment-step {
  align-items: flex-end;
}

/* Quick replies */
.lori-quick-replies{
  display:flex;
  flex-direction: column;
  gap:8px;
  padding:10px 12px;
  border-top:1px solid var(--lw-outline);
}

.lori-quick-replies-title{
  font-size: 12px;
  font-weight: 700;
  color: var(--lw-on-surface-variant);
}

.lori-quick-replies-row{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lori-quick-reply-btn{
  cursor:pointer;
  border:1px solid var(--lw-outline);
  background: var(--lw-surface);
  color: var(--lw-interaction-primary);
  padding:8px 10px;
  border-radius:999px;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s ease, border-color .15s ease, transform .06s ease;
}

.lori-quick-reply-btn:hover{
  background: var(--lw-interaction-primary-container-hover-alpha);
  border-color: var(--lw-outline);
}

.lori-quick-reply-btn:active{
  transform: translateY(1px);
}

.lori-quick-reply-btn:focus-visible{
  outline: 3px solid var(--lw-interaction-primary-container-alpha);
  outline-offset: 2px;
}

.input-wrapper {
  position: relative;
  width: 100%;
  padding: 16px;
}

.input-wrapper textarea {
  width: 100%;
  padding: 14px 50px 14px 16px;
  border-radius: 20px;
  border: none;
  background: #f1f1f1;
  font-size: 16px;
  outline: none;

  /* obrigatório para o autoResize funcionar corretamente */
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
  line-height: 1.5;
  font-family: inherit;
}

.input-wrapper button {
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.input-wrapper button:hover {
  background: #d5d5d5;
}

.input-wrapper svg {
  display: block;
}