/* Chatbot Widget Container */
#chatbot-root {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: Arial, sans-serif;
}


/* Toggle Button */
#chatbot-toggle-button {
    color: #171533;
    background-color: #171533;
    border-radius: 50%;
    transform: scale(1.3);
    width: 70px;
    height: 70px;
    font-size: 24px;
    cursor: pointer;
    position: fixed;
    bottom: 20px;
    right: 20px;
    opacity: 1;
    align-items: center;
    justify-content: center;
    background-image: url('LogoChat.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    box-shadow: none !important;
    border: none !important;
    transition: all 0.2s ease 0.4s;
    transform-origin: right bottom;
}

#chatbot-toggle-button.hidden {
    transform: scale(0);
    opacity: 0;
    transition: all 0.2s ease 0s;
}

#chatbot-close-button::before {
    content: "⭸";
}

/* Chat Window */
#chatbot-window {
    width: 350px;
    height: 0px;
    opacity: 0;
    background-color: #fff;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.5s ease 0s;
}

#chatbot-window.open {
    width: 350px;
    height: 500px;
    opacity: 1;
    transition: all 0.5s ease 0.1s;
}

.chatbot-header {
    background-color: #171533;
    color: white;
    padding: 10px 10px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    font-size: 1.3em;
    gap: 15px; /* antes era 10px */
}

.chatbot-header::before {
    content: '';
    display: inline-block;
    width: 70px;
    height: 70px;
    background-image: url('Nora.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    transform: scale(1.3);
    transform-origin: center center;
}

.chatbot-header::after {
    content: 'Habla con Nora';
    font-size: 1.1em;
}

.chatbot-header button {
    background: none;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    margin-left: auto;
    margin-right: 12px;
    order: 2;
}

/* Messages Area */
#chatbot-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: scroll;
    scrollbar-width: 1px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chatbot-message {
    padding: 8px 12px;
    border-radius: 15px;
    max-width: 75%;
    word-wrap: break-word;
}

/* User Message */
.user-message {
    background-color: #fff;
    color: #171533;
    border: 2px solid #f47527;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.bot-message {
    background-color: #fff;
    color: #171533;
    border: 2px solid #171533;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

/* Input Area */
#chatbot-input-area {
    display: flex;
    padding: 10px;
    border-top: 1px solid #eee;
}

#chatbot-input {
    flex-grow: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    margin-right: 10px;
    outline: none;
}

#chatbot-send-button {
    background-color: #171533;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 15px;
    cursor: pointer;
    font-weight: bold;
}
#chatbot-send-button:hover {
    background-color: #171580;
}
#chatbot-send-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Options Area */
#chatbot-options-area {
    padding: 10px;
    border-top: 1px solid #eee;
    display: none; /* Hidden by default */
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.chatbot-option-button {
    background-color: #e9ecef;
    color: #171533;
    border: 1px solid #171533;
    border-radius: 20px;
    padding: 8px 15px;
    cursor: pointer;
    font-size: 0.9em;
}
.chatbot-option-button:hover {
    background-color: #171533;
    color: white;
}

/* Floating Buttons */
.chatbot-buttons-floating {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 10px 0;
    background: none;
    box-shadow: none;
    flex-wrap: wrap; /* Allow buttons to wrap to multiple lines */
}

/* Welcome Bubble con animación */
.chatbot-welcome-bubble {
    /* position: absolute; */
    position: fixed;
    /* ... (deja las propiedades left, bottom, background, color, border, etc. que ya tenías) ... */
    background: #fff;
    color: #171533;
    border: 2px solid #171533;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 1.1em;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    white-space: pre-line;
    z-index: 1001;
    max-width: 220px;
    min-width: 120px;
    text-align: center;
    line-height: 1.4;
    word-break: break-word;
    cursor: pointer; /* Para que parezca clickeable */

    /* --- Propiedades para la animación --- */
    opacity: 0;
    transform: translateY(15px); /* Empieza un poco más abajo */
    pointer-events: none; /* No se puede hacer clic mientras está invisible */

    transition: all 0.2s ease;
}

.chatbot-welcome-bubble.visible {
    opacity: 0.97; /* Tu opacidad original */
    transform: translateY(0); /* Vuelve a su posición normal */
    pointer-events: auto; /* Se puede hacer clic cuando está visible */
}

/* Indicador de escritura del bot */
.chatbot-message.typing-indicator {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background-color: #fff;
    color: #171533;
    border: 2px solid #171533;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #171533;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: chatbot-typing-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 chatbot-typing-blink {
    0% { opacity: 0.2; }
    20% { opacity: 1; }
    100% { opacity: 0.2; }
}

/* Estilo para el icono de enlace cuando se añade a una burbuja de texto */
.chatbot-message .chatbot-appended-link {
    display: inline-block;
    margin-left: 10px; /* Espacio entre el texto y el icono */
    vertical-align: middle; /* Alinea el icono con el texto */
    color: #555; /* Un color ligeramente diferente para que destaque */
    transition: color 0.2s;
}

.chatbot-message .chatbot-appended-link:hover {
    color: #007bff; /* Color al pasar el ratón */
}

/* Estilo para las burbujas que SOLO contienen un enlace (comportamiento de respaldo) */
.chatbot-message.link-only-message {
    background-color: transparent; /* Sin fondo */
    padding: 5px 15px;
}

.chatbot-message.link-only-message .chatbot-appended-link {
    margin-left: 0; /* Sin margen si está solo */
}