/**
 * @author      Ghulam Dastgir <ghulam.dastgir@knfilters.com>
 * @copyright   © K&N Engineering, Inc. All rights reserved.
 * @see         KN_LICENSE.txt for license details.
 *
 * SPDX-License-Identifier: NONE
 */

.kn-chatbot-button {
    position: fixed !important;
    bottom: 30px !important;
    right: 20px !important;
    width: 120px;
    height: 120px;
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999 !important;
    transition: transform 0.2s ease;
}

.kn-chatbot-button:hover {
    transform: scale(1.1);
}

.kn-chatbot-icon-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kn-chatbot-icon-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.kn-chatbot-cta {
    display: none;
}

.kn-chatbot-popup {
    position: fixed !important;
    bottom: 160px !important;
    right: 20px !important;
    width: 350px;
    min-height: 160px;
    max-height: 500px;
    background: white;
    border-radius: 16px;
    border: 2px solid #000;
    box-shadow: none;
    z-index: 9998 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.kn-chatbot-popup[style*="display: block"] {
    opacity: 1;
    transform: translateY(0);
}

.kn-chatbot-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    color: #000;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.kn-chatbot-header {
    margin-bottom: 15px;
}

.kn-chatbot-greeting {
    font-weight: 600;
    font-size: 18px;
    line-height: 1.3;
    color: #000;
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 8px;
}

.kn-chatbot-description {
    font-size: 14px;
    color: #444;
    line-height: 1.4;
    font-family: 'Montserrat', sans-serif;
}

.kn-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.kn-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
    max-height: 250px;
}

.kn-chatbot-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    font-family: 'Montserrat', sans-serif;
}

.kn-chatbot-message-user {
    background: #f32835;
    color: #f9f9f9;
    align-self: flex-end;
    margin-left: auto;
}

.kn-chatbot-message-bot {
    background: #f9f9f9;
    color: #1d1d1d;
    align-self: flex-start;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.kn-chatbot-message-error {
    background: #d70000;
    color: #f9f9f9;
    align-self: flex-start;
}

.kn-chatbot-input {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.kn-chatbot-input input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #dedede;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    background: white;
    color: #1d1d1d;
    font-family: 'Montserrat', sans-serif;
}

.kn-chatbot-input input:focus {
    border-color: #f32835;
}

.kn-chatbot-input button {
    background: #ff6e00;
    color: #1d1d1d;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Montserrat', sans-serif;
}

.kn-chatbot-input button:hover {
    background: #f32835;
}

.kn-chatbot-input button:disabled {
    background: #636363;
    cursor: not-allowed;
}

.kn-chatbot-disclaimer {
    font-size: 10px;
    color: #666;
    line-height: 1.3;
    margin-top: 10px;
    font-family: 'Montserrat', sans-serif;
}

@media (max-width: 768px) {
    .kn-chatbot-button {
        width: 90px;
        height: 90px;
        bottom: 25px;
        right: 15px;
    }
    
    .kn-chatbot-popup {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
        bottom: 125px;
    }
}

.kn-chatbot-typing {
    display: flex;
    align-items: center;
    margin: 5px 0;
}

.kn-typing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #636363;
    margin: 0 2px;
    animation: kn-typing 1.4s infinite;
}

.kn-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.kn-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes kn-typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}
