/* ============================================================
   P18 — ASISTENTE CHATBOTZ (solo dashboard de usuario)
   Identidad: robot blanco/perla, visor negro, cyan neón glow
   ============================================================ */

#cbzAsstFab{
    position:fixed;bottom:1.5rem;right:1.5rem;z-index:1001;
    width:64px;height:64px;border-radius:50%;border:none;cursor:pointer;
    background:linear-gradient(145deg,#ffffff,#eef2f7);
    box-shadow:0 8px 30px rgba(6,182,212,.35),0 2px 8px rgba(0,0,0,.25);
    display:flex;align-items:center;justify-content:center;
    transition:transform .25s cubic-bezier(.34,1.56,.64,1),box-shadow .25s;
    animation:cbzFabPulse 3s ease-in-out infinite;
}
#cbzAsstFab:hover{transform:scale(1.08);box-shadow:0 12px 40px rgba(6,182,212,.5),0 4px 12px rgba(0,0,0,.3)}
#cbzAsstFab img{width:44px;height:44px;object-fit:contain;pointer-events:none}
@keyframes cbzFabPulse{
    0%,100%{box-shadow:0 8px 30px rgba(6,182,212,.35),0 2px 8px rgba(0,0,0,.25)}
    50%{box-shadow:0 8px 40px rgba(6,182,212,.6),0 2px 8px rgba(0,0,0,.25)}
}

/* Badge de notificación */
#cbzAsstFab .cbz-asst-badge{
    position:absolute;top:-2px;right:-2px;width:16px;height:16px;border-radius:50%;
    background:var(--a,#06b6d4);border:2px solid #fff;display:none;
    box-shadow:0 0 8px rgba(6,182,212,.8);
}

/* Panel del chat */
#cbzAsstPanel{
    position:fixed;bottom:calc(1.5rem + 76px);right:1.5rem;z-index:1001;
    width:400px;max-width:calc(100vw - 2rem);height:560px;max-height:calc(100vh - 7rem);
    background:linear-gradient(170deg,#ffffff,#f4f7fb);
    border-radius:1.5rem;overflow:hidden;
    box-shadow:0 25px 70px rgba(0,0,0,.45),0 0 0 1px rgba(6,182,212,.15),0 0 40px rgba(6,182,212,.08);
    display:flex;flex-direction:column;
    opacity:0;transform:translateY(16px) scale(.96);pointer-events:none;
    transition:opacity .28s ease,transform .28s cubic-bezier(.34,1.56,.64,1);
}
#cbzAsstPanel.open{opacity:1;transform:translateY(0) scale(1);pointer-events:auto}

/* Cabecera: negro visor con robot */
#cbzAsstPanel .cbz-asst-head{
    background:linear-gradient(135deg,#0a0f1e,#111827);
    padding:.9rem 1.1rem;display:flex;align-items:center;gap:.75rem;flex-shrink:0;
}
#cbzAsstPanel .cbz-asst-head img{width:38px;height:38px;object-fit:contain;
    filter:drop-shadow(0 0 6px rgba(6,182,212,.5))}
#cbzAsstPanel .cbz-asst-head-info{flex:1;min-width:0}
#cbzAsstPanel .cbz-asst-head-info h4{margin:0;font-size:.95rem;font-weight:700;color:#f8fafc;letter-spacing:.01em}
#cbzAsstPanel .cbz-asst-head-info p{margin:0;font-size:.7rem;color:#22d3ee;display:flex;align-items:center;gap:.3rem}
#cbzAsstPanel .cbz-asst-head-info p::before{content:'';width:6px;height:6px;border-radius:50%;background:#22d3ee;
    box-shadow:0 0 6px #22d3ee;animation:cbzDotPulse 2s infinite}
@keyframes cbzDotPulse{0%,100%{opacity:1}50%{opacity:.4}}
#cbzAsstPanel .cbz-asst-head-actions{display:flex;gap:.35rem}
#cbzAsstPanel .cbz-asst-head-actions button{
    background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);color:#cbd5e1;
    width:30px;height:30px;border-radius:.55rem;cursor:pointer;font-size:.8rem;
    display:flex;align-items:center;justify-content:center;transition:all .2s;
}
#cbzAsstPanel .cbz-asst-head-actions button:hover{background:rgba(6,182,212,.2);color:#22d3ee;border-color:rgba(6,182,212,.35)}

/* Historial (lista de conversaciones) */
#cbzAsstHistory{
    display:none;flex-direction:column;flex:1;overflow-y:auto;background:#f8fafc;
}
#cbzAsstHistory.show{display:flex}
#cbzAsstHistory .cbz-asst-hist-head{padding:.8rem 1rem;font-size:.75rem;font-weight:700;color:#475569;
    text-transform:uppercase;letter-spacing:.05em;border-bottom:1px solid #e2e8f0}
#cbzAsstHistory .cbz-asst-hist-item{
    padding:.75rem 1rem;border-bottom:1px solid #eef2f7;cursor:pointer;transition:background .15s;
}
#cbzAsstHistory .cbz-asst-hist-item:hover{background:#eef9fb}
#cbzAsstHistory .cbz-asst-hist-item .t{font-size:.85rem;color:#0f172a;font-weight:600;
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#cbzAsstHistory .cbz-asst-hist-item .d{font-size:.7rem;color:#94a3b8;margin-top:.15rem}
#cbzAsstHistory .cbz-asst-hist-empty{padding:2rem;text-align:center;color:#94a3b8;font-size:.85rem}

/* Área de mensajes */
#cbzAsstMsgs{
    flex:1;overflow-y:auto;padding:1rem;display:flex;flex-direction:column;gap:.75rem;
    background:
      radial-gradient(circle at 85% 10%,rgba(6,182,212,.05),transparent 40%),
      linear-gradient(170deg,#ffffff,#f4f7fb);
}
#cbzAsstMsgs::-webkit-scrollbar{width:5px}
#cbzAsstMsgs::-webkit-scrollbar-thumb{background:rgba(6,182,212,.25);border-radius:3px}

/* Mensajes */
.cbz-asst-msg{display:flex;gap:.55rem;max-width:92%;animation:cbzMsgIn .3s ease}
@keyframes cbzMsgIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
.cbz-asst-msg.user{align-self:flex-end;flex-direction:row-reverse}
.cbz-asst-msg .avatar{width:30px;height:30px;border-radius:50%;flex-shrink:0;
    display:flex;align-items:center;justify-content:center;overflow:hidden}
.cbz-asst-msg.bot .avatar{background:#0a0f1e;box-shadow:0 0 10px rgba(6,182,212,.35)}
.cbz-asst-msg.bot .avatar img{width:24px;height:24px;object-fit:contain}
.cbz-asst-msg.user .avatar{background:linear-gradient(135deg,var(--p,#6366f1),var(--s,#8b5cf6));
    color:#fff;font-size:.75rem;font-weight:700}
.cbz-asst-msg .bubble{
    padding:.65rem .9rem;border-radius:1.1rem;font-size:.855rem;line-height:1.55;
    white-space:pre-wrap;word-break:break-word;
}
.cbz-asst-msg.bot .bubble{
    background:#fff;color:#1e293b;border:1px solid #e6edf5;
    border-bottom-left-radius:.3rem;
    box-shadow:0 2px 10px rgba(15,23,42,.06);
}
.cbz-asst-msg.user .bubble{
    background:linear-gradient(135deg,#0a0f1e,#1e293b);color:#e2e8f0;
    border-bottom-right-radius:.3rem;
}
.cbz-asst-msg.bot .bubble strong{color:#0891b2}

/* Typing indicator cyan con glow */
.cbz-asst-typing{display:flex;gap:.3rem;padding:.65rem .9rem;background:#fff;border:1px solid #e6edf5;
    border-radius:1.1rem;border-bottom-left-radius:.3rem;width:fit-content;
    box-shadow:0 2px 10px rgba(15,23,42,.06)}
.cbz-asst-typing span{width:7px;height:7px;border-radius:50%;background:#06b6d4;
    box-shadow:0 0 6px rgba(6,182,212,.7);animation:cbzTyping 1.2s infinite}
.cbz-asst-typing span:nth-child(2){animation-delay:.2s}
.cbz-asst-typing span:nth-child(3){animation-delay:.4s}
.cbz-asst-typing-label{display:flex;align-items:center;gap:.3rem;color:#64748b;font-size:.74rem}
.cbz-asst-typing-label i{color:#06b6d4;font-size:.72rem}
#cbzAsstTray{display:none;flex-wrap:wrap;gap:.4rem;padding:.45rem .75rem;background:#f8fafc;border-top:1px solid #e6edf5}
#cbzAsstTray.has{display:flex}
.cbz-asst-chip{display:flex;align-items:center;gap:.35rem;padding:.25rem .5rem;background:#fff;border:1px solid #e6edf5;border-radius:.6rem;font-size:.72rem;color:#334155;max-width:100%}
.cbz-asst-chip img{width:22px;height:22px;object-fit:cover;border-radius:.3rem}
.cbz-asst-chip>i{color:#06b6d4}
.cbz-asst-chip-name{max-width:130px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cbz-asst-chip.uploading{opacity:.75}
.cbz-asst-chip-x{background:none;border:none;color:#94a3b8;cursor:pointer;font-size:.7rem;padding:.1rem}
.cbz-asst-chip-x:hover{color:#ef4444}
#cbzAsstInputBar #cbzAsstAttach{width:36px;height:36px;background:none;border:1px solid #e6edf5;border-radius:50%;color:#06b6d4;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:all .15s;box-shadow:none;font-size:.85rem}
#cbzAsstInputBar #cbzAsstAttach:hover{background:#ecfeff;border-color:#06b6d4;transform:none;box-shadow:none}
@keyframes cbzTyping{0%,60%,100%{transform:translateY(0);opacity:.5}30%{transform:translateY(-5px);opacity:1}}

/* Sugerencias rápidas */
#cbzAsstSuggest{display:flex;flex-wrap:wrap;gap:.4rem;padding:.5rem .9rem;flex-shrink:0}
#cbzAsstSuggest button{
    background:#fff;border:1px solid rgba(6,182,212,.3);color:#0e7490;
    font-size:.72rem;padding:.35rem .7rem;border-radius:999px;cursor:pointer;
    transition:all .2s;font-weight:600;
}
#cbzAsstSuggest button:hover{background:rgba(6,182,212,.1);border-color:#06b6d4;
    box-shadow:0 0 10px rgba(6,182,212,.2)}

/* Input */
#cbzAsstInputBar{
    display:flex;gap:.5rem;padding:.8rem .9rem;background:#fff;border-top:1px solid #e6edf5;flex-shrink:0;
}
#cbzAsstInputBar input{
    flex:1;border:1.5px solid #e2e8f0;border-radius:999px;padding:.6rem 1rem;
    font-size:.85rem;outline:none;font-family:inherit;color:#0f172a;background:#f8fafc;
    transition:border-color .2s,box-shadow .2s;
}
#cbzAsstInputBar input:focus{border-color:#06b6d4;box-shadow:0 0 0 3px rgba(6,182,212,.12);background:#fff}
#cbzAsstInputBar button{
    width:42px;height:42px;border-radius:50%;border:none;cursor:pointer;flex-shrink:0;
    background:linear-gradient(135deg,#06b6d4,#0891b2);color:#fff;font-size:.9rem;
    box-shadow:0 4px 14px rgba(6,182,212,.4);transition:transform .2s,box-shadow .2s;
    display:flex;align-items:center;justify-content:center;
}
#cbzAsstInputBar button:hover{transform:scale(1.08);box-shadow:0 6px 20px rgba(6,182,212,.55)}
#cbzAsstInputBar button:disabled{opacity:.5;cursor:not-allowed;transform:none}

/* Responsive: móvil full-width con margen */
@media (max-width:480px){
    #cbzAsstPanel{
        right:.75rem;left:.75rem;width:auto;
        bottom:calc(.9rem + 70px);height:min(580px,calc(100vh - 6rem));
    }
    #cbzAsstFab{bottom:.9rem;right:.9rem;width:58px;height:58px}
}

/* P21.7: zoom fantasma iOS — el input del asistente a 16px en móvil (LOG #240) */
@media (max-width:640px){
    #cbzAsstInputBar input{font-size:16px !important;padding:.5rem 1rem}
}
