/* 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;
}

/* Hide future features - used to temporarily hide UI elements not yet implemented */
.hidden {
    display: none !important;
}

/* Chat attachment button - Possible feature for individual file uploads for a chat */
/* Currently hidden via .hidden class - uncomment button in HTML when implementing */
/* 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;
}



/* Item download icon in folder dropdown rows */
.item-download-icon {
    display: inline-flex;
    align-items: center;
    opacity: 0.4;
    cursor: pointer;
    margin-right: 6px;
    transition: opacity 0.15s;
    color: #4CAF50;
}

.item-download-icon:hover {
    opacity: 1.0;
}

.item-download-icon svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.item-text {
    cursor: pointer;
}



/* 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;
  padding: 0;
}

.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: 100%;
  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,
.dropup:has(.client-search-input:focus) .dropup-menu {
  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-search-input {
  width: calc(100% - 16px);
  padding: 8px;
  margin: 8px;
  border: 1px solid #444;
  background: #222;
  color: #fff;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
}

.client-search-input:focus {
  border-color: #4CAF50;
}

.client-search-input::placeholder {
  color: #999;
}

/* Light mode */
body.light-mode .client-search-input {
  background: #fff;
  color: #333;
  border-color: #ddd;
}

body.light-mode .client-search-input:focus {
  border-color: #4CAF50;
}

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

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


/* Report rows in folder dropdown */
.report-row {
  border-bottom: 1px solid #333;
}

.report-row:last-of-type {
  border-bottom: 1px solid #444;
  margin-bottom: 4px;
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  color: #4CAF50;
  font-weight: normal;
}

.report-header .feather-download {
  width: 16px;
  height: 16px;
  opacity: 0.8;
}

.report-header .feather-download svg {
  width: 16px;
  height: 16px;
}

.report-header:hover {
  background-color: rgba(76, 175, 80, 0.1);
}

/* Light mode */
body.light-mode .report-header {
  color: #2E7D32;
}

body.light-mode .report-row {
  border-bottom-color: #ddd;
}

.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;
  border-left: 3px solid transparent;
  transition: border-left-color 0.2s ease, background-color 0.2s ease;
}

.client-header:hover {
  border-left-color: #4CAF50;
  background-color: rgba(139, 188, 143, 0.05);
}

/* Loading state - pulsing green bar with subtle glow */
.client-header.loading,
.quote-item.loading,
.order-item.loading,
.lead-item.loading {
    animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { 
        border-left: 3px solid #4CAF50;
        background-color: rgba(76, 175, 80, 0.05);
    }
    50% { 
        border-left: 3px solid #81c784;
        background-color: rgba(76, 175, 80, 0.25);
    }
}

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

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

/* Show file lists on either hover OR selected */
.client-wrapper:hover .file-list,
.client-wrapper.selected .file-list {
  display: block;
}

/* Show quote lists on either hover OR selected */
.client-wrapper:hover .quotes-list,
.client-wrapper.selected .quotes-list {
  display: block;
}

.file-list li {
  font-size: 13px;
  color: #E5E7EB;
  padding: 4px;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
  width: auto !important;
  min-width: max-content;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.file-list li:hover {
  background-color: rgba(55, 65, 81, 0.5);   /* Equivalent to Tailwind's bg-gray-700/50  oriingal green-tinted 139, 188, 143, 0.1 */
}

/* Quote-specific styles - separate from file list for future customization */
/* Quote-specific styles - separate from file list for future customization */
.quotes-list {
  display: none;
  list-style-type: none;
  padding-left: 20px;
  margin: 4px 0 0 0;
}

.quotes-list .quote-item {
  font-size: 14px;
  font-weight: normal;
  color: #E5E7EB;
  padding: 4px;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
  width: auto !important;
  min-width: max-content;
  border-radius: 4px;
  border-left: 3px solid transparent;
  background-color: transparent;
  transition: border-left-color 0.2s ease, background-color 0.2s ease;
  cursor: pointer;
}

/* Order item styles */
.quotes-list .order-item {
  font-size: 13px;
  font-weight: normal;
  color: #E5E7EB;
  padding: 4px;
  padding-left: 24px;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
  width: auto !important;
  min-width: max-content;
  border-radius: 4px;
  border-left: 3px solid transparent;
  background-color: transparent;
  transition: border-left-color 0.2s ease, background-color 0.2s ease;
  cursor: pointer;
  font-style: italic;
}

/* Quote hover and selected */
.quotes-list .quote-item:hover {
  border-left: 3px solid #4CAF50;
  background-color: rgba(139, 188, 143, 0.05);
}

.quotes-list .quote-item.selected,
.quotes-list .quote-item.selected:hover {
  border-left: 3px solid #4CAF50;
  background-color: rgba(76, 175, 80, 0.3);
}

/* Order hover and selected */
.quotes-list .order-item:hover {
  border-left: 3px solid #4CAF50;
  background-color: rgba(139, 188, 143, 0.05);
}

.quotes-list .order-item.selected,
.quotes-list .order-item.selected:hover {
  border-left: 3px solid #4CAF50;
  background-color: rgba(76, 175, 80, 0.3);
}



/* Lead item styles */
.quotes-list .lead-item {
  font-size: 14px;
  font-weight: normal;
  color: #00b4ff;
  padding: 4px;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
  width: auto !important;
  min-width: max-content;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.quotes-list .lead-item:hover {
  border-left: 3px solid #4CAF50;
  background-color: rgba(139, 188, 143, 0.05);
}

.quotes-list .lead-item.selected {
  border-left: 3px solid #4CAF50;
  background-color: rgba(76, 175, 80, 0.3);
}


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

/* Heat indicator classes for events */
.file-list li.event-opportunity-only {
  color: #4CAF50;  /* Using our existing green */
}

.file-list li.event-risk-only {
  color: #ff4444;  /* Matches error message red */
}

.file-list li.event-hot {
  color: #FFA500;  /* Using web safe orange to match theme */
}

/* Hover states should maintain readability */
.file-list li.event-opportunity-only:hover,
.file-list li.event-risk-only:hover,
.file-list li.event-hot:hover {
  background-color: rgba(139, 188, 143, 0.1);  /* Keep consistent hover effect */
}

/* base */
.dropup-menu { bottom: 100%; }  /* no +5px gap */

#clients-documents-dropup .dropup-menu {
  padding: 0;
  overflow-y: auto;
  max-height: 70vh;       /* still caps size and enables scrolling */
  min-width: 600px !important;
  max-width: 800px !important;
  width: max-content;
}

/* forgiving hover buffer for this menu */
#clients-documents-dropup {
  position: relative; /* already true, but safe */
}

#clients-documents-dropup::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: -8px;
  right: -8px;
  height: 20px;   /* bigger bridge so you can reach top items */
}

/* 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;
}

body.light-mode .quotes-list {
  background-color: #f9f9f9;
}

body.light-mode .quotes-list .quote-item {
  color: #2E7D32;  /* Darker green for light mode */
}

/* 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 {
    display: flex;
    width: fit-content;
    background: #1f1f1f;
    border-radius: 20px; /* Pill shape */
    padding: 4px;
    border: 1px solid #2a2a2a;
    gap: 2px;
}

.mode-button {
    padding: 10px 24px;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    border-radius: 16px; /* Pill shape for individual buttons */
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mode-button:hover {
    color: #fff;
}

.mode-button.active {
    color: #fff;
}

/* Dark mode styles */
body.dark-mode .toggle-buttons {
    background: #1f1f1f;
    border: 1px solid #2a2a2a;
}

body.dark-mode .mode-button {
    color: #aaa;
}

/* Leads ROSS blue */
body.dark-mode .mode-button[data-mode="leads"].active {
  background: #00b4ff;
  color: #fff;
}

/* Activity orange */
body.dark-mode .mode-button[data-mode="activity"].active {
  background: #FF9800;
  color: #fff;
}

/* Q&A green */
body.dark-mode .mode-button[data-mode="qa"].active {
  background: #4CAF50;
  color: #fff;
}

/* AI silver */
body.dark-mode .mode-button[data-mode="ai"].active {
  background: #9E9E9E;
  color: #fff;
}

/* 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;
}

/* Leads ROSS blue */
body.light-mode .mode-button[data-mode="leads"].active {
  background: #00b4ff;
  color: #fff;
}

/* Activity orange */
body.light-mode .mode-button[data-mode="activity"].active {
  background: #F57C00;
  color: #fff;
}

/* Q&A green */
body.light-mode .mode-button[data-mode="qa"].active {
  background: #2E7D32;
  color: #fff;
}

/* AI silver */
body.light-mode .mode-button[data-mode="ai"].active {
  background: #757575;
  color: #fff;
}

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