/* PAIC STYLES */

#paic-chatbox-mobile-container {
  --light-background: #1a1a1a;
  --dark-background: #0f0f0f;
  --border-color: #2a2a2a;
  --text-color: #efefef;
  --font-family: Arial, sans-serif;
  --font-size: 14px;
  --border-radius: 8px;
  --user-message-bg: #434383;
  --bot-message-bg: #323232;
  --accent-color: #39af74;
  --close-color: #a82a0d;

  --expanded-height-fallback: min(calc(100vh - 160px), 624px);
  --expanded-height: min(calc(100svh - 160px), 624px);

  overscroll-behavior: contain;

  z-index: 25;
  position: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  width: 100%;
  bottom: 0;
}

#paic-chatbox-top-row {
  width: 100%;
  position: relative;
  bottom: -1px;
}

#paic-chatbox-top-row-close {
  position: absolute;
  justify-items: center;
  align-items: center;
  bottom: 0;
  left: 20px;
  cursor: pointer;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  padding: 6px;
  border: none;
  background-color: var(--close-color);
  color: var(--text-color);
  display: none;
}

#paic-chatbox-mobile-container.expanded #paic-chatbox-top-row-close {
  display: flex;
}

#paic-chatbox-top-row-close > svg {
  width: 20px;
  height: 20px;
}

#paic-chatbox-mobile {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 160px;
  margin-left: auto;
  margin-right: auto;
  cursor: pointer;
  padding-top: 10px;
  padding-bottom: 8px;
  gap: 8px;
  background-color: var(--accent-color);
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  color: var(--text-color);
  font-weight: 600;
  border: none;
}

#paic-chatbox-mobile > svg {
  transition: transform 0.25s ease-out;
}

#paic-chatbox-mobile.expanded > svg {
  transform: rotate(180deg);
}

#paic-chatbox {
  height: 0;
  width: calc(100% - 2px);
  background-color: var(--dark-background);
  border-top-right-radius: 16px;
  border-top-left-radius: 16px;
  transition: height 0.25s ease-out;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#paic-chatbox.expanded {
  height: var(--expanded-height-fallback);
  height: var(--expanded-height);
}

#paic-chatbox-title {
  display: none;
}
#paic-chatbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0px 14px;
  background-color: var(--light-background);
}

#paic-header-buttons {
  display: flex;
  justify-content: end;
  align-items: center;
  gap: 8px;
}

.paic-button {
  height: 40px;
  padding: 4px;
  display: flex;
  border: none;
  align-items: center;
  gap: 4px;
  border-radius: 4px;
  color: #fff;
  background-color: var(--background-color);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.paic-button > .text {
  font-size: 14px;
}

.paic-button > svg {
  width: 16px;
  height: 16px;
}

#paic-chatbox-disclaimer {
  font-size: 12px;
  padding: 6px 12px;
  background-color: #39af741c;
  color: #dedede;
}

#paic-chatbox-content {
  font-size: 14px;
  flex-grow: 1;
  overflow-y: auto;
  padding: 10px;
}

#paic-chatbox-hints-container {
  padding: 0px 8px;
  font-size: 13px;
  color: var(--text-color);
}

#paic-chatbox-hints {
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  padding: 4px 8px;
  background-color: var(--accent-color);
}

#paic-chatbox-input-container {
  display: flex;
  align-items: center;
  padding: 8px 8px 16px 8px;
  background-color: var(--light-background);
  --input-height: 36px;
}

#paic-chatbox-input-container input[type="text"] {
  --input-radius: 4px;
  height: var(--input-height);
  flex-grow: 1;
  padding: 5px;
  box-sizing: border-box;
  border: none;
  border-bottom-left-radius: var(--input-radius);
  border-top-left-radius: var(--input-radius);
  border-bottom-right-radius: 0;
  border-top-right-radius: 0;
  outline: none;
}

#paic-chatbox-input-container button {
  --button-radius: 12px;
  background-color: var(--accent-color);
  color: white;
  width: 90px;
  height: var(--input-height);
  padding: 5px;
  border-top-right-radius: var(--button-radius);
  border-bottom-right-radius: var(--button-radius);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border: none;
  cursor: pointer;
}

#paic-chatbox-input-container input[type="text"],
#paic-chatbox-input-container button {
  transition: background-color 0.15s ease-out;
}

#paic-chatbox-input-container input[type="text"][disabled],
#paic-chatbox-input-container button[disabled] {
  opacity: 0.85;
  cursor: not-allowed;
}
#paic-chatbox-input-container input[type="text"][disabled] {
  background-color: #323232;
}

#paic-chatbox-input-container button[disabled] {
  background-color: #2b4538;
}

.paic-user-message,
.paic-bot-message,
.paic-loading-message {
  margin-bottom: 10px;
  padding: 8px;
  border-radius: 5px;
  max-width: 80%;
  color: var(--text-color);
}

.paic-user-message {
  background: var(--user-message-bg);
  margin-left: auto;
}

.paic-bot-message,
.paic-loading-message {
  background: var(--bot-message-bg);
  margin-right: auto;
}

.paic-user-message div,
.paic-bot-message div {
  margin: 0;
  word-wrap: break-word;
}

/* Message styles */
.paic-user-msg,
.paic-bot-msg,
.paic-loading-msg,
.paic-error-msg {
  margin-bottom: 8px;
  display: flex;
}
.paic-bot-msg {
  color: #e3e3e3;
}
.paic-error-msg {
  color: red;
}

.paic-loading-dot {
  width: 4px;
  height: 4px;
  border-radius: 100%;
  background-color: #dfdfdf;
  animation: paic-loading 1800ms infinite ease-in-out;
  display: inline-block;
  margin-right: 3px;
  opacity: 0%;
}
.paic-loading-message > .paic-loading-dot:nth-of-type(2) {
  animation-delay: 600ms;
}
.paic-loading-message > .paic-loading-dot:nth-of-type(3) {
  animation-delay: 1200ms;
}

@keyframes paic-loading {
  50% {
    opacity: 85%;
  }
}

@media screen and (min-width: 768px) {
  /* #paic-expand-button {
    display: inline-block;
  } */

  #paic-chatbox-mobile-container {
    right: 0;
    bottom: 0;
    left: auto;
    flex-direction: row;
    width: auto;
  }

  #paic-chatbox-top-row {
    width: auto;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: end;
  }

  #paic-chatbox-top-row-close {
    top: 40px;
    bottom: auto;
    left: auto;
    right: 0;
    rotate: -90deg;
  }

  #paic-chatbox-mobile {
    margin-bottom: 250px;
    flex-direction: column;
    width: 80px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 12px;
  }

  #paic-chatbox-mobile > svg {
    transform: rotate(-90deg);
  }

  #paic-chatbox-mobile.expanded > svg {
    transform: rotate(90deg);
  }

  #paic-chatbox {
    border-width: 0;
    width: 0px;
    height: auto;
    transition: width 0.25s ease-out;
    height: var(--expanded-height-fallback);
    height: var(--expanded-height);
    border-top-right-radius: 0;
  }

  #paic-chatbox.expanded {
    border-width: 1px;
    width: min(calc(100vw - 112px), 950px);
  }

  #paic-chatbox-title {
    display: inline-block;
    font-weight: bold;
  }
}
