/* =========================================================
   PMB STIFAR AI CHATBOT
   TIFA - Chatbot PMB STIFAR
   ========================================================= */


/* =========================================================
   VARIABLES
   ========================================================= */

:root {
    --pmb-chat-primary: #06a76e;
    --pmb-chat-primary-dark: #058357;
    --pmb-chat-navy: #071a33;
    --pmb-chat-navy-light: #0c315a;
    --pmb-chat-bg: #f6f8fb;

    --pmb-chat-radius: 18px;
    --pmb-chat-shadow: 0 18px 55px rgba(0, 0, 0, .24);
}


/* =========================================================
   GLOBAL
   ========================================================= */

#pmb-chatbot {
    font-family: Nunito, Arial, sans-serif;
}

#pmb-chatbot *,
#pmb-chatbot *::before,
#pmb-chatbot *::after {
    box-sizing: border-box;
}


/* =========================================================
   FLOATING CHATBOT BUTTON
   ========================================================= */

#pmb-chatbot .pmb-chat-toggle {
    position: fixed;

    /* Posisi chatbot di atas WhatsApp */
    right: 24px;
    bottom: 130px;

    z-index: 99998;

    /* UKURAN LOGO DESKTOP */
    width: 90px;
    height: 90px;

    min-width: 90px;
    min-height: 90px;

    padding: 0;
    margin: 0;

    border: none;
    outline: none;

    border-radius: 0;

    background: transparent !important;

    box-shadow: none !important;

    color: inherit;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    appearance: none;
    -webkit-appearance: none;

    transition:
        transform .22s ease,
        opacity .22s ease;
}


/* =========================================================
   LOGO FLOATING CHATBOT
   ========================================================= */

#pmb-chatbot .pmb-chat-toggle img {
    width: 90px !important;
    height: 90px !important;

    min-width: 90px !important;
    min-height: 90px !important;

    max-width: 90px !important;
    max-height: 90px !important;

    margin: 0 !important;
    padding: 0 !important;

    border: none !important;
    outline: none !important;

    background: transparent !important;

    object-fit: contain !important;

    display: block !important;

    box-shadow: none !important;
}


/* =========================================================
   HOVER LOGO
   ========================================================= */

#pmb-chatbot .pmb-chat-toggle:hover {
    transform: translateY(-4px) scale(1.06);

    background: transparent !important;

    box-shadow: none !important;
}


#pmb-chatbot .pmb-chat-toggle:focus,
#pmb-chatbot .pmb-chat-toggle:active {
    outline: none;

    background: transparent !important;

    box-shadow: none !important;
}


/* =========================================================
   CHAT BADGE
   ========================================================= */

#pmb-chatbot .pmb-chat-badge {
    position: absolute;

    top: 2px;
    right: 2px;

    width: 19px;
    height: 19px;

    border-radius: 50%;

    background: #ff4d4f;

    border: 2px solid #fff;

    display: none;

    z-index: 2;
}


/* =========================================================
   CHAT WINDOW
   ========================================================= */

#pmb-chatbot .pmb-chat-window {
    position: fixed;

    /*
     * Window berada di atas logo chatbot.
     */
    right: 24px;
    bottom: 225px;

    z-index: 99999;

    width: min(390px, calc(100vw - 28px));

    height: min(610px, calc(100vh - 240px));

    min-height: 430px;

    background: #fff;

    border-radius: var(--pmb-chat-radius);

    overflow: hidden;

    border: 1px solid rgba(7, 26, 51, .08);

    box-shadow: var(--pmb-chat-shadow);

    display: none;

    flex-direction: column;

    isolation: isolate;
}


/* =========================================================
   CHAT WINDOW OPEN
   ========================================================= */

#pmb-chatbot .pmb-chat-window.open {
    display: flex;

    animation: pmbChatIn .18s ease-out;
}


/* =========================================================
   CHAT WINDOW ANIMATION
   ========================================================= */

@keyframes pmbChatIn {

    from {
        opacity: 0;
        transform: translateY(10px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

}


/* =========================================================
   CHAT HEADER
   ========================================================= */

#pmb-chatbot .pmb-chat-head {
    flex: 0 0 auto;

    background:
        linear-gradient(
            135deg,
            var(--pmb-chat-navy),
            var(--pmb-chat-navy-light)
        );

    color: #fff;

    padding: 15px 16px;

    display: flex;
    align-items: center;

    gap: 11px;
}


/* =========================================================
   CHAT AVATAR
   ========================================================= */

#pmb-chatbot .pmb-chat-avatar {
    width: 40px !important;
    height: 40px !important;

    min-width: 40px !important;
    min-height: 40px !important;

    max-width: 40px !important;
    max-height: 40px !important;

    flex: 0 0 40px;

    border-radius: 50%;

    background: #fff;

    color: var(--pmb-chat-primary);

    display: flex;

    align-items: center;
    justify-content: center;

    overflow: hidden;
}


/* =========================================================
   HEADER LOGO
   ========================================================= */

#pmb-chatbot .pmb-chat-avatar img {
    width: 30px !important;
    height: 30px !important;

    min-width: 30px !important;
    min-height: 30px !important;

    max-width: 30px !important;
    max-height: 30px !important;

    object-fit: contain !important;

    display: block !important;

    margin: 0 !important;
    padding: 0 !important;

    border: 0 !important;
}


/* =========================================================
   HEADER TITLE
   ========================================================= */

#pmb-chatbot .pmb-chat-head strong {
    display: block;

    font-size: 15px;

    line-height: 1.2;

    font-weight: 700;
}


/* =========================================================
   ONLINE STATUS
   ========================================================= */

#pmb-chatbot .pmb-chat-status {
    display: block;

    font-size: 11px;

    opacity: .78;

    margin-top: 3px;

    line-height: 1.3;
}


/* =========================================================
   CLOSE BUTTON
   ========================================================= */

#pmb-chatbot .pmb-chat-close {
    margin-left: auto;

    width: 34px;
    height: 34px;

    padding: 0;

    border: 0;

    border-radius: 8px;

    background: transparent;

    color: #fff;

    font-size: 22px;

    line-height: 1;

    cursor: pointer;

    display: flex;

    align-items: center;
    justify-content: center;

    transition: background .2s ease;
}


#pmb-chatbot .pmb-chat-close:hover {
    background: rgba(255, 255, 255, .12);
}


/* =========================================================
   MESSAGE AREA
   ========================================================= */

#pmb-chatbot .pmb-chat-messages {
    flex: 1 1 auto;

    min-height: 0;

    overflow-y: auto;

    overflow-x: hidden;

    padding: 15px;

    background: var(--pmb-chat-bg);

    scroll-behavior: smooth;

    -webkit-overflow-scrolling: touch;
}


/* =========================================================
   CUSTOM SCROLLBAR
   ========================================================= */

#pmb-chatbot .pmb-chat-messages::-webkit-scrollbar {
    width: 6px;
}


#pmb-chatbot .pmb-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}


#pmb-chatbot .pmb-chat-messages::-webkit-scrollbar-thumb {
    background: #cfd7df;

    border-radius: 10px;
}


/* =========================================================
   MESSAGE
   ========================================================= */

#pmb-chatbot .pmb-chat-msg {
    max-width: 88%;

    margin: 0 0 11px;

    display: flex;

    flex-direction: column;
}


#pmb-chatbot .pmb-chat-msg.user {
    margin-left: auto;

    align-items: flex-end;
}


#pmb-chatbot .pmb-chat-msg.bot {
    align-items: flex-start;
}


/* =========================================================
   MESSAGE BUBBLE
   ========================================================= */

#pmb-chatbot .pmb-chat-bubble {
    padding: 10px 12px;

    border-radius: 14px;

    font-size: 13.5px;

    line-height: 1.5;

    white-space: pre-wrap;

    word-break: break-word;

    overflow-wrap: anywhere;
}


/* BOT */

#pmb-chatbot .pmb-chat-msg.bot .pmb-chat-bubble {
    background: #fff;

    color: #263238;

    border: 1px solid #e6ebf0;

    border-top-left-radius: 5px;
}


/* USER */

#pmb-chatbot .pmb-chat-msg.user .pmb-chat-bubble {
    background: var(--pmb-chat-primary);

    color: #fff;

    border-top-right-radius: 5px;
}


/* =========================================================
   MESSAGE TIME
   ========================================================= */

#pmb-chatbot .pmb-chat-time {
    font-size: 9px;

    color: #8995a3;

    margin-top: 3px;

    padding: 0 4px;
}


/* =========================================================
   QUICK BUTTONS
   ========================================================= */

#pmb-chatbot .pmb-chat-quick {
    flex: 0 0 auto;

    padding: 8px 12px 5px;

    background: #fff;

    display: flex;

    gap: 6px;

    overflow-x: auto;

    border-top: 1px solid #edf0f3;

    -webkit-overflow-scrolling: touch;
}


#pmb-chatbot .pmb-chat-quick::-webkit-scrollbar {
    display: none;
}


#pmb-chatbot .pmb-chat-quick button {
    flex: 0 0 auto;

    border: 1px solid #dce7e2;

    background: #f8fffc;

    color: #08794f;

    border-radius: 18px;

    padding: 7px 10px;

    font-size: 11px;

    line-height: 1.2;

    cursor: pointer;

    transition:
        background .2s ease,
        border-color .2s ease,
        transform .2s ease;
}


#pmb-chatbot .pmb-chat-quick button:hover {
    background: #ecfbf5;

    border-color: #b8dfd0;

    transform: translateY(-1px);
}


/* =========================================================
   INPUT AREA
   ========================================================= */

#pmb-chatbot .pmb-chat-input {
    flex: 0 0 auto;

    display: flex;

    align-items: flex-end;

    gap: 8px;

    padding: 10px;

    background: #fff;

    border-top: 1px solid #edf0f3;
}


/* =========================================================
   TEXTAREA
   ========================================================= */

#pmb-chatbot .pmb-chat-input textarea {
    flex: 1 1 auto;

    width: 100%;

    resize: none;

    min-height: 42px;

    max-height: 105px;

    border: 1px solid #dbe1e6;

    border-radius: 12px;

    padding: 10px 11px;

    font-size: 13px;

    line-height: 1.4;

    outline: none;

    font-family: inherit;

    background: #fff;

    color: #263238;

    transition:
        border-color .2s ease,
        box-shadow .2s ease;
}


#pmb-chatbot .pmb-chat-input textarea::placeholder {
    color: #9aa5af;
}


#pmb-chatbot .pmb-chat-input textarea:focus {
    border-color: #75c9a7;

    box-shadow:
        0 0 0 3px rgba(6, 167, 110, .09);
}


/* =========================================================
   SEND BUTTON
   ========================================================= */

#pmb-chatbot .pmb-chat-send {
    flex: 0 0 42px;

    width: 42px;
    height: 42px;

    padding: 0;

    border: 0;

    border-radius: 12px;

    background: var(--pmb-chat-primary);

    color: #fff;

    cursor: pointer;

    display: flex;

    align-items: center;
    justify-content: center;

    transition:
        background .2s ease,
        transform .2s ease;
}


#pmb-chatbot .pmb-chat-send:hover {
    background: var(--pmb-chat-primary-dark);

    transform: translateY(-1px);
}


#pmb-chatbot .pmb-chat-send:disabled {
    opacity: .55;

    cursor: not-allowed;

    transform: none;
}


/* =========================================================
   DISCLAIMER
   ========================================================= */

#pmb-chatbot .pmb-chat-disclaimer {
    flex: 0 0 auto;

    font-size: 9px;

    line-height: 1.3;

    color: #8b96a3;

    text-align: center;

    padding: 0 12px 8px;

    background: #fff;
}


/* =========================================================
   TYPING INDICATOR
   ========================================================= */

#pmb-chatbot .pmb-chat-typing {
    display: inline-flex;

    gap: 3px;

    padding: 12px 14px !important;
}


#pmb-chatbot .pmb-chat-typing span {
    width: 5px;

    height: 5px;

    background: #93a0ac;

    border-radius: 50%;

    animation: pmbDot 1s infinite ease-in-out;
}


#pmb-chatbot .pmb-chat-typing span:nth-child(2) {
    animation-delay: .15s;
}


#pmb-chatbot .pmb-chat-typing span:nth-child(3) {
    animation-delay: .3s;
}


@keyframes pmbDot {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: .5;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }

}


/* =========================================================
   LINKS
   ========================================================= */

#pmb-chatbot .pmb-chat-link {
    color: inherit;

    text-decoration: underline;

    word-break: break-all;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 576px) {

    /* -----------------------------------------
       FLOATING CHATBOT
       ----------------------------------------- */

    #pmb-chatbot .pmb-chat-toggle {

        right: 15px;

        /*
         * WhatsApp:
         * bottom: 40px
         *
         * Chatbot:
         * bottom: 105px
         */

        bottom: 105px;

        /* UKURAN MOBILE */
        width: 80px;
        height: 80px;

        min-width: 80px;
        min-height: 80px;
    }


    /* -----------------------------------------
       LOGO MOBILE
       ----------------------------------------- */

    #pmb-chatbot .pmb-chat-toggle img {

        width: 80px !important;
        height: 80px !important;

        min-width: 80px !important;
        min-height: 80px !important;

        max-width: 80px !important;
        max-height: 80px !important;
    }


    /* -----------------------------------------
       CHAT WINDOW MOBILE
       ----------------------------------------- */

    #pmb-chatbot .pmb-chat-window {

        right: 10px;

        bottom: 190px;

        width: calc(100vw - 20px);

        height: calc(100vh - 215px);

        min-height: 420px;

        border-radius: 16px;
    }


    /* -----------------------------------------
       HEADER MOBILE
       ----------------------------------------- */

    #pmb-chatbot .pmb-chat-head {
        padding: 13px 14px;
    }


    /* -----------------------------------------
       MESSAGE MOBILE
       ----------------------------------------- */

    #pmb-chatbot .pmb-chat-messages {
        padding: 12px;
    }


    #pmb-chatbot .pmb-chat-msg {
        max-width: 92%;
    }


    #pmb-chatbot .pmb-chat-bubble {
        font-size: 13px;
    }


    /* -----------------------------------------
       INPUT MOBILE
       ----------------------------------------- */

    #pmb-chatbot .pmb-chat-input {
        padding: 8px;
    }


    #pmb-chatbot .pmb-chat-input textarea {
        font-size: 13px;

        min-height: 40px;
    }


    #pmb-chatbot .pmb-chat-send {

        width: 40px;
        height: 40px;

        flex-basis: 40px;
    }

}


/* =========================================================
   VERY SMALL MOBILE
   ========================================================= */

@media (max-width: 380px) {

    #pmb-chatbot .pmb-chat-toggle {

        right: 10px;

        bottom: 100px;

        width: 70px;
        height: 70px;

        min-width: 70px;
        min-height: 70px;
    }


    #pmb-chatbot .pmb-chat-toggle img {

        width: 70px !important;
        height: 70px !important;

        min-width: 70px !important;
        min-height: 70px !important;

        max-width: 70px !important;
        max-height: 70px !important;
    }


    #pmb-chatbot .pmb-chat-window {

        right: 8px;

        bottom: 175px;

        width: calc(100vw - 16px);
    }

}


/* =========================================================
   ACCESSIBILITY
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    #pmb-chatbot .pmb-chat-toggle,
    #pmb-chatbot .pmb-chat-send,
    #pmb-chatbot .pmb-chat-quick button {
        transition: none;
    }


    #pmb-chatbot .pmb-chat-window.open {
        animation: none;
    }


    #pmb-chatbot .pmb-chat-typing span {
        animation: none;
    }

}