:root {
    --chat-primary: #00AEEF;
    --chat-radius: 16px;
    --chat-shadow: 0 10px 25px rgba(0,0,0,.18);
    --chat-border: #d0d7e2;
}

/* Nút mở chatbot (tròn, góc phải dưới) */
#chatbot-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: var(--chat-primary);
    box-shadow: var(--chat-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    transition: transform .18s ease-out, box-shadow .18s ease-out, background .18s;
}

#chatbot-toggle img {
    width: 32px;
    height: 32px;
    margin-top: 10px;
}

#chatbot-toggle:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 14px 30px rgba(0,0,0,.22);
}

#chatbot-toggle:active {
    transform: translateY(0) scale(0.99);
}

/* Widget chatbot */
#chatbot-widget {
    position: fixed;
    right: 24px;
    bottom: 90px; /* nằm trên nút */
    width: 360px;
    max-height: 520px;
    height: 480px;
    background: #ffffff;
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;

    /* trạng thái đóng */
    opacity: 0;
    transform: translateY(16px) scale(.97);
    pointer-events: none;
    transition:
        opacity .25s ease-out,
        transform .25s cubic-bezier(.21,.94,.33,1);
}

/* Khi JS thêm class "open" thì hộp chat hiện ra */
#chatbot-widget.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
#chatbot-header {
    background: var(--chat-primary);
    color: #ffffff;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

#chatbot-header .title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

#chatbot-header .subtitle {
    font-size: 11px;
    opacity: .95;
}

#chatbot-close {
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

    .msg {
      margin-bottom: 10px;
      display: flex;
    }

    .msg.user {
      justify-content: flex-end;
       white-space: pre-line; /* tự xuống dòng từ \n */
       line-height: 1.5;      
    }

    .msg.assistant {
      justify-content: flex-start;
        white-space: pre-line; /* tự xuống dòng từ \n */
        line-height: 1.5;      
    }


    .bubble {
      max-width: 80%;
      padding: 8px 10px;
      border-radius: 14px;
      font-size: 13px;
      line-height: 1.4;
    }

    .msg.user .bubble {
      background: #007bffa4;
      color: white;
      border-bottom-right-radius: 4px;
    }

    .msg.assistant .bubble {
      background: #e5e7eb;
      color: #111827;
      border-bottom-left-radius: 4px;
    }
/* Khu vực tin nhắn */
#chatbot-messages {
    flex: 1;
    padding: 10px;
    background: #fff;
    overflow-y: auto;
    font-size: 13px;
}

/* Trạng thái nhỏ dưới messages (đang gõ, đang gửi...) */
#chatbot-status {
    font-size: 11px;
    color: #6b7280;
    padding: 2px 10px 4px;
    min-height: 16px;
}

/* Input + nút gửi */
#chatbot-input-area {
    display: flex;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid #e2e6f0;
    background: #ffffff;
}

#chatbot-input {
    flex: 1;
    border-radius: 999px;
    border: 1px solid var(--chat-border);
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
}

#chatbot-input:focus {
    border-color: var(--chat-primary);
    box-shadow: 0 0 0 1px rgba(0,174,239,.18);
}

#chatbot-send {
    border: none;
    border-radius: 999px;
    padding: 0 16px;
    background: var(--chat-primary);
    color: #ffffff;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .18s, transform .18s;
}

#chatbot-send:hover {
    background: #0094cf;
    transform: translateY(-1px);
}

#chatbot-send:active {
    transform: translateY(0);
}

/* Mobile: widget gần full width */
@media (max-width: 600px) {
    #chatbot-widget {
        top:10px;
        right: 10px;
        left: 10px;
        width: auto;
        max-height: 80vh;
    }
    #chatbot-toggle {
        right: 16px;
        bottom: 16px;
    }
    #chatbot-input, #chatbot-messages  {  font-size: 18px;}
    #chatbot-header .title {font-size: 18px;}
    #chatbot-send {font-size: 16px;}
}
