/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --- Biến màu sắc toàn cục --- */
:root {
    --primary-color: #00d2ff;     /* Xanh neon đặc trưng công nghệ */
    --secondary-color: #3a7bd5;   /* Xanh biển đậm */
    --bg-dark: #0f0f13;           /* Nền đen chì */
    --glass-bg: rgba(30, 30, 35, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --font-family: 'Inter', sans-serif;
}

/* --- Reset cơ bản --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-dark);
    height: 100vh;
    color: var(--text-primary);
    background-image: radial-gradient(circle at top right, #1a1a2e, #0f0f13 70%); /* Nền giả lập sang trọng */
}

/* =========================================
   CHATBOT WIDGET STYLES
========================================= */

/* Container chứa toàn bộ (nằm góc dưới phải) */
.chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* --- Nút Mở Chat (Floating Action Button) --- */
.chat-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 210, 255, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    outline: none;
    /* Hiệu ứng nhịp tim toả sáng màu xanh neon */
    animation: pulse-glow 2.5s infinite; 
}

.chat-fab:hover {
    transform: scale(1.1);
}

.chat-fab:active {
    transform: scale(0.95);
}

.chat-fab .icon-chat, .chat-fab .icon-close {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.chat-fab .hidden {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

@keyframes pulse-glow {
    0%   { box-shadow: 0 0 0 0 rgba(0, 210, 255, 0.7); }
    70%  { box-shadow: 0 0 0 16px rgba(0, 210, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 210, 255, 0); }
}

/* Tooltip gợi ý bấm vào nút */
.tooltip-text {
    position: absolute;
    right: 80px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;                     /* Mặc định ẩn */
    pointer-events: none;
    transition: opacity 0.3s ease;
    font-weight: 500;
    border: 1px solid var(--glass-border);
}
.chat-fab:hover .tooltip-text {
    opacity: 1;
}


/* --- Cửa Sổ Chat (Khung Glassmorphism) --- */
.chat-window {
    width: 360px;
    height: 550px;
    margin-bottom: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);         /* Làm mờ nền phía sau */
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    transform-origin: bottom right;      /* Phóng ra từ góc dưới phải */
    opacity: 1;
    transform: scale(1) translateY(0);
}

.chat-window.hidden {
    opacity: 0;
    transform: scale(0.6) translateY(50px); /* Thu nhỏ và tụt xuống khi ẩn */
    pointer-events: none;
}

/* Phần Header trong khung chat */
.chat-header {
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bot-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.3);
}

.header-info h3 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.status {
    font-size: 12px;
    color: #4ade80;  /* Màu xanh lá cây sáng (hoạt động) */
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}
.status::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    background-color: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 5px #4ade80;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.3s ease;
}
.close-btn:hover {
    color: white;
}

/* Phần Body (Nơi hiển thị đoạn chat) */
.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.chat-body::-webkit-scrollbar {
    width: 6px;
}
.chat-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
}

/* Từng Khung Tin Nhắn (Bong bóng chat) */
.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    animation: slideInMsg 0.4s ease-out;
}

@keyframes slideInMsg {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tin của Bot */
.message.bot-msg {
    background: rgba(255, 255, 255, 0.08); /* Nền tối mờ của bot */
    border: 1px solid var(--glass-border);
    align-self: flex-start;
    border-bottom-left-radius: 4px; /* Vát góc nhẹ dưới bên trái */
}

/* Tin của người dùng */
.message.user-msg {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    align-self: flex-end;
    border-bottom-right-radius: 4px; /* Vát góc dưới phải */
    color: white;
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.2);
}

/* Phần Footer (Nhập liệu) */
.chat-footer {
    padding: 16px;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 12px;
}

.chat-footer input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 12px 16px;
    border-radius: 20px;
    color: white;
    outline: none;
    font-size: 14px;
    transition: all 0.3s ease;
}
.chat-footer input:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
}
.chat-footer input::placeholder {
    color: #888;
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}
.send-btn:hover {
    background: var(--primary-color);
    color: #0f0f13; /* Chữ chuyển màu đen khi hover */
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
}
