﻿* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    /*font-family: 'Nunito', sans-serif;*/
    font-weight: 400;
    font-size: 100%;
    background: #F1F1F1;
}

*, html {
    --primaryGradient: linear-gradient(93.12deg, #6F91D3 0%, #3A5CA3 70%, #082971 100%);
    --secondaryGradient: linear-gradient(93.12deg, #6F91D3 0%, #3A5CA3 70%, #082971 100%);
    --primaryBoxShadow: 0px 10px 15px rgba(0, 0, 0, 0.1);
    --secondaryBoxShadow: 0px -10px 15px rgba(0, 0, 0, 0.1);
    --primary: #FF7FA2;
}

/* CHATBOX */
.chatbox {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999 !important;
    font-family: 'Nunito', sans-serif;
    z-index: 2147483647 !important; /* giá trị z-index cao nhất */
}


/* CONTENT CLOSED */
.chatbox__support {
    display: none; /* Mặc định ẩn hẳn */
    flex-direction: column;
    background: #f9f9f9;
    height: 600px;
    width: 450px;
    box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.1);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border-bottom-right-radius: 20px;
    border-bottom-left-radius: 20px;
    z-index: 9999 !important;
    opacity: 0; /* Sẵn sàng cho hoạt ảnh */
    transition: opacity .5s ease-in-out;
    margin-bottom: 10px;
}

    /* Mở chat: hiển thị và fade-in */
    .chatbox__support.chatbox--active {
        display: flex; /* Bật lại flex khi mở */
        opacity: 1;
    }


/* BUTTON */
.chatbox__button {
    text-align: right;
}

.send__button {
    padding: 6px;
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
}

/* HEADER */
.chatbox__header {
    position: sticky;
    top: 0;
    background: orange;
}

/* HEADER */
.chatbox__header {
    background: var(--primaryGradient);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: var(--primaryBoxShadow);
}

.chatbox__image--header {
    margin-right: 10px;
}

.chatbox__heading--header {
    font-size: .9rem;
    color: white;
}

.chatbox__description--header {
    font-size: .9rem;
    color: white;
}

/* MESSAGES */
.chatbox__messages {
    padding: 20px 20px 20px 20px;
    margin-top: auto;
    display: flex;
    overflow-y: scroll;
    flex-direction: column-reverse;
}

.messages__item {
    margin-top: 10px;
    background: #fff;
    padding: 8px 12px;
    max-width: 70%;
    width: fit-content;
    border: 1px solid #082971;
}

.messages__item--visitor,
.messages__item--typing {
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border-bottom-right-radius: 20px;
}

.messages__item--operator {
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border-bottom-left-radius: 20px;
    background: var(--primary);
    color: white;
    margin-left: auto;
}

/* FOOTER */
.chatbox__footer {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px;
    background: var(--secondaryGradient);
    box-shadow: var(--secondaryBoxShadow);
    border-bottom-right-radius: 20px;
    border-bottom-left-radius: 20px;
    margin-top: 20px;
}

    .chatbox__footer input {
        width: 80%;
        border: none;
        padding: 10px 10px;
        border-radius: 30px;
        text-align: left;
    }

.chatbox__send--footer {
    color: white;
}

.chatbox__button button,
.chatbox__button button:focus,
.chatbox__button button:visited {
    padding: 0px;
    background: white;
    border: none;
    outline: none;
    border-top-left-radius: 50px;
    border-top-right-radius: 50px;
    border-bottom-left-radius: 50px;
    box-shadow: 0px 10px 15px rgba(0.3, 0.3, 0.3, 0.3);
    cursor: pointer;
}

/* SUGGESTIONS */
.suggestion-wrapper {
    margin: 10px 0;
    margin-bottom: 0px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.chat-suggestion {
    background: #eef6ff;
    border: 1px solid #ccc;
    padding: 6px 12px;
    border-radius: 18px;
    cursor: pointer;
    transition: background 0.2s;
}

    .chat-suggestion:hover {
        background: #d7ebff;
    }

/* TYPING EFFECT - BA CHẤM NHẢY */
.thinking .content {
    display: inline-block;
    position: relative;
    font-size: 16px;
    color: #999;
    letter-spacing: 2px;
}

    .thinking .content::after {
        content: "...";
        animation: blink 1s infinite steps(1);
    }

@keyframes blink {
    0% {
        content: ".";
    }

    33% {
        content: "..";
    }

    66% {
        content: "...";
    }

    100% {
        content: "....";
    }
}

/* --- Cập nhật CSS của thẻ đề xuất chatbot ---*/
.chatbox__suggestions-fixed {
    position: sticky;
    bottom: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 15px;
    background: #fff;
    border-top: 1px solid #ccc;
    justify-content: center;
    z-index: 10;
}

.chatbox__suggestions-fixed .chat-suggestion {
    background: #eef6ff;
    border: 1px solid #ccc;
    padding: 6px 12px;
    border-radius: 18px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

    .chatbox__suggestions-fixed .chat-suggestion:hover {
        background: #d7ebff;
    }


#introVideo {
    width: 20%; /* nhỏ còn 1/3 chiều rộng khung chat */
    margin: 0 auto; /* căn giữa ngang */
    display: block; /* để margin hoạt động */
    border: none; /* bỏ viền (mặc định video không có viền, nhưng thêm để chắc chắn) */
    padding-top: 20px;
}


    #introVideo.fade-out {
        opacity: 0;
    }

.message-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 12px;
}

    .message-wrapper.operator {
        align-items: flex-end; /* User bên phải */
    }

.message-timestamp {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    margin-left: 12px;
    margin-right: 12px;
}
.chatbox__close-btn {
    display: none;
}
.chatbox__button img {
    width: 70px;
    transition: width 0.3s ease;
}
.suggestion-toggle-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border-radius: 10px;
}

/* Nút “Hiển thị thẻ” khi THU GỌN */
.suggestion-toggle-btn {
    background: linear-gradient(93.12deg, #6F91D3 0%, #3A5CA3 70%, #3A5CA3 100%);
    color: #fff;
    padding: 5px 10px;
    font-size: 13px;
    border-radius: 14px;
    border: 1px solid #ccc;
    cursor: pointer;
    align-self: flex-start;
}
.suggestion-close-btn {
    align-self: flex-end;
    background: none;
    border: none;
    font-size: 20px;
    color: #3A5CA3; /* ✅ màu xanh yêu cầu */
    cursor: pointer;
    margin-bottom: 4px;
}
.chatbox__close-btn {
    display: block;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

    .chatbox__close-btn button {
        background: none;
        border: none;
        font-size: 24px;
        color: white;
        cursor: pointer;
    }


@media (max-width: 768px) {
    #introVideo {
        display: none !important;
    }
    .chatbox {
        bottom: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
    }
    body.chatbot-open #mainNav {
        display: none !important;
    }

    /* Tùy chọn: ẩn footer hoặc các thành phần khác nếu cần */
    body.chatbot-open footer {
        display: none !important;
    }
    .chatbox__support {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        z-index: 99999; /* cao hơn header */
        border-radius: 0;
        margin: 0; /* ✅ thêm dòng này */
        padding: 0; /* ✅ thêm dòng này */
        box-shadow: none;
        flex-direction: column;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease-in-out;
        box-sizing: border-box; /* ✅ thêm dòng này */
    }


        .chatbox__support.chatbox--active {
            visibility: visible;
            opacity: 1;
            pointer-events: auto;
            display: flex;
        }

    .chatbox__messages {
        flex: 1; /* chiếm hết không gian còn lại */
        overflow-y: auto;
        padding: 10px;
        margin-top: 0; /* tránh bị đẩy xuống nếu có */
    }



    .chatbox__close-btn {
        display: block;
        position: absolute;
        top: 10px;
        right: 10px;
        z-index: 1000;
    }

        .chatbox__close-btn button {
            background: none;
            border: none;
            font-size: 24px;
            color: white;
            cursor: pointer;
        }
    .chatbox__button button,
    .chatbox__button button:focus,
    .chatbox__button button:visited {
        padding: 0px;
        background: white;
        border: none;
        outline: none;
        border-top-left-radius: 50px;
        border-top-right-radius: 50px;
        border-bottom-left-radius: 50px;
        box-shadow: 0px 10px 15px rgba(0.1, 0.1, 0.1, 0.1);
        cursor: pointer;
    }

    .chatbox__button {
        text-align: right;
        position: fixed;
        bottom: 10px;
        right: 10px;
        z-index: 9999;
    }

        .chatbox__button img {
            width: 50px;
        }

    .suggestion-wrapper {
        background-color: #fff; /* hoặc giữ màu mặc định giống desktop */
        justify-content: center;
    }

        .suggestion-wrapper .chat-suggestion {
            background-color: #e6e6e6;
            color: #333;
            border: 1px solid #ccc;
        }

            .suggestion-wrapper .chat-suggestion:hover {
                background-color: #ddd;
            }


            .suggestion-wrapper .chat-suggestion:hover {
                background-color: #ffffff33;
            }

    .suggestion-close-btn {
        color: #fff; /* dấu X trong mobile cũng trắng cho đồng bộ */
    }

    .suggestion-toggle-btn {
        background: linear-gradient(93.12deg, #6F91D3 0%, #3A5CA3 70%, #082971 100%);
        color: #fff;
        padding: 5px 10px;
        font-size: 13px;
        border-radius: 14px;
    }

    /* Nút đóng gợi ý */
    .suggestion-close-btn {
        align-self: flex-end;
        background: none;
        border: none;
        font-size: 20px;
        color: #3A5CA3; /* ✅ màu xanh yêu cầu */
        cursor: pointer;
        margin-bottom: 4px;
    }
    .chatbox__footer {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 10px 10px;
        background: var(--secondaryGradient);
        box-shadow: var(--secondaryBoxShadow);
        border-bottom-right-radius: 10px;
        border-bottom-left-radius: 10px;
        margin-top: 20px;
    }
    .chatbox__suggestions-fixed {
        position: sticky;
        bottom: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        background: #fff;
        border-top: 1px solid #ccc;
        justify-content: center;
        z-index: 10;
    }
}

@media (min-width: 1200px) and (max-width: 1399.98px) {
    .chatbox__support {
        height: 300px;
        width: 300px;

    }

        .chatbox__support.chatbox--active {
            display: flex;
            opacity: 1;
        }
}

@keyframes shake {
    0% {
        transform: rotate(0deg);
    }


    30% {
        transform: rotate(-5deg);
    }


    60% {
        transform: rotate(5deg);
    }

    90% {
        transform: rotate(-5deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

.shake-animation {
    animation: shake 1s ease-in-out 5;
}

.chatbox__start-wrapper {
    text-align: center;
    padding: 10px;
    background-color: #f9f9f9;
    border-bottom-right-radius: 10px;
    border-bottom-left-radius: 10px;
}

.chatbox__start-button {
    background: linear-gradient(93.12deg, #6F91D3 0%, #3A5CA3 70%, #082971 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-block;
    margin-top: 10px;
}

@media (max-width: 768px) {
    body.chatbot-open .chatbox__button {
        display: none !important;
    }
}


@media (min-width: 1200px) and (max-width: 1399.98px) {
    .chatbox__support {
        width: 450px !important; /* ✅ Tăng chiều rộng khung chat */
        height: 600px !important; /* ✅ Tăng chiều cao nếu cần */
        border-radius: 20px;
        bottom: 100px;
        right: 30px;
    }

    .chatbox__messages {
        max-height: 400px; /* hoặc giá trị phù hợp */
        overflow-y: auto;
    }

    .chatbox__footer input {
        font-size: 14px;
    }

    .chatbox__suggestions-fixed .chat-suggestion {
        font-size: 14px;
        padding: 6px 10px;
    }
}

.chatbot-thought {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: #333;
    padding: 8px 12px;
    border-radius: 15px;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease-in-out;
    z-index: 9999;
}

    .chatbot-thought::after {
        content: "";
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        border: 6px solid transparent;
        border-top-color: #fff;
    }


/*Kích thước chatbot cho laptop Hoàng*/
@media (max-height: 800px) and (min-width: 768px) {
    .chatbox__support {
        height: 500px !important;
        width: 350px !important;
        bottom: 30px !important;
        right: 30px !important;
        border-radius: 20px !important;
    }

    /* Đảm bảo các phần bên trong không tràn */
    .chatbox__messages {
        max-height: 250px;
        overflow-y: auto;
    }

    .chatbox__footer input {
        font-size: 13px;
    }

    .chatbox__suggestions-fixed .chat-suggestion {
        font-size: 13px;
        padding: 4px 10px;
    }
}

@media (max-width: 1024px) {
    .chatbot-thought {
        font-size: 0.6rem;
        padding: 4px 8px;
        border-radius: 10px;
    }

        .chatbot-thought::after {
            border-width: 5px;
        }
}

