/* 전체 레이아웃 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    background-color: #f7f7f8;
}

/* 메인 컨테이너 */
#container {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* 사이드바 */
#sidebar {
    width: 300px;  /* 고정된 너비 */
    flex-shrink: 0;  /* 사이드바가 줄어들지 않도록 설정 */
    background-color: #202123;
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.new-chat-btn, .delete-all-btn {
    background-color: #2f3136;
    color: white;
    padding: 10px;
    margin-bottom: 20px;
    border: none;
    cursor: pointer;
    text-align: left;
    border-radius: 5px;
}

.new-chat-btn:hover, .delete-all-btn:hover {
    background-color: #40444b;
}

#chat-sessions {
    flex-grow: 1;
    overflow-y: auto;
    padding-left: 0; /* 패딩 제거 */
    margin: 0; /* 기본 마진 제거 */
}

#chat-sessions li {
    list-style: none;
    padding: 10px;
    cursor: pointer;
    border-radius: 5px;
    margin-bottom: 10px;
    background-color: #2f3136;
    position: relative; /* 삭제 버튼을 li의 오른쪽 끝에 배치하기 위해 필요 */
}
#chat-sessions li .delete-btn {
    position: absolute;
    right: 10px; /* li의 오른쪽 끝에서 10px 떨어진 위치 */
    top: 50%;
    transform: translateY(-50%); /* 버튼을 세로로 중앙 정렬 */
    background-color: #ff4d4f;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 5px 10px;
    cursor: pointer;
    display: none; /* 기본적으로는 보이지 않음 */
}

#chat-sessions li:hover {
    background-color: #40444b;
}

#chat-sessions li:hover .delete-btn {
    display: block; /* 마우스가 li 위에 있을 때만 보이도록 설정 */
}

#chat-sessions li.selected {
    background-color: #3b4a56;
}

/* 채팅 영역 */
#chat-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
}

#chatbox {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: 20px;
}

#messages {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 20px;
}

.message {
    margin: 10px 0;
    max-width: 80%;
    padding: 10px;
    border-radius: 10px;
    font-size: 1rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* 유저 메시지를 오른쪽에 정렬 */
.message.user {
    align-self: flex-end;
    background-color: #007bff;
    color: white;
    max-width: 60%;  /* 유저 메시지의 최대 너비 설정 */
    margin-right: 10px;  /* 오른쪽 여백 추가 */
    word-wrap: break-word;  /* 긴 단어가 있을 때 줄바꿈 처리 */
    overflow-wrap: break-word;  /* 긴 단어가 div 밖으로 나오는 것을 방지 */
    box-sizing: border-box;  /* 패딩 포함하여 크기 계산 */
}

/* 봇 메시지를 왼쪽에 정렬 */
.message.bot {
    align-self: flex-start;
    background-color: #e1e1e1;
    color: black;
    max-width: 60%;  /* 봇 메시지의 최대 너비 설정 */
    margin-left: 10px;  /* 왼쪽 여백 추가 */
    word-wrap: break-word;  /* 긴 단어가 있을 때 줄바꿈 처리 */
    overflow-wrap: break-word;  /* 긴 단어가 div 밖으로 나오는 것을 방지 */
    box-sizing: border-box;  /* 패딩 포함하여 크기 계산 */
}

/* 입력 영역 */
#input-box {
    display: flex;
    align-items: center;
    padding: 10px;
    border-top: 1px solid #e1e1e1;
    background-color: #f9f9f9;
}

#user-input {
    flex-grow: 1;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 5px;
    outline: none;
    resize: none;
}

.send-btn {
    margin-left: 10px;
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.send-btn:hover {
    background-color: #0056b3;
}
