/* =========================================================
   CHATBOT STYLES (chatbot.css)
   ========================================================= */

/* ---------- Container & Button (Giao diện chính) ---------- */
#openChatBotBtn {
    cursor: pointer;
    position: fixed;
    bottom: 20px;
    right: 40px;
    width: 110px;
    height: 110px;
    z-index: 9999;
    border-radius: 50%;
    animation: bounce 2s infinite;
}

/* Container chứa nội dung Chatbot */
#chatBotContainer {
    position: fixed;
    bottom: 140px;
    right: 40px;
    width: 350px; /* Tăng chiều rộng để phù hợp với nội dung */
    height: 420px; /* Tăng chiều cao */
    border: none;
    border-radius: 12px;
    background-color: #fff; /* Giữ nền trắng cho container ngoài */
    box-shadow:
            0 0 0 1.5px rgba(0, 0, 0, 0.12), /* Lớp 1: Viền mỏng 1.5px, màu xám nhạt */
            0 8px 30px rgba(0, 0, 0, 0.1);  /* Lớp 2: Bóng đổ mờ, tạo chiều sâu nhẹ */
    z-index: 9998;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    55% { transform: translateY(-10px); }
}

/* ---------- Chat content (Nội dung bên trong container) ---------- */
/* Trong file chatbot.css */

.chat-widget-container {
    all: initial;
    box-sizing: border-box;
    /* Xóa font-family: 'Inter', Arial, sans-serif; để tránh rò rỉ */
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;

    /* === ĐIỀU CHỈNH VIỀN VÀ TRÀN === */
    border: 1px solid #cfd8e6; /* Viền nhẹ (Tôi dùng màu từ input focus) */
    border-radius: 8px; /* Khớp với border-radius của #chatBotContainer */
    overflow: hidden; /* QUAN TRỌNG: Đảm bảo các góc tròn được hiển thị đúng */
    /* =============================== */
}

/* STYLE CHUNG CHO BODY CỦA CHATBOT (Nếu dùng innerHTML, chỉ áp dụng cục bộ) */
body {
    font-family: 'Inter', Arial, sans-serif;
    background: transparent;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* HEADER */
.chat-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #eef0f4;
    background: #f7f9fc;
    flex-shrink: 0;
    height: 48px;
    box-sizing: border-box;
    font-family: 'Inter', Arial, sans-serif; /* Áp dụng font Inter cục bộ */
}

.bot-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

/* Container bao tiêu đề và trạng thái */
.header-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.2;
}

/* Tiêu đề chat (Trợ lý AI BookStore) */
.chat-title {
    margin: 0;
    font-weight: 700;
    color: #2b3a55;
    font-size: 15px;
    margin-bottom: 1px; /* Khoảng cách nhẹ dưới tiêu đề */
    line-height: 1.2;
}

/* Container cho chấm xanh và chữ Online */
.bot-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #4CAF50;
    margin-top: 0;
}

/* Dấu chấm xanh */
.status-dot {
    display: block;
    width: 6px;
    height: 6px;
    background-color: #4CAF50;
    border-radius: 50%;
}


/* KHUNG TIN NHẮN */
#messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    font-family: 'Inter', Arial, sans-serif;
}

/* ROW CỦA TIN NHẮN */
.message-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
}

.user-row {
    justify-content: flex-end;
}

/* TIN NHẮN */
.msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    line-height: 1.4;
    font-size: 13.5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* TIN NHẮN USER */
.msg-user {
    margin-left: auto;
    /* ĐÃ SỬA: Xanh Lá Tươi */
    background: #4CAF50;
    color: white;
    border-bottom-right-radius: 4px;
}

/* TIN NHẮN BOT */
.msg-bot {
    background: #eef1f6;
    color: #2b3a55;
    border-bottom-left-radius: 4px;
}

/* QUICK REPLIES/GỢI Ý */
.quick-replies {
    margin-top: 5px;
    max-width: 85%;
    margin-left: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-family: 'Inter', Arial, sans-serif;
}

.quick-reply-btn {
    background: #ffffff;
    /* ĐÃ SỬA: Xanh Lá Tươi */
    color: #4CAF50;
    /* ĐÃ SỬA: Xanh Lá Tươi */
    border: 1px solid #4CAF50;
    border-radius: 16px;
    padding: 5px 10px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    appearance: none;
    -webkit-appearance: none;
}

.quick-reply-btn:hover {
    /* ĐÃ SỬA: Xanh Lá Tươi */
    background: #4CAF50;
    color: white;
    /* ĐÃ SỬA: Xanh Lá Tươi */
    border-color: #4CAF50;
}

/* INPUT BOX */
#chat-input-box {
    display: flex;
    gap: 6px;
    padding: 10px 15px;
    border-top: 1px solid #eef0f4;
    background: #f7f9fc;
    flex-shrink: 0;
    height: 58px;
    box-sizing: border-box;
    font-family: 'Inter', Arial, sans-serif;
}

#msg {
    flex: 1;
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid #cfd8e6;
    font-size: 14px;
    outline: none;
}

#msg:focus {
    /* ĐÃ SỬA: Xanh Lá Tươi */
    border-color: #4CAF50;
}

button#sendBtn {
    padding: 0 14px;
    border-radius: 20px;
    /* ĐÃ SỬA: Xanh Lá Tươi */
    background: #4CAF50;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    height: 38px;
    min-width: 60px;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    border: none;
}

button#sendBtn:hover {
    /* ĐÃ SỬA: Xanh Lá Đậm hơn */
    background: #388E3C;
}