.section__chatbox {
  position: fixed;
  display: flex;
  flex-direction: column;
  right: 50px;
  bottom: 50px;
  z-index: var(--chatbox-level);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  width: 60px;
  height: 60px;
  transition: all var(--chatbox-action-time) ease;
}

@media screen and (max-width: 800px) {
  .section__chatbox {
    display: none;
    right: 20px;
    bottom: 20px;
  }
}

.section__chatbox.active {
  background-color: var(--white-color);
  width: 360px;
  height: 500px;
  bottom: 0;
  box-shadow: var(--box-shadow-1);
}

.section__chatbox.active.scale_up {
  width: calc(100vw - 140px);
  height: calc(100vh - 70px);
}

.section__chatbox .header {
  display: flex;
  justify-content: space-between;
  gap: 0;
  transition: padding var(--chatbox-action-time) ease;
}

.section__chatbox.active .header {
  padding: 16px;
  gap: 10px;
}

.section__chatbox .header .chatbox_icon {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  box-shadow: var(--box-shadow-1);
  cursor: pointer;
}

.section__chatbox:not(.active) .header .chatbox_icon {
  transition: transform 0.3s ease;
}

.section__chatbox:not(.active) .header .chatbox_icon:hover {
  transform: scale(1.2);
}

.section__chatbox:not(.active) .header .chatbox_icon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--primary-color);
  animation: pulse-animation 1.5s infinite;
}

.section__chatbox .header .chatbox_icon>img {
  width: 100%;
  height: 100%;
  z-index: var(--chatbox-level);
}

.section__chatbox.active .header .chatbox_icon .online-status {
  position: absolute;
  bottom: 2px;
  right: 0;
  width: 14px;
  height: 14px;
  border-radius: 7px;
  border: 2px solid var(--white-color);
  background-color: #00c057;
  z-index: var(--chatbox-level);
}

.section__chatbox .header>.title {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 0;
  overflow: hidden;
  animation: close-chatbox-animation var(--chatbox-action-time) ease forwards;
}

.section__chatbox.active .header>.title {
  width: unset;
  animation: open-chatbox-animation var(--chatbox-action-time) ease forwards;
}

.section__chatbox .header>.title .name {
  font-size: 18px;
  font-weight: bold;
}

.section__chatbox .header>.title .status {
  font-size: 14px;
  color: #a2a2a2;
}

.section__chatbox .header .action {
  display: flex;
  gap: 6px;
  width: 0;
  overflow: hidden;
}

.section__chatbox.active .header .action {
  width: unset;
}

.section__chatbox .header .action>button {
  width: 24px;
  height: 24px;
  border-radius: 5px;
}

.section__chatbox .header .action>button.scale {
  position: relative;
}

.section__chatbox .header .action>button.scale img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.section__chatbox.scale_up .header .action>button.scale img:first-child {
  opacity: 0;
}

.section__chatbox.scale_up .header .action>button.scale img:last-child {
  opacity: 1;
}

.section__chatbox .header .action>button.scale img:last-child {
  opacity: 0;
}

.section__chatbox .body {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  background: linear-gradient(180deg,
      rgba(237, 237, 237, 1) 0%,
      rgba(255, 255, 255, 1) 6%,
      rgba(255, 255, 255, 1) 100%);
  height: 0;
  padding: 0;
  overflow: hidden;
  gap: 16px;
  opacity: 0;
  transition: opacity var(--chatbox-action-time) ease;
}

.section__chatbox.active .body {
  padding: 16px;
  height: unset;
  overflow: unset;
  opacity: 1;
}

.section__chatbox .body .chat-view {
  flex: 1;
  justify-content: end;
  overflow: hidden;
  max-height: 500px;
  max-height: calc(500px - (32px + 58px + 16px + 92px));
  overflow-y: auto;
  scrollbar-width: thin;
  margin: 0 -16px;
  animation: close-chatbox-animation var(--chatbox-action-time) ease forwards;
  transition: max-height var(--chatbox-action-time) ease;
}

.section__chatbox.active .body .chat-view {
  animation: open-chatbox-animation var(--chatbox-action-time) ease forwards;
}

.section__chatbox.scale_up .body .chat-view {
  max-height: calc(100vh - (70px + 32px + 58px + 16px + 92px));
}

.section__chatbox .body .chat-input {
  border: 1px solid var(--light-grey-color);
  padding: 16px;
  display: flex;
  gap: 10px;
  border-radius: 12px;
  animation: close-chatbox-animation var(--chatbox-action-time) ease forwards;
}

.section__chatbox.active .body .chat-input {
  animation: open-chatbox-animation var(--chatbox-action-time) ease forwards;
}

.section__chatbox .body .chat-input input {
  flex: 1;
}

.section__chatbox .body .chat-input input::placeholder {
  color: #00000035;
}

.section__chatbox .body .chat-input button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 24px;
  height: 24px;
  display: flex;
  border-radius: 12px;
  background-color: var(--primary-color);
}

.section__chatbox .body .chat-input>button>img {
  width: 10px;
  height: 10px;
}

.chat-view {
  flex: 1;
}

.chat-view .message {
  text-align: right;
  margin: 0 16px 24px;
}

.chat-view .message.left {
  text-align: left;
  padding-left: 32px;
}

.chat-view .message .message__main {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.chat-view .message.left .message__main {
  align-items: flex-start;
}

.chat-view .message .message__main>div:last-child {
  margin-top: 8px;
}

.chat-view .message .message__main .name {
  position: relative;
  font-size: 14px;
  color: #a27591;
  line-height: 24px;
  margin-bottom: -8px;
  max-height: 0;
  animation: message-animation var(--message-animation-time) ease forwards;
}

.chat-view .message.left .message__main .name::before {
  content: "";
  background: center 100% / 100% no-repeat url("/images/chatbox/bot.svg");
  position: absolute;
  top: 0;
  left: -32px;
  width: 24px;
  height: 24px;
}

.chat-view .message .message__main .message__contain {
  display: inline-block;
  margin-top: 8px;
  border-radius: 16px;
  border-top-right-radius: 2px;
  padding: 12px;
  max-width: 80%;
  background-color: var(--message-bg-color);
  background-color: var(--primary-color);
  color: var(--white-color);
  text-align: left;
  max-height: 0;
  overflow: hidden;
  animation: message-animation var(--message-animation-time) ease forwards;
}

.chat-view .message .message__main>button {
  margin-top: 8px;
  animation: message-animation var(--message-animation-time) ease forwards;
}

.chat-view .message.left .message__main .message__contain {
  background-color: var(--message-bg-color);
  color: var(--dark-black-color);
  ;
  border-top-right-radius: 12px;
  border-top-left-radius: 2px;
}

.chat-view .message .message__main .message__contain.loading {
  max-width: 54px;
  max-height: unset;
  animation: loading-message-animation var(--message-animation-time) ease forwards;
}

.chat-view .message .message__main .message__contain.after_loading {
  transition: all var(--message-animation-time) ease;
  max-height: unset;
  animation: after-loading-message-animation calc(var(--message-animation-time) * 2) ease forwards;
}

.chat-view .message .message__main .message__contain.pure {
  animation: unset;
}

.chat-view .message .message__main .message__contain.loading::before {
  content: "";
  display: block;
  width: 30px;
  height: 15px;
  aspect-ratio: 2;
  --g: no-repeat radial-gradient(circle closest-side, var(--pale-grey-color) 80%, var(--white-color)0);
  background: var(--g) 0% 50%, var(--g) 50% 50%, var(--g) 100% 50%;
  background-size: calc(100% / 3) 50%;
  animation: l3 1s infinite linear;
}

.chat-view .message.left .message__main .message__contain.template-4 .title {
  font-size: 16px;
  font-weight: bold;
}

.chat-view .message.left .message__main .message__contain.template-4 .contain {
  display: flex;
  margin-top: 12px;
  gap: 12px;
}

.chat-view .message.left .message__main .message__contain.template-4 .contain .right {
  max-width: 320px;
}

.chat-view .message.left .message__main .message__contain.template-4 .contain .right .title {
  font-size: 16px;
  font-weight: bold;
}

.chat-view .message.left .message__main .message__contain.template-4 .contain .right>p {
  margin-top: 16px;
}

.chat-view .message.left .message__main .message__contain.template-type {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0;
  background-color: unset;
}

.chat-view .message.left .message__main .message__contain.template-type>button {
  padding: 8px 12px;
  background-color: var(--white-color);
  border: 1px solid var(--primary-color);
  border-radius: 12px;
  animation: message-animation var(--message-animation-time) ease forwards;
}

.chat-view .message.left .message__main .message__contain.template-type>button:hover {
  background-color: var(--primary-color);
  color: var(--white-color);
}

.chat-input {
  border: 1px solid var(--light-grey-color);
  padding: 16px;
  display: flex;
  gap: 10px;
  border-radius: 12px;
}

.chat-view .message.left .message__main .message__contain.template-question {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 0;
  background-color: unset;
}

.chat-view .message.left .message__main .message__contain.template-question>button {
  padding: 8px 12px;
  background-color: var(--white-color);
  border: 1px solid var(--primary-color);
  border-radius: 12px;
  text-align: left;
  overflow: hidden;
  max-height: 0;
  animation: message-animation var(--message-animation-time) ease forwards;
}

.chat-view .message.left .message__main .message__contain.template-question>button:hover {
  background-color: var(--primary-color);
  color: var(--white-color);
}

.chat-view .message.left .message__main .message__contain.template-question>button.arrow_left {
  padding: 4px 12px;
  border: none;
  background-color: var(--pale-grey-color);
  color: var(--white-color);
  border-radius: 16px;
}

@keyframes message-animation {
  0% {
    max-height: 0vmax;
    transform: translateY(30px);
    opacity: 0;
  }

  80% {
    transform: translateY(-10px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
    overflow: visible;
    max-height: 100vmax;
  }
}

@keyframes loading-message-animation {
  0% {
    max-height: 0;
    transform: translateY(30px);
    opacity: 0;
  }

  80% {
    transform: translateY(-10px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
    overflow: visible;
  }
}

@keyframes after-loading-message-animation {
  0% {
    color: transparent;
  }

  50% {
    color: transparent;
  }
}

@keyframes pulse-animation {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

@keyframes open-chatbox-animation {
  from {
    opacity: 0;
  }

  90% {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes close-chatbox-animation {
  from {
    opacity: 1;
  }

  10% {
    opacity: 0;
  }

  to {
    opacity: 0;
  }
}

@media screen and (max-width: 576px) {
  .section__chatbox.active {
    right: 0px;
    width: 100%;
    height: 100vh;
  }

  .section__chatbox.active .action .scale {
    display: none;
  }

  .section__chatbox.active .chat-view {
    max-height: calc(100vh - (32px + 58px + 16px + 92px));
  }
}