/* =========================================================
   THUẬN PHÁT - CHAT KHÁCH HÀNG
   CSS SẠCH - DỄ CHỈNH SỬA
   ========================================================= */

/* =========================================================
   1. NÚT CHAT NỔI
   ========================================================= */

.tp-chat-widget {
    position: fixed !important;
    right: 120px !important;
    bottom: 25px !important;

    z-index: 99998 !important;

    font-family: Arial, Helvetica, sans-serif;
}

/* Nút tròn chính */
.tp-chat-launch {
    width: 68px !important;
    height: 68px !important;

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

    border: none !important;
    border-radius: 50% !important;

    background: #ffffff !important;
    color: #ffffff !important;

    box-shadow: 0 7px 25px rgba(0, 0, 0, 0.22);

    cursor: pointer;

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

    position: relative !important;
    overflow: visible !important;

    font-size: 27px;
    transition: 0.2s;
}

.tp-chat-launch:hover {
    transform: scale(1.06);
}

/* =========================================================
   2. ICON NỮ TƯ VẤN
   ========================================================= */

.tp-chat-launch .tp-chat-icon {
    width: 100% !important;
    height: 100% !important;

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

    border-radius: 50% !important;
    overflow: hidden !important;
}

.tp-chat-launch .tp-chat-icon img {
    width: 108% !important;
    height: 108% !important;

    max-width: none !important;
    max-height: none !important;

    display: block !important;

    object-fit: cover !important;
    object-position: center !important;

    border-radius: 50% !important;
}

/* Khi mở cửa sổ chat: đổi icon thành dấu X */
.tp-chat-launch .tp-chat-close-icon {
    display: none;
}

.tp-chat-widget.open .tp-chat-launch .tp-chat-icon {
    display: none !important;
}

.tp-chat-widget.open .tp-chat-launch .tp-chat-close-icon {
    display: inline !important;
}

/* =========================================================
   3. SỐ THÔNG BÁO ĐỎ
   ========================================================= */

.tp-chat-badge {
    position: absolute !important;

    right: -2px !important;
    top: -2px !important;

    width: 18px !important;
    height: 18px !important;

    border-radius: 50% !important;

    background: #c94b3d !important;
    color: #ffffff !important;

    border: 2px solid #ffffff !important;

    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 1 !important;

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

    z-index: 30 !important;
}

.tp-chat-widget.open .tp-chat-badge {
    display: none !important;
}

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

.tp-chat-panel {
    position: absolute;
    right: 0;
    bottom: 82px;

    width: 380px;

    background: #ffffff;

    border: 1px solid rgba(183, 142, 63, 0.32);
    border-radius: 18px;

    overflow: hidden;

    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.20);

    transform: scale(0.88) translateY(18px);
    transform-origin: bottom right;

    opacity: 0;
    pointer-events: none;

    transition: 0.28s;
}

.tp-chat-widget.open .tp-chat-panel {
    transform: none;
    opacity: 1;
    pointer-events: auto;
}

/* =========================================================
   5. HEADER CHAT
   ========================================================= */

.tp-chat-header {
    min-height: 78px;

    padding: 12px 15px;

    background: linear-gradient(135deg, #173d35, #285d50);
    color: #ffffff;

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

.tp-chat-brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

.tp-chat-logo {
    width: 44px;
    height: 44px;

    border-radius: 50%;

    background: #ffffff;

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

    overflow: hidden;

    border: 1px solid rgba(255, 255, 255, 0.6);

    flex-shrink: 0;
}

.tp-chat-logo img {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.tp-chat-title {
    font-size: 15px;
    font-weight: 700;
}

.tp-chat-status {
    margin-top: 3px;
    font-size: 11px;
    color: #e8d5a6;
}

.tp-chat-close {
    width: 32px;
    height: 32px;

    border: 0;
    border-radius: 9px;

    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;

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

/* =========================================================
   6. FORM KHÁCH HÀNG
   ========================================================= */

.tp-chat-form-view {
    padding: 20px 18px 18px;
    background: #faf9f6;
}

.tp-chat-welcome {
    margin-bottom: 17px;
}

.tp-chat-welcome h3 {
    margin: 0 0 6px;
    color: #173d35;
    font-size: 17px;
}

.tp-chat-welcome p {
    margin: 0;
    color: #6d6a62;
    font-size: 12px;
    line-height: 1.55;
}

.tp-chat-field {
    margin-bottom: 12px;
}

.tp-chat-field label {
    display: block;
    margin-bottom: 5px;
    color: #4e514d;
    font-size: 11px;
    font-weight: 700;
}

.tp-chat-field label span {
    color: #b64a3e;
}

.tp-chat-field input,
.tp-chat-field select {
    width: 100%;
    height: 43px;

    border: 1px solid #ddd6c8;
    border-radius: 11px;

    background: #ffffff;

    padding: 0 12px;

    outline: none;

    color: #29322e;

    font-family: inherit;
    font-size: 13px;
}

.tp-chat-field input:focus,
.tp-chat-field select:focus {
    border-color: #b78e3f;
    box-shadow: 0 0 0 2px rgba(183, 142, 63, 0.10);
}

.tp-chat-field input.tp-error,
.tp-chat-field select.tp-error {
    border-color: #c94b3d;
}

.tp-chat-error {
    display: none;
    margin-top: 4px;
    color: #b33f34;
    font-size: 10px;
}

.tp-chat-error.show {
    display: block;
}

.tp-chat-consent {
    display: flex;
    align-items: flex-start;
    gap: 7px;

    margin: 4px 0 13px;

    color: #77736a;
    font-size: 10px;
    line-height: 1.45;
}

.tp-chat-consent input {
    margin-top: 1px;
    accent-color: #1f5145;
}

.tp-chat-start {
    width: 100%;
    height: 45px;

    border: 0;
    border-radius: 12px;

    background: linear-gradient(135deg, #b78e3f, #9e7630);
    color: #ffffff;

    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;

    cursor: pointer;
}

.tp-chat-note {
    margin: 9px 0 0;
    text-align: center;
    color: #99958b;
    font-size: 9px;
}

/* =========================================================
   7. NỘI DUNG CUỘC CHAT
   ========================================================= */

.tp-chat-conversation {
    display: none;
    background: #faf9f6;
}

.tp-chat-conversation.active {
    display: block;
}

.tp-chat-body {
    height: 350px;
    padding: 17px 15px 10px;
    overflow-y: auto;
}

.tp-chat-message {
    display: flex;
    margin-bottom: 12px;
}

.tp-chat-message.user {
    justify-content: flex-end;
}

.tp-chat-bubble {
    max-width: 82%;
    padding: 10px 12px;

    font-size: 13px;
    line-height: 1.55;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tp-chat-message.bot .tp-chat-bubble {
    background: #ffffff;
    color: #26332f;
    border: 1px solid #eee9dd;
    border-radius: 5px 15px 15px 15px;
}

.tp-chat-message.user .tp-chat-bubble {
    background: #1f5145;
    color: #ffffff;
    border-radius: 15px 5px 15px 15px;
}

/* =========================================================
   8. 3 NÚT GỢI Ý
   ========================================================= */

.tp-chat-quick {
    padding: 8px 12px 7px;
    background: #ffffff;
    border-top: 1px solid #eeeeee;
}

.tp-chat-quick-title {
    margin: 0 0 6px 2px;
    color: #8b7750;
    font-size: 9px;
    letter-spacing: 0.5px;
}

.tp-chat-quick-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tp-chat-quick-list button {
    border: 1px solid #d8c59d;
    background: #fffdf8;
    color: #31564c;
    border-radius: 20px;

    padding: 7px 10px;

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

/* =========================================================
   9. Ô NHẬP CÂU HỎI
   ========================================================= */

.tp-chat-input {
    height: 70px;

    display: flex;
    align-items: center;
    gap: 7px;

    padding: 10px 11px;

    background: #ffffff;
    border-top: 1px solid #eeeeee;
}

.tp-chat-input input {
    flex: 1;
    min-width: 0;
    height: 42px;

    border: 1px solid #ddd6c8;
    border-radius: 12px;

    padding: 0 12px;

    outline: none;

    font-size: 12px;
}

.tp-chat-send {
    width: 42px;
    height: 42px;

    border: 0;
    border-radius: 12px;

    background: #b78e3f;
    color: #ffffff;

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

/* =========================================================
   10. ĐIỆN THOẠI
   ========================================================= */

@media (max-width: 768px) {

    .tp-chat-widget {
        right: 90px !important;
        bottom: 20px !important;
    }

    .tp-chat-panel {
        position: fixed;
        right: 12px;
        bottom: 92px;

        width: calc(100vw - 24px);
        max-width: 390px;
        max-height: calc(100vh - 115px);
    }

    .tp-chat-body {
        height: 330px;
    }

    .tp-chat-launch {
        width: 62px !important;
        height: 62px !important;
    }

    .tp-chat-badge {
        right: -2px !important;
        top: -2px !important;
    }
}

/* =========================================================
   11. GHI CHÚ NHANH ĐỂ SAU NÀY DỄ CHỈNH

   Vị trí desktop:
       right: 105px;
       bottom: 25px;

   Vị trí điện thoại:
       right: 82px;
       bottom: 20px;

   Kích thước desktop:
       width: 68px;
       height: 68px;

   Kích thước điện thoại:
       width: 62px;
       height: 62px;

   Nếu muốn Chat gần nút Liên hệ hơn:
       GIẢM right xuống.

   Nếu muốn Chat xa nút Liên hệ hơn:
       TĂNG right lên.
   ========================================================= */
