* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

:root {
  /* ========== Colors ========== */
  --body-color: #fff;
  --sidebar-color: #F9F9F9;
  --primary-color: #3B7B9A;
  --border-color: #ECECF1;
  --primary-color-light: #f0f0f5;
  --toggle-color: white;
  --text-color: black;
  --grey-hover: #f1f1f3;
  --grey-btn-color: #f0f0f5;
  --grey-text-color: #6e6e80;

  /* ========== Filters ========== */
  /* https://codepen.io/sosuke/pen/Pjoqqp */
  --sidebar-icon-filter: invert(66%) sepia(11%) saturate(414%) hue-rotate(202deg) brightness(85%) contrast(84%);
  --filter-white: brightness(0) invert(1);
  --filter-grey: filter: invert(51%) sepia(1%) saturate(3213%) hue-rotate(202deg) brightness(86%) contrast(104%);

  /* ========== Transitions ========== */
  --tran-02: all 0.2s ease;
  --tran-03: all 0.3s ease;
  --tran-04: all 0.4s ease;
  --tran-05: all 0.5s ease;

  /* ========== Padding ========== */
  --sidebar-padding: 10px;
  --chat-window-margin-vertical: 40px;
  --textbox-container-margin-horizontal: 60px;

  --top-menu-height: 50px;
  --top-menu-top-margin: 20px;
  --col-2-left-padding: 10px;
  --col-2-right-padding: 50px;
  --chat-window-top-margin: 10px;
  --user-input-wrapper-height: 50px;
  --user-input-border-color: #9b9b9b;
}

body {
  height: 100vh;
  width: 100vw;
  background: var(--body-color);
}

/* ============================== Setting up the page grid ============================== */

.grid-container {
  display: grid;
  grid-template-columns: min-content 1fr; /* Adjust the column widths */
  grid-template-rows: 1fr min-content; /* Make grid take up full viewport height */
  height: 100vh; /* Ensure container takes up full height */
  width: 100vw;
  overflow: hidden;
  min-height: 0;
  min-width: 0; 
}
/* ============================== Sidebar ============================== */

.menu-links {
  padding-left: 0;
  margin: 0;
}

.logout-container {
  display: flex;
  align-items: center;
  justify-content: space-between; /* Push the .uid element to the right */
  width: 100%; /* Ensure it takes up the full width */
}
.logout-button {
  width: 100%;
}
.login-button.hidden {
  display: none;
}
.logout-button.hidden {
  display: none;
}
.uid {
  display: block;
}
.uid.hidden{
  display: none;
}
.uid img {
  filter: var(--filter-grey);
}

/* ============================== Top Menu ============================== */
.top-menu-buttons {
  display: flex;
  flex-wrap: nowrap;
  margin-right: auto;
}

.top-menu-button {
  background: #F4F4F4;
  border: none;
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  margin: 0 5px;
}

.top-menu-button:hover {
  background: #d1d1dc;
}

.login-button:hover {
  background: #d1d1dc;
}

.chat-window-buttons .top-menu-button {
  margin: 0;
}

.chat-window-buttons {
  display: flex;
  gap: 1vw; /* Adjust spacing between buttons */
  align-items: center; /* Vertically center-align the buttons */
  justify-content: flex-end;
}
.chat-window-buttons .icon-button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.chat-window-buttons .icon-button img {
  width: 20px;
  height: 20px;
}
.chat-window-buttons .icon-button span {
  display: inline-block;
}


/* ============================== Main Chat Window ============================== */

.chat-window {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--body-color);
  padding: 0 var(--chat-window-margin-vertical);
  transition: var(--tran-05);
  grid-column: 2;
  grid-row: 1;
  overflow: scroll;
}

.chat-window .chat-message {
  position: relative;
  margin: 20px 0;
  padding: 20px;
  background-color: #F4F4F4;
  border-radius: 20px;
}

.chat-window .chat-message .message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-window .chat-message .message-sender {
  font-weight: bold;
  color: #333;
  margin: 0;
}

.chat-window .chat-message .message-icons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-window .chat-message .message-body {
  margin: 4px 0 0 0;
  color: black;
}

.chat-window .chat-message .icon {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.top-content-wrapper {
  position: sticky;
  top: 0;
  z-index: 10; /* Adjust the z-index if necessary to ensure it's above other content */
  background-color: var(--body-color); /* Ensures it has the same background color as the parent */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  margin-bottom: 10px;
}

/* ============================== User Input Box / Footer ============================== */
.textbox-container {
  position: relative;
  height: 100%;
  width: 100%;
  padding: 20px;
  border-radius: 25px;
  background: #F4F4F4;
}

.textbox-container #user-input {
  width: 100%;
  min-height: 50px;
  max-height: 150px;
  resize: none;
  font-size: 14px;
  box-sizing: border-box;
  border: none;
  outline: none;
  background: #F4F4F4;
  align-items: flex-start;
}

.file-upload-item {
  display: flex;
  align-items: center;
  padding: 5px;
  border: 1px solid #ddd;
  border-radius: 5px;
  width: min-content;
  background: white;
}

.file-upload-item button {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
}

.uploaded-files-container {
  width: 100%;
  max-width: 100%;
  height: min-content;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  grid-gap: 10px;
}

.textbox-container .buttons-container {
  position: absolute;
  bottom: 10px;
  left: 20px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.textbox-container .buttons-container .left-buttons,
.textbox-container .buttons-container .right-buttons {
  display: flex;
  gap: 10px;
}

.textbox-container .buttons-container .left-buttons .icon-button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.textbox-container .buttons-container .left-buttons .icon-button img {
  width: 24px;
  height: 24px;
}

.textbox-container .buttons-container .right-buttons .run-button-group {
  display: flex;
  align-items: center;
  position: relative;
}


.chat-btn, .dropdown-button {
  background-color: black; /* Green background */
  border: none;
  color: white;
  padding: 5px 10px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 14px;
  margin: 0;
  cursor: pointer;
  border-radius: 4px;
  position: relative;
}

.textbox-container .buttons-container .right-buttons .run-button-group .chat-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}


.textbox-container .buttons-container .right-buttons .run-button-group .chat-btn .icon {
  margin-right: 10px;
  width: 16px;
  height: 16px;
  filter: var(--filter-white);
}

#stop-submit {
    display: none;
}

.textbox-container .buttons-container .right-buttons .run-button-group .separator {
  width: 1px;
  height: 24px;
  background-color: white;
  margin: 0 0.5px;
}

.dropdown-button {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  height: 100%;
  display: flex;
  align-items: center;
}

.dropdown-button .dropdown-icon {
  width: 10px;
  filter: var(--filter-white);
}

.dropdown-menu {
  display: none;
  position: absolute;
  bottom: 100%; /* Position above the button */
  left: 0;
  background-color: #f9f9f9;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px; /* Add space between button and menu */
}

.dropdown-menu .dropdown-item {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  cursor: pointer;
}

.dropdown-menu .dropdown-item:hover {
  background-color: #f1f1f1;
}

/* ============================== Threads Dropdown ============================== */
.threads-dropdown {
  width: min-content;
  max-width: calc(100% - 250px); /* Adjust based on the width of the buttons */
  min-width: 100px;
  position: relative;
  display: inline-block;
}

.threads-dropdown-btn {
  width: 100%;
  height: auto;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  background: var(--body-color);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  border-radius: 10px; /* Add border-radius for better visual effect */
  padding: 10px;
}

.threads-dropdown-btn:hover {
  background: var(--grey-btn-color);
}

.threads-dropdown-btn img {
  width: 14px;
  height: 14px;
  margin-left: 5px;
}

.threads-dropdown-menu {
  display: none;
  position: absolute;
  top: 40px;
  width: 100%; /* Ensure the dropdown menu matches the button's width */
  min-width: 300px;
  max-height: 50vh;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background-color: var(--body-color);
  z-index: 1;
  max-height: 200px;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  font-size: 14px;
  overflow: scroll;
}

.threads-dropdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #ccc; /* Optional: Adds a bottom border to each item */
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: relative; /* Ensure positioning context for the more button */
}

.threads-dropdown-item-edit {
    width: 100%;
}

.threads-dropdown-item .threads-dropdown-item-more-button {
  width: 20px; /* Set the width of the more button */
  height: 20px; /* Set the height of the more button */
  cursor: pointer; /* Change cursor to pointer to indicate it's clickable */
  position: absolute; /* Position it absolutely within the item */
  right: 10px; /* Adjust as necessary */
}

.threads-dropdown-text {
  flex-grow: 1;
  overflow: hidden;
  white-space: nowrap;
  margin-right: 5px; /* Ensure space for the more button */
}

.threads-dropdown-item-text {
  flex-grow: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 25px; /* Ensure space for the more button */
}

.threads-dropdown-item:hover {
  background-color: #f1f1f1;
}

.threads-dropdown-item.hover {
  background-color: #f1f1f1;
}

.hidden {
  display: none;
}

.active {
  display: block;
}

/* ============================== Modals ============================== */
/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
}

.modal-content {
  background-color: #fff;
  margin: 10% auto;
  padding: 20px;
  border-radius: 10px;
  width: 30vw;
  min-width: min-content;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  position: relative;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
}

h2 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 24px;
}

.input-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

.input-group label {
  margin-bottom: 5px;
  font-weight: bold;
}

.input-group input {
  padding: 10px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#personal-storage-modal .modal-content {
  width: min-content;
  max-width: 800px;
}

#personal-storage-modal .input-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1em;
}

#personal-storage-modal .input-group label {
  margin-bottom: 0.5em;
}

#personal-storage-modal .input-group input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

#personal-storage-modal .input-group .search-button {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: -1px; /* To merge the borders */
  display: inline-block;
  padding-left: 10px;
  padding-right: 10px;
}

#personal-storage-modal .input-group input,
#personal-storage-modal .input-group .search-button {
  border: 1px solid #ccc;
  padding: 10px;
}

#personal-storage-modal .input-group input {
  flex: 1;
}

.personal-storage-import-input-field {
  display: flex;
  width: 500px;
}

.button-group {
  display: flex;
  justify-content: space-between;
  gap: 15px;
}

.button {
  padding: 10px 20px;
  font-size: 14px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.continue-button-group, .reconnect-button-group {
  display: none;
  text-align: center;
}

.save-button {
  background-color: #007bff;
  color: white;
}

.remove-button {
  background-color: #dc3545;
  color: white;
}

.dropdown-container {
  margin-top: 10px;
}

.dropdown-container select {
  margin-left: 5px;
}

#login-modal .modal-content p {
  text-align: center;
}

.button-group.login-modal-buttons {
  justify-content: center;
}

.threads-dropdown-item-actions {
  display: none;
  position: absolute;
  top: 0; /* Align with the top of the threads-dropdown-item */
  left: 100%; /* Position to the right of the threads-dropdown-menu */
  background: white;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  z-index: 1000;
  white-space: nowrap; /* Prevent text wrapping */
}

.threads-dropdown-item-actions .action {
  padding: 10px 20px;
  cursor: pointer;
  white-space: nowrap;
}

.threads-dropdown-item-actions .action:hover {
  background-color: #f1f1f1;
}

.loader {
  display: none;
  width: 95%;
  height: 7px;
  position: absolute; /* Position it absolutely within the textbox-container */
  top: calc(0.5 * var(--chat-window-margin-vertical)); /* Adjust the top position to ignore the container's vertical margin */
  left: calc(0.5 * var(--textbox-container-margin-horizontal)); /* Adjust the left position to ignore the container's horizontal margin */
  overflow: hidden;
  background-color: #f4f4f4;
  border-radius: 20px;
  z-index: 1000; /* Ensure it is on top */
}

.loader:before {
  content: "";
  position: absolute;
  left: -50%;
  height: 7px;
  width: 40%;
  background-color: #d1d1dc;
  animation: lineAnim 2s linear infinite;
  border-radius: 20px;
}

@keyframes lineAnim {
  0% { left: -40%; }
  50% { left: 20%; width: 80%; }
  100% { left: 100%; width: 100%; }
}

.file-storage-threads-list {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: #fff;
  max-height: 300px;
  overflow-y: auto;
}

.file-storage-thread-item {
  padding: 8px 0;
  cursor: pointer;
}

.file-storage-thread-item:hover {
  background-color: #f1f1f1;
}

.personal-storage-threads {
  display: flex;
  flex-direction: column;
}

.storage-header {
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 10px;
}

.storage-header p {
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.storage-header a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#open-assistant-configuration-btn, #close-assistant-configuration-btn {
  display: none;
}

#close-assistant-configuration-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000; /* Ensure the button is above other content */
  left: calc(var(--assistant-configuration-width) - 40px);
}

#open-assistant-configuration-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000; /* Ensure the button is above other content */
  left: -5px;
}

#close-assistant-configuration-btn img, #open-assistant-configuration-btn img {
  width: 23px;
  height: 23px;
}

.user-input-wrapper {
  position: relative;
  grid-column: 2;
  grid-row: 2;
  padding: var(--chat-window-margin-vertical) var(--textbox-container-margin-horizontal);
}

div.nano_start, div.nano_end {
  font-size: 1px;
  height: 1px;
  color: transparent;
}

.code-header {
  background: #FFFFFF;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  padding-bottom: 20px;
}

/* Ensure the code block background is white */
.code-container pre.hljs, 
.code-container pre.hljs code {
    background-color: white !important;
    color: black !important; /* Ensure the text color is appropriate for a light background */
}

.code-buttons {
  display: flex;
  gap: 5px;
  margin-left: 10px;
}

.code-buttons .code-button {
  background: none;
  border: none;
  cursor: pointer;
}

.code-buttons .code-button img {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

#import-thread-modal .modal-content p {
  text-align: center;
}

.footer {
  text-align: center;
  font-size: 12px;
  padding-top: 10px;
}

.notice.success {
  display: block;
  width: min-content;
  background-color: #47b881;
  color: white;
  text-align: center;
  border-radius: 10px;
  padding: 16px;
  position: absolute;
  z-index: 9999;
  left: 50%;
  transform: translateX(-50%);
  top: 10px;
  min-width: 200px;
}

.notice.failure {
  display: block;
  width: min-content;
  background-color: #f17173;
  color: white;
  text-align: center;
  border-radius: 10px;
  padding: 16px;
  position: absolute;
  z-index: 9999;
  left: 50%;
  transform: translateX(-50%);
  top: 10px;
  min-width: 200px;
}

#function-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
}

#function-modal .modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 20px;
  border-radius: 10px;
  width: 75vw;
  max-height: 75vh;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: auto;
}

#function-modal .close {
  color: #aaa;
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

#function-modal .close:hover,
#function-modal .close:focus {
  color: black;
  text-decoration: none;
}

#function-modal .input-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

#function-modal #function-input {
  width: 100%;
  height: 50vh;
  padding: 10px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  resize: none;
  font-family: monospace;
  white-space: pre;
}

#function-modal .button-group {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
}

#function-modal .button {
  padding: 10px 20px;
  font-size: 14px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

#function-modal .save-button {
  background-color: #007bff;
  color: white;
}

.styled-table {
  border-collapse: collapse;
  width: 100%;
  margin: 25px 0;
  font-size: 18px;
  text-align: left;
}

.styled-table th, .styled-table td {
  border: 1px solid #dddddd;
  padding: 12px 15px;
}

.styled-table th {
  background-color: #f3f3f3;
  font-weight: bold;
  text-align: center;
}

.styled-table tr {
  border-bottom: 1px solid #dddddd;
}

.styled-table tr:nth-of-type(even) {
  background-color: #f9f9f9;
}

.styled-table tr:hover {
  background-color: #f1f1f1;
}

.attach-files-modal .input-group {
  margin-bottom: 20px;
}
.attach-files-modal .button-group {
  display: flex;
  justify-content: flex-end;
}
.attach-files-modal .button {
  background-color: #4CAF50;
  color: white;
  padding: 10px 20px;
  margin: 5px;
  border: none;
  cursor: pointer;
  border-radius: 5px;
}
.attach-files-modal .button:hover {
  background-color: #45a049;
}
.attach-files-modal .drag-drop-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed #ccc;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
}
.attach-files-modal .drag-drop-area img {
  width: 50px;
  height: 50px;
  margin-bottom: 10px;
}
.attach-files-modal .drop_zone {
  border: 2px dashed blue;
  padding: 20px;
  border-radius: 10px;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.attach-files-modal .form-control {
    width: 100%;
    text-align: left;
}

.uploaded-files {
  margin-top: 20px;
}
.uploaded-files table {
  width: 100%;
  border-collapse: collapse;
}
.uploaded-files th, .uploaded-files td {
  border: 1px solid #ddd;
  padding: 8px;
}
.uploaded-files th {
  background-color: #f2f2f2;
  text-align: left;
}

.file-upload-item-img {
  width: 60px;
  height: auto;
}

.chat-file-message {
  position: relative;
  margin: 10px 0;
  padding: 10px;
  border: 1px solid black;
}

.enable-audio-field, .enable-debug-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#enable_audio {
  margin: 0;
}

#stop-recording-button {
  display: none;
}

#audio-field-label {
  margin: 0;
}

.user-img-zoom-in , .user-img-zoom-out {
    float: right;
}

.assistants-suggestions-dropdown .assistants-suggestions-item.selected {
    background-color: #e0e0e0;
}

#assistant-id {
  position: absolute;
  padding: 0 10px 0 5px;
  top: 23px;
  left: 10px;
  border-radius: 10px;
  font-size: 90%;
  background-color: #199ddb;
  color: white;
  display: none;
}

.search-input {
    background-repeat: no-repeat;
    background-image: url(../svg/filter-circle.svg);
    background-position-y: center;
    text-indent: 6px;
}
