/* Widget de chat IA - Grupo Lucian Santos (reutilizavel) */
.gls-chat,
.gls-chat * { box-sizing: border-box; }

.gls-chat {
  --gls-accent: #1877F2;
  --gls-accent-2: #3be5ff;
  --gls-bg: #0f1420;
  --gls-surface: #161d2c;
  --gls-text: #e8edf6;
  --gls-muted: #93a0b5;
  --gls-border: rgba(255,255,255,.10);
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99999;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* Variante canto esquerdo (evita colidir com botao do WhatsApp na direita) */
.gls-chat--left { left: 22px; right: auto; }
.gls-chat--left .gls-chat__nudge { left: 74px; right: auto; }
.gls-chat--left .gls-chat__panel { left: 0; right: auto; }

/* Botao flutuante */
.gls-chat__fab {
  position: relative;
  width: 60px; height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: grid; place-items: center;
  color: #fff;
  overflow: visible;
  background: linear-gradient(135deg, var(--gls-accent), var(--gls-accent-2));
  box-shadow: 0 10px 30px rgba(0,0,0,.35), 0 0 0 0 rgba(0,0,0,.2);
  transition: transform .18s ease, box-shadow .18s ease;
}
.gls-chat__fab:hover { transform: translateY(-2px) scale(1.04); }
.gls-chat__fab svg { width: 28px; height: 28px; }
.gls-chat__fab img.gls-chat__fab-avatar {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block;
}
/* badge "online" no FAB com avatar */
.gls-chat__fab .gls-chat__fab-dot {
  position: absolute; right: 2px; bottom: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #43e08a; border: 2px solid #0f1420;
}
.gls-chat.is-open .gls-chat__fab .gls-chat__fab-avatar,
.gls-chat.is-open .gls-chat__fab .gls-chat__fab-dot { display: none; }
.gls-chat__fab .gls-chat__close-ico { display: none; }
.gls-chat.is-open .gls-chat__fab .gls-chat__open-ico { display: none; }
.gls-chat.is-open .gls-chat__fab .gls-chat__close-ico { display: block; }

/* Balao "fale conosco" */
.gls-chat__nudge {
  position: absolute;
  right: 74px; bottom: 12px;
  white-space: nowrap;
  background: var(--gls-surface);
  color: var(--gls-text);
  border: 1px solid var(--gls-border);
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  opacity: 0; transform: translateY(6px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
}
.gls-chat__nudge.show { opacity: 1; transform: translateY(0); }
.gls-chat.is-open .gls-chat__nudge { display: none; }

/* Painel */
.gls-chat__panel {
  position: absolute;
  right: 0; bottom: 74px;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: var(--gls-bg);
  border: 1px solid var(--gls-border);
  border-radius: 18px;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(12px) scale(.98);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.gls-chat.is-open .gls-chat__panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.gls-chat__header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--gls-accent), var(--gls-accent-2));
  color: #fff;
}
.gls-chat__avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: grid; place-items: center; font-weight: 700;
  overflow: hidden; flex: 0 0 42px;
}
.gls-chat__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gls-chat__title { font-weight: 700; font-size: 15px; line-height: 1.1; }
.gls-chat__status { font-size: 12px; opacity: .9; display: flex; align-items: center; gap: 5px; }
.gls-chat__status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #43e08a; }

.gls-chat__body {
  flex: 1; overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--gls-bg);
}
.gls-chat__msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px; line-height: 1.45;
  white-space: pre-wrap; word-wrap: break-word;
}
.gls-chat__msg--bot {
  align-self: flex-start;
  background: var(--gls-surface);
  color: var(--gls-text);
  border: 1px solid var(--gls-border);
  border-bottom-left-radius: 4px;
}
.gls-chat__msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--gls-accent), var(--gls-accent-2));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.gls-chat__typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; }
.gls-chat__typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--gls-muted);
  animation: gls-bounce 1.2s infinite ease-in-out;
}
.gls-chat__typing span:nth-child(2) { animation-delay: .15s; }
.gls-chat__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes gls-bounce { 0%,80%,100% { transform: translateY(0); opacity:.5 } 40% { transform: translateY(-5px); opacity:1 } }

.gls-chat__footer {
  padding: 10px;
  border-top: 1px solid var(--gls-border);
  background: var(--gls-bg);
}
.gls-chat__inputwrap { display: flex; gap: 8px; align-items: flex-end; }
.gls-chat__input {
  flex: 1; resize: none;
  background: var(--gls-surface);
  border: 1px solid var(--gls-border);
  color: var(--gls-text);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px; font-family: inherit;
  max-height: 110px; min-height: 42px;
  outline: none;
}
.gls-chat__input:focus { border-color: var(--gls-accent); }
.gls-chat__send {
  width: 42px; height: 42px; flex: 0 0 42px;
  border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, var(--gls-accent), var(--gls-accent-2));
  color: #fff; display: grid; place-items: center;
}
.gls-chat__send:disabled { opacity: .5; cursor: default; }
.gls-chat__send svg { width: 20px; height: 20px; }
.gls-chat__disclaimer { font-size: 11px; color: var(--gls-muted); text-align: center; margin-top: 7px; }

@media (max-width: 480px) {
  .gls-chat { right: 14px; bottom: 14px; }
  .gls-chat__panel { width: calc(100vw - 28px); height: calc(100vh - 96px); }
}
@media (prefers-reduced-motion: reduce) {
  .gls-chat__fab, .gls-chat__panel, .gls-chat__nudge { transition: none; }
  .gls-chat__typing span { animation: none; }
}
