#chat-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 300px;
    height: 400px;
    background: url("img/chat_bg.png") no-repeat center center;
    background-size: cover;
    border-radius: 10px;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    opacity: 0; /* โปร่งแสง */
    transition: opacity 1s ease-in-out; /* ทำให้ค่อย ๆ ปรากฏ */
    overflow: hidden;
    resize: both;
    min-width: 200px;
    min-height: 150px;
    max-width: 500px;
    max-height: 600px;
    z-index: 9997; 
    visibility: hidden;

}
/* ✅ เมื่อปิดแชท (เลื่อนออกทางซ้าย + จางหาย) */
#chat-container.hidden {
    transform: translateX(-110%);
    opacity: 0;
}
#chat-header {
    position: relative;
    display: flex;
    align-items: center; 
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    font-size: 16px;
    user-select: none;
    width: 100%; 
    box-sizing: border-box;
    white-space: nowrap; 
}

#chat-header span {
    flex-grow: 1; 
    text-align: left; 
}

#chat-close {
    width: auto; 
    height: auto; 
    background: none; 
    color: #ff0000; 
    font-size: 16px; 
    text-align: center;
    cursor: pointer;
    border-radius: 0; 
    padding: 0 5px; 
}


#chat-box {
    flex-grow: 1;
    padding: 10px;
    color: #FFACE0; 
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.2); /* สีเลื่อนโปร่งแสง */
    background: rgba(0, 0, 0, 0.5); /* สีดำโปร่งแสง */
    scroll-behavior: smooth; /* ทำให้การเลื่อนลงนุ่มนวล */
}

#chat-box::-webkit-scrollbar {
    display: none;
}


/* ✅ ปุ่ม minimized (เริ่มต้นซ่อนอยู่) */
#chat-minimized {
    position: fixed;
    bottom: 20px;
    left: 10px;
    width: 50px;
    height: 50px;
    background: url("img/chat_min.png") no-repeat center center;
    background-size: contain;
    cursor: pointer;
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
     z-index: 9997;    
}


#chat-minimized.visible {
    display: block;
    opacity: 1;
}

/* สำหรับเบราว์เซอร์ที่รองรับ WebKit (เช่น Chrome, Safari) */
#chat-box::-webkit-scrollbar {
    width: 8px;
}

#chat-box::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2); /* รางเลื่อนโปร่งแสง */
    border-radius: 5px;
}

#chat-box::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3); /* แถบเลื่อนโปร่งแสง */
    border-radius: 5px;
}

#chat-box::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5); /* ทำให้เข้มขึ้นเมื่อ hover */
}