.toc-menu {
  color: var(--toc-font-color);
  margin-top: 2.5rem;
}

.toc.sidebar .toc-menu {
  margin-right: 0.75rem;
  position: sticky;
  top: var(--toc-top);
}

.toc .toc-menu h3 {
  color: var(--toc-heading-font-color);
  font-size: calc(16 / var(--rem-base) * 1rem);
  font-weight: var(--body-font-weight-bold);
  line-height: 1.3;
  margin: 0 -0.5px;
  padding-bottom: 0.25rem;
}

.toc.sidebar .toc-menu h3 {
  display: flex;
  flex-direction: column;
  /* height: 2.5rem; */
  justify-content: flex-end;
}

.toc .toc-menu ul {
  font-size: calc(15 / var(--rem-base) * 1rem);
  line-height: var(--toc-line-height);
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc.sidebar .toc-menu ul {
  max-height: var(--toc-height);
  overflow-y: auto;
  overscroll-behavior: none;
}

@supports (scrollbar-width: none) {
  .toc.sidebar .toc-menu ul {
    scrollbar-width: none;
  }
}

.toc .toc-menu ul::-webkit-scrollbar {
  width: 0;
  height: 0;
}

@media screen and (min-width: 1024px) {
  .toc .toc-menu h3 {
    font-size: calc(15 / var(--rem-base) * 1rem);
  }

  .toc .toc-menu ul {
    font-size: calc(13.5 / var(--rem-base) * 1rem);
  }
}

.toc .toc-menu li {
  position: relative;
  margin: 0;
}

.toc .toc-menu li[data-level="2"] a {
  padding-left: 1.25rem;
}

.toc .toc-menu li[data-level="3"] a {
  padding-left: 2rem;
}

.toc .toc-menu a {
  color: inherit;
  border-left: 2px solid var(--toc-border-color);
  display: inline-block;
  padding: 0.5rem 0 0.5rem 0.5rem;
  text-decoration: none;
}

.sidebar.toc .toc-menu a {
  display: block;
  outline: none;
}

/* .toc .toc-menu a:hover {
  color: var(--color-bwg-main);
} */

.toc .toc-menu a.is-active {
  border-left: 3px solid var(--color-bwg-main);
  color: var(--color-bwg-main);
  font-weight: 600;
}

.sidebar.toc .toc-menu a:hover {
  background: var(--color-blue-10);
}

.chat-btn {
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--color-bwg-main);
  box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
}

.chat-btn:hover {
  transition: transform 0.2s ease-in-out;
  background-color: #005bb5;
  transform: scale(1.1);
}

.chat {
  display: none;
  position: fixed;
  z-index: 1;
  right: 10px;
  bottom: 85px;
  width: 415px;
  height: 600px;
  /* overflow: hidden; */
  background-color: #fff;
  box-shadow: 0 1px 2px 1px rgba(47, 56, 61, 0.15), 0 1px 2px rgba(47, 56, 61, 0.2);
  border-radius: 12px;
}

.chat.expand {
  width: 830px;
  height: 650px;
}

.chat.expand .chat-area {
  height: 150px;
}

.chat.show {
  display: flex;
  flex-direction: column;
}

.chat .chat-head {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  background-color: var(--color-bwg-main);
  height: 80px;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  color: var(--color-white);
  margin-bottom: 40px;
}

.chat .chat-head .model {
  display: flex;
  align-items: center;
  position: absolute;
  width: 100%;
  height: 50px;
  background-color: #fff;
  top: 80px;
  left: 0;
  padding: 0 1rem;
}

.chat .chat-head .model .backdrop {
  display: none;
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2;
}

.chat .chat-head .model .backdrop.is-active {
  display: block;
}

#model-toggle {
  color: var(--color-bwg-main);
  font-weight: 600;
  background: url(../img/chevron.svg) no-repeat;
  background-position: right 0.5rem top 50%;
  background-size: auto 0.65em;
  outline: none;
  border: none;
  line-height: inherit;
  padding: 0.5rem 1.5rem 0.5rem 0.75rem;
  border-radius: 0.5rem;
  transition: all 0.15s ease-in-out;
}

#model-toggle:hover {
  background-color: #f1f1f1;
}

#model-popover {
  display: none;
  list-style: none;
  border-radius: 6px;
  border: none;
  font-weight: 500;
  width: 115px;
  box-shadow: 0 8px 16px rgba(10, 10, 10, 0.1);
  position: absolute;
  top: 45px;
  background-color: #fff;
  padding: 0.25em;
  margin: 0;
  z-index: 3;
}

#model-popover.show {
  display: block;
}

#model-popover li {
  font-size: 14px;
  padding: 0.5rem;
  cursor: pointer;
  color: #222;
  border-radius: 6px;
}

#model-popover li:hover {
  background-color: #f1f1f1;
}

.chat-head .model .tooltip {
  position: relative;
  cursor: pointer;
  line-height: 10px;
  margin-left: 5px;
}

.chat-head .model .tooltip .tooltip-text {
  visibility: hidden;
  width: 280px;
  background-color: #fff;
  color: #222;
  text-align: center;
  border-radius: 6px;
  padding: 10px;
  font-size: 13px;
  line-height: 1.5;
  white-space: normal;
  box-shadow: 0 8px 16px rgba(10, 10, 10, 0.1);
  position: absolute;
  z-index: 999;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);

  /* Fade in tooltip */
  opacity: 0;
  transition: opacity 0.3s;
}

.chat-head .model .tooltip .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #fff transparent transparent transparent;
}

.chat-head .model .tooltip:hover .tooltip-text {
  cursor: pointer;
  visibility: visible;
  opacity: 1;
}

.chat-logo {
  display: inline-block;
  width: 40px;
  height: 40px;
  background-image: url('../img/logo.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  margin-right: 5px;
}

.chat-logo-title-contents {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-grow: 1;
}

.chat-logo-title-contents .chat-logo-title {
  font-size: 29px;
  font-weight: 600;
}

.chat-logo-title-contents .chat-logo-title.sub {
  font-size: 12px;
  font-weight: 300;
}

#expand-btn,
#close-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 35px;
  height: 35px;
  cursor: pointer;
  border-radius: 6px;
  transition: 300ms ease;
}

#close-btn {
  display: none;
}

#expand-btn:hover,
#close-btn:hover {
  cursor: pointer;
  background-color: #005bb5;
}

#expand-btn:active svg,
#close-btn:active svg {
  transform: scale(0.9);
}

.chat .chat-body {
  padding: 1rem;
  height: 420px;
  border-bottom: 1px solid var(--color-bwg-main);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  color: var(--color-black);
}

.chat .chat-body .message {
  font-size: 16px;
  max-width: 70%;
  padding: 0.8rem;
  border-radius: 6px;
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.5;
  margin: 0;
}

.chat .chat-body .message.user {
  align-self: flex-end;
  background-color: var(--color-bwg-main);
  color: #fff;
}

.chat .chat-body .message.ai {
  align-self: flex-start;
  background-color: var(--color-blue-50);
  text-align: left;
}

.chat .chat-body .chat-loader {
  display: flex;
  background-color: var(--color-blue-50);
  align-items: center;
  padding-left: 1.5rem;
  width: 65px;
  min-height: 50px;
  border-radius: 6px;
}

.chat .chat-body > ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 10px;
  max-width: 70%;
}

.chat .chat-body > ul li {
  cursor: pointer;
  background-color: var(--color-blue-50);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  transition: 300ms ease;
}

.chat .chat-body > ul li:hover {
  transform: translateY(-5px);
}

.chat .chat-area {
  display: flex;
  justify-content: center;
  height: 100px;
  padding: 10px;
  padding-right: 1rem;
  gap: 10px;
}

.chat .chat-area textarea {
  border: none;
  outline: none;
  width: 100%;
  /* height: 55px; */
  height: 100%;
  resize: none; /* 사용자가 크기를 변경하지 못하게 설정 */
  font-size: 16px;
  line-height: 1.5;
}

.chat .chat-area textarea:focus {
  outline: none;
}

.chat .chat-area .chat-btn-area {
  display: flex;
  align-items: center;
  width: 40px;
  height: 100%;
}

#send-btn {
  cursor: pointer;
  display: none;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--color-bwg-main);
}

#stop-btn {
  cursor: pointer;
  display: none;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--color-bwg-main);
}

#send-btn:active,
#stop-btn:active {
  background-color: #005bb5;
  transition: 0.3ms ease;
}

#send-btn.active {
  display: flex;
}

#stop-btn.active {
  display: flex;
}

#stop-btn.active #send-btn {
  display: none;
}

#send-btn.active #stop-btn {
  display: none;
}

.chat .chat-area .chat-btn-area .send-btn svg {
  margin-left: 2px;
}

.loader {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: l5 1s infinite linear alternate;
}

@keyframes l5 {
  0% {
    box-shadow: 15px 0 var(--color-bwg-main), -15px 0 var(--color-bwg-20);
    background: var(--color-bwg-main);
  }

  33% {
    box-shadow: 15px 0 var(--color-bwg-main), -15px 0 var(--color-bwg-20);
    background: var(--color-bwg-20);
  }

  66% {
    box-shadow: 15px 0 var(--color-bwg-20), -15px 0 var(--color-bwg-main);
    background: var(--color-bwg-20);
  }

  100% {
    box-shadow: 15px 0 var(--color-bwg-20), -15px 0 var(--color-bwg-main);
    background: var(--color-bwg-main);
  }
}

@media screen and (max-width: 768.5px) {
  .chat {
    width: 100%;
    height: 100%;
    z-index: 100;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }

  .chat.expand {
    width: 100%;
    height: 100%;
  }

  .chat .chat-head .chat-logo {
    margin-top: 3px;
    width: 30px;
    height: 30px;
  }

  .chat-logo-title-contents .chat-logo-title.main {
    font-size: 20px;
  }

  .chat-logo-title-contents .chat-logo-title.sub {
    font-size: 10px;
  }

  #expand-btn {
    display: none;
  }

  #close-btn {
    display: flex;
  }

  .chat .chat-body {
    height: 100%;
  }

  .chat .chat-area textarea {
    font-size: 13px;
  }

  .chat .chat-body .message {
    max-width: 90%;
    font-size: 12px;
  }

  .chat .chat-head .model {
    top: 60px;
  }

  .chat-head .model .tooltip .tooltip-text {
    font-size: 12px;
    width: 200px;
  }
}