/* =========================================================================
   JENIX CHAT SIMPLE VERSION - Version 1.9.5
   Màu sắc chủ đạo:
   - Xanh dương đậm (#4682B4)
   - Cam (#FF8C00)
   - Trắng (#FFFFFF)
   Giao diện cải tiến, tinh tế, hiện đại
   ========================================================================= */

:root {
    /* Màu chủ đạo */
    --jc-primary: #4682B4; 
    --jc-accent: #FF8C00;  
    --jc-white: #FFFFFF;

    /* Văn bản, nền phụ */
    --jc-text: #333333;
    --jc-bg: #f5f5f5;

    /* Bong bóng tin nhắn */
    --jc-user-bg: #4682B4; 
    --jc-bot-bg: #ffffff; 
    
    /* Độ bo góc, font, transition */
    --jc-border-radius: 8px;
    --jc-font-family: 'Open Sans', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    --jc-transition: 0.3s ease;
}

/* HEADER AVATAR (trong chatbox header) */
.jenix-avatar-header {
    width: 36px;
    height: 36px;
    border-radius: 0%;
    margin-right: 8px;
    vertical-align: middle;
    cursor: pointer;
    border: 0px solid var(--jc-accent);
    transition: transform var(--jc-transition), box-shadow var(--jc-transition);
}
.jenix-avatar-header:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* AVATAR TOGGLE (ở góc dưới bên phải) */
#jenix-avatar {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 60px;
    height: 60px;
    border-radius: 0%;
    cursor: pointer;
    z-index: 2147483647; 
    border: 0px solid var(--jc-accent);
    transition: transform var(--jc-transition), box-shadow var(--jc-transition);
}
#jenix-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

/* CHATBOX CONTAINER */
#jenix-chat-box {
    position: fixed;
    bottom: 80px;
    right: 1.5rem;
    width: 22rem;
    height: 27rem; 
    background-color: var(--jc-white);
    border-radius: var(--jc-border-radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    font-family: var(--jc-font-family);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 2147483647;
    transform: translateY(110%);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.25,0.8,0.25,1), opacity 0.5s;
}
#jenix-chat-box.open {
    transform: translateY(0);
    opacity: 1;
}

/* HEADER */
#jenix-chat-header {
    background: linear-gradient(135deg, var(--jc-primary), #549fcf);
    color: var(--jc-white);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background var(--jc-transition);
    border-top-left-radius: var(--jc-border-radius);
    border-top-right-radius: var(--jc-border-radius);
}
#jenix-chat-header:hover {
    background: linear-gradient(135deg, #549fcf, var(--jc-primary));
}
#jenix-chat-header .header-title {
    vertical-align: middle;
}

/* BODY */
#jenix-chat-body {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    background-color: var(--jc-bg);
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    position: relative;
}
#jenix-chat-messages {
    flex: 1;
    margin: 0;
    padding: 0;
}

/* BONG BÓNG TIN NHẮN */
.jenix-chat-message {
    position: relative;
    margin-bottom: 0.75rem;
    padding: 0.65rem 1rem;
    border-radius: var(--jc-border-radius);
    clear: both;
    font-size: 0.9rem;
    line-height: 1.4;
    transition: opacity var(--jc-transition), transform var(--jc-transition);
    word-wrap: break-word;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.jenix-chat-message.user {
    background-color: var(--jc-user-bg);
    color: #fff;
    float: right;
    max-width: 75%;
}
.jenix-chat-message.bot {
    background-color: var(--jc-bot-bg);
    color: var(--jc-text);
    float: left;
    max-width: 75%;
}

/* TOOLTIP HIỂN THỊ TIMESTAMP KHI HOVER */
.jenix-chat-message:hover::after {
    content: attr(data-timestamp);
    position: absolute;
    bottom: 100%;
    right: 0;
    background-color: rgba(0,0,0,0.75);
    color: #fff;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    white-space: nowrap;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    opacity: 0;
    animation: fadeInTooltip 0.3s forwards;
    pointer-events: none;
}
@keyframes fadeInTooltip {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* TYPING INDICATOR */
#jenix-chat-typing {
    display: none;
    margin-top: auto;
    padding: 0.5rem 0;
    align-self: center;
    font-size: 0.9rem;
    color: var(--jc-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
#jenix-chat-typing .typing-text {
    font-style: italic;
    color: var(--jc-primary);
    font-weight: 500;
}
#jenix-chat-typing .dot {
    width: 0.45rem;
    height: 0.45rem;
    background-color: var(--jc-accent);
    border-radius: 50%;
    opacity: 0;
    animation: blink 1.4s infinite;
}
#jenix-chat-typing .dot:nth-child(2) {
    animation-delay: 0.3s;
}
#jenix-chat-typing .dot:nth-child(3) {
    animation-delay: 0.6s;
}
@keyframes blink {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}

/* FOOTER / INPUT */
#jenix-chat-footer {
    background-color: #fafafa;
    padding: 0.75rem 1rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    border-bottom-left-radius: var(--jc-border-radius);
    border-bottom-right-radius: var(--jc-border-radius);
}
#jenix-chat-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color var(--jc-transition);
}
#jenix-chat-input:focus {
    border-color: var(--jc-primary);
    outline: none;
}

/* NÚT GỬI (NHỎ HƠN, DÙNG MÀU GRADIENT) */
#jenix-chat-send {
    margin-left: 0.5rem;
    padding: 0.4rem 0.8rem; /* nhỏ hơn */
    border: none;
    background: linear-gradient(135deg, var(--jc-accent), #ffa333); /* gradient từ màu cam chủ đạo */
    color: var(--jc-white);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color var(--jc-transition), transform var(--jc-transition);
    font-weight: 600;
    font-size: 0.9rem;
}
#jenix-chat-send:hover {
    background: linear-gradient(135deg, #ffa333, var(--jc-accent)); /* đảo gradient */
    transform: scale(1.05);
}

/* RESPONSIVE */
@media (max-width: 480px) {
    #jenix-chat-box {
        width: 90%;
        right: 5%;
        bottom: 5rem;
    }
    #jenix-chat-header, #jenix-chat-footer {
        padding: 0.75rem 1rem;
    }
    #jenix-chat-input {
        font-size: 0.9rem;
    }
    #jenix-chat-send {
        padding: 0.4rem 0.7rem;
        font-size: 0.85rem;
    }
}
/* BONG BÓNG CHO JENIX BUBBLE */
#jenix-bubble.jenix-bubble {
    position: fixed;
    bottom: 5.5rem;      /* 100px / 16 = 6.25rem */
    right: 3rem;        /* 40px / 16 = 2.5rem */
    background: linear-gradient(135deg, #FF8C00, #4682B4);
    color: #FFFFFF;
    padding: 0.625rem 1rem; /* 10px và 16px */
    border-radius: 1rem;    /* 16px */
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.2);  /* 4px và 12px */
    font-size: 0.875rem;    /* 14px */
    font-weight: 600;       /* In đậm hơn */
    line-height: 1.4;
    cursor: pointer;
    z-index: 2147483647;
    transition: all 0.3s ease-in-out;
  }
  
  #jenix-bubble.jenix-bubble:hover {
    box-shadow: 0 0.375rem 1rem rgba(0, 0, 0, 0.3); /* 6px và 16px */
    transform: translateY(-0.125rem); /* 2px / 16 = 0.125rem */
  }