:root {
  --cb-color: #2b7a78;
  --cb-radius: 16px;
  --cb-shadow: 0 8px 32px rgba(0,0,0,.18);
}

#cb-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--cb-color);
  border: none;
  cursor: pointer;
  font-size: 26px;
  box-shadow: var(--cb-shadow);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s;
  overflow: hidden;
}
#cb-btn:hover { transform: scale(1.08); }
#cb-btn img { width: 66%; height: 66%; object-fit: contain; border-radius: 0; }

#cb-box {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 340px;
  height: 480px;
  max-height: calc(100vh - 130px);
  background: var(--t-bg, #fff);
  border-radius: var(--cb-radius);
  box-shadow: var(--cb-shadow);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  pointer-events: none;
  transition: opacity .22s, transform .22s, width .25s, height .25s, bottom .25s, right .25s;
}
#cb-box.cb-open {
  opacity: 1;
  transform: none;
  pointer-events: all;
}

/* Pantalla completa: 80% del viewport, centrado */
#cb-box.cb-full {
  width: 80vw;
  height: 80vh;
  max-height: 80vh;
  right: 10vw;
  bottom: 10vh;
}

#cb-header {
  background: var(--cb-color);
  color: #fff;
  padding: 14px 16px;
  font-weight: 600;
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.cb-header-nombre { letter-spacing: .01em; }
#cb-header span.cb-dot {
  width: 8px; height: 8px;
  background: #a7f3d0;
  border-radius: 50%;
  display: inline-block;
}
.cb-controles { margin-left: auto; display: flex; gap: 4px; }
.cb-ctrl {
  background: rgba(255,255,255,.16);
  border: none;
  color: #fff;
  width: 26px; height: 26px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .8rem;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.cb-ctrl:hover { background: rgba(255,255,255,.3); }

#cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--t-bg, #f8f8f8);
}

.cb-msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: .88rem;
  line-height: 1.45;
  word-break: break-word;
}
.cb-msg.bot {
  background: var(--t-bg, #fff);
  border: 1px solid rgba(0,0,0,.08);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.cb-msg.user {
  background: var(--cb-color);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.cb-msg.typing span {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--cb-color);
  border-radius: 50%;
  margin: 0 2px;
  animation: cb-pulse .9s infinite;
}
.cb-msg.typing span:nth-child(2) { animation-delay: .15s; }
.cb-msg.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes cb-pulse {
  0%,80%,100% { transform: scale(0.7); opacity:.5; }
  40% { transform: scale(1); opacity:1; }
}

#cb-footer {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(0,0,0,.07);
  background: var(--t-bg, #fff);
}
#cb-input {
  flex: 1;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .88rem;
  outline: none;
  background: var(--t-bg, #fff);
  color: var(--t-text, #111);
}
#cb-input:focus { border-color: var(--cb-color); }
#cb-send {
  background: var(--cb-color);
  border: none;
  color: #fff;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  font-size: 1rem;
  transition: opacity .15s;
}
#cb-send:disabled { opacity: .5; cursor: default; }

#cb-powered {
  text-align: center;
  font-size: .68rem;
  color: var(--t-text, #888);
  opacity: .5;
  padding: 4px 0 6px;
  background: var(--t-bg, #fff);
}

@media (max-width: 400px) {
  #cb-box { width: calc(100vw - 32px); right: 16px; }
  #cb-box.cb-full { width: calc(100vw - 16px); height: 86vh; max-height: 86vh; right: 8px; bottom: 7vh; }
}

/* 2026-07-13: boton real de WhatsApp dentro de la respuesta del bot -
   pedido explicito de Eduardo, antes el numero era texto suelto. */
.cb-btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 14px;
  background: #25D366;
  color: #fff;
  font-size: .85rem;
  font-weight: 600;
  border-radius: 999px;
  text-decoration: none;
  transition: filter .15s;
}
.cb-btn-whatsapp:hover { filter: brightness(1.05); }
.cb-btn-whatsapp-icono { font-size: 1rem; }
