/* ═══════════════════════════════════════════════
   CHATBOT COMBATE RASANTE — Weikren Bot
   ═══════════════════════════════════════════════ */

/* ── Intro do Weikren (vídeo de entrada) ── */
#cr-intro {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: 9992;
  width: min(320px, calc(100vw - 32px));
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.60);
  display: none;
  background: transparent;
  pointer-events: none;
}
#cr-intro.show { display: block; }
#cr-intro video {
  width: 100%;
  display: block;
  border-radius: 20px;
}

/* ── Botão flutuante (avatar circular) ── */
#cr-chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  overflow: visible;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
#cr-chat-btn img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 15%;
  border: 3px solid #16a34a;
  box-shadow: 0 0 0 3px rgba(34,197,94,.35), 0 4px 20px rgba(0,0,0,.45);
  display: block;
  transition: border-color .2s, box-shadow .2s;
}
#cr-chat-btn:hover { transform: scale(1.10); }
#cr-chat-btn:hover img {
  border-color: #4ade80;
  box-shadow: 0 0 0 4px rgba(34,197,94,.50), 0 6px 24px rgba(0,0,0,.50);
}
.cr-notif {
  position: absolute;
  top: 0; right: 0;
  width: 16px; height: 16px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
  animation: cr-pulse 1.8s infinite;
}
.cr-notif.show { display: block; }
@keyframes cr-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); }
  60%      { box-shadow: 0 0 0 7px rgba(239,68,68,0); }
}

/* ── Balão de saudação ── */
#cr-hello-bubble {
  position: fixed;
  bottom: 100px;
  right: 96px;
  z-index: 9989;
  background: #0d2418;
  border: 1px solid rgba(34,197,94,.45);
  border-radius: 14px 14px 4px 14px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,.45);
  max-width: 190px;
  line-height: 1.45;
  cursor: pointer;
  transition: transform .15s;
}
#cr-hello-bubble:hover { transform: scale(1.03); }
#cr-hello-bubble.hide { display: none; }

/* ── Janela do chat ── */
#cr-chat-win {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: 9991;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 130px));
  background: #0d2418;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform .28s cubic-bezier(.34,1.56,.64,1), opacity .2s;
}
#cr-chat-win.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ── */
.cr-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #14532d 0%, #166534 100%);
  flex-shrink: 0;
}
.cr-header-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.55);
  box-shadow: 0 0 0 3px rgba(34,197,94,.35), 0 4px 12px rgba(0,0,0,.35);
  overflow: hidden;
  flex-shrink: 0;
}
.cr-header-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 15%;
}
.cr-header-info { flex: 1; min-width: 0; }
.cr-header-name { font-weight: 900; font-size: 15px; color: #fff; }
.cr-header-role { font-size: 11px; color: rgba(255,255,255,.60); margin-top: 1px; }
.cr-header-status {
  font-size: 11px; color: rgba(255,255,255,.75);
  display: flex; align-items: center; gap: 5px; margin-top: 3px;
}
.cr-header-status::before {
  content: ""; width: 7px; height: 7px;
  background: #4ade80; border-radius: 50%;
  animation: cr-blink 2s infinite;
}
@keyframes cr-blink { 0%,100%{opacity:1} 50%{opacity:.35} }
.cr-close {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 8px;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; font-size: 14px; transition: background .15s; flex-shrink: 0;
}
.cr-close:hover { background: rgba(255,255,255,.28); }

/* ── Mensagens ── */
.cr-msgs {
  flex: 1; overflow-y: auto; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth;
}
.cr-msgs::-webkit-scrollbar { width: 4px; }
.cr-msgs::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

/* Row do bot com avatar mini */
.cr-bot-row {
  display: flex; align-items: flex-end; gap: 7px;
  align-self: flex-start; max-width: 92%; animation: cr-pop .2s ease;
}
.cr-bot-mini {
  width: 26px; height: 26px; border-radius: 50%;
  overflow: hidden; flex-shrink: 0;
  border: 1.5px solid rgba(34,197,94,.50);
}
.cr-bot-mini img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 15%;
}

.cr-bubble {
  max-width: 100%; padding: 10px 13px;
  border-radius: 16px; font-size: 13px;
  line-height: 1.65; color: #fff;
  word-break: break-word; animation: cr-pop .2s ease;
}
@keyframes cr-pop {
  from { transform: scale(.92); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.cr-bubble.bot {
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.12);
  border-bottom-left-radius: 4px;
}
.cr-bubble.user {
  background: linear-gradient(135deg, #16a34a, #15803d);
  border-bottom-right-radius: 4px;
  align-self: flex-end; max-width: 88%;
}

/* Opções */
.cr-options {
  display: flex; flex-direction: column; gap: 7px;
  align-self: flex-start; width: 100%; max-width: 88%;
  animation: cr-pop .2s ease; padding-left: 33px;
}
.cr-opt-btn {
  background: rgba(22,163,74,.18); border: 1px solid rgba(34,197,94,.40);
  color: #86efac; padding: 9px 13px; border-radius: 12px;
  font-size: 12px; font-weight: 700; cursor: pointer;
  text-align: left; transition: background .15s, transform .1s; font-family: inherit;
}
.cr-opt-btn:hover {
  background: rgba(22,163,74,.32); border-color: rgba(34,197,94,.65);
  color: #fff; transform: translateX(3px);
}

/* Typing */
.cr-typing-row {
  display: flex; align-items: flex-end; gap: 7px;
  align-self: flex-start; animation: cr-pop .2s ease;
}
.cr-typing {
  display: flex; gap: 4px; align-items: center;
  padding: 10px 14px; background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; border-bottom-left-radius: 4px;
}
.cr-typing span {
  width: 7px; height: 7px; background: rgba(255,255,255,.55);
  border-radius: 50%; animation: cr-bounce 1.2s infinite;
}
.cr-typing span:nth-child(2) { animation-delay: .15s; }
.cr-typing span:nth-child(3) { animation-delay: .30s; }
@keyframes cr-bounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-6px); }
}

/* Input */
.cr-input-row {
  display: flex; gap: 8px; padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.25); flex-shrink: 0;
}
.cr-input-row textarea {
  flex: 1; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18); border-radius: 12px;
  color: #fff; font-size: 13px; font-family: inherit;
  padding: 9px 12px; resize: none; outline: none;
  max-height: 90px; min-height: 38px;
  transition: border-color .15s; line-height: 1.5;
}
.cr-input-row textarea::placeholder { color: rgba(255,255,255,.40); font-style: italic; }
.cr-input-row textarea:focus { border-color: rgba(34,197,94,.60); }
.cr-send {
  width: 38px; height: 38px; flex-shrink: 0;
  background: linear-gradient(135deg, #16a34a, #15803d);
  border: none; border-radius: 10px; color: #fff;
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s, transform .1s;
}
.cr-send:hover { transform: scale(1.08); }
.cr-send:disabled { opacity: .4; cursor: default; transform: none; }

/* Rodapé visitante */
.cr-visitor-footer {
  padding: 10px 14px; text-align: center;
  font-size: 11px; color: rgba(255,255,255,.40);
  border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0;
}
.cr-visitor-footer a { color: rgba(34,197,94,.80); text-decoration: none; font-weight: 700; }

/* Botão voltar */
.cr-back-btn {
  align-self: flex-start; margin-left: 33px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  color: rgba(255,255,255,.65); font-size: 11px; font-weight: 700;
  padding: 5px 11px; border-radius: 8px; cursor: pointer; font-family: inherit;
  transition: background .15s;
}
.cr-back-btn:hover { background: rgba(255,255,255,.14); color: #fff; }

/* ── Botão PDF na barra de input ── */
.cr-pdf-btn {
  width: 38px; height: 38px; flex-shrink: 0;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.20);
  border-radius: 10px; color: rgba(255,255,255,.80);
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s, transform .1s;
  title: "Salvar conversa em PDF";
}
.cr-pdf-btn:hover {
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.35);
  color: #fff;
  transform: scale(1.08);
}

/* ── Botão salvar par ── */
.cr-save-pair-btn {
  background: rgba(34,197,94,.14);
  border: 1px solid rgba(34,197,94,.30);
  color: rgba(34,197,94,.90);
  font-size: 11px; font-weight: 700;
  padding: 4px 12px; border-radius: 8px;
  cursor: pointer; font-family: inherit;
  transition: background .15s, color .15s;
}
.cr-save-pair-btn:hover {
  background: rgba(34,197,94,.25);
  color: #fff;
}
