/* =========================================================
   SUPPORT BOT
   ========================================================= */

#support-bot {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 99999;
    font-family: Arial, sans-serif;
}

/* =========================================================
   NÚT MỞ CHAT
   ========================================================= */

#support-bot-button {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: #198754;
    color: #fff;
    font-size: 27px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}

#support-bot-button:hover {
    transform: scale(1.05);
}

/* =========================================================
   CỬA SỔ CHAT
   ========================================================= */

#support-bot-window {
    display: none;
    position: absolute;
    right: 0;
    bottom: 70px;

    width: 360px;
    max-width: calc(100vw - 30px);
    height: 540px;
    max-height: calc(100vh - 100px);

    background: #fff;
    border: 1px solid #ddd;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 35px rgba(0, 0, 0, 0.28);
}

#support-bot-window.open {
    display: flex;
    flex-direction: column;
}

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

#support-bot-header {
    min-height: 58px;
    padding: 10px 14px;

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

    background: #198754;
    color: #fff;
}

#support-bot-header strong {
    display: block;
    font-size: 16px;
}

#support-bot-header small {
    display: block;
    margin-top: 3px;
    opacity: 0.9;
    font-size: 12px;
}

#support-bot-close {
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 27px;
    line-height: 1;
    cursor: pointer;
}

/* =========================================================
   KHU VỰC TIN NHẮN
   ========================================================= */

#support-bot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f5f6f8;
}

.support-bot-message {
    display: flex;
    margin-bottom: 10px;
}

.support-bot-message.user {
    justify-content: flex-end;
}

.support-bot-message.bot {
    justify-content: flex-start;
}

.support-bot-message-content {
    max-width: 82%;
    padding: 9px 12px;

    border-radius: 12px;
    white-space: pre-wrap;
    word-break: break-word;

    font-size: 14px;
    line-height: 1.2;
}

.support-bot-message.user .support-bot-message-content {
    background: #198754;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.support-bot-message.bot .support-bot-message-content {
    background: #fff;
    color: #222;
    border: 1px solid #e2e2e2;
    border-bottom-left-radius: 4px;
}

/* =========================================================
   MENU NHANH - TỰ ĐỘNG DÀN ĐỀU, KHÔNG CẮT CHỮ
   ========================================================= */

#support-bot-quick-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;

    gap: 6px;
    padding: 8px;

    width: 100%;
    box-sizing: border-box;

    background: #fff;
    border-top: 1px solid #eee;
}

/* Các nút menu */
#support-bot-quick-actions button {
    flex: 1 1 auto;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;

    width: auto;
    min-width: max-content;
    max-width: 100%;

    padding: 8px 12px;

    border: 1px solid #d7d7d7;
    border-radius: 20px;

    background: #fff;
    color: #333;

    font-size: 13px;
    line-height: 1.3;
    text-align: center;

    /* Không cắt chữ */
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: break-word;

    cursor: pointer;
    box-sizing: border-box;

    transition:
        background 0.2s ease,
        transform 0.1s ease;
}

#support-bot-quick-actions button:hover {
    background: #f1f1f1;
}

#support-bot-quick-actions button:active {
    transform: scale(0.98);
}

/* =========================================================
   Ô NHẬP TIN NHẮN
   ========================================================= */

#support-bot-input-area {
    display: flex;
    gap: 7px;

    padding: 9px;
    background: #fff;
    border-top: 1px solid #ddd;
}

#support-bot-input {
    flex: 1;
    min-width: 0;
    height: 40px;

    border: 1px solid #ccc;
    border-radius: 20px;

    padding: 0 14px;
    outline: none;

    font-size: 14px;
    box-sizing: border-box;
}

#support-bot-input:focus {
    border-color: #198754;
}

#support-bot-send {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;

    border: 0;
    border-radius: 50%;

    background: #198754;
    color: #fff;

    font-size: 18px;
    cursor: pointer;
}

#support-bot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* =========================================================
   TIN NHẮN NHÂN VIÊN
   ========================================================= */

#support-bot-messages .support-bot-message.admin {
    display: block;

    width: fit-content;
    max-width: 82%;

    margin: 8px auto 8px 2px;
    padding: 10px 13px;

    border-radius: 10px;
    background: #fff;
    color: #222;

    border: 1px solid #ddd;
    box-sizing: border-box;

    text-align: left;
    line-height: 1.2;

    word-break: break-word;
    white-space: pre-wrap;
}

#support-bot-messages
.support-bot-message.admin
.support-bot-message-content {
    max-width: 100%;

    background: transparent;
    color: #222;

    padding: 0;
    margin: 0;

    text-align: left;
}

#support-bot-messages
.support-bot-message.admin
.support-bot-message-content::first-line {
    font-weight: 600;
}

/* Hiệu ứng chọn văn bản */
#support-bot-messages
.support-bot-message.admin::selection,

#support-bot-messages
.support-bot-message.admin
.support-bot-message-content::selection {
    background: #b3d7ff;
    color: #222;
}

/* =========================================================
   KHU VỰC UPLOAD BILL
   ========================================================= */

#support-bot-upload-area {
    padding: 6px 8px;
    border-top: 1px solid #eee;
}

#support-bot-upload-area[hidden] {
    display: none !important;
}

.support-bot-upload-label {
    display: none;

    text-align: center;
    padding: 9px;

    border: 1px dashed #aaa;
    border-radius: 10px;

    cursor: pointer;
    font-size: 13px;
}

#support-bot-bill {
    display: none;
}

#support-bot-upload-area small {
    display: block;
    margin-top: 4px;

    text-align: center;
    font-size: 10px;
    opacity: 0.7;
}

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

@media (max-width: 600px) {
    #support-bot {
        right: 12px;
        bottom: 12px;
    }

    #support-bot-button {
        width: 54px;
        height: 54px;
        font-size: 25px;
    }

    #support-bot-window {
        right: 0;
        bottom: 64px;

        width: calc(100vw - 24px);
        max-width: none;

        height: min(560px, calc(100vh - 90px));
        border-radius: 12px;
    }

    #support-bot-quick-actions {
        justify-content: center;
        gap: 6px;
        padding: 8px;
    }

    #support-bot-quick-actions button {
        flex: 1 1 auto;
        min-width: max-content;
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* =========================================================
   MOBILE NHỎ
   ========================================================= */

@media (max-width: 360px) {
    #support-bot-quick-actions {
        justify-content: flex-start;
    }

    #support-bot-quick-actions button {
        flex: 0 1 auto;
        max-width: 100%;
        font-size: 12px;
        padding: 7px 9px;
    }
}