/* Enhanced CompactB AI Chatbot Styles */

/* Fix positioning to avoid collisions with header and footer */
.ai-chatbot {
  top: 120px !important;
  bottom: 32px !important;
  height: auto !important;
  width: 420px !important;
}

/* Send button - now visible with icon */
.send-btn-new {
  background: var(--primary);
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.send-btn-new:hover { 
  background: color-mix(in hsl, var(--primary) 90%, black); 
  transform: scale(1.05); 
}
.send-btn-new:disabled { 
  opacity: 0.5; 
  cursor: not-allowed; 
  transform: scale(1);
}
.send-btn-new .material-symbols-outlined { font-size: 18px; }

/* Quick Actions Bar */
.ai-quick-actions {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: thin;
}

.ai-quick-actions::-webkit-scrollbar {
  height: 4px;
}

.ai-quick-actions::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: color-mix(in hsl, var(--primary) 8%, var(--surface));
  border: 1px solid color-mix(in hsl, var(--primary) 20%, transparent);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  transition: all 0.2s ease;
  white-space: nowrap;
  font-weight: 500;
}

.quick-action-btn:hover {
  background: color-mix(in hsl, var(--primary) 15%, var(--surface));
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.quick-action-btn:active {
  transform: translateY(0);
}

.quick-action-btn .material-symbols-outlined {
  font-size: 16px;
}

/* AI Greeting */
.ai-greeting {
  text-align: center;
  padding: 20px;
  color: var(--muted);
}

.ai-greeting .sparkle-icon {
  font-size: 32px;
  color: var(--primary);
  margin-bottom: 8px;
  animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.ai-greeting p {
  font-size: 14px;
  margin: 8px 0;
  color: var(--text);
  font-weight: 500;
}

.greeting-tip {
  margin-top: 12px;
  padding: 8px 12px;
  background: color-mix(in hsl, var(--primary) 8%, var(--surface));
  border-radius: 8px;
  font-size: 12px;
  text-align: left;
  border-left: 3px solid var(--primary);
  line-height: 1.4;
}

/* System Message */
.message.system {
  justify-content: center;
}

.system-message {
  display: flex;
  align-items: center;
  gap: 6px;
  background: color-mix(in hsl, var(--primary) 5%, var(--surface));
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
  border: 1px dashed var(--border);
  max-width: fit-content;
}

.system-message .material-symbols-outlined {
  font-size: 14px;
}

/* Thinking Animation */
.thinking-message {
  display: flex;
  align-items: center;
  gap: 8px;
  font-style: italic;
  color: var(--muted);
}

.thinking-dots::before {
  content: '●●●';
  animation: thinkingDots 1.4s infinite;
  color: var(--primary);
}

@keyframes thinkingDots {
  0%, 20% { content: '●○○'; }
  40% { content: '●●○'; }
  60%, 100% { content: '●●●'; }
}

/* Enhanced Edit Proposal */
.edit-proposal .message-content {
  background: linear-gradient(135deg, color-mix(in hsl, var(--primary) 8%, var(--surface)), color-mix(in hsl, var(--primary) 12%, var(--surface)));
  border: 2px solid color-mix(in hsl, var(--primary) 30%, transparent);
  border-radius: 12px;
  max-width: 100%;
  padding: 12px;
}

.edit-explanation {
  padding: 12px;
  background: color-mix(in hsl, var(--primary) 15%, var(--surface));
  border-radius: 8px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}

.explanation-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.edit-preview {
  margin: 12px 0;
}

.ops-list {
  margin: 8px 0;
}

.ops-header {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 13px;
  padding: 6px 0;
}

.op-item {
  padding: 10px;
  background: var(--surface);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
  transition: all 0.2s ease;
}

.op-item:hover {
  background: color-mix(in hsl, var(--primary) 5%, var(--surface));
  transform: translateX(2px);
}

.op-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 6px;
  text-transform: lowercase;
}

.op-badge.append { background: color-mix(in hsl, #10b981 20%, transparent); color: #10b981; }
.op-badge.prepend { background: color-mix(in hsl, #3b82f6 20%, transparent); color: #3b82f6; }
.op-badge.insert { background: color-mix(in hsl, #8b5cf6 20%, transparent); color: #8b5cf6; }
.op-badge.replace { background: color-mix(in hsl, #f59e0b 20%, transparent); color: #f59e0b; }
.op-badge.format { background: color-mix(in hsl, #ec4899 20%, transparent); color: #ec4899; }

.op-preview {
  margin-top: 6px;
  padding: 6px 8px;
  background: color-mix(in hsl, var(--muted) 10%, var(--surface));
  border-radius: 4px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  border-left: 2px solid var(--border);
  line-height: 1.4;
}

.diff-section {
  margin: 8px 0;
  padding: 8px;
  background: var(--surface);
  border-radius: 6px;
}

.diff-section summary {
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.diff-section summary:hover {
  background: color-mix(in hsl, var(--primary) 8%, var(--surface));
}

.change-stats {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  margin-left: 4px;
}

.diff-container {
  margin-top: 8px;
  padding: 8px;
  background: color-mix(in hsl, var(--muted) 5%, var(--surface));
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
}

/* Edit Action Buttons */
.edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.edit-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.edit-btn .material-symbols-outlined {
  font-size: 16px;
}

.edit-btn.preview-btn {
  background: color-mix(in hsl, var(--primary) 12%, var(--surface));
  color: var(--primary);
  border: 1px solid var(--primary);
}

.edit-btn.preview-btn:hover {
  background: color-mix(in hsl, var(--primary) 20%, var(--surface));
  transform: translateY(-1px);
}

.edit-btn.accept-btn {
  background: #10b981;
  color: white;
}

.edit-btn.accept-btn:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.edit-btn.deny-btn {
  background: color-mix(in hsl, #ef4444 15%, var(--surface));
  color: #ef4444;
  border: 1px solid #ef4444;
}

.edit-btn.deny-btn:hover {
  background: color-mix(in hsl, #ef4444 25%, var(--surface));
  transform: translateY(-1px);
}

.edit-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 13px;
}

.edit-status.accepted { 
  background: color-mix(in hsl, #10b981 15%, var(--surface)); 
  color: #10b981; 
}

.edit-status.denied { 
  background: color-mix(in hsl, #f59e0b 15%, var(--surface)); 
  color: #f59e0b; 
}

.edit-status.error { 
  background: color-mix(in hsl, #ef4444 15%, var(--surface)); 
  color: #ef4444; 
}

/* Error styling */
.error-icon {
  font-size: 16px;
  margin-right: 4px;
}

.message-content code {
  background: color-mix(in hsl, var(--muted) 15%, var(--surface));
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
}

.message-content strong {
  font-weight: 600;
  color: var(--text);
}

.message-content em {
  font-style: italic;
  opacity: 0.9;
}

/* Smooth message animations */
.message {
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Document Diff Preview Overlay Styles */
.document-diff-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.document-diff-container {
  background: var(--surface);
  border-radius: 12px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.diff-preview-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.diff-preview-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.diff-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
}

.diff-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.diff-legend-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

.diff-legend-color.deletion {
  background: rgba(244, 63, 94, 0.3);
  border: 1px solid #f43f5e;
}

.diff-legend-color.addition {
  background: rgba(16, 185, 129, 0.3);
  border: 1px solid #10b981;
}

.diff-close-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.diff-close-btn:hover {
  background: color-mix(in hsl, var(--primary) 10%, var(--surface));
  color: var(--text);
}

.diff-preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.diff-preview-document {
  max-width: 800px;
  margin: 0 auto;
}

.diff-deletion {
  background: rgba(244, 63, 94, 0.2);
  text-decoration: line-through;
  padding: 2px 4px;
  border-radius: 3px;
}

.diff-addition {
  background: rgba(16, 185, 129, 0.2);
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 500;
}

.diff-preview-actions {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.diff-preview-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.diff-preview-btn.cancel {
  background: color-mix(in hsl, var(--muted) 15%, var(--surface));
  color: var(--text);
}

.diff-preview-btn.cancel:hover {
  background: color-mix(in hsl, var(--muted) 25%, var(--surface));
}

.diff-preview-btn.confirm {
  background: var(--primary);
  color: white;
}

.diff-preview-btn.confirm:hover {
  background: color-mix(in hsl, var(--primary) 90%, black);
  box-shadow: 0 4px 12px rgba(5, 80, 255, 0.3);
}
