/* Boton flotante */

#chat-toggle {
    position: fixed;
    bottom: 100px;
    right: 100px;
    background: transparent;
    width: 60px;
    height: 60px;
    z-index: 9999;
}

#chat-toggle img {
    width: 100px;
    height: 100px;
    background: transparent;
}

#chat-box {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
}

#chat-header {
    background: #2563eb;
    color: white;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

/* fin boton */

/* CONTENEDOR PRINCIPAL */
#chat-box {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 550px;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* HEADER */
#chat-header {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: #fff;
    padding: 14px 16px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* MENSAJES */
#chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f5f7fb;
    scroll-behavior: smooth;
}

/* Scroll más elegante */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}
#chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

/* MENSAJE USUARIO */
.chat-user {
    text-align: right;
    margin-bottom: 12px;
}

.chat-user span {
    display: inline-block;
    background: #2563eb;
    color: #fff;
    padding: 10px 14px;
    border-radius: 16px 16px 4px 16px;
    max-width: 75%;
    font-size: 14px;
    line-height: 1.4;
}

/* MENSAJE BOT */
.chat-bot {
    text-align: left;
    margin-bottom: 12px;
}

.chat-bot span {
    display: inline-block;
    background: #e5e7eb;
    color: #111827;
    padding: 10px 14px;
    border-radius: 16px 16px 16px 4px;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.4;
}

/* ÁREA INPUT */
.chat-input-area {
    display: flex;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

/* INPUT */
#ollama-msg {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    transition: 0.2s ease;
}

#ollama-msg:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* BOTÓN */
#ollama-send {
    margin-left: 8px;
    background: #2563eb;
    border: none;
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s ease;
}

#ollama-send:hover {
    background: #1e40af;
}


/* ================ Animacion ===================*/

/* Contenedor mensajes */
#chat-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    overflow-y: auto;
    height: 350px;
}

/* Base burbuja */
.chat-user,
.chat-bot {
    max-width: 80%;
    padding: 10px 5px 0px; 
    border-radius: 5px;
    font-size: 14px;
    line-height: 1.4;
    animation: bubbleIn 0.25s ease-out;
    word-wrap: break-word;
}

/* Usuario */
.chat-user {
    align-self: flex-end;
    background: #2563eb;
    color: white;
    border-bottom-right-radius: 5px;
}

/* Bot */
.chat-bot {
    align-self: flex-start;
    background: #f1f5f9;
    color: #111;
    border-bottom-left-radius: 5px;
}

/* Animación entrada */
@keyframes bubbleIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Indicador escribiendo */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
}

.typing-indicator span {
    width: 5px;
    height: 1px;
    background: #888;
    border-radius: 25%;
    animation: blink 1.4s infinite both;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {
    0% { opacity: .2; }
    20% { opacity: 1; }
    100% { opacity: .2; }
}

