.zb-chat {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 10070; /* por encima de .cabecera (10050) */
    font-family: 'Segoe UI', system-ui, Arial, sans-serif;
}

.zb-chat__fab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.75rem 0.28rem 0.28rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

/* Catálogo PC: asistente más chico para no tapar productos */
@media only screen and (min-width: 1025px) {
    body.pagina-catalogo .zb-chat {
        right: 0.55rem;
        bottom: 0.65rem;
    }

    body.pagina-catalogo .zb-chat__fab {
        gap: 0.28rem;
        padding: 0.18rem 0.55rem 0.18rem 0.18rem;
        font-size: 0.68rem;
        box-shadow: 0 3px 10px rgba(13, 148, 136, 0.3);
    }

    body.pagina-catalogo .zb-chat__fab-avatar {
        width: 1.7rem;
        height: 1.7rem;
    }

    body.pagina-catalogo .zb-chat__fab-svg {
        width: 30px;
        height: 30px;
    }

    body.pagina-catalogo .zb-chat__panel {
        right: 0.45rem;
        bottom: 3.1rem;
    }
}

.zb-chat__fab:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(13, 148, 136, 0.42);
}

.zb-chat__fab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.zb-chat__fab-avatar {
    display: inline-flex;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22);
    animation: zbChatAvatarFloat 2.4s ease-in-out infinite;
}

.zb-chat__fab-svg {
    display: block;
    width: 100%;
    height: 100%;
}

.zb-chat__fab-halo {
    transform-origin: 32px 32px;
    animation: zbChatHaloPulse 2.4s ease-in-out infinite;
}

.zb-chat__fab-ojo {
    transform-origin: center;
    animation: zbChatBlink 4.5s ease-in-out infinite;
}

.zb-chat__fab-ojo--der {
    animation-delay: 0.08s;
}

.zb-chat__fab-dot {
    animation: zbChatDotBounce 1.25s ease-in-out infinite;
}

.zb-chat__fab-dot--2 {
    animation-delay: 0.15s;
}

.zb-chat__fab-dot--3 {
    animation-delay: 0.3s;
}

@keyframes zbChatAvatarFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

@keyframes zbChatHaloPulse {
    0%, 100% { opacity: 0.35; transform: scale(0.92); }
    50% { opacity: 0.85; transform: scale(1); }
}

@keyframes zbChatBlink {
    0%, 42%, 48%, 100% { transform: scaleY(1); }
    45% { transform: scaleY(0.12); }
}

@keyframes zbChatDotBounce {
    0%, 100% { opacity: 0.45; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-2.5px); }
}

@media (prefers-reduced-motion: reduce) {
    .zb-chat__fab-avatar,
    .zb-chat__fab-halo,
    .zb-chat__fab-ojo,
    .zb-chat__fab-dot {
        animation: none !important;
    }
}

.zb-chat__panel {
    position: absolute;
    right: 0;
    bottom: 2.7rem;
    width: min(380px, calc(100vw - 1.5rem));
    height: min(520px, calc(100vh - 6rem));
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
    overflow: hidden;
}

.zb-chat__panel[hidden] {
    display: none !important;
}

.zb-chat__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 0.95rem;
    background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
    color: #fff;
}

.zb-chat__title {
    display: block;
    font-size: 1rem;
}

.zb-chat__subtitle {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    opacity: 0.9;
}

.zb-chat__cerrar {
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.zb-chat__mensajes {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.85rem;
    background: #f8fafc;
}

.zb-chat__msg {
    margin-bottom: 0.7rem;
    max-width: 92%;
}

.zb-chat__msg--user {
    margin-left: auto;
    text-align: right;
}

.zb-chat__msg-quien {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}

.zb-chat__msg-texto {
    display: inline-block;
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
}

.zb-chat__msg--bot .zb-chat__msg-texto {
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #0f172a;
}

.zb-chat__msg--user .zb-chat__msg-texto {
    background: #ccfbf1;
    border: 1px solid #99f6e4;
    color: #134e4a;
}

.zb-chat__msg--pensando .zb-chat__msg-texto {
    color: #64748b;
    font-style: italic;
}

.zb-chat__mas-catalogo {
    display: inline-flex;
    align-items: center;
    margin-top: 0.55rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: #ecfdf5;
    border: 1px solid #99f6e4;
    color: #0f766e;
    font-size: 0.82rem;
    font-weight: 750;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.zb-chat__mas-catalogo:hover,
.zb-chat__mas-catalogo:focus-visible {
    background: #ccfbf1;
    border-color: #5eead4;
    color: #115e59;
    outline: none;
}

.zb-chat__rubros {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.7rem;
    max-height: 260px;
    overflow-y: auto;
    padding: 0.45rem;
    border-radius: 12px;
    background: #f0fdfa;
    border: 1px solid #99f6e4;
}

.zb-chat__rubro {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    padding: 0.42rem 0.75rem;
    border: 1px solid #5eead4;
    border-radius: 999px;
    background: #fff;
    color: #0f766e;
    font-size: 0.8rem;
    font-weight: 750;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(15, 118, 110, 0.08);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.zb-chat__rubro:hover,
.zb-chat__rubro:focus-visible {
    background: #0d9488;
    border-color: #0d9488;
    color: #fff;
    outline: none;
    transform: translateY(-1px);
}

.zb-chat__productos {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.55rem;
    max-width: 100%;
}

.zb-chat__prod {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 0.55rem;
    width: 100%;
    margin: 0;
    padding: 0.45rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.zb-chat__prod:hover {
    border-color: #14b8a6;
    box-shadow: 0 6px 16px rgba(13, 148, 136, 0.16);
    transform: translateY(-1px);
}

.zb-chat__prod-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.zb-chat__prod-info {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
}

.zb-chat__prod-cod {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #0f766e;
}

.zb-chat__prod-desc {
    font-size: 0.82rem;
    font-weight: 650;
    line-height: 1.25;
    color: #0f172a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.zb-chat__prod-rubro {
    font-size: 0.7rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zb-chat__prod-precio {
    font-size: 0.88rem;
    font-weight: 800;
    color: #0f172a;
}

.zb-chat__prod-cta {
    font-size: 0.72rem;
    font-weight: 700;
    color: #0d9488;
}

.zb-chat__form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.45rem;
    padding: 0.7rem;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.zb-chat__input {
    width: 100%;
    min-height: 2.5rem;
    max-height: 5.5rem;
    resize: none;
    padding: 0.55rem 0.7rem;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    font: inherit;
    font-size: 0.9rem;
}

.zb-chat__input:focus {
    outline: 2px solid #14b8a6;
    outline-offset: 1px;
    border-color: #14b8a6;
}

.zb-chat__enviar {
    align-self: end;
    padding: 0.55rem 0.9rem;
    border: none;
    border-radius: 10px;
    background: #0d9488;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.zb-chat__enviar:disabled {
    opacity: 0.55;
    cursor: default;
}

.zb-chat__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

@media only screen and (max-width: 480px) {
    .zb-chat {
        right: 0.65rem;
        bottom: 0.65rem;
    }

    .zb-chat__panel {
        position: fixed;
        right: 0.5rem;
        left: 0.5rem;
        bottom: 3.2rem;
        width: auto;
        height: min(70vh, 520px);
    }

    .zb-chat__fab-label {
        display: none;
    }

    .zb-chat__fab {
        width: 3rem;
        height: 3rem;
        padding: 0.2rem;
        justify-content: center;
        border-radius: 50%;
    }

    .zb-chat__fab-avatar {
        width: 2.55rem;
        height: 2.55rem;
    }
}
