/* 0101 MEDIA · widget de chat */
.cb0101-root, .cb0101-root * { box-sizing: border-box; }

.cb0101-root {
  --cb-naranjo: #FF6600;
  --cb-naranjo-osc: #E25500;
  --cb-tinta: #1C274C;
  --cb-gris: #6B6B76;
  --cb-linea: #E7E7EC;
  --cb-fondo: #FFFFFF;
  --cb-suave: #F7F7FA;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  position: fixed;
  z-index: 999999;
  right: 20px;
  bottom: 20px;
  --cb-fs: 15px;
  font-size: var(--cb-fs, 15px);
  line-height: 1.45;
}

/* lado izquierdo (configurable) */
.cb0101-root.cb0101-left { right: auto; left: 20px; }
.cb0101-root.cb0101-left .cb0101-panel { right: auto; left: 0; }

/* burbuja */
.cb0101-bubble {
  width: 60px; height: 60px;
  border: 0; border-radius: 50%;
  background: linear-gradient(135deg, var(--cb-naranjo), var(--cb-grad2, #FF8A3D));
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(255, 102, 0, .35);
  transition: transform .18s ease, box-shadow .18s ease;
}
.cb0101-bubble:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 14px 30px rgba(255,102,0,.42); }
.cb0101-bubble:focus-visible { outline: 3px solid #7678ED; outline-offset: 3px; }

.cb0101-root.cb0101-hint .cb0101-bubble::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(255,102,0,.5); animation: cbPulse 2s infinite;
}
@keyframes cbPulse {
  0% { transform: scale(.9); opacity: .8; }
  70% { transform: scale(1.25); opacity: 0; }
  100% { opacity: 0; }
}

/* panel */
.cb0101-panel {
  position: absolute; right: 0; bottom: 74px;
  width: 384px; max-width: calc(100vw - 32px);
  height: 580px; max-height: calc(100vh - 120px);
  background: var(--cb-fondo);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(20,20,30,.22), 0 2px 8px rgba(20,20,30,.08);
  display: flex; flex-direction: column;
  overflow: hidden;
  opacity: 0; transform: translateY(12px) scale(.98);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.cb0101-panel.cb0101-visible { opacity: 1; transform: none; pointer-events: auto; }

.cb0101-head {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 15px;
  background: var(--cb-tinta);
  color: #fff;
}
.cb0101-avatar {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--cb-naranjo), var(--cb-grad2, #FF8A3D));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; letter-spacing: .02em;
  overflow: hidden; flex: 0 0 auto;
}
.cb0101-avatar-img {
  width: 100%; height: 100%; display: block;
  object-fit: cover; image-rendering: pixelated;
}
/* barra de handoff: WhatsApp + demo, siempre visible */
.cb0101-handoff {
  display: flex; gap: 8px; padding: 8px 12px;
  background: var(--cb-suave); border-bottom: 1px solid var(--cb-linea);
}
.cb0101-ho {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  flex: 1; padding: 7px 10px; border-radius: 9px;
  font-size: 12.5px; font-weight: 600; text-decoration: none; line-height: 1;
  border: 1px solid var(--cb-linea); background: #fff; color: var(--cb-tinta);
  transition: .15s;
}
.cb0101-ho-wa svg { color: #25D366; }
.cb0101-ho:hover { border-color: var(--cb-naranjo); color: var(--cb-naranjo-osc); }
.cb0101-ho-demo { background: var(--cb-tinta); border-color: var(--cb-tinta); color: #fff; }
.cb0101-ho-demo svg { color: var(--cb-naranjo); }
.cb0101-ho-demo:hover { background: #16203f; color: #fff; }
.cb0101-id { flex: 1; min-width: 0; }
.cb0101-id strong { display: block; font-size: 14.5px; font-weight: 650; }
.cb0101-id span { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #BFBFC9; }
.cb0101-dot { width: 7px; height: 7px; border-radius: 50%; background: #00C2A8; display: inline-block; }
.cb0101-x {
  background: transparent; border: 0; color: #9C9CA8;
  font-size: 26px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.cb0101-x:hover { color: #fff; }

/* cuerpo */
.cb0101-body {
  flex: 1 1 auto; min-height: 140px;
  overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none;
  padding: 16px 14px 14px;
  background: var(--cb-suave);
  display: flex; flex-direction: column; gap: 9px;
  scrollbar-width: thin;
}
/* el resto de bloques no se estira ni se achica: el alto lo cede sólo el cuerpo */
.cb0101-head, .cb0101-handoff, .cb0101-chips, .cb0101-form { flex: 0 0 auto; }
.cb0101-msg { display: flex; }
.cb0101-msg.cb0101-user { justify-content: flex-end; }
.cb0101-burbuja {
  max-width: 84%; padding: 9px 13px; border-radius: 14px;
  font-size: var(--cb-fs, 15px); color: #fff;
  background: var(--cb-tinta); border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(20,20,30,.06);
  overflow-wrap: anywhere;
}
.cb0101-user .cb0101-burbuja {
  background: var(--cb-naranjo); color: #fff; border-color: transparent;
  border-bottom-right-radius: 4px;
}
.cb0101-bot .cb0101-burbuja { border-bottom-left-radius: 4px; }
.cb0101-burbuja a { color: #FFB27A; text-decoration: underline; }
.cb0101-user .cb0101-burbuja a { color: #fff; }

.cb0101-typing .cb0101-burbuja { display: flex; gap: 4px; padding: 12px 14px; }
.cb0101-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: #8C97B8;
  animation: cbType 1.2s infinite;
}
.cb0101-typing span:nth-child(2) { animation-delay: .18s; }
.cb0101-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes cbType {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* chips */
.cb0101-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 14px;
  background: var(--cb-suave);
}
/* bloque propio, separado del área de mensajes: nunca encima del último mensaje */
.cb0101-chips:not(:empty) {
  padding: 8px 14px 10px;
  background: #fff; border-top: 1px solid var(--cb-linea);
}
.cb0101-chips:not(:empty) + .cb0101-form { border-top: 0; }
.cb0101-chip {
  font-size: 12.5px; padding: 7px 11px; border-radius: 999px;
  border: 1px solid #DADAE3; background: #fff; color: #3A3A45;
  cursor: pointer; transition: .15s;
}
.cb0101-chip:hover { border-color: var(--cb-naranjo); color: var(--cb-naranjo-osc); }

/* input */
.cb0101-form {
  display: flex; gap: 8px; padding: 11px 12px;
  border-top: 1px solid var(--cb-linea); background: #fff;
}
.cb0101-form input {
  flex: 1; border: 1px solid var(--cb-linea); border-radius: 11px;
  padding: 10px 13px; font-size: var(--cb-fs, 15px); outline: none;
  font-family: inherit; color: var(--cb-tinta); background: #fff;
}
.cb0101-form input:focus { border-color: var(--cb-naranjo); box-shadow: 0 0 0 3px rgba(255,102,0,.12); }
.cb0101-form button {
  width: 42px; border: 0; border-radius: 11px; cursor: pointer;
  background: var(--cb-naranjo); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.cb0101-form button:hover { background: var(--cb-naranjo-osc); }

/* cta + formulario de datos */
.cb0101-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #FFF3EA; border: 1px solid #FFD9BE; border-radius: 12px;
  padding: 10px 12px; font-size: 13px; color: #7A3A00;
}
.cb0101-cta button {
  border: 0; border-radius: 9px; background: var(--cb-naranjo); color: #fff;
  padding: 7px 11px; font-size: 12.5px; cursor: pointer; white-space: nowrap;
}

.cb0101-lead {
  display: flex; flex-direction: column; gap: 7px;
  background: #fff; border: 1px solid var(--cb-linea); border-radius: 14px;
  padding: 12px;
}
.cb0101-lead p { margin: 0 0 2px; font-size: 13px; color: var(--cb-gris); }
.cb0101-lead input, .cb0101-lead select, .cb0101-lead textarea {
  width: 100%; border: 1px solid var(--cb-linea); border-radius: 9px;
  padding: 9px 11px; font-size: 14px; font-family: inherit; color: var(--cb-tinta);
  background: #fff; outline: none;
}
.cb0101-lead input:focus, .cb0101-lead select:focus, .cb0101-lead textarea:focus {
  border-color: var(--cb-naranjo); box-shadow: 0 0 0 3px rgba(255,102,0,.12);
}
.cb0101-hp { position: absolute !important; left: -9999px !important; opacity: 0; }
.cb0101-check { display: flex; gap: 7px; font-size: 11.5px; color: var(--cb-gris); line-height: 1.35; }
.cb0101-check input { width: auto; margin-top: 2px; }
.cb0101-lead button[type=submit] {
  border: 0; border-radius: 10px; background: var(--cb-tinta); color: #fff;
  padding: 10px; font-size: 14px; cursor: pointer; font-weight: 600;
}
.cb0101-lead button[type=submit]:hover { background: #000; }
.cb0101-err { color: #D81E5B; font-size: 11.5px; min-height: 14px; }

@media (max-width: 520px), (max-height: 620px) {
  .cb0101-root { right: 14px; bottom: 14px; }
  .cb0101-panel {
    position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
    border-radius: 0; bottom: 0; right: 0;
  }
  .cb0101-bubble { width: 56px; height: 56px; }
  .cb0101-root.cb0101-open .cb0101-bubble { display: none; }
}
