﻿/* Importing Google Fonts - Chakra Petch*/
@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Chakra Petch', 'Lato', sans-serif;
}

body {
    background-image: url(https://m.hello3dworld.com/mobile/images/BG-1.jpg);
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: center;
    background-size: cover;
}

#chatbot-toggler {
    position: fixed;
    bottom: 50px;
    right: 20px;
    border: none;
    background: none;
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    z-index: 9999;
}

.chatbot-greeting {
    padding: 6px 12px;
    margin-top: -20px;
    border-radius: 60px;
    background: linear-gradient(to right, #fd321b, #019d5e);
    color: white;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.5s ease-out, opacity 0.3s ease-out;
    animation: showAndHide 10s infinite;
    z-index: 9999;
}

@keyframes showAndHide {
    0% {
        max-width: 0;
        opacity: 0;
    }

    10% {
        max-width: 500px;
        opacity: 1;
    }

    60% {
        max-width: 500px;
        opacity: 1;
    }

    70% {
        max-width: 0;
        opacity: 0;
    }

    100% {
        max-width: 0;
        opacity: 0;
    }
}

body.show-chatbot #chatbot-toggler {
    //transform: rotate(90deg);
}

#chatbot-toggler span {
    color: #fff;
    position: absolute;
}

.chatbot-popup {
    position: fixed;
    right: 25px;
    bottom: 25px;
    width: 420px;
    background: #fff;
    overflow: hidden;
    border-radius: 25px;
    opacity: 0;
    transform: scale(0.2);
    transform-origin: bottom right;
    pointer-events: none;
    box-shadow: 0 0 128px 0 rgba(0, 0, 0, 0.1), 0 32px 64px -48px rgba(0, 0, 0, 0.5);
    transition: all 0.1s ease;
    z-index: 9999;
}

body.show-chatbot .chatbot-popup {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.chat-header {
    display: flex;
    align-items: center;
    background: linear-gradient(to right, #fd321b, #019d5e);
    padding: 15px 22px;
    justify-content: space-between;
    height: 45px;
}

.chat-header .header-info {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.header-info .chatbot-logo {
    display: block;
    height: 25px;
    width: 25px;
    padding: 3px;
    fill: #FD321B;
    flex-shrink: 0;
    background: #fff;
    border-radius: 50%;
}

.header-info .logo-text {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    justify-content: center;
    width: 100%;
}

.chat-header #close-chatbot {
    border: none;
    color: #fff;
    height: 30px;
    width: 30px;
    font-size: 1.5rem;
    margin-right: -10px;
    padding-top: 2px;
    cursor: pointer;
    border-radius: 50%;
    background: none;
    transition: 0.2s ease;
}

.chat-header #close-chatbot:hover {
    background: #007f4c;
}

.chat-body {
    padding: 25px 22px;
    display: flex;
    gap: 20px;
    height: 460px;
    min-width: 200px;
    margin-bottom: 82px;
    overflow-y: auto;
    max-height: calc(100vh - 127px);
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: #ffe0dc transparent; /* #ffeff1 - cũ: #ccccf5 */
}

.chat-body .message {
    display: flex;
    gap: 6px;
    align-items: center;
    line-height: 1.5;
}

.chat-body .bot-message .bot-avatar {
    display: block;
    height: 25px;
    width: 25px;
    padding: 3px;
    fill: #03C979; /* #18F700 - cũ:#fff */
    flex-shrink: 0;
    margin-bottom: 2px;
    align-self: flex-end;
    background: #FD321B;
    border-radius: 50%;    
}

.chat-body .user-message {
    flex-direction: column;
    align-items: flex-end;
}

.chat-body .message .message-text {
    padding: 12px 12px;
    max-width: 86%;
    font-size: 14px;
    background: #ffe0dc;
}

.chat-body .bot-message.thinking .message-text {
    padding: 2px 16px;
}

.chat-body .bot-message .message-text {
    background: #ececec;
    border-radius: 13px 13px 13px 3px;
    color: #fd321b;
}

.chat-body .user-message .message-text {
    color: #019d5e;
    background: #ececec;
    border-radius: 13px 13px 3px 13px;
}

.chat-body .bot-message .thinking-indicator {
    display: flex;
    gap: 4px;
    padding-block: 15px;
}

.chat-body .bot-message .thinking-indicator .dot {
    height: 6px;
    width: 6px;
    opacity: 0.7;
    border-radius: 50%;
    background: #6F6BC2;
    animation: dotPulse 1.8s ease-in-out infinite;
}

.chat-body .bot-message .thinking-indicator .dot:nth-child(1) {
    animation-delay: 0.2s;
}

.chat-body .bot-message .thinking-indicator .dot:nth-child(2) {
    animation-delay: 0.3s;
}

.chat-body .bot-message .thinking-indicator .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotPulse {
    0%, 44% {
        transform: translateY(0);
    }

    28% {
        opacity: 0.4;
        transform: translateY(-4px);
    }

    44% {
        opacity: 0.2;
    }
}

.chat-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: #fff;
    padding: 15px 22px 20px;
}

.chat-footer .chat-form {
    display: flex;
    position: relative;
    align-items: center;
    background: #fff;
    border-radius: 32px;
    outline: 1px solid #ececec;
}

.chat-footer .chat-form:focus-within {
    outline: 2px solid #FD321B;
}

.chat-form .message-input {
    border: none;
    outline: none;
    height: 47px;
    width: 100%;
    resize: none;
    max-height: 180px;
    white-space: pre-line;
    font-size: 0.95rem;
    padding: 14px 0 13px 18px;
    border-radius: inherit;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    color: #019d5e;
}

.chat-form .message-input:hover {
    scrollbar-color: #ffe0dc transparent;
}

.chat-form .chat-controls {
    display: flex;
    height: 47px;
    gap: 3px;
    align-items: center;
    align-self: flex-end;
    padding-right: 6px;
}

.chat-form .chat-controls button {
    height: 35px;
    width: 35px;
    border: none;
    font-size: 1.15rem;
    cursor: pointer;
    color: #03C979; /* #3ab22d - cũ: #706DB0*/
    background: none;
    border-radius: 50%;
    transition: 0.2s ease;
}

.chat-form .chat-controls #send-message {
    color: #fff;
    display: none;
    background: #FD321B;
}

.chat-form .message-input:valid~.chat-controls #send-message {
    display: block;
}

.chat-form .chat-controls #send-message:hover {
    background: #ff0024; /* #ff0024 - cũ: #3d39ac */
}

#emoji-picker {
    font-size: 30px;
    background: linear-gradient(to right, #fd321b, #019d5e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    border: none;
    cursor: pointer;
}

.material-symbols-rounded {
    font-family: 'Material Symbols Rounded';
    font-weight: normal;
    font-style: normal;
    font-size: 30px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

/* Gradient icon */
.gradient-icon {
    background: linear-gradient(to right, #fd321b, #019d5e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

em-emoji-picker {
    position: absolute;
    left: 50%;
    top: -337px;
    width: 100%;
    max-width: 350px;
    max-height: 330px;
    visibility: hidden;
    transform: translateX(-50%);
}

body.show-emoji-picker em-emoji-picker {
    visibility: visible;
}

/* Responsive media query for mobile screens */
@media (max-width: 520px) {
    #chatbot-toggler {
        right: 5px;
        bottom: 50px;
    }

    .chatbot-popup {
        right: 0;
        bottom: 0;
        height: 100%;
        border-radius: 0;
        width: 100%;
    }

    .chatbot-popup .chat-header {
        padding: 12px 15px;
    }

    .chat-body {
        height: calc(90% - 55px);
        padding: 25px 15px;
    }

    .chat-footer {
        padding: 10px 15px 15px;
    }
}
