:root {
  --max-width: 860px;
}

body {
    font-family: Arial, sans-serif;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    height: 100dvh;
    margin: 0;
    padding: 0;
  }

  .header {
    width: 80dvw;
    max-width: var(--max-width);
    padding: 1rem 1rem 0rem 1rem;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    position: relative;
  }
  
  .header > h1 {
    margin-left: auto;
    margin-right: auto;
  }

  .logo-and-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin-left: auto;
    margin-right: auto;
  }

  .command-tray {
    display: grid;
    grid-template-columns: 2fr 5fr;
    margin-top: 10px;
    margin-bottom: 5px;
    width: 80dvw;
    max-width: var(--max-width);
  }

  .command-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin-left: auto;
  }

  .command-buttons > button {
    text-align: center;
    /* height: 2em; */
  }

  #trace-container {
    width: 80dvw;
    max-width: var(--max-width);
    margin-bottom: 10px;
  }

  .trace-message {
    background-color: rgb(223, 223, 223);
    border-radius: 0px 20px 20px 20px;
    padding: 5px 10px;
    line-height: 1.5;
    margin-top: 10px;
    margin-bottom: 10px;
  }

  button {
    width: 100%;
    cursor: pointer;
    font-size: 12px;
  }

  button:hover {
    background-color: #333;
    color: white;
    transform: translateY(-2px);
  }

  button:active {
    transform: translateY(0px);
  }

  .index {
    width: 50dvw;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
  }

  .index-main-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .login-container {
    transform: translateX(-30%);
    width: 30dvw;
  }
  .login-container > h2 {
    text-align: center;
  }
  
  .register-container {
    transform: translateX(30%);
    width: 30dvw;
  }
  .register-container > h2 {
    text-align: center;
  }
  
  @media (max-width: 767.98px) {
    .index-main-container {
      grid-template-columns: 1fr;
    }
    .login-container, .register-container {
      transform: translateX(0%);
      width: 60dvw;
    }
  }
  
  form {
    display: grid;
  }
  
  .header img {
    width: 5em;
    max-width: 80px;
    vertical-align: middle;
  }
  
  .header h1 {
    font-size: 1.5em;
  }

  #chat-history {
    width: 80dvw;
    max-width: var(--max-width);
    overflow-y: auto;
    background-color: rgb(255, 255, 255);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 1.5dvh;
  }

  .chat-message-container {
    display: flex;
    width: 100%;
    margin-bottom: 10px;
  }
  
  .chat-message {
    font-size: 16px;
    display: inline-block;
    word-wrap: break-word;
    line-height: 1.5;
    padding: 10px 20px;
    border-radius: 20px;
    max-width: 80%;
  }
  
  .chat-message.user {
    background-color: rgb(250, 243, 214);
    border-radius: 20px 20px 1px 20px;
    max-width: 60%;
    margin-left: auto;
  }
  
  .chat-message.system {
    border-radius: 20px 20px 20px 0px;
  }

  .chat-message.ai {
    background-color: rgb(230, 243, 254);
    border-radius: 20px 20px 20px 0px;
    max-height: 130vh;
    overflow-y: scroll;
  }

  .chat-message.ai.image-container.links-container > a {
    margin-right: 1em;
    font-size: 12px;
  }

  .lightaccent {
    background-color: rgb(240, 247, 253);
  }

  .codeblock {
    font-family: monospace;
    font-size: 12px;
  }
  
  .scrollable {
    max-height: 20dvh;
    overflow-y: scroll;
  }

  #chat-input-container {
    width: 77dvw;
    max-width: calc(var(--max-width) - 2dvw);
    display: flex;
    align-items: center;
    flex-direction: column;
    position: relative;
    border-radius: 30px;
    border: 1px solid #dedede;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1), 
            0 1px 3px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
    padding: 17px;
    max-height: 300px; 
  }
  
  #chat-input {
    background-color: #ffffff;
    border: none;
    width: 100%;
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    transition: height 0.2s ease;
    caret-color: black;
    margin-bottom: 30px;
  }

  #chat-input:focus {
    outline: none; 
  }
  
  #send-button {
    width: 100%;
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 35px;
    height: 35px;
    background-color: #000;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
  }
  
  #send-button:hover {
    background-color: #333;
  }
  
  #send-button #send-icon {
    font-size: 20px;
    transition: transform 0.3s ease;
  }

  #chat-history::-webkit-scrollbar {
    width: 6px;
  }
  
  #chat-history::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
  }
  
  #chat-history::-webkit-scrollbar-track {
    background: transparent;
  }

/* lds = loading spinner style */
.lds-spinner,
.lds-spinner div,
.lds-spinner div:after {
  box-sizing: border-box;
}
.lds-spinner {
  color: currentColor;
  display: block;
  position: relative;
  width: 20px;
  height: 20px;
}
.lds-spinner div {
  transform-origin: 10px 10px;
  animation: lds-spinner 1.2s linear infinite;
}
.lds-spinner div:after {
  content: " ";
  display: block;
  position: absolute;
  top: -3px;
  left: 8.8px;
  width: 2.4px;
  height: 7.2px;
  border-radius: 20%;
  background: currentColor;
}
.lds-spinner div:nth-child(1) {
  transform: rotate(0deg);
  animation-delay: -1.1s;
}
.lds-spinner div:nth-child(2) {
  transform: rotate(30deg);
  animation-delay: -1s;
}
.lds-spinner div:nth-child(3) {
  transform: rotate(60deg);
  animation-delay: -0.9s;
}
.lds-spinner div:nth-child(4) {
  transform: rotate(90deg);
  animation-delay: -0.8s;
}
.lds-spinner div:nth-child(5) {
  transform: rotate(120deg);
  animation-delay: -0.7s;
}
.lds-spinner div:nth-child(6) {
  transform: rotate(150deg);
  animation-delay: -0.6s;
}
.lds-spinner div:nth-child(7) {
  transform: rotate(180deg);
  animation-delay: -0.5s;
}
.lds-spinner div:nth-child(8) {
  transform: rotate(210deg);
  animation-delay: -0.4s;
}
.lds-spinner div:nth-child(9) {
  transform: rotate(240deg);
  animation-delay: -0.3s;
}
.lds-spinner div:nth-child(10) {
  transform: rotate(270deg);
  animation-delay: -0.2s;
}
.lds-spinner div:nth-child(11) {
  transform: rotate(300deg);
  animation-delay: -0.1s;
}
.lds-spinner div:nth-child(12) {
  transform: rotate(330deg);
  animation-delay: 0s;
}
@keyframes lds-spinner {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.init-spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.init-spinner-message {
  font-size: 16px;
  text-align: center;
  width: 20vw;
  height: auto;
  color: #7b7b7b;
}

.init-spinner-element {
  border: 16px solid #cacaca;
  border-top: 16px solid #515151;
  border-radius: 50%;
  width: 10vw;
  max-width: 100px;
  height: 10vw;
  max-height: 100px;
  animation: init-spin 2s linear infinite;
}

@keyframes init-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}