.fab {
    position: fixed;
    bottom: 39px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #6200ea;
    color: white;
    font-size: 24px;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 10000; /* 챗봇보다 아래에 위치 */
}

.fab:hover {
    background-color: #3700b3;
}

.fab i {
    font-size: 24px;
}

/* Chat container styling */
.chat-container {
    position: fixed;
    bottom: 110px;
    right: 2%;
    width: 300px;
    height: 400px; /* Fixed height to prevent expanding */
    background-color: white;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10001; /* FAB보다 위에 위치 */
}

.hidden {
    display: none;
}

/* Chat header */
.chat-header {
    background-color: #6200ea;
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: 500;
    position: relative;
}

/* Close button */
.close-chat {
    position: absolute;
    right: 10px;
    top: 10px;
    cursor: pointer;
}

/* Chat body */
.chat-body {
    padding: 10px;
    flex-grow: 1;
    overflow-y: auto; /* Allows scrolling for long messages */
    max-height: calc(100% - 100px); /* 헤더+푸터 공간 제외 */
}

/* Hide the scrollbar */
.chat-body::-webkit-scrollbar {
    width: 0;
}

/* Common chat message style */
.chat-message {
    display: flex;
    align-items: flex-start; /* 아바타와 메시지 상단 정렬 */
    padding: 8px;
    margin-bottom: 10px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
    position: relative;
}

/* Message bubble styling */
.chat-message span {
    display: inline-block;
    padding: 10px;
    border-radius: 12px;
}

/* Bot message (aligned left) */
.chat-message.bot {
    justify-content: flex-start;
    margin-right: auto; /* 왼쪽 정렬 */
}

.chat-message.bot span {
    background-color: #eee;
}

/* User message (aligned right) */
.chat-message.user {
    justify-content: flex-end;
    margin-left: auto; /* 오른쪽 정렬 */
}

.chat-message.user span {
    background-color: #6200ea;
    color: white;
}

/* Avatar styles */
.avatar {
    width: 30px; /* 아바타 크기 조정 */
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #ccc; /* 기본 배경색 */
    color: #fff; /* 아이콘 색상 */
    font-size: 16px; /* 아이콘 크기 */
}

/* Bot avatar (on the left side of message) */
.chat-message.bot .avatar {
    margin-right: 10px; /* Space between avatar and message */
    background-color: #6200ea; /* 봇 아바타 색상 */
}

/* User avatar (on the right side of message) */
.chat-message.user .avatar {
    margin-left: 10px; /* Space between avatar and message */
    order: 1; /* Avatar appears after the message */
    background-color: #3700b3; /* 사용자 아바타 색상 */
}

/* Chat footer (input and send button) */
.chat-footer {
    display: flex;
    align-items: center;
    padding: 10px;
    border-top: 1px solid #ddd;
    background-color: #f9f9f9;
}

.chat-footer input {
    flex-grow: 1;
    border: none;
    padding: 12px;
    border-radius: 10px;
    background-color: #e0e0e0;
    outline: none;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.chat-footer input:focus {
    background-color: #d4d4d4;
}

.chat-footer button {
    padding: 10px 15px;
    margin-left: 10px;
    background-color: #6200ea;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease;
}

.chat-footer button:hover {
    background-color: #3700b3;
}

.chat-footer button i {
    font-size: 18px;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .chat-container {
        width: 300px;
        height: 400px;
        bottom: 110px;
        right: 6%;
        top: auto;
    }

    .chat-body {
        max-height: calc(100% - 100px); /* 모바일에서도 스크롤 영역 확보 */
    }
}