/* Estilos del chat de Saul, compartidos por el botón flotante y la vista completa. */

.saul-turno + .saul-turno { margin-top: 1.25rem; }

.saul-fila { display: flex; gap: 0.75rem; }
.saul-fila-usuario { display: flex; justify-content: flex-end; }
.saul-cuerpo { min-width: 0; flex: 1; }

.saul-avatar {
    width: 2rem; height: 2rem; border-radius: 0.5rem; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: #111113; color: #fff;
}

.saul-burbuja {
    background: #111113; color: #fff;
    border-radius: 1rem 1rem 0.25rem 1rem;
    padding: 0.5rem 0.9rem; max-width: 32rem; font-size: 13.5px; line-height: 1.55;
    white-space: pre-wrap; word-break: break-word;
}
.dark .saul-burbuja { background: #f4f4f5; color: #18181b; }

.saul-respuesta { font-size: 14px; line-height: 1.7; color: #27272a; }
.dark .saul-respuesta { color: #e4e4e7; }
.saul-respuesta p { margin-bottom: 0.7em; }
.saul-respuesta p:last-child { margin-bottom: 0; }
.saul-respuesta ul { margin: 0.4em 0 0.7em 0; padding-left: 1.2em; list-style: disc; }
.saul-respuesta li { margin-bottom: 0.2em; }
.saul-respuesta strong { font-weight: 600; color: #18181b; }
.dark .saul-respuesta strong { color: #fafafa; }
.saul-respuesta code {
    font-family: ui-monospace, monospace; font-size: 0.87em;
    background: #f4f4f5; padding: 1px 5px; border-radius: 4px;
}
.dark .saul-respuesta code { background: #3f3f46; }

.saul-error {
    padding: 0.65rem 0.9rem; border-radius: 0.5rem; font-size: 13px;
    border: 1px solid #fecaca; background: #fef2f2; color: #b91c1c;
}
.dark .saul-error { border-color: #991b1b; background: rgba(127,29,29,.3); color: #fca5a5; }

/* Bloque plegable con el SQL ejecutado */
.saul-detalle { margin-top: 0.7rem; }
.saul-detalle > summary {
    font-size: 11px; color: #a1a1aa; cursor: pointer; user-select: none;
    display: inline-flex; align-items: center; gap: 0.25rem; list-style: none;
}
.saul-detalle > summary::-webkit-details-marker { display: none; }
.saul-detalle > summary:hover { color: #52525b; }
.dark .saul-detalle > summary:hover { color: #d4d4d8; }
.saul-detalle[open] > summary .material-symbols-rounded { transform: rotate(90deg); }
.saul-detalle > summary .material-symbols-rounded { transition: transform .15s; }
.saul-detalle-cuerpo {
    margin-top: 0.5rem; padding-left: 0.9rem;
    border-left: 2px solid #e4e4e7;
}
.dark .saul-detalle-cuerpo { border-left-color: #3f3f46; }
.saul-consulta-tit { font-size: 11px; font-weight: 500; color: #71717a; margin-bottom: 0.25rem; }
.dark .saul-consulta-tit { color: #a1a1aa; }
.saul-tenue { color: #a1a1aa; }
.saul-rojo { color: #dc2626; }
.dark .saul-rojo { color: #f87171; }
.saul-sql {
    font-family: ui-monospace, monospace; font-size: 11px; line-height: 1.6;
    white-space: pre-wrap; word-break: break-word;
    padding: 0.5rem 0.7rem; border-radius: 0.375rem;
    background: #f4f4f5; color: #52525b;
}
.dark .saul-sql { background: #27272a; color: #d4d4d8; }

/* Indicador de "pensando" */
.saul-puntos { display: flex; align-items: center; gap: 0.35rem; padding-top: 0.65rem; }
.saul-puntos span {
    width: 6px; height: 6px; border-radius: 50%; background: #a1a1aa;
    animation: saul-rebote 1.2s infinite ease-in-out;
}
.saul-puntos span:nth-child(2) { animation-delay: .15s; }
.saul-puntos span:nth-child(3) { animation-delay: .3s; }
@keyframes saul-rebote {
    0%, 60%, 100% { transform: translateY(0);    opacity: .4; }
    30%           { transform: translateY(-5px); opacity: 1;  }
}

/* Campo de entrada */
.saul-entrada {
    flex: 1; resize: none; max-height: 140px;
    padding: 0.65rem 0.9rem; border-radius: 0.75rem; font-size: 13.5px; outline: none;
    border: 1px solid #e4e4e7; background: #fff; color: #18181b;
    transition: border-color .15s, box-shadow .15s;
}
.saul-entrada:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.35); }
.dark .saul-entrada { border-color: #52525b; background: #18181b; color: #f4f4f5; }

.saul-enviar {
    flex-shrink: 0; padding: 0.65rem; border-radius: 0.75rem;
    background: #111113; color: #fff; transition: background .15s, opacity .15s;
}
.saul-enviar:hover:not(:disabled) { background: #3f3f46; }
.saul-enviar:disabled { opacity: .4; }
.dark .saul-enviar { background: #f4f4f5; color: #18181b; }

.saul-sugerencia {
    text-align: left; padding: 0.55rem 0.8rem; border-radius: 0.6rem; font-size: 12.5px;
    border: 1px solid #e4e4e7; background: #fff; color: #3f3f46;
    transition: background .12s, border-color .12s;
}
.saul-sugerencia:hover { background: #fafafa; border-color: #a1a1aa; }
.dark .saul-sugerencia { background: #27272a; border-color: #3f3f46; color: #d4d4d8; }
.dark .saul-sugerencia:hover { background: #3f3f46; }

/* ===== Botón flotante y panel ===== */
#saulLanzador {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 60;
    width: 3.25rem; height: 3.25rem; border-radius: 9999px;
    display: flex; align-items: center; justify-content: center;
    background: #111113; color: #fff; border: none; cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,.22);
    transition: transform .15s, box-shadow .15s;
}
#saulLanzador:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,.28); }
.dark #saulLanzador { background: #f4f4f5; color: #18181b; }

/* Marca cuando hay conversación en curso */
#saulLanzador .saul-punto {
    position: absolute; top: 2px; right: 2px;
    width: 11px; height: 11px; border-radius: 9999px;
    background: #10b981; border: 2px solid #fff;
}
.dark #saulLanzador .saul-punto { border-color: #18181b; }

#saulPanel {
    position: fixed; bottom: 5.5rem; right: 1.5rem; z-index: 60;
    width: 26rem; max-width: calc(100vw - 3rem);
    height: 34rem; max-height: calc(100vh - 8rem);
    display: none; flex-direction: column; overflow: hidden;
    background: #fff; border: 1px solid #e4e4e7; border-radius: 1rem;
    box-shadow: 0 16px 48px rgba(0,0,0,.2);
}
#saulPanel.abierto { display: flex; }
.dark #saulPanel { background: #18181b; border-color: #3f3f46; }

@media (max-width: 640px) {
    #saulPanel {
        right: 0.75rem; left: 0.75rem; bottom: 5rem;
        width: auto; max-width: none; height: calc(100vh - 7rem);
    }
}

/* Los avisos flotantes de cada módulo comparten esquina con el lanzador */
#toast { bottom: 5.5rem !important; }
