/* =============================================================================
   chat-rosa.css — estilo do WIDGET DE CHAT da assistente virtual "Rosa".
   Componente STANDALONE do site CyberCat (Onda B / GTM). Servido de
   /brand/css/chat-rosa.css. Par do módulo /brand/js/chat-rosa.js.

   REGRAS DE MARCA (Manual V1.1 = lei / auditoria A107):
     - ZERO hex cru fora da paleta oficial: cores vêm de var(--color-*) de
       tokens.css (com fallback nos 6 hexes OFICIAIS) ou de rgba() — que o
       brand-lint não conta como hex. Nenhum hue novo (verde/rosa/laranja).
     - Tipografia: var(--font-headline)/var(--font-body) de tokens.css, com
       fallback de sistema. Nenhuma fonte alheia como primária.
     - Amarelo (ouro) só como acento comedido (botão enviar / foco).

   NÃO injeta em página de produção por si só: é ativado por chat-rosa.js
   apenas quando CyberCatRosa.init() é chamado (wiring = Fase 3, pós red team).
   Criado 2026-07-24 (Opus, frente paralela do bot Rosa).
   ============================================================================= */

/* Vars locais do widget — mapeiam para tokens.css oficiais, com fallback nos
   6 hexes canônicos. Todo tint/sombra usa rgba() do azul-marinho oficial. */
.ccr-root {
  --ccr-primary:   var(--color-primary, #003376);
  --ccr-royal:     var(--color-primary-hover, #00529c);
  --ccr-gold:      var(--color-accent, #f5d800);
  --ccr-white:     var(--color-text-on-primary, #ffffff);
  --ccr-ink:       var(--color-text, #000000);
  --ccr-ink-soft:  var(--color-text-secondary, #555555);
  --ccr-line:      var(--color-border, #cccccc);
  --ccr-error:     var(--color-error, #c73030);

  --ccr-surface:   var(--color-bg, #ffffff);
  --ccr-surface-2: rgba(0, 51, 118, .045);        /* tint navy p/ bolha Rosa */
  --ccr-user-bg:   rgba(0, 82, 156, .10);          /* tint royal p/ bolha usuário */
  --ccr-overlay:   rgba(0, 16, 39, .55);
  --ccr-shadow:    0 18px 44px -18px rgba(0, 26, 60, .45);
  --ccr-shadow-sm: 0 6px 18px -8px rgba(0, 26, 60, .35);

  --ccr-head:  var(--font-headline, "Montserrat", "Segoe UI", system-ui, sans-serif);
  --ccr-body:  var(--font-body, "Dubai", "Segoe UI", system-ui, sans-serif);

  --ccr-radius: 16px;
  --ccr-z: 2147483000;   /* acima de tudo, abaixo do teto int32 */

  position: fixed;
  inset: 0;
  pointer-events: none;   /* só os filhos interativos captam clique */
  z-index: var(--ccr-z);
  font-family: var(--ccr-body);
}

.ccr-root *,
.ccr-root *::before,
.ccr-root *::after { box-sizing: border-box; }

/* ─── LAUNCHER (botão flutuante) ─────────────────────────────────────────── */
.ccr-launcher {
  pointer-events: auto;
  position: absolute;
  right: 20px;
  bottom: 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: none;
  cursor: pointer;
  padding: 0 18px 0 16px;
  height: 56px;
  border-radius: var(--ccr-radius);
  background: linear-gradient(135deg, var(--ccr-royal) 0%, var(--ccr-primary) 100%);
  color: var(--ccr-white);
  font-family: var(--ccr-head);
  font-weight: 600;
  font-size: 1rem;
  box-shadow: var(--ccr-shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.ccr-launcher:hover { transform: translateY(-2px); }
.ccr-launcher:focus-visible {
  outline: 3px solid var(--ccr-gold);
  outline-offset: 2px;
}
.ccr-launcher svg { flex: none; width: 24px; height: 24px; }
.ccr-launcher .ccr-launcher-label { white-space: nowrap; }
.ccr-root[data-open="true"] .ccr-launcher { display: none; }

/* ponto de notificação (saudação não lida) */
.ccr-launcher .ccr-dot {
  position: absolute; top: -4px; right: -4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--ccr-gold);
  border: 2px solid var(--ccr-primary);
}

/* ─── PAINEL ─────────────────────────────────────────────────────────────── */
.ccr-panel {
  pointer-events: auto;
  position: absolute;
  right: 20px;
  bottom: 20px;
  width: 384px;
  max-width: calc(100vw - 32px);
  height: min(620px, calc(100vh - 40px));
  display: none;
  flex-direction: column;
  background: var(--ccr-surface);
  color: var(--ccr-ink);
  border: 1px solid var(--ccr-line);
  border-radius: var(--ccr-radius);
  box-shadow: var(--ccr-shadow);
  overflow: hidden;
}
.ccr-root[data-open="true"] .ccr-panel {
  display: flex;
  animation: ccr-rise .18s ease both;
}
@keyframes ccr-rise {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* Cabeçalho navy */
.ccr-head {
  background: linear-gradient(135deg, var(--ccr-primary) 0%, #001e4d 100%);
  color: var(--ccr-white);
  padding: 14px 14px 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ccr-head-logo {
  width: 34px; height: 34px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .12);
  border-radius: 10px;
}
.ccr-head-logo img { width: 24px; height: 24px; display: block; }
.ccr-head-txt { flex: 1 1 auto; min-width: 0; }
.ccr-head-title {
  font-family: var(--ccr-head);
  font-weight: 700; font-size: 1.02rem; line-height: 1.15;
  margin: 0;
}
.ccr-head-sub {
  font-size: .72rem; opacity: .85; margin: 2px 0 0;
  display: flex; align-items: center; gap: 6px;
}
.ccr-head-sub .ccr-badge {
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 999px; padding: 1px 7px; font-size: .66rem; letter-spacing: .02em;
}
.ccr-head-close {
  flex: none;
  width: 34px; height: 34px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .28);
  color: var(--ccr-white);
  border-radius: 9px; cursor: pointer;
  font-size: 20px; line-height: 1;
}
.ccr-head-close:hover { background: rgba(255, 255, 255, .14); }
.ccr-head-close:focus-visible { outline: 3px solid var(--ccr-gold); outline-offset: 1px; }

/* Corpo / histórico */
.ccr-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(0, 82, 156, .05), transparent 60%),
    var(--ccr-surface);
  scroll-behavior: smooth;
}
.ccr-msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: .92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.ccr-msg-rosa {
  align-self: flex-start;
  background: var(--ccr-surface-2);
  border: 1px solid var(--ccr-line);
  border-bottom-left-radius: 5px;
  color: var(--ccr-ink);
}
.ccr-msg-user {
  align-self: flex-end;
  background: var(--ccr-user-bg);
  border: 1px solid rgba(0, 82, 156, .25);
  border-bottom-right-radius: 5px;
  color: var(--ccr-ink);
}
.ccr-msg-sys {
  align-self: center;
  max-width: 92%;
  text-align: center;
  font-size: .78rem;
  color: var(--ccr-ink-soft);
  background: transparent;
  padding: 4px 8px;
}
.ccr-msg-sys a { color: var(--ccr-royal); }
.ccr-msg-error {
  align-self: center;
  max-width: 92%;
  text-align: center;
  font-size: .82rem;
  color: var(--ccr-error);
  background: rgba(199, 48, 48, .06);
  border: 1px solid rgba(199, 48, 48, .25);
}

/* aviso LGPD (topo do log) */
.ccr-notice {
  align-self: stretch;
  font-size: .74rem;
  color: var(--ccr-ink-soft);
  line-height: 1.4;
  background: var(--ccr-surface-2);
  border: 1px solid var(--ccr-line);
  border-radius: 10px;
  padding: 9px 11px;
}

/* indicador de digitação */
.ccr-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px;
  background: var(--ccr-surface-2); border: 1px solid var(--ccr-line);
  border-radius: 14px; border-bottom-left-radius: 5px; }
.ccr-typing span { width: 7px; height: 7px; border-radius: 50%;
  background: var(--ccr-royal); opacity: .5; animation: ccr-blink 1.2s infinite; }
.ccr-typing span:nth-child(2) { animation-delay: .2s; }
.ccr-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes ccr-blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); } }

/* quick-replies / sugestões */
.ccr-suggests { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px 14px 6px; }
.ccr-chip {
  pointer-events: auto;
  border: 1px solid var(--ccr-royal);
  background: transparent;
  color: var(--ccr-royal);
  font-family: var(--ccr-body);
  font-size: .82rem;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
}
.ccr-chip:hover { background: rgba(0, 82, 156, .08); }
.ccr-chip:focus-visible { outline: 3px solid var(--ccr-gold); outline-offset: 1px; }

/* Rodapé / composer */
.ccr-foot { border-top: 1px solid var(--ccr-line); padding: 10px 12px 8px; background: var(--ccr-surface); }
.ccr-composer { display: flex; align-items: flex-end; gap: 8px; }
.ccr-input {
  flex: 1 1 auto;
  resize: none;
  max-height: 120px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--ccr-line);
  border-radius: 12px;
  font-family: var(--ccr-body);
  font-size: .95rem;
  line-height: 1.4;
  color: var(--ccr-ink);
  background: var(--ccr-surface);
}
.ccr-input:focus { outline: none; border-color: var(--ccr-royal);
  box-shadow: 0 0 0 3px rgba(0, 82, 156, .18); }
.ccr-input:disabled { background: rgba(0, 51, 118, .04); cursor: not-allowed; }
.ccr-send {
  flex: none;
  width: 44px; height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--ccr-gold);
  color: #1a1600;                 /* tint escuro do amarelo — neutro, on-brand */
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.ccr-send svg { width: 20px; height: 20px; }
.ccr-send:hover { filter: brightness(.96); }
.ccr-send:disabled { opacity: .5; cursor: not-allowed; }
.ccr-send:focus-visible { outline: 3px solid var(--ccr-primary); outline-offset: 2px; }

.ccr-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 6px; font-size: .68rem; color: var(--ccr-ink-soft);
}
.ccr-count.ccr-count-warn { color: var(--ccr-error); }
.ccr-disclaimer { text-align: right; line-height: 1.3; }

/* ─── RESPONSIVO / MOBILE (bottom-sheet) ─────────────────────────────────── */
@media (max-width: 480px) {
  .ccr-panel {
    right: 0; bottom: 0;
    width: 100vw; max-width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }
  .ccr-launcher { right: 14px; bottom: 14px; }
  .ccr-launcher .ccr-launcher-label { display: none; }   /* só o ícone no celular */
  .ccr-launcher { padding: 0; width: 56px; justify-content: center; }
}

/* ─── ACESSIBILIDADE: reduzir movimento ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ccr-root[data-open="true"] .ccr-panel { animation: none; }
  .ccr-launcher { transition: none; }
  .ccr-typing span { animation: none; }
  .ccr-log { scroll-behavior: auto; }
}

/* ─── CAPTURA DE CONTATO (lead assíncrono; substitui transferência ao vivo) ─── */
.ccr-capture {
  align-self: stretch;
  background: var(--ccr-surface-2);
  border: 1px solid var(--ccr-line);
  border-radius: 12px;
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ccr-capture-intro {
  font-size: .9rem;
  line-height: 1.45;
  color: var(--ccr-ink);
}
.ccr-capture-form { display: flex; flex-direction: column; gap: 9px; }
.ccr-capture-channel { display: flex; gap: 14px; flex-wrap: wrap; }
.ccr-capture-radio {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .88rem; color: var(--ccr-ink); cursor: pointer;
}
.ccr-capture-radio input { accent-color: var(--ccr-royal); width: 16px; height: 16px; }
.ccr-capture-field { display: flex; flex-direction: column; gap: 3px; }
.ccr-capture-field > span { font-size: .76rem; color: var(--ccr-ink-soft); }
.ccr-capture-field > span em { font-style: normal; opacity: .75; }
.ccr-capture-field input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--ccr-line);
  border-radius: 10px;
  font-family: var(--ccr-body);
  font-size: .92rem;
  color: var(--ccr-ink);
  background: var(--ccr-surface);
}
.ccr-capture-field input:focus {
  outline: none; border-color: var(--ccr-royal);
  box-shadow: 0 0 0 3px rgba(0, 82, 156, .18);
}
.ccr-capture-consent {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: .74rem; line-height: 1.4; color: var(--ccr-ink-soft);
  cursor: pointer;
}
.ccr-capture-consent input { margin-top: 2px; accent-color: var(--ccr-royal);
  width: 15px; height: 15px; flex: none; }
.ccr-capture-actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px;
}
.ccr-capture-submit {
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ccr-royal) 0%, var(--ccr-primary) 100%);
  color: var(--ccr-white);
  font-family: var(--ccr-head);
  font-weight: 600;
  font-size: .9rem;
  padding: 9px 16px;
  cursor: pointer;
}
.ccr-capture-submit:hover { filter: brightness(1.04); }
.ccr-capture-submit:disabled { opacity: .55; cursor: not-allowed; }
.ccr-capture-submit:focus-visible { outline: 3px solid var(--ccr-gold); outline-offset: 2px; }
.ccr-capture-msg { font-size: .78rem; }
.ccr-capture-msg.ok { color: var(--ccr-royal); }
.ccr-capture-msg.err { color: var(--ccr-error); }
.ccr-capture-done {
  font-size: .9rem; line-height: 1.45; color: var(--ccr-ink);
  padding: 2px 0;
}

/* utilitário só-leitor-de-tela */
.ccr-sr-only {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
