/* Conversation UI Styles for ooWebUI v2.1.0 */
/* Styles for the new conversation management system */

/* Current conversation info display */
.current-conversation-title {
  font-weight: 500;
  font-size: 1.1em;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.current-conversation-meta {
  font-size: 0.85em;
  color: var(--text-secondary);
  display: flex;
  gap: 12px;
}

.current-conversation-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* History list improvements */
.history-item {
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.history-item:hover {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
}

.history-item.active {
  background-color: rgba(var(--accent-color-rgb, 0, 123, 255), 0.1);
  color: var(--text-primary, #333);
  border-color: var(--accent-color);
}

.history-item.active .history-item-title {
  color: var(--text-primary, #333);
}

.history-item.active .history-item-meta {
  color: var(--text-secondary, #666);
}

.history-item-title {
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-meta {
  font-size: 0.8em;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-item-date {
  font-size: 0.75em;
}

.history-item-stats {
  font-size: 0.75em;
}

/* Message enhancements */
.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.85em;
}

.message-role {
  font-weight: 500;
  color: var(--text-primary);
}

.message.user .message-role {
  color: #007bff;
}

.message.assistant .message-role {
  color: #28a745;
}

/* Ensure consistent background colors for both systems */
.message.user {
  background: #e6f3ff !important;
  margin-left: auto;
}

.message.assistant,
.message.ai {
  background: var(--message-content-bg) !important;
  margin-right: auto;
}

.message.assistant:hover,
.message.ai:hover {
  background: var(--message-content-hover-bg) !important;
}

.message-timestamp {
  color: var(--text-secondary);
  font-size: 0.8em;
}

/* Dark theme override for message timestamp */
[data-theme="dark"] .message-timestamp {
  color: var(--text-primary);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .message-timestamp {
    color: var(--text-primary);
  }
}


/* Code block improvements - moved to chat-messages.css */

.code-block[data-language]:before {
  content: attr(data-language);
  display: block;
  font-size: 0.75em;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  font-weight: 500;
}

.inline-code {
  background-color: var(--code-bg);
  padding: 2px 4px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--code-text);
}

/* File panel enhancements */
.file-panel {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin: 12px 0;
  overflow: hidden;
  transition: all 0.2s ease;
  background-color: var(--bg-primary);
}

.file-panel:hover {
  border-color: var(--accent-color);
  box-shadow: 0 2px 8px var(--shadow-color);
}

.file-panel.file-missing {
  border-color: var(--error-color);
  opacity: 0.6;
}

.file-panel.file-missing .file-panel-header {
  background-color: var(--error-bg);
}

.file-panel-header {
  background-color: var(--bg-secondary);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
}

.file-panel-icon {
  color: var(--accent-color);
  font-size: 1.1em;
}

.file-panel-name {
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.file-panel-details {
  padding: 8px 12px;
  display: flex;
  gap: 16px;
  font-size: 0.85em;
  color: var(--text-secondary);
}

/* Search highlighting */
.search-highlight {
  background-color: var(--warning-bg);
  border-left: 3px solid var(--warning-color);
}

.search-highlight mark {
  background-color: var(--warning-color);
  color: white;
  padding: 1px 2px;
  border-radius: 2px;
}

/* Conversations header layout */
.conversations-header {
  display: flex;
  align-items: center;
  min-height: 40px; /* Ensure consistent height */
}

.conversations-header h2 {
  margin-bottom: 0 !important; /* Override sidebar.css margin-bottom: 10px */
  flex: 1;
  display: flex;
  align-items: center; /* Center the h2 content vertically */
  height: 40px; /* Match the min-height */
}

/* New conversation button */
.new-conversation-btn {
  padding: 6px 12px;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.85em;
  white-space: nowrap;
  height: 32px; /* Fixed height for consistent alignment */
  flex-shrink: 0; /* Prevent shrinking */
}

.new-conversation-btn:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

.new-conversation-btn:active {
  transform: translateY(0);
}

/* Handle minimized sidebar state */
#sidebar.minimized .conversations-header {
  flex-direction: column;
  gap: 4px;
}

#sidebar.minimized .new-conversation-btn span {
  display: none;
}

#sidebar.minimized .new-conversation-btn {
  padding: 6px;
  font-size: 0.9em;
}

/* Initialization error display */
.initialization-error {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--error-bg);
  border: 2px solid var(--error-color);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  z-index: 10000;
  max-width: 400px;
}

.initialization-error h3 {
  color: var(--error-color);
  margin-bottom: 12px;
}

.initialization-error p {
  color: var(--text-primary);
  margin-bottom: 16px;
}

.initialization-error button {
  background-color: var(--accent-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

/* Loading states */
.loading-conversations {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
}

.loading-conversations i {
  font-size: 2em;
  margin-bottom: 12px;
  animation: spin 1s linear infinite;
}

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

/* Empty state */
.empty-conversation {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-conversation i {
  font-size: 3em;
  margin-bottom: 16px;
  color: var(--text-tertiary);
}

.empty-conversation h3 {
  margin-bottom: 8px;
  color: var(--text-primary);
}

.empty-conversation p {
  font-size: 0.9em;
  line-height: 1.4;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .history-item-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .current-conversation-meta {
    flex-direction: column;
    gap: 4px;
  }
  
  .file-panel-details {
    flex-direction: column;
    gap: 4px;
  }
}

/* Dark theme adjustments - code blocks now use CSS variables automatically */

.dark-theme .inline-code {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
}

.dark-theme .file-panel {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
}

.dark-theme .file-panel-header {
  background-color: var(--bg-primary);
  border-color: var(--border-color);
}

.dark-theme .search-highlight {
  background-color: rgba(255, 193, 7, 0.2);
}

.dark-theme .initialization-error {
  background-color: var(--bg-secondary);
  border-color: var(--status-error);
}