/* Styles used in chat.html */
html, body {
  scroll-behavior: smooth;
  min-height: 100%;
  height: 100%;
  background-color: #f5f5f5;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
  padding: 0;
}

/* body {
  min-height: 100%;
  height: 100%;
  background-color: #f5f5f5;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
  padding: 2rem;
} */
.page-wrapper {
  display: flex;
  background-color: inherit;
  flex-direction: column;
  min-height: 100vh;
}

.chat-box-wrapper {
  flex-grow: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-box {
  flex-grow: 1;
  overflow-y: auto;
  max-height: calc(100vh - 450px); /* adjust based on header + form height */
  padding: 1rem;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  background-color: #f9f9f9;
}

/* Don't resize the chat box to fit on landscape mobile phones */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .chat-box {
    max-height: none !important;
    height: auto;
  }
}

.chat-box .chat-placeholder {
    color: #979696;
    font-style: italic;
    /* content: "No conversation yet. Ask a question to begin."; */
}
.chat-turn {
    margin-bottom: 1.5rem;
}
.chat-turn .user {
    font-weight: bold;
    color: #3273dc;
}
.chat-turn .assistant {
    margin-top: 0.5rem;
    color: #23d160
}
.chat-turn + .chat-turn {
  border-top: 1px solid #e2e2e2;
  margin-top: 1rem;
  padding-top: 1rem;
}

.spinner {
    opacity: 1;
}


/* Animated "Thinking..." message to make sure it gets noticed. */
#thinking {
  opacity: 0;
  transition: opacity 0.5s ease;
}
@keyframes pulse {
  0% {
    opacity: 0.3;
    color: #888;
    background-color: transparent;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    color: #582b2b;
    background-color: #faffb4;
    transform: scale(1.05);
  }
  100% {
    opacity: 0.3;
    color: #888;
    background-color: transparent;
    transform: scale(1);
  }
}
#thinking.pulsing {
  animation: pulse 1.5s infinite;
}

/* Animation to add new model responses by sliding in from the top */
@keyframes slideInFromTop {
  from {
    /* opacity: 0; */
    transform: translateY(-20px);
  }
  to {
    /* opacity: 1; */
    transform: translateY(0);
  }
}
.chat-turn {
  animation: slideInFromTop 0.4s ease;
}
.new-turn {
  animation: slideInFromTop 0.4s ease;
}
/* End of animation styling */
/*  Thoughts */
.assistant-thoughts {
  background-color: #eef6ff;
  border-left: 4px solid #3273dc;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  border-radius: 4px;
  font-style: italic;
  color: #363636;
}
.scroll-indicator {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.5rem;
  color: #3273dc;
  animation: bounce 1.2s infinite;
  transition: opacity 0.4s ease;
  opacity: 1;
  pointer-events: none; /* ensures it doesn't block clicks */
}
/* Scroll indicator bounce animation */
@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(4px); }
}

/* Info button above the Demo mode dropdown */
#infoBtn {
  cursor: pointer;
  border-radius: 50%;
  padding: 2px 6px;
  color: #097deb;
  /* background-color: #eee; */
  font-weight: bold;
  border: none;
} 
 /* Tooltip fade-in and fade-out */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-5px); }
}

#tooltip {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  position: absolute;
  top: 30px;
  left: 0;
  padding: 8px 12px;
  background-color: #eee;
  border: 2px solid #3d3d3d;
  border-radius: 10px;
  z-index: 9999;

}

#tooltip.show {
  animation: fadeIn 0.3s ease forwards;
  pointer-events: auto;
}

#tooltip.hide {
  animation: fadeOut 0.3s ease forwards;
  pointer-events: none;
}

#closeTooltip {
  position: absolute;
  top: 4px;
  right: 6px;
  cursor: pointer;
  font-weight: bold;
  color: #ff0101;
}
/* ######################################################################################## */
/* Dark mode patch */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #121212;
    color: #e0e0e0;
  }
  /* Input box */
  .input,
  .textarea,
  .select select {
    background-color: #1e1e1e;
    color: #e0e0e0;
    border-color: #444;
  }

  .input::placeholder {
    color: #888;
  }

  .input:focus {
    border-color: #4ea1ff;
    box-shadow: 0 0 0 0.125em rgba(78, 161, 255, 0.25);
  }

  /* Chat box */
  .chat-box {
    background-color: #1e1e1e;
    border-color: #333;
  }

  .chat-box .chat-placeholder {
    color: #aaa;
  }

  .chat-turn {
    background-color: #1a1a1a;
    border-top: 1px solid #444;
  }

  .chat-turn .user {
    color: #4ea1ff;
  }

  .chat-turn .assistant {
    color: #4fdc8c;
  }

  /* Buttons */
  .button {
    color: #fff;
    transition: background-color 0.2s ease;
  }

  .button.is-primary {
    background-color: #3273dc;
    border-color: transparent;
  }

  .button.is-primary:hover,
  .button.is-primary.is-loading {
    background-color: #3063b4;
    border-color: transparent;
  }

  .button.is-danger {
    background-color: #ff3860;
  }
  .button.is-danger:hover {
    background-color: #cf2c4c;
  }

  .button.is-link {
    background-color: #485fc7;
  }
  .button.is-link:hover {
    background-color: #3e52ad;
  }

  /* Text elements */
    .assistant-thoughts {
    background-color: #1e2a3a;
    border-left: 4px solid #4ea1ff;
    color: #ccc;
  }
    #scroll-indicator {
    color: #4ea1ff;
  }
  /* Scroll bar */
  .chat-box::-webkit-scrollbar {
    width: 8px;
  }

  .chat-box::-webkit-scrollbar-track {
    background: #1e1e1e;
  }

  .chat-box::-webkit-scrollbar-thumb {
    background-color: #444;
    border-radius: 4px;
    border: 2px solid #1e1e1e;
  }
  /* Special case when browser auto-fill is selected as the input */
  input:-webkit-autofill,
  input:-webkit-autofill:focus,
  input:-webkit-autofill:hover {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
    caret-color: #e0e0e0;
    box-shadow: 0 0 0px 1000px #1e1e1e inset !important;
    -webkit-text-fill-color: #e0e0e0 !important; /* This is the key to forcing the text to be light grey*/
    border-color: #4ea1ff;
  }

  /* Info button */
  #infoBtn {
    color: #eee;
    /* background-color: #097deb; */
  } 
  /* Tooltip */
  #tooltip {
    background-color: #3d3d3d;
    border: 2px solid #eee;
  }

}

/* End of dark mode patch */