/**
 * Hoja de Estilos Estáticos para Promotitlán Chatbot.
 *
 * Versión 21.1: Añadidos estilos para el botón de limpiar historial.
 */

#chatbot-container {
    width: 320px;
    height: 450px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .1);
    display: flex;
    flex-direction: column;
    font-size: 14px;
    visibility: hidden;
    opacity: 0;
    transform: scale(.9);
    transition: all .3s ease-in-out;
    position: fixed;
    z-index: 9999999;
}

#chatbot-container.visible {
    visibility: visible;
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

#chatbot-header {
    letter-spacing: .5px;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Modificado para espaciar el título y el botón */
    min-height: 55px;
    padding: 8px 15px; /* Aumentado el padding lateral */
    flex-shrink: 0;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1; /* Permite que el contenido del header ocupe el espacio */
}

.chatbot-header-img {
    max-height: 45px;
    width: auto;
    max-width: 170px;
    object-fit: contain;
}

.chatbot-header-text {
    font-weight: bold;
    font-size: 17px;
    text-align: center;
}

/* NUEVO [Privacidad de Usuario]: Estilos para el botón de limpiar historial */
#chatbot-clear-history {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    margin-left: 10px; /* Espacio con el título */
    opacity: 0.7;
    transition: opacity 0.2s;
    line-height: 0; /* Para alinear el SVG correctamente */
}

#chatbot-clear-history:hover {
    opacity: 1;
}

#chatbot-messages {
    flex: 1 1 auto;
    padding: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    line-height: 1.5;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    user-select: text;
}

.chat-message {
    padding: 10px 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    max-width: 80%;
    word-wrap: break-word;
}

.chat-message.user {
    background: #f1f1f1;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message.bot {
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    font-weight: normal;
}

.chat-message.bot ul {
    list-style-type: none;
    padding-left: 15px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.chat-message.bot li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 5px;
    line-height: 1.4;
}

.chat-message.bot li:before {
    content: "🏖️";
    position: absolute;
    left: 0;
    font-size: 14px;
}

.chat-message.bot hr {
    border: 0;
    border-top: 1px solid #ddd;
    margin: 15px 0;
}

.chat-message.bot strong {
    font-weight: bold;
}

#chatbot-quick-replies-container {
    padding: 10px;
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.chatbot-quick-reply-button {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s;
    flex-grow: 1;
    text-align: center;
}

.chatbot-quick-reply-button:hover {
    background-color: #e0e0e0;
}

#chatbot-input-container {
    background: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 10px;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

#chatbot-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    outline: 0;
    font-size: 14px;
    transition: border-color .3s ease-in-out;
}

#chatbot-input:focus {
    border-color: #571db6;
}

#chatbot-send {
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: filter .2s ease-in-out;
}

#chatbot-send:hover {
    filter: brightness(115%);
}

#chatbot-toggle {
    border: none;
    padding: 1px;
    border-radius: 30%;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, .15);
    transition: all .3s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    position: fixed;
}

.chatbot-toggle-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#chatbot-toggle img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

.typing span {
    width: 6px;
    height: 6px;
    background: #666;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

.typing span:nth-child(3) {
    animation-delay: .4s;
}

@keyframes typing {
    0%, 80%, 100% { transform: translateY(0) }
    40% { transform: translateY(-6px) }
}

.promochat-embedded {
    position: relative !important;
    z-index: auto !important;
    transform: none !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    margin: 20px auto;
    max-width: 100%;
}

.promochat-embedded + #chatbot-toggle {
    display: none !important;
}

.chatbot-action-button-container {
    padding: 5px 0 10px 0;
    align-self: flex-start;
    width: 100%;
}

.chatbot-action-button {
    background-color: #571db6;
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: filter 0.2s ease-in-out;
    display: block;
    margin: 5px auto;
    max-width: 90%;
    text-align: center;
}

.chatbot-action-button:hover {
    filter: brightness(115%);
}


@media (max-width:600px) {
    #chatbot-container {
        width: 90% !important;
    }

    .promochat-embedded {
        width: 100% !important;
    }

    #chatbot-toggle {
        width: 60px;
        height: 60px;
    }
    #chatbot-toggle img {
        width: 32px;
        height: 32px;
    }
    .chatbot-quick-reply-button {
        font-size: 12px;
        padding: 5px 10px;
    }
}
