/* ========== BASE / RESET LOCAL ========== */
#cb-root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  color-scheme: dark;
  position: relative;
}

/* Títulos sempre brancos dentro do widget */
#cb-root h1,
#cb-root h2,
#cb-root h3,
#cb-root h4,
#cb-root h5,
#cb-root h6 {
  color: #e5e7eb !important;
}

/* Em especial o título de tópicos e o título de lead */
#cb-root #cb-topics-inline h3,
#cb-root #cb-lead-form h3,
#cb-root #cb-end h3,
#cb-root #cb-header-title {
  color: #e5e7eb !important;
}

/* Reset local: nada de margin/padding herdado do site */
#cb-root,
#cb-root * {
  box-sizing: border-box;
}

#cb-root h1,
#cb-root h2,
#cb-root h3,
#cb-root h4,
#cb-root h5,
#cb-root h6 {
  margin: 0;
  padding: 0;
  font-weight: 600;
  line-height: 1.3;
  font-size: 14px;
}

#cb-root p {
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.4;
}

#cb-root label {
  margin: 0;
  padding: 0;
}

#cb-root input,
#cb-root textarea,
#cb-root button,
#cb-root a {
  font-family: inherit;
  font-size: 14px;
  line-height: 1.3;
  border: none;
  outline: none;
  background: none;
}

/* Classes utilitárias internas */
#cb-root .cb-hidden {
  display: none !important;
}

/* ========== BOTÃO FLUTUANTE ========== */
/* Botão flutuante do chat – vidro (desktop) */
#cb-root #cb-toggle {
  position: fixed;
  bottom: 20px;
  right: 22px;
  z-index: 9999;

  display: inline-flex;
  align-items: center;
  gap: 10px;

  padding: 10px 24px;
  border-radius: 999px;

  /* efeito vidro */
  background:
    linear-gradient(135deg,
      rgba(15, 23, 42, 0.70),
      rgba(15, 23, 42, 0.88));
  border: 1px solid rgba(148, 163, 184, 0.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  color: #e5e7eb;
  cursor: pointer;

  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.95);
  transition:
    transform 0.15s ease-out,
    box-shadow 0.15s ease-out,
    border-color 0.15s ease-out,
    background-color 0.15s ease-out;
}

#cb-root #cb-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 1);
  border-color: rgba(129, 140, 248, 0.9);
  background:
    linear-gradient(135deg,
      rgba(15, 23, 42, 0.80),
      rgba(15, 23, 42, 0.95));
}

#cb-root #cb-unread {
  background: #f97316;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  display: none;
}

/* Bolinha com o ícone de chat */
#cb-root .cb-toggle-icon {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, var(--cb-primary), #1f2937);
  color: #0f172a;
  box-shadow: 0 0 0 1px #020617;
}

#cb-root .cb-toggle-icon svg {
  width: 18px;
  height: 18px;
}

#cb-root .cb-toggle-label {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* Mobile: botão do chat como barra inteira no rodapé */
/* Mobile: botão do chat como barra inteira no rodapé, mais alto e com sombra azul suave */
@media (max-width: 600px) {
  #cb-root #cb-toggle {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    border-radius: 0;
    justify-content: center;

    /* aumenta a altura */
    padding: 14px 24px;

    /* sombra azul suave no topo do botão */
    box-shadow: 0 -4px 20px rgba(37, 99, 235, 0.35);
  }
}

@media (max-width: 340px) {
  #cb-root .cb-toggle-label {
    display: none;
  }
}

/* ========== JANELA DO CHAT ========== */
#cb-root #cb-window {
  position: fixed;
  bottom: 86px;
  right: 0;
  width: 360px;
  max-height: 560px;
  background: #020617;
  border-radius: 16px;
  border: 1px solid #1f2937;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.95);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
}

/* ========== CABEÇALHO ========== */
#cb-root #cb-header {
  background: #020617;
  color: #e5e7eb;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #1f2937;
}

#cb-root #cb-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

#cb-root #cb-agent-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #111827;
  color: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  border: 1px solid rgba(75, 85, 99, 0.9);
}

#cb-root #cb-agent-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#cb-root #cb-header-texts {
  display: flex;
  flex-direction: column;
}

#cb-root #cb-header-title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
}

#cb-root #cb-agent-info {
  font-size: 11px;
  opacity: 0.9;
}

#cb-root #cb-agent-name {
  font-weight: 500;
}

#cb-root #cb-agent-profession {
  margin-left: 4px;
  color: #9ca3af;
}

#cb-root #cb-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

#cb-root .cb-icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: #020617;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition:
    background-color 0.15s ease-out,
    border-color 0.15s ease-out,
    color 0.15s ease-out;
}

#cb-root .cb-icon-btn svg {
  width: 14px;
  height: 14px;
}

#cb-root .cb-icon-btn:hover {
  background: #0b1120;
  border-color: rgba(99, 102, 241, 0.8);
  color: #e5e7eb;
}

/* ========== CORPO DO CHAT ========== */
#cb-root #cb-body {
  flex: 1;
  padding: 10px;
  display: block;
  overflow-y: auto;
}

/* Banner offline */
#cb-root #cb-offline-banner {
  background: #020617;
  border: 1px solid rgba(55, 65, 81, 0.9);
  padding: 10px;
  border-radius: 12px;
  margin-bottom: 10px;
  color: #e5e7eb;
}

#cb-root #cb-offline-banner h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

#cb-root #cb-offline-banner p {
  margin: 0;
  font-size: 13px;
  color: #9ca3af;
}

/* ========== FORM DE LEAD ========== */
#cb-root #cb-lead-form {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#cb-root .cb-lead-card {
  width: 100%;
  max-width: 320px;       /* card mais estreito */
  margin: 8px auto;       /* centraliza e afasta das bordas */
  padding: 10px 10px;     /* menos padding interno */
  border-radius: 12px;
  background: #020617;
  border: 1px solid rgba(55, 65, 81, 0.9);
}

#cb-root #cb-lead-form h3 {
  margin-top: 0;
  margin-bottom: 2px;
  font-size: 16px;
  font-weight: 600;
}

#cb-root .cb-lead-subtitle {
  margin: 0 0 8px;
  font-size: 13px;
  color: #9ca3af;
}

/* Espaçamento entre campos mais justo */
#cb-root .cb-field {
  margin-bottom: 6px;
}

#cb-root .cb-field label {
  display: block;
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 2px;
}

#cb-root .cb-field input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #020617;
  color: #e5e7eb;
  font-size: 13px;
}

#cb-root .cb-error {
  min-height: 11px;
  margin-top: 1px;
  font-size: 11px;
  color: #f97373;
}

/* Botão do form com margem menor em cima */
#cb-root #cb-lead-form button#cb-save-lead {
  width: 100%;
  margin-top: 6px;
  padding: 8px;
  background: var(--cb-primary);
  color: #020617;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
}

/* Esconder footer quando tiver cb-hidden */
#cb-root #cb-footer.cb-hidden {
  display: none !important;
}

/* ========== TÓPICOS DENTRO DO CHAT ========== */
#cb-root #cb-chat {
  margin-top: 8px;
  position: relative; /* necessário para posicionar a seta dentro */
}

/* Seta de rolar para o fim (desktop) */
#cb-root #cb-scroll-bottom {
  position: absolute;
  right: 10px;
  bottom: 58px; /* ajusta se precisar */
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: #020617;
  color: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.9);
}

/* Some no mobile */
@media (max-width: 600px) {
  #cb-root #cb-scroll-bottom {
    display: none !important;
  }
}

#cb-root #cb-topics-inline {
  margin-bottom: 8px;
}

#cb-root #cb-topics-inline h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

#cb-root #cb-topics-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#cb-root .cb-topic-btn {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: #020617;
  cursor: pointer;
  font-size: 14px;
  color: #e5e7eb;
}

#cb-root .cb-topic-btn:hover {
  background: #030712;
}

/* ========== MENSAGENS ========== */
#cb-root #cb-messages {
  max-height: none;
  overflow-y: visible;
  padding-right: 4px;
  background: #020617;
  border-radius: 12px;
  padding: 8px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  color: #e5e7eb;
}

#cb-root .cb-message {
  max-width: 80%;
  margin: 4px 0;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.3;
  word-wrap: break-word;
}

#cb-root .cb-message.user {
  margin-left: auto;
  background: var(--cb-primary);
  color: #020617;
}

#cb-root .cb-message.bot,
#cb-root .cb-message.agent {
  margin-right: auto;
  background: #020617;
  color: #e5e7eb;
  border: 1px solid rgba(55, 65, 81, 0.9);
}

#cb-root .cb-message.system {
  margin: 4px auto;
  background: #f97316;
  color: #111827;
}

/* Label acima da mensagem (ex.: nome do atendente) */
#cb-root .cb-message-label {
  font-size: 11px;
  margin-bottom: 2px;
}

/* Label específica para mensagens do atendente (azul) */
#cb-root .cb-message-label.agent {
  color: #60a5fa; /* azul claro */
}

/* Garante que o texto da mensagem fique separado da label */
#cb-root .cb-message-text {
  /* se quiser, pode ajustar padding interno aqui no futuro */
}
/* Digitando */
#cb-root #cb-typing {
  margin-top: 8px;
  font-size: 12px;
  color: #9ca3af;
}

/* ========== RODAPÉ / INPUT DE MENSAGEM ========== */
#cb-root #cb-footer {
  padding: 8px;
  border-top: 1px solid #1f2937;
  display: flex;
  gap: 6px;
  background: #020617;
}

#cb-root #cb-input {
  flex: 1;
  padding: 8px;
  border-radius: 999px;
  border: 1px solid #374151;
  background: #020617;
  color: #e5e7eb;
  font-size: 14px;
}

#cb-root #cb-input::placeholder {
  color: #6b7280;
}

/* Botão Enviar – sempre arredondado */
#cb-root #cb-send {
  padding: 8px 12px !important;
  background: var(--cb-primary) !important;
  color: #020617 !important;
  border: none !important;
  border-radius: 999px !important;
  cursor: pointer !important;
  font-weight: 500 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
/* Ajustar espaçamento vertical no cabeçalho */
#cb-root #cb-header-texts {
  display: flex;
  flex-direction: column;
  gap: 0px; /* praticamente sem espaço extra */
}

#cb-root #cb-header-title {
  margin: 0 !important;
  line-height: 1.2 !important;
}

#cb-root #cb-agent-info {
  margin: 0 !important;
  line-height: 1.1 !important;
  font-size: 11px;
}

/* Mobile: chat em tela cheia */
@media (max-width: 600px) {
  #cb-root #cb-window {
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
}









/* ===== Tela final / Conversa encerrada ===== */
#cb-root #cb-end {
  color: #e5e7eb;
}

#cb-root .cb-end-card {
  text-align: center;
  padding: 18px 12px;
}

#cb-root .cb-end-icon {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
}

#cb-root .cb-end-icon svg {
  width: 22px;
  height: 22px;
}

#cb-root .cb-end-card h3 {
  margin: 4px 0 4px;
  font-size: 16px;
  font-weight: 600;
}

#cb-root .cb-end-subtitle {
  margin: 0 0 10px;
  font-size: 13px;
  color: #9ca3af;
}

/* Linha "Atendimento humano • rápido • profissional" */
#cb-root .cb-end-note {
  margin: 10px 0 10px;
  font-size: 12px;
  color: #9ca3af;
}

/* Ícones das redes – centralizados com bom espaçamento */
#cb-root .cb-social-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 8px 0 4px;
}

#cb-root .cb-social-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  background: #020617;
  color: #e5e7eb;
  border: 1px solid #111827;
  box-shadow: none;
  transition:
    transform 0.12s ease-out,
    border-color 0.12s ease-out,
    color 0.12s ease-out;
}

#cb-root .cb-social-icon svg {
  width: 20px;
  height: 20px;
}

#cb-root .cb-social-icon:hover {
  transform: translateY(-1px);
  border-color: #e5e7eb;
}

#cb-root .cb-social-whatsapp:hover { color: #22c55e; }
#cb-root .cb-social-instagram:hover { color: #f97316; }
#cb-root .cb-social-linkedin:hover { color: #60a5fa; }
#cb-root .cb-social-email:hover    { color: #e5e7eb; }

/* Botão "Iniciar nova conversa" */
#cb-root .cb-new-chat-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 22px;
  border-radius: 999px;
  border: none;
  background: #2563eb;
  color: #0f172a;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

/* =========================================================
   ==========   DESKTOP ONLY  (≥ 601px)   ===================
   ========================================================= */
@media (min-width: 601px) {

  /* Scroll fino e estilizado no corpo do chat */
  #cb-root #cb-body {
    scrollbar-width: thin;                          /* Firefox */
    scrollbar-color: #4f46e5 #020617;              /* thumb, track */
  }

  /* Chrome / Edge / Safari (WebKit) */
  #cb-root #cb-body::-webkit-scrollbar {
    width: 6px;
  }

  #cb-root #cb-body::-webkit-scrollbar-track {
    background: transparent;
  }

  #cb-root #cb-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #4f46e5, #22d3ee);
    border-radius: 999px;
  }

  #cb-root #cb-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #6366f1, #22d3ee);
  }
}










/* =========================================================
   ==========   MOBILE ONLY  (≤ 600px)   ===================
   ========================================================= */
@media (max-width: 600px) {

  /* Base um pouco maior no mobile */
  #cb-root {
    font-size: 15px;
  }

  /* ===== JANELA FULL SCREEN ===== */
  #cb-root #cb-window {
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none; /* full screen não precisa sombra externa */
  }

  /* ===== BOTÃO DO CHAT: barra no rodapé ===== */
  #cb-root #cb-toggle {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    border-radius: 0;
    justify-content: center;

    padding: 14px 24px;

    /* efeito vidro */
    background:
      linear-gradient(135deg, rgba(15, 23, 42, 0.75), rgba(15, 23, 42, 0.85));
    border-top: 1px solid rgba(148, 163, 184, 0.4);
    border-left: none;
    border-right: none;
    border-bottom: none;

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.95);
  }

  /* ===== TOPO: botões em cima, avatar/título embaixo ===== */

  /* Header em coluna: primeiro linha de botões, depois avatar + textos */
  #cb-root #cb-header {
    padding: 10px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  /* Linha dos botões (Encerrar / Fechar) no topo, com linha separadora */
  #cb-root #cb-header-right {
    order: 1;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid #111827;
  }

  /* Linha abaixo: avatar grande + título + profissão */
  #cb-root #cb-header-left {
    order: 2;
    display: flex;
    align-items: center;
    gap: 12px;
  }

#cb-root #cb-agent-avatar {
  width: 52px;  /* antes 42 */
  height: 52px; /* antes 42 */
}

  #cb-root #cb-header-texts {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  #cb-root #cb-header-title {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
  }

  #cb-root #cb-agent-info {
    font-size: 13px;
    margin: 0;
    line-height: 1.2;
  }

  /* Botões de encerrar / fechar maiores, com texto */

  #cb-root .cb-icon-btn {
    width: auto;
    height: auto;
    border-radius: 999px;
    padding: 5px 10px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    background: #020617;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }

  #cb-root .cb-icon-btn svg {
    width: 14px;
    height: 14px;
  }

  /* Encerrar chat: destaque em vermelho escuro */
  #cb-root #cb-end-chat {
    background: #7f1d1d;
    border-color: #b91c1c;
    color: #fee2e2;
  }

  #cb-root #cb-end-chat::after {
    content: "Encerrar";
    font-size: 12px;
    font-weight: 500;
  }

  /* Fechar: X + texto em cinza */
#cb-root #cb-close {
  background: #111827;         /* fundo cinza escuro */
  border-color: #2563eb;       /* borda azul */
  color: #e5e7eb;              /* texto claro */
}

  #cb-root #cb-close::after {
    content: "✕ Fechar";
    font-size: 12px;
    font-weight: 500;
  }

  /* Esconde o ícone do botão fechar, fica só o "✕ Fechar" */
  #cb-root #cb-close svg {
    display: none;
  }

  /* ===== CORPO E FORM MAIS AJUSTADOS ===== */

  #cb-root #cb-body {
    padding: 12px 12px;
  }

  #cb-root .cb-lead-card {
    max-width: 100%;
    margin: 12px 0;
    padding: 12px 10px;
  }

  /* Títulos no corpo um pouco maiores */
  #cb-root #cb-topics-inline h3,
  #cb-root #cb-lead-form h3,
  #cb-root #cb-end h3 {
    font-size: 16px;
  }

  /* Tópicos e mensagens um pouco maiores */
  #cb-root .cb-topic-btn {
    font-size: 15px;
  }

  #cb-root .cb-message {
    font-size: 15px;
  }

  /* Rodapé mais confortável para digitar */
  #cb-root #cb-footer {
    padding: 10px 12px;
  }

  #cb-root #cb-input {
    font-size: 15px;
    padding: 10px 12px;
  }

  #cb-root #cb-send {
    font-size: 14px;
    padding: 10px 16px;
  }

  /* ===== TELA FINAL (Conversa encerrada) MAIS ORGANIZADA ===== */

  #cb-root #cb-end .cb-end-card {
    padding: 20px 16px;
  }

  #cb-root #cb-end .cb-end-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
  }

  #cb-root #cb-end h3 {
    font-size: 17px;
    margin-bottom: 4px;
  }

  #cb-root .cb-end-subtitle {
    font-size: 14px;
  }

  #cb-root .cb-end-note {
    font-size: 13px;
    margin-top: 10px;
  }

  #cb-root .cb-social-row {
    gap: 14px;
    margin: 10px 0 6px;
  }

  #cb-root .cb-social-icon {
    width: 44px;
    height: 44px;
  }

  #cb-root .cb-new-chat-btn {
    margin-top: 12px;
    padding: 10px 26px;
    font-size: 14px;
  }
}

/* Esconder só o texto do botão do chat em telas MUITO estreitas */
@media (max-width: 340px) {
  #cb-root .cb-toggle-label {
    display: none;
  }
}
  /* Esconder a barra de scroll no mobile, mas manter rolagem por toque */
  #cb-root #cb-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* rolagem suave em iOS */
  }

  /* WebKit (Chrome/Safari mobile) */
  #cb-root #cb-body::-webkit-scrollbar {
    width: 0px;
    height: 0px;
  }

  /* Firefox */
  #cb-root #cb-body {
    scrollbar-width: none;
  }

  /* Ícone dentro do botão: menos contraste, mais vidro */
  #cb-root .cb-toggle-icon {
    background:
      radial-gradient(circle at 30% 20%, rgba(37, 99, 235, 0.9), rgba(15, 23, 42, 0.9));
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9);
  }
}