﻿/* =========================================================
   KHELMART SMART ASSISTANT
   COMPLETE CHATBOT CSS
   ========================================================= */

#khelmart-chatbot {
    font-family: Arial, Helvetica, sans-serif;
}

    #khelmart-chatbot,
    #khelmart-chatbot * {
        box-sizing: border-box;
    }


/* =========================================================
   FLOATING CHAT BUTTON
   ========================================================= */

.chatbot-floating-btn {
    position: fixed;
    left: 20px;
    right: auto;
    bottom: 90px;
    width: 58px;
    height: 58px;
    border: none;
    border-radius: 50%;
    background: #25D366;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    z-index: 9998;
    transition: transform 0.2s ease;
}

    .chatbot-floating-btn:hover {
        transform: scale(1.06);
    }


/* =========================================================
   CHAT WINDOW - DESKTOP
   ========================================================= */

.chatbot-window {
    position: fixed;
    left: 20px;
    right: auto;
    bottom: 160px;
    width: 360px;
    height: 520px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 8px 35px rgba(0, 0, 0, 0.22);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
}


/* =========================================================
   CHATBOT HEADER
   ========================================================= */

.chatbot-header {
    background: #075E54;
    color: #ffffff;
    padding: 13px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.chatbot-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    color: #075E54;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.chatbot-title {
    font-size: 15px;
    font-weight: 600;
}

.chatbot-status {
    font-size: 11px;
    margin-top: 2px;
    opacity: 0.9;
}

.chatbot-close {
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
    flex-shrink: 0;
}


/* =========================================================
   MESSAGES AREA
   ========================================================= */

.chatbot-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 15px;
    background: #f3f3f3;
    -webkit-overflow-scrolling: touch;
}

.chat-message {
    max-width: 82%;
    padding: 9px 12px;
    margin-bottom: 9px;
    border-radius: 9px;
    line-height: 1.4;
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}


/* =========================================================
   BOT MESSAGE
   ========================================================= */

.bot-message {
    background: #ffffff;
    color: #333333;
    border-top-left-radius: 3px;
}


/* =========================================================
   USER MESSAGE
   ========================================================= */

.user-message {
    background: #dcf8c6;
    color: #222222;
    margin-left: auto;
    border-top-right-radius: 3px;
}


/* =========================================================
   INPUT AREA
   ========================================================= */

.chatbot-input-area {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    width: 100%;
    padding: 10px;
    background: #ffffff;
    border-top: 1px solid #eeeeee;
}


/* =========================================================
   TEXT INPUT
   ========================================================= */

#chatbot-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 46px;
    border: 1px solid #dddddd;
    border-radius: 23px;
    padding: 10px 14px;
    outline: none;
    font-size: 14px;
    background: #ffffff;
    color: #222222;
}

    #chatbot-input:focus {
        border-color: #25D366;
    }

    #chatbot-input::placeholder {
        color: #777777;
    }


/* =========================================================
   MICROPHONE BUTTON
   ========================================================= */

.chatbot-mic {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border: none;
    border-radius: 50%;
    background: #f3f3f3;
    color: #555555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

    .chatbot-mic:hover {
        background: #e9e9e9;
    }


    /* Microphone while listening */

    .chatbot-mic.listening {
        color: #ffffff;
        background: #e53935;
        animation: chatbot-mic-pulse 1s infinite;
    }


/* =========================================================
   MICROPHONE PULSE
   ========================================================= */

@keyframes chatbot-mic-pulse {

    0% {
        box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.4);
    }

    70% {
        box-shadow: 0 0 0 9px rgba(229, 57, 53, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(229, 57, 53, 0);
    }
}


/* =========================================================
   SEND BUTTON
   ========================================================= */

#chatbot-send {
    height: 46px;
    flex-shrink: 0;
    margin-left: 0;
    border: none;
    border-radius: 23px;
    background: #25D366;
    color: #ffffff;
    padding: 0 17px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

    #chatbot-send:hover {
        opacity: 0.9;
    }

    #chatbot-send:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }


/* =========================================================
   PRODUCT ITEMS INSIDE CHAT
   ========================================================= */

.product-item {
    padding: 7px 0;
    border-bottom: 1px solid #eeeeee;
}

    .product-item:last-child {
        border-bottom: none;
    }

    .product-item a {
        color: #175fc7;
        text-decoration: none;
    }

        .product-item a:hover {
            text-decoration: underline;
        }


/* =========================================================
   SHOW MORE BUTTON
   ========================================================= */

.chat-show-more-btn {
    margin-top: 10px;
    padding: 7px 14px;
    border: none;
    border-radius: 5px;
    background: #075E54;
    color: #ffffff;
    cursor: pointer;
    font-size: 13px;
}
/* =========================================================
   TABLET + MOBILE
   FULL SCREEN CHATBOT
   ========================================================= */

@media (max-width: 768px) {

    /*
       Keep complete chatbot above website
       mobile navigation / sticky elements
    */
    #khelmart-chatbot {
        position: relative !important;
        z-index: 2147483646 !important;
    }


    /*
       FULL SCREEN CHAT WINDOW
    */
    .chatbot-window {
        position: fixed !important;
        top: 0;
        left: 0 !important;
        right: 0 !important;
        bottom: auto;
        width: 100vw !important;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        z-index: 2147483647 !important;
        flex-direction: column !important;
        overflow: hidden !important;
        background: #ffffff !important;
    }


    /*
       HEADER
       Never shrink or disappear
    */
    .chatbot-header {
        position: relative !important;
        flex: 0 0 auto !important;
        flex-shrink: 0 !important;
        width: 100% !important;
        min-height: 66px;
        padding: calc(10px + env(safe-area-inset-top)) 14px 10px 14px !important;
        background: #075E54 !important;
        z-index: 30 !important;
    }


    .chatbot-header-info {
        min-width: 0;
    }


    .chatbot-avatar {
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
    }


    .chatbot-title {
        font-size: 16px;
    }


    .chatbot-status {
        font-size: 11px;
    }


    .chatbot-close {
        flex-shrink: 0;
        font-size: 29px;
    }


    /*
       MESSAGE AREA
       Only this section is allowed to grow/shrink
    */
    .chatbot-messages {
        position: relative !important;
        flex: 1 1 0 !important;
        min-height: 0 !important;
        width: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 14px !important;
        background: #f3f3f3 !important;
        -webkit-overflow-scrolling: touch;
    }


    .chat-message {
        max-width: 90%;
        font-size: 14px;
    }


    /*
       CHAT FOOTER
       Always remains visible
    */
    .chatbot-input-area {
        position: relative !important;
        flex: 0 0 auto !important;
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center !important;
        gap: 7px !important;
        width: 100% !important;
        min-height: 66px !important;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom)) 10px !important;
        margin: 0 !important;
        background: #ffffff !important;
        border-top: 1px solid #eeeeee !important;
        visibility: visible !important;
        z-index: 30 !important;
    }


    /*
       INPUT
    */
    #chatbot-input {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: auto !important;
        height: 46px !important;
        padding: 10px 14px !important;
        font-size: 16px !important;
        box-sizing: border-box !important;
    }


    /*
       MICROPHONE
    */
    .chatbot-mic {
        flex: 0 0 46px !important;
        width: 46px !important;
        height: 46px !important;
        margin: 0 !important;
    }


    /*
       SEND BUTTON
    */
    #chatbot-send {
        flex: 0 0 auto !important;
        height: 46px !important;
        margin: 0 !important;
        padding: 0 16px !important;
    }


    /*
       Floating button
    */
    .chatbot-floating-btn {
        left: 14px !important;
        bottom: 85px !important;
        width: 54px !important;
        height: 54px !important;
        z-index: 2147483645 !important;
    }
}


/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 480px) {

    .chatbot-header {
        min-height: 62px;
        padding: calc(9px + env(safe-area-inset-top)) 12px 9px 12px !important;
    }


    .chatbot-avatar {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }


    .chatbot-title {
        font-size: 15px;
    }


    .chatbot-messages {
        padding: 12px !important;
    }


    .chat-message {
        max-width: 91%;
        font-size: 14px;
    }


    .chatbot-input-area {
        min-height: 64px !important;
        gap: 6px !important;
        padding: 9px 9px calc(9px + env(safe-area-inset-bottom)) 9px !important;
    }


    #chatbot-input {
        height: 45px !important;
        padding: 9px 13px !important;
    }


    .chatbot-mic {
        width: 45px !important;
        height: 45px !important;
        flex-basis: 45px !important;
    }


    #chatbot-send {
        height: 45px !important;
        padding: 0 15px !important;
    }
}


/* =========================================================
   VERY SMALL MOBILE
   ========================================================= */

@media (max-width: 380px) {

    .chatbot-header {
        min-height: 60px;
        padding: calc(8px + env(safe-area-inset-top)) 10px 8px 10px !important;
    }


    .chatbot-avatar {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }


    .chatbot-title {
        font-size: 14px;
    }


    .chatbot-status {
        font-size: 10px;
    }


    .chatbot-messages {
        padding: 10px !important;
    }


    .chat-message {
        max-width: 92%;
        font-size: 13px;
        padding: 8px 10px;
    }


    .chatbot-input-area {
        min-height: 60px !important;
        gap: 5px !important;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) 8px !important;
    }


    #chatbot-input {
        height: 44px !important;
        padding: 8px 11px !important;
        font-size: 16px !important;
    }


    .chatbot-mic {
        width: 44px !important;
        height: 44px !important;
        flex-basis: 44px !important;
    }


    #chatbot-send {
        height: 44px !important;
        padding: 0 13px !important;
        font-size: 14px !important;
    }
}