@import url('base.css');

#trelis-chatbot {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.jp-ChatbotWidget {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding: 10px;
}

.chat-interface {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-container {
  flex-grow: 1;
  overflow-y: auto;
  margin-bottom: 20px;
  padding: 10px;
}

.chat-message {
  margin: 10px 0;  /* Change from margin-bottom: 15px to equal top/bottom margins */
  padding: 10px;
  border-radius: 8px;
  position: relative; /* For the left border */
  padding-left: 20px; /* Make room for the left border */
}

.user-message {
  border-left: 4px solid #4CAF50; /* Green for user */
  background-color: #f5f9f5;
}

.assistant-message {
  border-left: 4px solid #0f579b; /* Blue for assistant */
  background-color: #f8f9fa;
}

/* Remove the "You:" and "Trelis Assistant:" labels from the messages */
.chat-message strong {
  display: none;
}

/* Style for the generating message */
.generating-message {
  font-style: italic;
  color: #666;
  padding: 10px;
  margin: 10px 0;  /* Make consistent with other messages */
  background-color: #f8f9fa;
  border-left: 4px solid #0f579b;
  padding-left: 20px;
}

.code-container {
  display: flex;
  flex-direction: column; /* Stack children vertically */
  position: relative;
  margin: 0.5rem 0;
  padding: 0.25rem;
  background-color: #f8f8f8;
  border-radius: 4px;
}

.code-container pre {
  padding: 0.25rem;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.button-container {
  display: flex;
  gap: 8px; /* Space between buttons */
  align-items: center;
  margin-top: 8px; /* Space between code and buttons */
}

.replace-button {
  background-color: #0f579b;
  color: white;
  border: none;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 12px;
}

.input-container {
  display: flex;
  flex-direction: column;
  border-top: 1px solid #ccc;
  padding-top: 10px;
  width: 100%;
  box-sizing: border-box;
}

.input-area {
  width: 100%;
  min-height: 10rem;
  max-height: 25rem;
  margin-bottom: 1rem;
  resize: vertical;
  overflow-y: auto;
  padding: 8px;
  border-radius: 4px;
  border: 1px solid #ccc;
  box-sizing: border-box;
}

.send-button-container {
  display: flex;
  flex-direction: column;
  gap: 10px; /* Space between buttons */
}

/* Style for the send button and hint */
.send-button {
  background-color: #0f579b;
  color: white;
  border: none;
  padding: 8px 15px;
  cursor: pointer;
  border-radius: 4px;
  width: 100px;
}

.send-button-hint {
  font-style: italic;
  color: #666;
  margin-left: 10px;
}

.copy-button {
  background-color: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.copy-button svg {
  width: 16px; /* Adjust size as needed */
  height: 16px; /* Adjust size as needed */
  fill: #0f579b; /* Match the theme color */
}

/* Optional: Add hover effect */
.copy-button:hover {
  opacity: 0.7; /* Slightly fade on hover */
}

.api-key-container {
  padding: 15px;
  margin-bottom: 15px;
  border-bottom: 1px solid #ccc;
}

.api-key-input-group {
  margin-bottom: 10px;
}

.api-key-input-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.api-key-input-group label a {
  color: #0f579b;
  text-decoration: none;
}

.api-key-input-group label a:hover {
  text-decoration: underline;
}

.api-key-input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 10px;
}

.api-key-actions-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.get-api-key-link {
  color: #0f579b;
  text-decoration: none;
  font-size: 14px;
}

.get-api-key-link:hover {
  text-decoration: underline;
}

.save-key-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.save-key-container input[type="checkbox"] {
  margin: 0;
}

.save-key-container label {
  font-size: 14px;
}

.save-button {
  background-color: #0f579b;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.save-button:hover {
  background-color: #0d4a84;
}

.error-message {
  background-color: #ffebee;
  border-left: 4px solid #f44336;
  padding: 10px;
  margin: 10px 0;
  font-family: monospace;
  white-space: pre-wrap;
}

.send-button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

.input-area:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

/* Add styles for the button container */
.action-buttons-container {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

/* Style for the New Chat button */
.new-chat-button {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 8px 15px;
  cursor: pointer;
  border-radius: 4px;
  width: 100px;
  align-self: flex-start; /* Align with the Send button */
}

.new-chat-button:hover {
  background-color: #45a049;
}

/* Add style for the scroll button */
.scroll-button {
  background-color: #6c757d;  /* Different color to distinguish from replace button */
  color: white;
  border: none;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 12px;
}

.scroll-button:hover {
  background-color: #5a6268;
}

.logout-link {
  margin-left: 10px;
  color: #666;
  text-decoration: none;
  font-style: italic;
}

.logout-link:hover {
  text-decoration: underline;
  cursor: pointer;
}

/* Add these styles for markdown headings */
.chat-message h1 {
  font-size: 1.3em;
  margin: 0.5em 0;
}

.chat-message h2 {
  font-size: 1.2em;
  margin: 0.4em 0;
}

.chat-message h3 {
  font-size: 1.1em;
  margin: 0.3em 0;
}

.chat-message h4, .chat-message h5, .chat-message h6 {
  font-size: 1em;
  margin: 0.2em 0;
}

/* Add styles for the support link footer */
.chat-footer {
    padding: 8px 0;
    text-align: center;
    border-top: 1px solid #eee;
    margin-top: 10px;
}

.support-link {
    color: #666;
    text-decoration: none;
    font-size: 0.9em;
}

.support-link:hover {
    text-decoration: underline;
    color: #0f579b;
}

.cancel-button {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 4px;
    margin-left: 10px;
}

.cancel-button:hover {
    background-color: #c82333;
}

/* Add styles for message editing */
.message-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 4px;
}

.edit-message-button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 14px;
}

.edit-message-button:hover {
    color: #333;
}

.edit-wrapper {
    width: 100%;
    padding: 0;  /* Match the padding of the message */
    box-sizing: border-box;
}

.edit-message-textarea {
    width: 100%;
    min-height: 60px;
    padding: 8px;
    margin: 4px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.edit-buttons-container {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

.edit-save-button, .edit-cancel-button {
    padding: 4px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.edit-save-button {
    background-color: #4CAF50;
    color: white;
}

.edit-cancel-button {
    background-color: #6c757d;
    color: white;
}

.edit-save-button:hover {
    background-color: #45a049;
}

.edit-cancel-button:hover {
    background-color: #5a6268;
}
