@charset "UTF-8";

.modal.chat {    background: rgba(0, 0, 0, 0.4);}
.modal.chat .modal-body { 
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  padding-bottom: 60px;
  position: relative;
}

.modal.chat .modal-body .chat-content >span.notice {padding : 3px 0; font-weight : 600;}
.modal.chat .modal-body .chat-content > div {padding : 5px; }
.modal.chat .modal-body .chat-content > div > span {background-color : #aaa; color : #fff; padding : 5px 12px;}
/* .modal.chat .modal-body .chat-content > div.admin {text-align : right;} */
.modal.chat .modal-body .chat-content > div.admin > span {background-color : #6a7599;}

.modal.chat .modal-body .chat-content{
  flex: 1;
  overflow-y: scroll;
  overflow-x: hidden;
  padding: 0px 10px 20px 10px; /* 상하 패딩을 동일하게 20px */
  padding-right: 16px; /* 스크롤바 공간 확보 */
  background-color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  scroll-behavior: smooth;
  height: calc(100% - 60px); /* 입력창 높이만큼 빼기 */
}

/* 스크롤바 스타일링 (웹킷 기반 브라우저) */
.modal.chat .modal-body .chat-content::-webkit-scrollbar {
  width: 6px;
}

.modal.chat .modal-body .chat-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
  margin-top: 30px; /* 스크롤바 상단 마진 */
  margin-bottom: 30px; /* 스크롤바 하단 마진 - 상하 대칭 */
}

.modal.chat .modal-body .chat-content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.modal.chat .modal-body .chat-content::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 스크롤바 스타일링 (웹킷 기반 브라우저) */
.modal.chat .modal-body .chat-content::-webkit-scrollbar {
  width: 6px;
}

.modal.chat .modal-body .chat-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.modal.chat .modal-body .chat-content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.modal.chat .modal-body .chat-content::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.modal.chat .modal-body .chat-text {position : absolute; left : 0; bottom : 0; width : 100%; padding : 10px 1rem; align-items:center; justify-content:space-between;
border-top : var(--bs-modal-footer-border-width) solid var(--bs-modal-footer-border-color); display : none;
}
.modal.chat .modal-body .chat-text.show {display : flex;}
.modal.chat .modal-body .chat-text input[type='text'] {
	height: 38px;
    line-height: 38px;
    width: calc(100% - 68px);
    border-radius: 10px;
    border: 1px solid #999;
    padding: 0 10px;
    box-sizing: border-box;
}

.floating-btn-chatbot{
  margin: 20px 0;
  background: #FEE500;
}
.floating-btn-chatbot:hover{
  background: #bba800;
}
.modal.chat .modal-body .chat-text #sendBtn {display : none}

.modal.chat .modal-header {background-color : #004080; color : #fff;}
.modal.chat .modal-header button {
  /* filter: invert(1) brightness(1); */
}

.modal.chat #startBtn {width : 100%;}
.modal.chat:not(.chatroom) .modal-footer input[type="button"] {width : 100%;}
.modal.chat:not(.chatroom) .modal-footer input[type="button"].btn-success {display : none;}
.modal.chat:not(.chatroom) .modal-footer input[type="button"].btn-success.show {display : block;}
.modal.chat:not(.chatroom) .modal-footer input[type="button"].show + input[type="button"] {display : none;}
.modal.chat:not(.chatroom) .modal-footer input[type="button"] + input[type="button"] {display : block;}

.modal.chatroom {display : block; overflow : hidden;}
/* .modal.chatroom .modal-body {padding-bottom : 10px;} */
.modal.chatroom .modal-body:has(.chat-text.show) {padding-bottom : 60px;}
.modal.chatroom .modal-body .chat-text {margin : 0;}
.modal.chatroom .modal-body .chat-text #sendBtn {display : block}
.modal.chatroom .modal-footer {flex-wrap : nowrap;}
.modal.chatroom .modal-footer input[type="button"]:not(.close) {width : 50%;}
.modal.chatroom #endContainer {display : none;} 
.modal.chatroom #endContainer.show {display : block;}
.modal.chatroom #endContainer input[type="button"].close {width :100%; display :none;}
.modal.chatroom #endContainer.show input[type="button"].close {display :block;}

.chat-bubble {
  padding: 10px 14px !important;
  border-radius: 18px;
  margin: 0 10px;
  display: inline-block;
  word-break: break-word;
  max-width: 80%;
  font-size: 16px;
  line-height: 1.4;
  width: fit-content;
}

.mine {
  background-color: #cce5ff;
  margin-left: auto;
  text-align: left;
  border-bottom-right-radius: 0;
}

.theirs {
  background-color: #f1f1f1;
  margin-right: auto;
  text-align: left;
  border-bottom-left-radius: 0;
}

.sender-name {
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 4px;
}

.chat-bubble.system {
  text-align: center;
  font-style: italic;
  margin: 10px auto;
  padding: 10px 14px;
  border-radius: 18px;
  max-width: 80%;
  width: fit-content;
  font-size: 14px;
}

/* 🔴 연결 끊김용 */
.chat-bubble.system.error {
  background-color: #ffe6e6;
  color: #a94442;
}

/* ✅ 연결 성공용 */
.chat-bubble.system.success {
  background-color: #e6fff1;
  color: #1e824c;
}

.timestamp {
  font-size: 11px;
  color: #999;
  text-align: right;
  margin-top: 4px;
}

/* 맨 아래로 스크롤 버튼 */
.scroll-to-bottom-btn {
  position: absolute;
  bottom: 120px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #004080;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-to-bottom-btn:hover {
  background-color: #0056b3;
  transform: scale(1.1);
}

.scroll-to-bottom-btn:active {
  transform: scale(0.95);
}

/* 버튼 애니메이션 */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-5px);
  }
  60% {
    transform: translateY(-3px);
  }
}

.scroll-to-bottom-btn {
  animation: bounce 2s infinite;
}