/*
 * Assistente virtual (chatbot RAG) — widget flutuante.
 * Componente custom (como o aviso de cookies): usa a identidade visual gov.br
 * do portal, sem recriar componentes do DS que já existam. Sem JS inline.
 */
.cb-fab{
  position:fixed; right:20px; bottom:20px; z-index:1080;
  width:60px; height:60px; border-radius:50%; border:none; cursor:pointer;
  background:#1351b4; color:#fff; font-size:24px; line-height:1;
  box-shadow:0 6px 18px rgba(19,81,180,.35);
  display:flex; align-items:center; justify-content:center;
  transition:background-color .2s, transform .15s;
}
.cb-fab:hover{ background:#0c3c8c; }
.cb-fab:focus-visible{ outline:3px solid #f2cb05; outline-offset:2px; }
.cb-fab[hidden]{ display:none; }

.cb-panel{
  position:fixed; right:20px; bottom:20px; z-index:1090;
  width:min(380px, calc(100vw - 32px));
  height:min(560px, calc(100vh - 100px));
  background:#fff; border-radius:14px; overflow:hidden;
  box-shadow:0 12px 40px rgba(20,58,97,.28);
  display:flex; flex-direction:column;
  font-family:'Rawline','Raleway',system-ui,-apple-system,"Segoe UI",sans-serif;
}
.cb-panel[hidden]{ display:none; }

.cb-header{
  background:#1351b4; color:#fff; padding:14px 16px;
  display:flex; align-items:center; gap:10px;
}
.cb-header .cb-avatar{
  width:34px; height:34px; border-radius:50%; background:rgba(255,255,255,.16);
  display:flex; align-items:center; justify-content:center; font-size:16px; flex:0 0 auto;
}
.cb-header .cb-titles{ flex:1 1 auto; min-width:0; }
.cb-header .cb-title{ font-weight:700; font-size:15px; line-height:1.2; }
.cb-header .cb-subtitle{ font-size:12px; opacity:.85; }
.cb-close{
  background:transparent; border:none; color:#fff; cursor:pointer;
  width:32px; height:32px; border-radius:50%; font-size:18px; flex:0 0 auto;
}
.cb-close:hover{ background:rgba(255,255,255,.16); }
.cb-close:focus-visible{ outline:2px solid #f2cb05; outline-offset:2px; }

.cb-log{
  flex:1 1 auto; overflow-y:auto; padding:16px;
  background:#f4f6f9; display:flex; flex-direction:column; gap:12px;
}
.cb-msg{ max-width:88%; padding:10px 13px; border-radius:14px; font-size:14px; line-height:1.5; white-space:pre-wrap; word-wrap:break-word; }
.cb-msg.user{ align-self:flex-end; background:#1351b4; color:#fff; border-bottom-right-radius:4px; }
.cb-msg.bot{ align-self:flex-start; background:#fff; color:#1f2937; border:1px solid #e0e4ea; border-bottom-left-radius:4px; }

/* Mídia na resposta (intents curados) */
.cb-yt{ margin-top:8px; position:relative; width:100%; aspect-ratio:16/9; border-radius:10px; overflow:hidden; background:#000; }
.cb-yt-facade{ display:block; width:100%; height:100%; padding:0; border:none; cursor:pointer; position:relative; background:#000; }
.cb-yt-thumb{ width:100%; height:100%; object-fit:cover; display:block; }
.cb-yt-play{
  position:absolute; inset:0; margin:auto; width:54px; height:54px; border-radius:50%;
  background:rgba(19,81,180,.92); color:#fff; display:flex; align-items:center; justify-content:center;
  font-size:20px; padding-left:3px;
}
.cb-yt-facade:hover .cb-yt-play{ background:#1351b4; }
.cb-yt-facade:focus-visible{ outline:3px solid #f2cb05; outline-offset:2px; }
.cb-yt-iframe{ width:100%; height:100%; border:0; display:block; }

.cb-img{ margin:8px 0 0; }
.cb-img img{ width:100%; border-radius:10px; display:block; }
.cb-img figcaption{ font-size:12px; color:#5a6b80; margin-top:4px; }

.cb-sources{ margin-top:8px; display:flex; flex-direction:column; gap:6px; }
.cb-sources .cb-src-title{ font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:#5a6b80; font-weight:700; }
.cb-source{
  display:flex; gap:8px; align-items:flex-start; text-decoration:none;
  background:#eef3fb; border:1px solid #d6e2f5; border-radius:8px; padding:7px 9px; color:#0c3c8c;
}
.cb-source:hover{ background:#e1ebf9; }
.cb-source .cb-src-tag{ font-size:10px; font-weight:700; text-transform:uppercase; color:#1351b4; flex:0 0 auto; margin-top:2px; }
.cb-source .cb-src-name{ font-size:13px; line-height:1.35; }

.cb-form{ display:flex; gap:8px; padding:12px; border-top:1px solid #e0e4ea; background:#fff; }
.cb-input{
  flex:1 1 auto; resize:none; border:1px solid #c5ccd6; border-radius:20px;
  padding:10px 14px; font:inherit; font-size:14px; max-height:96px; line-height:1.4;
}
.cb-input:focus{ outline:none; border-color:#1351b4; box-shadow:0 0 0 2px rgba(19,81,180,.2); }
.cb-send{
  flex:0 0 auto; width:42px; height:42px; border-radius:50%; border:none; cursor:pointer;
  background:#1351b4; color:#fff; font-size:16px;
}
.cb-send:hover{ background:#0c3c8c; }
.cb-send:disabled{ background:#9bb4d9; cursor:not-allowed; }
.cb-send:focus-visible{ outline:3px solid #f2cb05; outline-offset:2px; }

.cb-typing{ display:flex; gap:4px; align-items:center; padding:4px 2px; }
.cb-typing span{ width:7px; height:7px; border-radius:50%; background:#9bb4d9; animation:cb-bounce 1.2s infinite ease-in-out; }
.cb-typing span:nth-child(2){ animation-delay:.15s; }
.cb-typing span:nth-child(3){ animation-delay:.3s; }
@keyframes cb-bounce{ 0%,80%,100%{ transform:scale(.6); opacity:.5; } 40%{ transform:scale(1); opacity:1; } }

/* Aviso de resposta gerada: discreto, mas dentro da bolha — o cidadão precisa
   ver que aquele texto não foi escrito por um servidor. */
.cb-gerada{
  font-size:11px; color:#5a6b80; font-style:italic;
  margin:6px 0 0; padding-top:6px; border-top:1px solid #e0e4ea;
}

.cb-disclaimer{ font-size:11px; color:#8a93a0; text-align:center; padding:0 12px 8px; background:#fff; }

@media (max-width:480px){
  .cb-panel{ right:8px; left:8px; bottom:8px; width:auto; height:min(82vh, 600px); }
  .cb-fab{ right:14px; bottom:14px; }
}
@media (prefers-reduced-motion:reduce){
  .cb-typing span{ animation:none; }
  .cb-fab{ transition:none; }
}
