/* components.css */
/* Version: 0.1.3 */

/* Dropdown styles */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  cursor: pointer;
  font-size: 16px;
}

.dropdown-menu {
  display: none;
  position: absolute;
  min-width: 200px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
  right: 0;
}

.dropdown:hover .dropdown-menu {
  display: block;
} 

.dropdown-menu a {
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}

.version {
  display: block;
  padding: 8px 16px;
  font-size: 12px;
}

.dropdown-item {
  padding: 8px 16px;
  cursor: pointer;
  position: relative;
}

/* Appearance toggle styles */
.appearance-toggle {
  display: none;
  flex-direction: column;
  margin-top: 8px;
}

.dropdown-item:hover .appearance-toggle {
  display: flex;
}

.appearance-option {
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.appearance-option.active {
  background-color: #444;
  color: #fff;
}

body.light-mode .appearance-option.active {
  background-color: #ddd;
  color: #000;
}

/* Add-ons dropdown styles */
#add-ons-dropdown {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.add-ons-menu {
  display: none;
  flex-direction: column;
  width: 100%;
  margin-top: 8px;
}

#add-ons-dropdown:hover .add-ons-menu {
  display: flex;
}

#add-ons-menu {
  list-style-type: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

.add-on-option {
  padding: 4px 8px;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}

.add-on-option:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Button container styles */
#button-container button {
  border: none;
  padding: 10px 20px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

/* Chat input styles */
#chat-input {
  padding: 20px;
  display: flex;
  justify-content: center;
  width: 100%;
  position: relative;
  z-index: 1;
}

.input-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  border-radius: 8px;
  gap: 8px;
  position: relative;
}

/* Common button styles */
#clients-documents-button,
#recent-conversations-button,
#new-chat-button,
#submit-button,
#copy-button,
#knowledge-upload-btn,  
#chat-attachment-btn { 
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.3s ease, opacity 0.3s ease, color 0.3s ease;
  padding: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  background-color: transparent;
  color: #4CAF50;
  opacity: 0.7;
}

/* SVG styles for icons, including #file-upload-btn and chat-attachment-btn */
#clients-documents-button svg,
#recent-conversations-button svg,
#new-chat-button svg,
#submit-button svg,
#copy-button svg,
#knowledge-upload-btn svg,
#chat-attachment-btn svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

/* Download icon styles */
.feather-download {
  display: inline-flex;
  align-items: center;
  opacity: 0.7;
  cursor: pointer;
  transition: background-color 0.3s ease, opacity 0.3s ease, color 0.3s ease, transform 0.3s ease;
  color: #fff !important;
  position: relative;  /* added for positioning the pseudo-element */
}

.feather-loader {
  display: inline-flex;
  align-items: center;
  opacity: 0.7;
  cursor: pointer;
  transition: background-color 0.3s ease, opacity 0.3s ease, color 0.3s ease;
  color: #fff !important;
}

.feather-download:hover {
  opacity: 1;
  transform: scale(1.1);
  color: #fff !important;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.feather-download.circle-spinner::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 1.5px solid rgba(255, 255, 255, 0.2); /* subtle full circle */
  border-top: 1.5px solid #fff;                  /* bright segment */
  border-radius: 50%;
  animation: spin 0.6s linear infinite;          /* smooth, professional speed */
}

.feather-download svg {
  width: 16px;   /* Reduced from 20px */
  height: 16px;  /* Reduced from 20px */
  stroke: currentColor;
}

/* Ensure icon alignment with text */
.prompt-message .feather-download {
  vertical-align: middle;
  margin-top: -2px; /* Fine-tune vertical alignment */
}

/* Button hover effects */
/* Hover effects */
#clients-documents-button:hover,
#recent-conversations-button:hover,
#copy-button:hover,
#new-chat-button:hover,
#knowledge-upload-btn:hover,
#chat-attachment-btn:hover {
  opacity: 1;
  background-color: #4CAF50;
  color: white;
}

#clients-documents-button:hover svg,
#recent-conversations-button:hover svg,
#copy-button:hover svg,
#new-chat-button:hover svg,
#knowledge-upload-btn:hover svg,
#chat-attachment-btn:hover svg {
  stroke: white;
}

/* Special hover effect for submit button */
#submit-button:hover {
  opacity: 0.8;
}

/* Question input styles */
#question-input {
  flex-grow: 1;
  margin: 0 8px;
  min-height: 40px;
  position: relative;
  z-index: 1;
}

/* Container for both info and error messages */
.prompt-message-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: auto;
  min-height: 0;  /* Add this line */
  padding: 0;     /* Add this line */
}

.prompt-message {
  color: #f0f0f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-color: rgba(76, 175, 80, 0.3);
  padding: 1px 6px;  /* Already reduced from 2px to 1px */
  display: inline-block;
  /* margin-bottom: 2px; -- Removed */
}

/* Add this for fine-tuned icon alignment in prompt message */
.prompt-message .feather-download {
  vertical-align: -2px;
}

.prompt-message-container:empty {
  display: none;
}

/* Dark mode styles for prompt messages */
body.dark-mode .prompt-message {
  color: #8FBC8F;
}

/* Light mode styles for prompt messages */
body.light-mode .prompt-message {
  color: #4CAF50;
}

/* Specific styles for error messages */
.error-message {
  color: #ff4444;
  padding: 2px 6px;
  display: block;
  background-color: transparent;
  border: none;
}

/* Loading indicator styles */
#loading-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 10px;
  border-radius: 4px;
  z-index: 9999;
}

/* Dropup styles */
.dropup {
  position: relative;
  display: inline-block;
}

.dropup::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 100%;
  height: 20px;
}

.dropup-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 5px);
  left: 0;
  background-color: #222;
  min-width: 400px;
  max-width: 500px;
  box-shadow: 0px -8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1000;
  border-radius: 8px;
  padding: 10px;
}

.dropup:hover .dropup-menu,
.dropup:hover::after,
.dropup-menu:hover {
  display: block;
}

/* Conversation list styles */
#conversation-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

.conversation-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid #444;
  cursor: pointer;
}

.conversation-item + .conversation-item {
  margin-top: 4px;
}

.conversation-item:last-child {
  border-bottom: none;
}

.conversation-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.conversation-preview {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 10px;
  font-weight: 300;
  max-width: 80%;
  color: #999;
}

.conversation-date {
  font-size: 0.8em;
  color: #999;
  white-space: nowrap;
  font-weight: 300;
}

/* Client documents list styles */
#clients-documents-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
  max-height: 70vh;
  overflow-y: auto;
}

.client-wrapper {
  position: relative;
  padding: 8px;
  border-bottom: 1px solid #444;
  transition: background-color 0.2s ease;
}

.client-wrapper:last-child {
  border-bottom: none;
}

.client-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: normal;
  color: #999;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
}

.client-header:hover {
  background-color: rgba(139, 188, 143, 0.1);
}

.file-count {
  font-size: 12px;
  color: #999;
}

.file-list {
  display: none;
  list-style-type: none;
  padding-left: 20px;
  margin: 4px 0 0 0;
}

.client-wrapper:hover .file-list {
  display: block;
}

.file-list li {
  font-size: 13px;
  color: #8FBC8F;
  padding: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.file-list li:hover {
  background-color: rgba(139, 188, 143, 0.1);
}

.client-wrapper.selected,
.file-list li.selected {
  background-color: rgba(76, 175, 80, 0.3);
}

/* Adjust dropup menu width */
#clients-documents-dropup .dropup-menu {
  padding: 0;
  overflow-y: auto;
  max-height: 70vh;
}

/* Specific styles for drop-up conversations */
.dropup-menu .conversation-item,
.dropup-menu .conversation-preview,
.dropup-menu .conversation-date {
  font-weight: normal !important;
}

.dropup-menu .conversation-preview {
  font-size: 14px;
}

.dropup-menu .conversation-date {
  font-size: 12px;
}

/* Dark mode specific styles */
body.dark-mode .dropdown-menu,
body.dark-mode .dropup-menu {
  background-color: #333;
  color: #f9f9f9;
}

body.dark-mode .dropdown-menu a,
body.dark-mode .dropup-menu a {
  color: #f9f9f9;
}

body.dark-mode .dropdown-menu a:hover,
body.dark-mode .dropup-menu a:hover,
body.dark-mode .conversation-item:hover,
body.dark-mode .client-wrapper:hover {
  background-color: #444;
}

body.dark-mode .conversation-item,
body.dark-mode .client-wrapper {
  border-bottom-color: #444;
}

body.dark-mode .conversation-date,
body.dark-mode .file-count {
  color: #999;
}

/* Ensure the SVG icons are visible in dark mode */
body.dark-mode #clients-documents-button,
body.dark-mode #recent-conversations-button,
body.dark-mode #submit-button,
body.dark-mode #copy-button,
body.dark-mode #new-chat-button {
  color: #4CAF50;
}

/* Add spinner rule right before the "Light mode specific styles" comment */
body.dark-mode .feather-download.circle-spinner::after {
  border: 1.5px solid rgba(255, 255, 255, 0.2);  /* subtle white circle */
  border-top: 1.5px solid #fff;                  /* bright white segment */
}

/* Light mode specific styles */
body.light-mode .dropdown-menu,
body.light-mode .dropup-menu,
body.light-mode .file-list {
  background-color: #f9f9f9;
  color: #333;
}

body.light-mode .dropdown-menu a,
body.light-mode .dropup-menu a {
  color: #333;
}

body.light-mode .dropdown-menu a:hover,
body.light-mode .dropup-menu a:hover,
body.light-mode .conversation-item:hover,
body.light-mode .client-wrapper:hover {
  background-color: #f0f0f0;
}

body.light-mode .conversation-item,
body.light-mode .client-wrapper {
  border-bottom-color: #ddd;
}

body.light-mode .conversation-date,
body.light-mode .file-count {
  color: #666;
}

body.light-mode .file-list li {
  color: #4CAF50;
}

/* Light mode specific styles */
body.light-mode .feather-download {
  color: #333 !important;  /* Change to black or dark gray to match text */
}

/* Spinner rule for light mode */
body.light-mode .feather-download.circle-spinner::after {
  border: 1.5px solid rgba(51, 51, 51, 0.2);    /* Subtle dark circle */
  border-top: 1.5px solid #333;                 /* Bright black/dark gray segment */
}


/* Media queries */
@media (max-width: 600px) {
  .input-container {
    gap: 4px;
  }
  
  #question-input {
    margin: 0 4px;
  }
}

/* Q/A Mode Toggle - Added 2024-02-25
   Appears under title in header showing Internal/External state 
   Dark mode: Green (#4CAF50) for Internal, Blue (#2196F3) for External
   Light mode: Darker Green (#2E7D32) for Internal, Darker Blue (#1976D2) for External
*/

.qa-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;     /* This will make it only as wide as its content */
  margin: 4px auto 0;
  font-size: 14px;
  font-weight: 200;
}

.toggle-label {
  font-weight: 200;
  color: #8FBC8F;
  opacity: 0.9;
  white-space: nowrap;  /* Add this to prevent breaking */
  margin-right: 4px;    /* Add some spacing */
}

.toggle-buttons {
  /* Add these to contain the buttons properly */
  display: flex;
  width: fit-content;
  background: #1f1f1f;
  border-radius: 4px;
  padding: 2px;
  border: 1px solid #2a2a2a;
}

.mode-button {
  padding: 3px 10px;
  border: none;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 200;
  transition: all 0.2s ease;
}

/* Dark mode styles */
body.dark-mode .toggle-label {
  color: #ffffff;
}

body.dark-mode .mode-button[data-mode="internal"].active {
  background: #4CAF50;
}

body.dark-mode .mode-button[data-mode="external"].active {
  background: #2196F3;
}

/* Light mode styles */
body.light-mode .toggle-label {
  color: #333333;
}

body.light-mode .toggle-buttons {
  background: #f0f0f0;
  border: 1px solid #ddd;
}

body.light-mode .mode-button {
  color: #333;
}

body.light-mode .mode-button[data-mode="internal"].active {
  background: #2E7D32;
  color: #fff;
}

body.light-mode .mode-button[data-mode="external"].active {
  background: #1976D2;
  color: #fff;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .toggle-buttons {
    min-width: 160px;
  }
}