/* ============================================================
   chat-widget.css — Chat próprio da Sattori (Fase 1)
   Arquivo separado de style.css de propósito: o widget é carregado
   em várias páginas (index, privacidade) e é independente do resto.
   Usa as variáveis da marca de style.css, com fallback literal pra
   funcionar mesmo numa página que não carregue o CSS principal.
   ============================================================ */

.sc-root {
  --sc-red:    var(--red, #E50914);
  --sc-red-d:  var(--red-d, #B00710);
  --sc-bg:     var(--bg, #F9FAFB);
  --sc-card:   var(--card, #FFFFFF);
  --sc-border: var(--border, #E5E7EB);
  --sc-text:   var(--text, #111827);
  --sc-muted:  var(--muted, #6B7280);
  --sc-shadow: 0 8px 32px rgba(0,0,0,.18);
  font-family: inherit;
}

/* ── Botão flutuante ── */
.sc-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 9998;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--sc-red); color: #fff; border: none;
  font-size: 1.6rem; cursor: pointer;
  box-shadow: 0 4px 16px rgba(229,9,20,.4);
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease;
}
.sc-fab:hover { transform: scale(1.06); box-shadow: 0 6px 22px rgba(229,9,20,.5); }
.sc-fab:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.sc-fab[hidden] { display: none; }

/* ── Painel ── */
.sc-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 9999;
  width: 380px; max-width: calc(100vw - 40px);
  height: 560px; max-height: calc(100vh - 40px);
  background: var(--sc-card); border: 1px solid var(--sc-border);
  border-radius: 16px; box-shadow: var(--sc-shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.sc-panel[hidden] { display: none; }

.sc-header {
  background: var(--sc-red); color: #fff;
  padding: 12px 14px; display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.sc-header-title { font-weight: 900; font-size: .95rem; line-height: 1.2; }
.sc-header-sub   { font-size: .68rem; opacity: .9; }
.sc-close {
  margin-left: auto; background: rgba(255,255,255,.18); color: #fff;
  border: none; width: 30px; height: 30px; border-radius: 8px;
  cursor: pointer; font-size: 1rem; line-height: 1;
}
.sc-close:hover { background: rgba(255,255,255,.3); }

/* ── Corpo ── */
.sc-body {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--sc-bg);
}

.sc-msg { max-width: 82%; padding: 9px 12px; border-radius: 12px; font-size: .875rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.sc-msg-bot    { background: var(--sc-card); border: 1px solid var(--sc-border); color: var(--sc-text); align-self: flex-start; border-bottom-left-radius: 4px; }
.sc-msg-user   { background: var(--sc-red); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.sc-msg-system { background: #FEF3C7; border: 1px solid #FDE68A; color: #92400E; align-self: center; font-size: .78rem; text-align: center; max-width: 95%; }
/* Fase 2: mensagem de atendente humano tem cor própria pro cliente perceber */
.sc-msg-human  { background: #DCFCE7; border: 1px solid #86EFAC; color: #14532D; align-self: flex-start; border-bottom-left-radius: 4px; }

.sc-typing { display: flex; gap: 4px; align-self: flex-start; padding: 10px 12px; background: var(--sc-card); border: 1px solid var(--sc-border); border-radius: 12px; }
.sc-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--sc-muted); animation: sc-blink 1.3s infinite; }
.sc-typing span:nth-child(2) { animation-delay: .18s; }
.sc-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes sc-blink { 0%,60%,100% { opacity: .25 } 30% { opacity: 1 } }

/* ── Chips de sugestão ── */
.sc-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; background: var(--sc-bg); }
.sc-chip {
  background: var(--sc-card); border: 1.5px solid var(--sc-red);
  color: var(--sc-red); border-radius: 999px;
  padding: 6px 12px; font-size: .75rem; font-weight: 700; cursor: pointer;
}
.sc-chip:hover { background: var(--sc-red); color: #fff; }

/* ── Botões de link vindos da IA ── */
.sc-links { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; }
.sc-link-btn {
  background: var(--sc-red); color: #fff; text-decoration: none;
  border-radius: 8px; padding: 7px 13px; font-size: .78rem; font-weight: 800;
  display: inline-block; border: none; cursor: pointer;
}
.sc-link-btn:hover { background: var(--sc-red-d); }

/* ── Erro + tentar de novo ── */
.sc-error { align-self: center; text-align: center; font-size: .78rem; color: #B91C1C; background: #FEE2E2; border: 1px solid #FCA5A5; border-radius: 10px; padding: 8px 12px; max-width: 95%; }
.sc-retry { margin-top: 6px; background: #B91C1C; color: #fff; border: none; border-radius: 6px; padding: 5px 12px; font-size: .74rem; font-weight: 800; cursor: pointer; }

/* ── Rodapé / composer ── */
.sc-footer { border-top: 1px solid var(--sc-border); background: var(--sc-card); flex-shrink: 0; }
.sc-form { display: flex; gap: 8px; padding: 10px; align-items: flex-end; }
.sc-input {
  flex: 1; min-width: 0; resize: none; font-family: inherit;
  border: 1.5px solid var(--sc-border); border-radius: 10px;
  padding: 9px 11px; font-size: .875rem; outline: none;
  max-height: 96px; line-height: 1.4; color: var(--sc-text); background: var(--sc-card);
}
.sc-input:focus { border-color: var(--sc-red); }
.sc-send {
  flex-shrink: 0; background: var(--sc-red); color: #fff; border: none;
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer; font-size: 1rem;
}
.sc-send:disabled { opacity: .45; cursor: not-allowed; }

/* Aviso LGPD — discreto mas sempre visível */
.sc-legal { font-size: .64rem; color: var(--sc-muted); text-align: center; padding: 0 10px 8px; line-height: 1.35; }
.sc-legal a { color: var(--sc-muted); text-decoration: underline; }

/* ── Tela de identificação ── */
.sc-ident { padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--sc-bg); flex: 1; }
.sc-ident-title { font-weight: 900; font-size: .95rem; color: var(--sc-text); }
.sc-ident-sub   { font-size: .8rem; color: var(--sc-muted); line-height: 1.45; }
.sc-ident-row   { display: flex; gap: 8px; }
.sc-ident-skip  { background: none; border: none; color: var(--sc-muted); font-size: .78rem; text-decoration: underline; cursor: pointer; padding: 4px; align-self: center; }

/* ── Mobile: tela cheia, não caixinha espremida ── */
@media (max-width: 640px) {
  .sc-panel {
    right: 0; bottom: 0; left: 0; top: 0;
    width: 100%; max-width: 100%;
    height: 100%; max-height: 100%;
    border-radius: 0; border: none;
  }
  .sc-fab { right: 16px; bottom: 16px; }
}

/* Respeita quem pediu menos animação no sistema */
@media (prefers-reduced-motion: reduce) {
  .sc-fab { transition: none; }
  .sc-typing span { animation: none; opacity: .5; }
}

/* Botão de WhatsApp no chat — verde da marca do WhatsApp pra diferenciar
   visualmente dos links internos do site (vermelhos da Sattori). */
.sc-link-btn.sc-link-wa { background: #25d366; }
.sc-link-btn.sc-link-wa:hover { background: #1da851; }

/* ── Balão de chamada ao lado do FAB ─────────────────────────────────────
   Some sozinho em 10s (o JS controla). Fica à esquerda do botão no desktop
   e acima dele no mobile, onde não cabe lado a lado. */
.sc-teaser {
  position: fixed; right: 88px; bottom: 30px; z-index: 9998;
  display: flex; align-items: center; gap: 8px;
  /* Mostarda fixo (não usa --sc-card/--sc-text/--sc-border — essas
     variáveis são compartilhadas com o resto do widget, só o balão muda).
     Texto e borda escolhidos pra manter contraste (~6.6:1 e ~3.8:1 sobre o
     mostarda, respectivamente) — cor padrão do site aqui sumiria. */
  background: #E1AD01; color: #3f2a00;
  border: 1px solid #a67c00; border-radius: 999px;
  padding: 9px 14px; font-size: .85rem; font-weight: 700;
  box-shadow: 0 4px 16px rgba(0,0,0,.14);
  cursor: pointer; max-width: 62vw;
  opacity: 0; transform: translateX(8px);
  transition: opacity .25s ease, transform .25s ease;
}
.sc-teaser.sc-teaser-on { opacity: 1; transform: translateX(0); }
/* `display:flex` acima vence a regra [hidden]{display:none} do navegador —
   sem esta linha o balão continua ocupando a tela mesmo escondido. */
.sc-teaser[hidden] { display: none; }
/* Rabinho apontando pro botão — background/border em "inherit" acompanham
   o mostarda automaticamente (herdam o computed value de .sc-teaser, não
   a variável), sem precisar repetir a cor aqui. */
.sc-teaser::after {
  content: ''; position: absolute; right: -6px; top: 50%;
  width: 12px; height: 12px; margin-top: -6px;
  background: inherit; border-right: inherit; border-top: inherit;
  transform: rotate(45deg);
}
.sc-teaser-x {
  background: none; border: none; cursor: pointer; padding: 0 2px;
  font-size: 1.05rem; line-height: 1; color: #3f2a00;
}
@media (max-width: 640px) {
  .sc-teaser { right: 16px; bottom: 84px; max-width: calc(100vw - 32px); }
  .sc-teaser::after { right: 20px; top: auto; bottom: -6px; margin-top: 0;
    border-right: inherit; border-bottom: inherit; border-top: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sc-teaser { transition: none; }
}
