/* ======================================================
   JJ Paper — Chatbot
   ====================================================== */

.cb-fab {
  position:fixed; bottom:28px; right:28px; z-index:1500;
  width:60px; height:60px; border-radius:50%; background:var(--wa);
  color:#fff; box-shadow:0 6px 22px rgba(37,211,102,.5);
  display:flex; align-items:center; justify-content:center;
  transition:var(--tr); animation:cbWaPulse 2.4s ease-in-out infinite;
}
.cb-fab:hover { filter:brightness(1.06); transform:scale(1.1); animation:none }
.cb-fab svg   { width:30px; height:30px }
@keyframes cbWaPulse {
  0%   { box-shadow:0 6px 22px rgba(37,211,102,.5), 0 0 0 0 rgba(37,211,102,.45) }
  70%  { box-shadow:0 6px 22px rgba(37,211,102,.5), 0 0 0 14px rgba(37,211,102,0) }
  100% { box-shadow:0 6px 22px rgba(37,211,102,.5), 0 0 0 0 rgba(37,211,102,0) }
}
@media (prefers-reduced-motion: reduce) { .cb-fab { animation:none } }

/* Botón directo a WhatsApp dentro del encabezado del chat */
.cb-wa-hd {
  margin-left:auto; display:flex; align-items:center; gap:5px;
  background:var(--wa); color:#fff; border-radius:16px;
  padding:5px 11px 5px 8px; font-size:11px; font-weight:800;
  box-shadow:0 2px 8px rgba(37,211,102,.35); transition:var(--tr);
}
.cb-wa-hd:hover { filter:brightness(1.08); transform:translateY(-1px) }
.cb-wa-hd svg   { width:16px; height:16px }
.cb-hd .cb-x    { margin-left:8px }
.cb-badge {
  position:absolute; top:-3px; right:-3px; width:18px; height:18px;
  background:#e53e3e; border-radius:50%;
  display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:800; color:#fff;
}

.cb-win {
  position:fixed; bottom:96px; right:28px; z-index:1500;
  width:340px; max-height:480px; background:#fff;
  border-radius:16px; box-shadow:var(--sl);
  display:none; flex-direction:column; overflow:hidden;
}
.cb-win.op { display:flex }

.cb-hd {
  background:var(--gd); color:#fff; padding:15px 18px;
  display:flex; align-items:center; gap:12px; flex-shrink:0;
}
.cb-av     { width:34px; height:34px; border-radius:50%; background:var(--gm);
             display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0 }
.cb-hd-i   { flex:1 1 auto; min-width:0 }
.cb-hd-i h4 { font-size:13px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.cb-hd-i p  { font-size:10px; opacity:.75; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.cb-x       { margin-left:auto; background:rgba(255,255,255,.15); color:#fff;
              width:28px; height:28px; border-radius:50%; font-size:15px;
              display:flex; align-items:center; justify-content:center; flex-shrink:0 }
.cb-x:hover { background:rgba(255,255,255,.3) }

.cb-msgs { flex:1; overflow-y:auto; padding:14px; display:flex; flex-direction:column; gap:10px }
.msg     { max-width:86% }
.msg.b   { align-self:flex-start }
.msg.u   { align-self:flex-end }
.msg-bub { padding:10px 13px; border-radius:12px; font-size:12px; line-height:1.55 }
.msg.b .msg-bub { background:var(--gl); color:var(--bk); border-radius:4px 12px 12px 12px }
.msg.u .msg-bub { background:var(--gd); color:#fff;      border-radius:12px 4px 12px 12px }
.msg-typing     { display:flex; gap:4px; align-items:center; padding:10px 13px; background:var(--gl);
                  border-radius:4px 12px 12px 12px; width:fit-content }
.dot-typing     { width:7px; height:7px; border-radius:50%; background:var(--gr);
                  animation:dotPulse 1.2s ease-in-out infinite }
.dot-typing:nth-child(2) { animation-delay:.2s }
.dot-typing:nth-child(3) { animation-delay:.4s }
@keyframes dotPulse { 0%,80%,100%{transform:scale(0);opacity:.5} 40%{transform:scale(1);opacity:1} }

.cb-qbtns { padding:0 14px 10px; display:flex; gap:6px; flex-wrap:wrap; flex-shrink:0 }
.qb-btn   { padding:5px 12px; border-radius:15px; font-size:10px; font-weight:700;
            background:var(--gx); color:var(--gd); border:1px solid rgba(103,164,39,.35); transition:var(--tr) }
.qb-btn:hover { background:var(--gd); color:#fff }

/* Botones de acción dentro de mensajes */
.cb-acts { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px }
.cb-act  { background:#fff; border:1.5px solid var(--gm); color:var(--gd);
           font-size:11px; font-weight:700; padding:6px 12px; border-radius:14px;
           transition:var(--tr); cursor:pointer; text-decoration:none; display:inline-block }
.cb-act:hover { background:var(--gx) }
.cb-act.p     { background:var(--gd); border-color:var(--gd); color:#fff }
.cb-act.p:hover { background:var(--gm); border-color:var(--gm) }

/* Resumen (carrito / cotización / rastreo) dentro del chat */
.cb-sum { background:#fff; border:1px solid #e8e8e8; border-radius:10px;
          padding:10px 12px; margin:8px 0; font-size:11.5px }
.cb-sum-hd  { font-weight:800; color:var(--gd); margin-bottom:6px; font-size:12px }
.cb-sum-row { display:flex; justify-content:space-between; align-items:center;
              gap:10px; padding:3px 0; border-bottom:1px dashed #f0f0f0 }
.cb-sum-row:last-child { border-bottom:none }
.cb-sum-row.total { font-weight:800; color:var(--gd); border-top:1px solid #eee;
                    margin-top:4px; padding-top:6px }
.cb-del { color:#ccc; font-size:12px; padding:2px 6px; flex-shrink:0; cursor:pointer }
.cb-del:hover { color:var(--danger) }

/* Tarjeta de producto dentro del chat */
.cb-prod { display:flex; align-items:center; gap:8px; background:#fff;
           border:1px solid #e8e8e8; border-radius:10px; padding:8px 10px; margin:7px 0 }
.cb-prod-ico  { font-size:20px; flex-shrink:0 }
.cb-prod-info { flex:1; font-size:11px; line-height:1.45 }
.cb-prod-add  { background:var(--gd); color:#fff; font-size:10px; font-weight:700;
                padding:5px 10px; border-radius:12px; flex-shrink:0; transition:var(--tr) }
.cb-prod-add:hover { background:var(--gm) }

.cb-ia   { padding:10px 14px; border-top:1px solid #f0f0f0; display:flex; gap:8px; align-items:center; flex-shrink:0 }
.cb-in   { flex:1; padding:9px 13px; border:2px solid #eee; border-radius:20px; font-size:12px;
           outline:none; transition:var(--tr) }
.cb-in:focus { border-color:var(--gm) }
.cb-send { width:34px; height:34px; border-radius:50%; background:var(--gd); color:#fff;
           font-size:14px; display:flex; align-items:center; justify-content:center; flex-shrink:0 }
.cb-send:hover { background:var(--gm) }
