/* Vendedor con IA de la tienda (26-10-2026, public/js/tienda/vendedorIA.js). Usa los colores de la tienda
   (--t-pri, --t-pri-txt) y se apila arriba del botón de WhatsApp (.t-wa-flotante, 18 px + 56 px). */

.t-chat-boton {
    position: fixed; right: 18px; bottom: 18px; z-index: 41;
    display: inline-flex; align-items: center; gap: .45rem; height: 52px; padding: 0 1.1rem 0 .95rem;
    border: 0; border-radius: 999px; background: var(--t-pri); color: var(--t-pri-txt);
    font-weight: 700; font-size: .95rem; box-shadow: 0 6px 18px rgba(0, 0, 0, .2); cursor: pointer;
}
.t-chat-boton i { font-size: 1.3rem; }
.t-chat-boton:hover { filter: brightness(1.05); }
.t-chat-boton:focus-visible { outline: 3px solid rgba(0, 0, 0, .35); outline-offset: 2px; }
/* Con WhatsApp en la página, el chat va arriba de ese botón. */
/* ⚠️ Reglas separadas: un navegador que no entiende :has() descarta la regla ENTERA si van juntas. */
.t-wa-flotante ~ .t-chat-boton { bottom: 86px; }
.t-chat-boton.abierto { display: none; }
@media (max-width: 575.98px) {
    .t-chat-boton { width: 52px; padding: 0; justify-content: center; }
    .t-chat-boton-texto { display: none; }
}

.t-chat-panel {
    position: fixed; right: 18px; bottom: 18px; z-index: 1070;
    width: 380px; max-width: calc(100vw - 36px); height: min(620px, calc(100vh - 36px));
    display: flex; flex-direction: column; background: #fff; color: var(--t-texto, #1d2129);
    border: 1px solid var(--t-borde, #e6e8ec); border-radius: 16px; box-shadow: 0 18px 50px rgba(0, 0, 0, .25); overflow: hidden;
}
.t-chat-panel[hidden] { display: none; }
@media (max-width: 575.98px) {
    .t-chat-panel { inset: 0; width: 100%; max-width: none; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
    body.t-chat-abierto { overflow: hidden; }
}

.t-chat-cab { display: flex; align-items: center; gap: .6rem; padding: .7rem .75rem; background: var(--t-pri); color: var(--t-pri-txt); }
.t-chat-cab-icono { width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.t-chat-cab-texto { flex: 1 1 auto; min-width: 0; line-height: 1.15; }
.t-chat-cab-texto strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-chat-cab-texto small { opacity: .85; font-size: .75rem; }
.t-chat-cab button { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 1.05rem; }
.t-chat-cab button:hover { background: rgba(255, 255, 255, .18); }

/* "Hablando de: ..." (27-10-2026): el producto de la conversación, y el separador cuando cambia. */
.t-chat-tema { display: flex; align-items: center; gap: .3rem; padding: .4rem .75rem; font-size: .8rem; background: #fff; border-bottom: 1px solid #e6e8eb; color: #5b6570; min-width: 0; }
.t-chat-tema[hidden] { display: none; }
.t-chat-cerrada { align-self: stretch; font-size: .8rem; color: #5b6570; background: #fff; border: 1px dashed #cfd4da; border-radius: 10px; padding: .5rem .65rem; }
.t-chat-tema span { flex: none; }
.t-chat-tema a { font-weight: 600; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.t-chat-separador { display: flex; align-items: center; gap: .5rem; font-size: .72rem; color: #6b7480; margin: .35rem 0 .1rem; }
.t-chat-separador::before, .t-chat-separador::after { content: ""; flex: 1 1 auto; height: 1px; background: #dfe2e6; }
.t-chat-separador span { max-width: 75%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-chat-mensajes { flex: 1 1 auto; overflow-y: auto; padding: .85rem .75rem; background: var(--t-fondo, #f6f7f9); display: flex; flex-direction: column; gap: .5rem; }
.t-chat-msg { max-width: 88%; padding: .55rem .75rem; border-radius: 14px; font-size: .92rem; line-height: 1.4; overflow-wrap: anywhere; }
.t-chat-asistente { align-self: flex-start; background: #fff; border: 1px solid var(--t-borde, #e6e8ec); border-bottom-left-radius: 4px; }
.t-chat-cliente { align-self: flex-end; background: var(--t-pri); color: var(--t-pri-txt); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.t-chat-vineta { display: block; padding-left: .9rem; position: relative; }
.t-chat-vineta::before { content: '•'; position: absolute; left: .15rem; }

.t-chat-escribiendo { display: inline-flex; gap: 4px; padding: .7rem .8rem; }
.t-chat-escribiendo span { width: 7px; height: 7px; border-radius: 50%; background: #9aa1ab; animation: t-chat-punto 1s infinite ease-in-out; }
.t-chat-escribiendo span:nth-child(2) { animation-delay: .15s; }
.t-chat-escribiendo span:nth-child(3) { animation-delay: .3s; }
@keyframes t-chat-punto { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .t-chat-escribiendo span { animation: none; opacity: .7; } }

.t-chat-sugeridas { display: flex; flex-wrap: wrap; gap: .35rem; }
.t-chat-sugerida { border: 1px solid var(--t-pri); color: var(--t-pri); background: #fff; border-radius: 999px; padding: .3rem .7rem; font-size: .82rem; }
.t-chat-sugerida:hover { background: var(--t-pri); color: var(--t-pri-txt); }

.t-chat-tarjetas { display: flex; flex-direction: column; gap: .4rem; }
.t-chat-tarjeta { display: flex; gap: .6rem; background: #fff; border: 1px solid var(--t-borde, #e6e8ec); border-radius: 12px; padding: .5rem; }
.t-chat-foto { flex: none; width: 64px; height: 64px; border-radius: 8px; overflow: hidden; background: #fff; display: flex; align-items: center; justify-content: center; }
.t-chat-foto img { width: 100%; height: 100%; object-fit: contain; }
.t-chat-sinfoto { color: #b4bac3; font-size: 1.5rem; }
.t-chat-datos { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.t-chat-nombre { color: var(--t-texto, #1d2129); font-weight: 600; font-size: .86rem; line-height: 1.25; text-decoration: none;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.t-chat-nombre:hover { color: var(--t-pri); }
.t-chat-marca { font-size: .74rem; color: #6b7280; }
.t-chat-linea { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .5rem; }
.t-chat-precio { font-weight: 800; font-variant-numeric: tabular-nums; }
.t-chat-precio small { font-weight: 600; color: #6b7280; }
.t-chat-stock { font-size: .74rem; color: #137333; }
.t-chat-acciones { display: flex; align-items: center; gap: .5rem; margin-top: .15rem; }
.t-chat-agregar { border: 0; border-radius: 8px; background: var(--t-pri); color: var(--t-pri-txt); font-size: .8rem; font-weight: 700; padding: .3rem .6rem; }
.t-chat-agregar.agregado { background: #137333; color: #fff; }
.t-chat-agregar:disabled { opacity: .6; }
/* Ficha del armador de PC (27-10-2026): el botón es un link. */
.t-chat-armador .t-chat-agregar { display: inline-flex; align-items: center; gap: .3rem; text-decoration: none; }
.t-chat-armador .t-chat-sinfoto { color: var(--t-pri); font-size: 1.9rem; }
.t-chat-ver { font-size: .8rem; color: var(--t-pri); }

.t-chat-agregado { align-self: flex-start; font-size: .84rem; background: #e7f6ec; color: #137333; border: 1px solid #c6ead2; border-radius: 10px; padding: .4rem .65rem; }
.t-chat-agregado a { color: #137333; font-weight: 700; }
.t-chat-deshacer { border: 0; background: none; padding: 0; color: #137333; font-weight: 700; text-decoration: underline; }
.t-chat-contacto { display: flex; flex-wrap: wrap; gap: .4rem; }
.t-chat-contacto a { display: inline-flex; align-items: center; gap: .35rem; border-radius: 999px; padding: .35rem .8rem; font-size: .85rem; font-weight: 700; text-decoration: none; background: #fff; border: 1px solid var(--t-borde, #e6e8ec); color: var(--t-texto, #1d2129); }
.t-chat-contacto a .bi-whatsapp { color: #25d366; }

.t-chat-form { display: flex; align-items: flex-end; gap: .4rem; padding: .55rem .6rem; border-top: 1px solid var(--t-borde, #e6e8ec); background: #fff; }
.t-chat-entrada { flex: 1 1 auto; resize: none; border: 1px solid var(--t-borde, #e6e8ec); border-radius: 12px; padding: .5rem .7rem; font-size: 16px; line-height: 1.3; max-height: 110px; }
.t-chat-entrada:focus { outline: 2px solid var(--t-pri); outline-offset: 0; border-color: transparent; }
.t-chat-enviar { flex: none; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--t-pri); color: var(--t-pri-txt); }
.t-chat-enviar:disabled { opacity: .5; }
.t-chat-nota { margin: 0; padding: 0 .75rem .55rem; background: #fff; font-size: .68rem; color: #6b7280; line-height: 1.3; }

/* Aviso proactivo (27-10-2026): globito arriba del botón del chat. Texto fijo, no llama a la IA. */
.t-chat-globo {
    position: fixed; right: 18px; bottom: 80px; z-index: 41;
    display: flex; align-items: flex-start; max-width: min(300px, calc(100vw - 36px));
    background: #fff; color: var(--t-texto, #1d2129); border: 1px solid var(--t-borde, #e6e8ec);
    border-radius: 14px; box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
    animation: t-chat-globo-entra .25s ease-out;
}
.t-chat-globo::after {
    content: ''; position: absolute; right: 26px; bottom: -7px; width: 12px; height: 12px;
    background: #fff; border-right: 1px solid var(--t-borde, #e6e8ec); border-bottom: 1px solid var(--t-borde, #e6e8ec);
    transform: rotate(45deg);
}
.t-wa-flotante ~ .t-chat-globo { bottom: 148px; }
.t-chat-globo-texto {
    flex: 1; display: flex; flex-direction: column; gap: .15rem; text-align: left;
    padding: .7rem .2rem .7rem .9rem; border: 0; background: none; color: inherit; font-size: .9rem; line-height: 1.35; cursor: pointer;
}
.t-chat-globo-texto strong { font-size: .78rem; color: var(--t-pri); }
.t-chat-globo-cerrar {
    flex: 0 0 auto; width: 36px; height: 36px; margin: .2rem; border: 0; border-radius: 999px;
    background: none; color: #6b7280; font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.t-chat-globo-cerrar:hover { background: #f1f3f5; }
@keyframes t-chat-globo-entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .t-chat-globo { animation: none; } }
