/* chatbot.css - Asistente virtual flotante (assets/js/chatbot.js) */

#hbChatbot {
    --hbc-amarillo: #f1c50e;
    --hbc-negro: #0b0b0c;
    --hbc-gris: #f3f3f1;
    font-family: 'Montserrat', 'Open Sans', Arial, sans-serif;
    position: fixed;
    right: 28px;
    bottom: 100px;   /* sobre el botón de WhatsApp */
    z-index: 1001;
}
#hbChatbot *, #hbChatbot *::before, #hbChatbot *::after { box-sizing: border-box; }

/* ---------- Botón lanzador ---------- */
.hbc-lanzador {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--hbc-amarillo);
    background: var(--hbc-negro);
    color: var(--hbc-amarillo);
    font-size: 1.7rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
    transition: transform .25s ease;
    padding: 0;
}
.hbc-lanzador:hover { transform: scale(1.07); }
.hbc-lanzador::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 3px solid var(--hbc-amarillo);
    animation: hbcPulso 2.4s ease-out infinite;
    pointer-events: none;
}
@keyframes hbcPulso { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.45); opacity: 0; } }
.hbc-ico-cerrar { display: none; font-size: 1.3rem; }
.hbc-abierto .hbc-ico-abrir { display: none; }
.hbc-abierto .hbc-ico-cerrar { display: block; }
.hbc-abierto .hbc-lanzador::after { display: none; }

/* Globito de invitación */
.hbc-globo {
    position: absolute;
    right: 72px;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    white-space: nowrap;
    background: #fff;
    color: var(--hbc-negro);
    font-size: .85rem;
    font-weight: 600;
    padding: 9px 14px;
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .2);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease, transform .3s ease;
}
.hbc-globo::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: #fff;
}
.hbc-invitar .hbc-globo { opacity: 1; transform: translateY(-50%); }

/* ---------- Panel ---------- */
.hbc-panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 370px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 200px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(.97);
    transform-origin: bottom right;
    transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
.hbc-abierto .hbc-panel { opacity: 1; visibility: visible; transform: none; }

.hbc-cabecera {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 14px 16px;
    background: var(--hbc-negro);
    color: #fff;
    border-bottom: 3px solid var(--hbc-amarillo);
}
.hbc-avatar {
    flex: 0 0 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--hbc-amarillo);
    color: var(--hbc-negro);
    display: grid;
    place-items: center;
    font-size: 1.25rem;
}
.hbc-titulo { flex: 1; min-width: 0; line-height: 1.25; }
.hbc-titulo strong { display: block; font-size: .95rem; }
.hbc-titulo small { font-size: .72rem; color: #bdbdc4; display: inline-flex; align-items: center; gap: 5px; }
.hbc-punto { width: 7px; height: 7px; border-radius: 50%; background: #3ddc84; display: inline-block; }
.hbc-cabecera button {
    background: transparent;
    border: 0;
    color: #cfcfd5;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
}
.hbc-cabecera button:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.hbc-mensajes {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--hbc-gris);
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
.hbc-msg {
    max-width: 86%;
    padding: 10px 13px;
    border-radius: 16px;
    font-size: .88rem;
    line-height: 1.5;
    word-wrap: break-word;
}
.hbc-bot { align-self: flex-start; background: #fff; color: #1d1d1f; border-bottom-left-radius: 5px; box-shadow: 0 2px 6px rgba(0, 0, 0, .05); }
.hbc-usuario { align-self: flex-end; background: var(--hbc-negro); color: #fff; border-bottom-right-radius: 5px; }
.hbc-bot a { color: #8a6d00; font-weight: 600; }
.hbc-mas, .hbc-wa {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    margin-right: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 700;
    text-decoration: none !important;
}
.hbc-mas { background: #fff7d1; color: #6b5500 !important; }
.hbc-wa { background: #25d366; color: #fff !important; }
.hbc-wa:hover { background: #1ebe5a; }

.hbc-sugerencias { display: flex; flex-wrap: wrap; gap: 6px; }
.hbc-sugerencias button {
    border: 1.5px solid var(--hbc-amarillo);
    background: #fff;
    color: #1d1d1f;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background .2s ease;
}
.hbc-sugerencias button:hover:not(:disabled) { background: var(--hbc-amarillo); }
.hbc-sugerencias button:disabled { opacity: .45; cursor: default; }

.hbc-escribiendo { display: inline-flex; gap: 4px; padding: 13px 15px; }
.hbc-escribiendo span { width: 7px; height: 7px; border-radius: 50%; background: #9a9aa2; animation: hbcPuntos 1.2s infinite ease-in-out; }
.hbc-escribiendo span:nth-child(2) { animation-delay: .15s; }
.hbc-escribiendo span:nth-child(3) { animation-delay: .3s; }
@keyframes hbcPuntos { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

.hbc-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #e8e8e5; background: #fff; }
.hbc-form input {
    flex: 1;
    min-width: 0;
    border: 1.5px solid #e2e2df;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: .9rem;
    font-family: inherit;
    outline: none;
}
.hbc-form input:focus { border-color: var(--hbc-amarillo); }
.hbc-form button {
    flex: 0 0 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    background: var(--hbc-amarillo);
    color: var(--hbc-negro);
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
}
.hbc-form button:hover { background: #ffd84a; }
.hbc-pie { margin: 0; padding: 0 12px 10px; font-size: .68rem; color: #8b8b92; text-align: center; background: #fff; }
.hbc-pie a { color: #6b6b72; }
.hbc-oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 575px) {
    #hbChatbot { right: 16px; bottom: 84px; }
    .hbc-lanzador { width: 54px; height: 54px; font-size: 1.5rem; }
    .hbc-panel {
        position: fixed;
        right: 8px;
        left: 8px;
        bottom: 150px;
        width: auto;
        max-width: none;
        height: auto;
        top: 70px;
        max-height: none;
    }
    .hbc-globo { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .hbc-lanzador::after { animation: none; }
    .hbc-panel, .hbc-globo { transition: none; }
}

/* Aislar el widget de los estilos generales de la web (Nicepage) */
#hbChatbot p, #hbChatbot a, #hbChatbot button, #hbChatbot input { font-family: inherit; letter-spacing: normal; text-transform: none; }
#hbChatbot .hbc-msg a { font-size: inherit !important; line-height: inherit !important; }
#hbChatbot .hbc-pie { font-size: .7rem !important; line-height: 1.3 !important; margin: 0 !important; padding: 0 12px 10px !important; }
#hbChatbot .hbc-pie a { font-size: inherit !important; }
#hbChatbot .hbc-msg br { line-height: inherit; }
