/* Weltron: chat do site */

.chat-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: grid; place-items: center; width: 60px; height: 60px; border: 0; border-radius: 50%;
  background: var(--primary); color: #fff; cursor: pointer;
  box-shadow: 0 14px 30px -10px rgba(37, 99, 235, .6);
  transition: transform .3s var(--ease), background-color .2s;
}
.chat-fab:hover { background: var(--primary-dark); transform: translateY(-2px); }
.chat-fab:focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; }
.chat-fab::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--primary); z-index: -1; animation: chatPing 2.6s var(--ease) infinite; }
.chat-fab.is-seen::before, .chat-fab.is-open::before { display: none; }
.chat-fab__i { position: absolute; display: grid; place-items: center; transition: transform .35s var(--ease), opacity .25s; }
.chat-fab svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat-fab__i--close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.chat-fab.is-open .chat-fab__i--open { opacity: 0; transform: rotate(90deg) scale(.6); }
.chat-fab.is-open .chat-fab__i--close { opacity: 1; transform: none; }
.chat-fab__dot {
  position: absolute; top: -2px; right: -2px; display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff;
  background: var(--red); color: #fff; font-size: .68rem; font-weight: 700;
  transition: transform .3s var(--ease);
}
.chat-fab.is-seen .chat-fab__dot { transform: scale(0); }
@keyframes chatPing { 0% { transform: scale(1); opacity: .45; } 70%, 100% { transform: scale(1.55); opacity: 0; } }

/* Aviso ao lado do botão */
.chat-teaser {
  position: fixed; right: 20px; bottom: 94px; z-index: 59; width: 250px;
  padding: 14px 34px 14px 16px; border-radius: 16px 16px 4px 16px;
  background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  cursor: pointer; opacity: 0; transform: translateY(10px) scale(.96); transform-origin: bottom right;
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.chat-teaser.is-on { opacity: 1; transform: none; }
.chat-teaser:not(.is-on) { pointer-events: none; }
.chat-teaser b { display: block; color: var(--ink); font-size: .92rem; }
.chat-teaser span { display: block; color: var(--muted); font-size: .82rem; line-height: 1.45; margin-top: 2px; }
.chat-teaser__x { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.chat-teaser__x:hover { background: #f1f5f9; color: var(--ink); }
.chat-teaser__x svg, .chat__close svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

/* Janela */
.chat {
  position: fixed; right: 20px; bottom: 94px; z-index: 60;
  display: flex; flex-direction: column; width: 380px; height: min(600px, calc(100svh - 120px));
  border-radius: 20px; overflow: hidden; background: #fff; border: 1px solid var(--border);
  box-shadow: 0 2px 6px rgba(15, 23, 42, .05), 0 40px 90px -24px rgba(15, 23, 42, .35);
  opacity: 0; transform: translateY(16px) scale(.97); transform-origin: bottom right;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.chat.is-open { opacity: 1; transform: none; }
.chat[hidden] { display: none; }

.chat__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--primary); color: #fff; }
.chat__avatar { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #fff; flex-shrink: 0; }
.chat__avatar img { width: 26px; height: 26px; object-fit: contain; }
.chat__who { flex: 1; min-width: 0; line-height: 1.3; }
.chat__who b { display: block; font-size: .95rem; }
.chat__who span { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: #dbe6ff; }
.chat__who i { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .25); }
.chat__close { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; transition: background-color .2s; }
.chat__close:hover { background: rgba(255, 255, 255, .22); }
.chat__close svg { width: 16px; height: 16px; }

.chat__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px; padding: 18px 14px; background: var(--bg-gray); }
.msg { max-width: 84%; padding: 10px 14px; border-radius: 16px; font-size: .9rem; line-height: 1.5; overflow-wrap: anywhere; animation: msgIn .35s var(--ease) both; }
.msg--bot { align-self: flex-start; background: #fff; color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg--user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg a { font-weight: 600; }
.msg--typing { display: flex; gap: 4px; padding: 14px 16px; }
.msg--typing i { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; animation: typing 1.1s infinite; }
.msg--typing i:nth-child(2) { animation-delay: .15s; }
.msg--typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }

.msg__card { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; }
.msg__card dt { font-size: .76rem; font-weight: 600; color: var(--muted); padding-top: 2px; }
.msg__card dd { margin: 0; color: var(--ink); font-weight: 500; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; animation: msgIn .35s var(--ease) both; }
.chip {
  padding: 8px 13px; border-radius: 999px; border: 1px solid #bfd3fe; background: #fff;
  color: var(--primary); font-size: .84rem; font-weight: 600; line-height: 1.3; text-align: left; cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s, transform .2s var(--ease);
}
.chip:hover { background: var(--primary-soft); border-color: var(--primary); }
.chip:active { transform: scale(.97); }
.chip--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip--primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.chip--ghost { border-color: var(--border); color: var(--muted); }
.chip--ghost:hover { background: #fff; border-color: #cbd5e1; color: var(--ink); }

.chat__input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); background: #fff; }
.chat__input input {
  flex: 1; min-width: 0; padding: 11px 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-gray); outline: none; font-size: 16px; transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.chat__input input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px var(--primary-soft); }
.chat__input button { display: grid; place-items: center; width: 44px; border: 0; border-radius: 12px; background: var(--primary); color: #fff; cursor: pointer; transition: background-color .2s; flex-shrink: 0; }
.chat__input button:hover { background: var(--primary-dark); }
.chat__input svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.chat__foot { padding: 0 12px 10px; background: #fff; text-align: center; font-size: .72rem; color: #94a3b8; }

/* Celular: chat em tela cheia */
@media (max-width: 760px) {
  .chat { inset: 0; width: auto; height: auto; border-radius: 0; border: 0; transform-origin: bottom center; }
  .chat-fab { right: 16px; bottom: 16px; width: 56px; height: 56px; }
  .chat-fab.is-open { display: none; }
  .chat-teaser { right: 16px; bottom: 84px; }
  .chat-lock, .chat-lock body { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-fab::before { display: none; }
}
