/* ServiBot — asistente flotante -------------------------------------------- */

:root {
    --bot-tinta:  #1f2d3d;
    --bot-marca:  #0d6efd;
    --bot-suave:  #eef3f9;
    --bot-borde:  #d7e0ea;
}

/* --- Icono flotante --- */
.servibot-lanzador {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid var(--bot-tinta);
    background: #fff;
    color: var(--bot-tinta);
    display: grid;
    place-items: center;
    cursor: pointer;
    z-index: 3000;
    box-shadow: 0 6px 20px rgba(31, 45, 61, .28);
    transition: transform .18s ease, box-shadow .18s ease;
}
.servibot-lanzador:hover  { transform: translateY(-3px) scale(1.04);
                            box-shadow: 0 10px 26px rgba(31, 45, 61, .34); }
.servibot-lanzador:active { transform: translateY(-1px) scale(.98); }
.servibot-lanzador.oculto { transform: scale(0); pointer-events: none; }

.servibot-robot        { width: 42px; height: 42px; }
.servibot-robot.chico  { width: 30px; height: 30px; flex: 0 0 30px; }

/* Saluda una vez con un cabeceo, para que se note que está ahí. */
@keyframes servibot-saludo {
    0%, 88%, 100% { transform: rotate(0); }
    91%           { transform: rotate(-9deg); }
    95%           { transform: rotate(9deg); }
}
.servibot-lanzador .servibot-robot { animation: servibot-saludo 6s ease-in-out 3; }

/* Punto de aviso cuando hay respuesta sin leer */
.servibot-punto {
    position: absolute; top: 4px; right: 4px;
    width: 13px; height: 13px; border-radius: 50%;
    background: #dc3545; border: 2px solid #fff;
    display: none;
}
.servibot-lanzador.avisa .servibot-punto { display: block; }

/* --- Panel --- */
.servibot-panel {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: min(410px, calc(100vw - 32px));
    height: min(620px, calc(100vh - 44px));
    background: #fff;
    border: 1px solid var(--bot-borde);
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(31, 45, 61, .32);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 3001;
    animation: servibot-entra .2s ease;
}
@keyframes servibot-entra {
    from { opacity: 0; transform: translateY(14px) scale(.97); }
    to   { opacity: 1; transform: none; }
}

.servibot-cabeza {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    background: var(--bot-tinta);
    color: #fff;
}
.servibot-quien        { flex: 1; line-height: 1.15; min-width: 0; }
.servibot-quien strong { display: block; font-size: 15px; }
.servibot-quien small  { opacity: .72; font-size: 11.5px; }

.servibot-accion {
    background: rgba(255, 255, 255, .12);
    border: 0; color: #fff;
    width: 30px; height: 30px; border-radius: 8px;
    cursor: pointer; font-size: 13px;
}
.servibot-accion:hover { background: rgba(255, 255, 255, .26); }

/* --- Conversación --- */
.servibot-charla {
    flex: 1; overflow-y: auto;
    padding: 14px; background: #f7f9fc;
    display: flex; flex-direction: column; gap: 10px;
}
.servibot-globo {
    max-width: 86%;
    padding: 9px 12px;
    border-radius: 13px;
    font-size: 13.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.servibot-globo.bot {
    background: #fff; border: 1px solid var(--bot-borde);
    align-self: flex-start; border-bottom-left-radius: 4px;
}
.servibot-globo.usuario {
    background: var(--bot-marca); color: #fff;
    align-self: flex-end; border-bottom-right-radius: 4px;
}
.servibot-globo.aviso {
    background: #fff4e5; border: 1px solid #ffd9a8; color: #7a4b00;
    align-self: stretch; max-width: 100%; font-size: 12.5px;
}
.servibot-hora {
    font-size: 10.5px; opacity: .5; margin-top: 3px; display: block;
}

/* Tabla de resultados dentro del globo */
.servibot-tabla        { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 11.5px; }
.servibot-tabla th     { background: var(--bot-suave); text-align: left; font-weight: 600; }
.servibot-tabla th,
.servibot-tabla td     { border: 1px solid var(--bot-borde); padding: 4px 6px; white-space: nowrap; }
.servibot-envoltura    { max-height: 240px; overflow: auto; margin-top: 6px; }
.servibot-sql {
    margin-top: 7px; font-size: 10.5px; color: #6b7a8d;
    background: #f2f5f9; border: 1px dashed var(--bot-borde);
    border-radius: 6px; padding: 5px 7px;
    white-space: pre-wrap; display: none;
}
.servibot-sql.visible  { display: block; }
.servibot-verver {
    font-size: 10.5px; color: var(--bot-marca);
    background: none; border: 0; cursor: pointer; padding: 3px 0 0;
}

/* Puntos de "escribiendo" */
.servibot-pensando { display: flex; gap: 4px; align-items: center; }
.servibot-pensando i {
    width: 6px; height: 6px; border-radius: 50%;
    background: #9fb0c4; animation: servibot-late 1.1s infinite ease-in-out;
}
.servibot-pensando i:nth-child(2) { animation-delay: .16s; }
.servibot-pensando i:nth-child(3) { animation-delay: .32s; }
@keyframes servibot-late {
    0%, 70%, 100% { transform: scale(.75); opacity: .45; }
    35%           { transform: scale(1.15); opacity: 1; }
}

/* --- Sugerencias --- */
.servibot-sugerencias {
    display: flex; gap: 6px; flex-wrap: wrap;
    padding: 8px 12px 0;
    border-top: 1px solid var(--bot-borde);
    background: #fff;
}
.servibot-chip {
    font-size: 11.5px;
    border: 1px solid var(--bot-borde);
    background: var(--bot-suave);
    color: var(--bot-tinta);
    border-radius: 20px; padding: 4px 11px; cursor: pointer;
}
.servibot-chip:hover { background: #dfe9f6; border-color: #b9cbe0; }

/* --- Barra de escritura --- */
.servibot-pie {
    display: flex; gap: 6px; align-items: center;
    padding: 10px 12px; background: #fff;
    border-top: 1px solid var(--bot-borde);
}
.servibot-entrada {
    flex: 1; border: 1px solid var(--bot-borde);
    border-radius: 20px; padding: 8px 13px; font-size: 13.5px;
    outline: none; font-family: inherit;
}
.servibot-entrada:focus { border-color: var(--bot-marca);
                          box-shadow: 0 0 0 3px rgba(13, 110, 253, .14); }
.servibot-boton {
    width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid var(--bot-borde); background: #fff;
    color: var(--bot-tinta); cursor: pointer; font-size: 13px;
    flex: 0 0 36px;
}
.servibot-boton:hover         { background: var(--bot-suave); }
.servibot-boton.enviar        { background: var(--bot-marca); border-color: var(--bot-marca); color: #fff; }
.servibot-boton.enviar:hover  { background: #0b5ed7; }
.servibot-boton.encendido     { background: #198754; border-color: #198754; color: #fff; }

@media (max-width: 480px) {
    .servibot-panel { right: 8px; bottom: 8px; width: calc(100vw - 16px); height: calc(100vh - 16px); }
}

/* Nada de esto se imprime. */
@media print {
    .servibot-lanzador, .servibot-panel { display: none !important; }
}
