/* Activity Log Styles - VibeSurf Extension */

/* Activity Section */
.activity-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.activity-log {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-lg);
  background-color: var(--bg-primary);
  min-height: 0; /* Allow proper flexbox sizing */
  display: flex;
  flex-direction: column;
}

.activity-log::-webkit-scrollbar {
  width: 6px;
}

.activity-log::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.activity-log::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.activity-log::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* Welcome Message */
.welcome-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: var(--spacing-lg) var(--spacing-2xl);
  color: var(--text-muted);
  min-height: 0; /* Allow shrinking */
  max-height: none; /* Remove any height constraints */
  overflow: visible; /* Ensure content is not clipped */
}

.welcome-text h4 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.welcome-text p {
  font-size: var(--font-size-sm);
  line-height: 1.6;
  margin-bottom: var(--spacing-xl);
}

/* Quick Tasks */
.quick-tasks {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
  width: 100%;
  max-width: 400px;
  min-height: 0; /* Ensure all items are visible */
  overflow: visible; /* Ensure content is not clipped */
  grid-auto-rows: auto; /* Let rows size automatically */
}

.task-suggestion {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.task-suggestion:hover {
  border-color: var(--primary-color);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.task-icon {
  font-size: 24px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-color);
  border-radius: var(--radius-md);
  color: white;
}

.task-content {
  flex: 1;
}

.task-title {
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
  font-size: var(--font-size-base);
}

.task-description {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Activity Log Items - Chat Style */
.activity-item {
  margin-bottom: var(--spacing-lg);
  width: 100%;
  display: flex;
  flex-direction: column;
}

.message-container {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  min-width: 0; /* Allow shrinking */
  animation: fadeIn 0.3s ease-out;
}

.user-container {
  align-self: flex-end;
  align-items: flex-end;
}

.agent-container {
  align-self: flex-start;
  align-items: flex-start;
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-xs);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.user-container .message-header {
  flex-direction: row-reverse;
  gap: var(--spacing-md);
}

.agent-container .message-header {
  flex-direction: row;
  gap: var(--spacing-md);
}

.agent-name {
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.user-container .agent-name {
  color: var(--primary-color);
}

.message-metadata {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 10px;
  flex-shrink: 0;
}

.message-time {
  font-size: 10px;
  color: var(--text-muted);
}

.message-metrics {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.metric-item {
  font-size: 10px;
  color: var(--text-muted);
  background-color: var(--bg-tertiary);
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  font-weight: var(--font-weight-normal);
}

.user-container .metric-item {
  background-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
}

/* Message Bubbles */
.message-bubble {
  padding: var(--spacing-md);
  border-radius: var(--radius-lg);
  position: relative;
  word-wrap: break-word;
  box-shadow: var(--shadow-sm);
  min-width: 0; /* Allow shrinking */
  max-width: 100%;
  overflow-wrap: break-word;
}

/* Copy Message Button */
.copy-message-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  z-index: 10;
  backdrop-filter: blur(4px);
}

.copy-message-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.05);
}

.copy-message-btn:active {
  transform: scale(0.95);
}

.copy-message-btn svg {
  width: 12px;
  height: 12px;
}

/* Show copy button on message bubble hover */
.message-bubble:hover .copy-message-btn {
  opacity: 1;
  visibility: visible;
}

/* User bubble copy button styling */
.user-bubble .copy-message-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.user-bubble .copy-message-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.user-bubble {
  background-color: var(--primary-color);
  color: white;
  border-bottom-right-radius: var(--radius-sm);
}

.agent-bubble {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: var(--radius-sm);
}

.message-bubble.working {
  border-left: 3px solid var(--warning-color);
  background-color: rgba(255, 193, 7, 0.05);
}

.message-bubble.result,
.message-bubble.done {
  border-left: 3px solid var(--accent-color);
  background-color: rgba(40, 167, 69, 0.05);
}

.message-bubble.error {
  border-left: 3px solid var(--danger-color);
  background-color: rgba(220, 53, 69, 0.05);
}

/* Message Status */
.message-status {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.user-bubble .message-status {
  color: rgba(255, 255, 255, 0.9);
}

.agent-bubble .message-status {
  color: var(--text-secondary);
}

.status-indicator {
  font-size: 12px;
}

.status-text {
  text-transform: capitalize;
}

/* Message Content */
.message-content {
  line-height: 1.6;
  font-size: var(--font-size-sm);
  min-width: 0; /* Allow shrinking */
  overflow-wrap: break-word;
}

.user-bubble .message-content {
  color: white;
}

.agent-bubble .message-content {
  color: var(--text-primary);
}

/* Content formatting */
.message-content h1,
.message-content h2,
.message-content h3 {
  margin: var(--spacing-sm) 0;
  font-weight: var(--font-weight-semibold);
}

.message-content h1 {
  font-size: var(--font-size-lg);
}

.message-content h2 {
  font-size: var(--font-size-base);
}

.message-content h3 {
  font-size: var(--font-size-sm);
}

.message-content ul {
  margin: var(--spacing-sm) 0;
  padding-left: var(--spacing-lg);
}

.message-content li {
  margin-bottom: var(--spacing-xs);
}

.message-content .code-block {
  background-color: var(--bg-tertiary);
  padding: var(--spacing-sm);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: var(--font-size-xs);
  margin: var(--spacing-sm) 0;
  border: 1px solid var(--border-color);
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Custom scrollbar for code blocks */
.message-content .code-block::-webkit-scrollbar {
  height: 6px;
}

.message-content .code-block::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 3px;
}

.message-content .code-block::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.message-content .code-block::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

.user-bubble .code-block {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.message-content .inline-code {
  background-color: var(--bg-tertiary);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: var(--font-size-xs);
  word-break: break-all;
  overflow-wrap: break-word;
}

.user-bubble .inline-code {
  background-color: rgba(255, 255, 255, 0.2);
}

.message-content .json-content {
  background-color: var(--bg-tertiary);
  padding: var(--spacing-sm);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: var(--font-size-xs);
  margin: var(--spacing-sm) 0;
  border: 1px solid var(--border-color);
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Custom scrollbar for JSON content */
.message-content .json-content::-webkit-scrollbar {
  height: 6px;
}

.message-content .json-content::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 3px;
}

.message-content .json-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.message-content .json-content::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

.user-bubble .json-content {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.message-content a {
  color: inherit;
  text-decoration: underline;
}

.user-bubble .message-content a {
  color: rgba(255, 255, 255, 0.9);
}

.agent-bubble .message-content a {
  color: var(--primary-color);
}

.message-content a:hover {
  opacity: 0.8;
}

/* Status indicators */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--border-color);
}

.status-dot.active {
  background-color: var(--accent-color);
  animation: pulse 2s infinite;
}

.status-dot.error {
  background-color: var(--danger-color);
}

/* Enhanced Markdown Styles */
.message-content .task-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin: var(--spacing-xs) 0;
  padding: var(--spacing-xs) 0;
  line-height: 1.4;
}

.message-content .task-item input[type="checkbox"] {
  margin: 0;
  cursor: default;
  accent-color: var(--primary-color);
}

.message-content .markdown-table {
  border-collapse: collapse;
  width: 100%;
  margin: var(--spacing-md) 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: var(--font-size-sm);
}

.message-content .markdown-table th,
.message-content .markdown-table td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.message-content .markdown-table th {
  background-color: var(--bg-tertiary);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.user-bubble .markdown-table th {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.message-content .markdown-table tr:hover {
  background-color: var(--bg-hover);
}

.user-bubble .markdown-table tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.message-content .markdown-quote {
  border-left: 4px solid var(--primary-color);
  padding-left: var(--spacing-md);
  margin: var(--spacing-md) 0;
  color: var(--text-secondary);
  font-style: italic;
  background-color: var(--bg-secondary);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
}

.user-bubble .markdown-quote {
  border-left-color: rgba(255, 255, 255, 0.8);
  background-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
  margin: var(--spacing-md) 0 var(--spacing-sm) 0;
  color: var(--text-primary);
  line-height: 1.3;
}

.user-bubble .message-content h1,
.user-bubble .message-content h2,
.user-bubble .message-content h3,
.user-bubble .message-content h4,
.user-bubble .message-content h5,
.user-bubble .message-content h6 {
  color: white;
}

.message-content h1 { font-size: var(--font-size-xl); font-weight: var(--font-weight-bold); }
.message-content h2 { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); }
.message-content h3 { font-size: var(--font-size-base); font-weight: var(--font-weight-semibold); }
.message-content h4 { font-size: var(--font-size-sm); font-weight: var(--font-weight-medium); }

.message-content ul,
.message-content ol {
  margin: var(--spacing-sm) 0;
  padding-left: var(--spacing-xl);
}

.message-content li {
  margin: var(--spacing-xs) 0;
  line-height: 1.5;
}

.message-content p {
  margin: var(--spacing-sm) 0;
  line-height: 1.6;
}

.message-content a {
  color: var(--primary-color);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-fast);
}

.message-content a:hover {
  border-bottom-color: var(--primary-color);
}

.user-bubble .message-content a {
  color: rgba(255, 255, 255, 0.9);
  border-bottom-color: transparent;
}

.user-bubble .message-content a:hover {
  border-bottom-color: rgba(255, 255, 255, 0.9);
}

.message-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: var(--spacing-lg) 0;
}

.user-bubble .message-content hr {
  border-top-color: rgba(255, 255, 255, 0.3);
}

.message-content strong {
  font-weight: var(--font-weight-semibold);
}

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

/* Suggestion Tasks Styles */
.suggestion-tasks-container {
  margin: var(--spacing-lg) 0;
  padding: var(--spacing-md);
  background: linear-gradient(135deg, rgba(0, 122, 204, 0.02), rgba(0, 122, 204, 0.05));
  border: 1px solid rgba(0, 122, 204, 0.1);
  border-radius: var(--radius-xl);
  position: relative;
  overflow: visible;
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: auto;
}

.suggestion-tasks-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.suggestion-tasks-header {
  text-align: center;
  margin-bottom: var(--spacing-md);
  padding: 0;
  display: block;
  width: 100%;
}

.suggestion-tasks-header h4 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin: 0;
  display: block;
  text-align: center;
  line-height: 1.3;
  white-space: normal;
  overflow: visible;
  word-wrap: break-word;
}

.suggestion-tasks-header p {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin: 0;
  opacity: 0.8;
  line-height: 1.4;
  display: block;
}

.suggestion-cards {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  width: 100%;
  min-height: auto;
}

.suggestion-task-card {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: visible;
  width: 100%;
  min-height: 50px;
  box-sizing: border-box;
  margin-bottom: 0;
}

.suggestion-task-card:last-child {
  margin-bottom: 0;
}

.suggestion-task-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary-color);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-fast);
}

.suggestion-task-card:hover {
  border-color: var(--primary-color);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.suggestion-task-card:hover::before {
  transform: scaleX(1);
}

.suggestion-task-card:active {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.suggestion-card-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  border-radius: var(--radius-md);
  color: white;
  transition: transform var(--transition-fast);
}

.suggestion-task-card:hover .suggestion-card-icon {
  transform: scale(1.1);
}

.suggestion-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.suggestion-task-text {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  line-height: 1.5;
  font-weight: var(--font-weight-medium);
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  text-overflow: clip;
}

.suggestion-tasks-section {
  margin: var(--spacing-lg) 0;
  width: 100%;
}

.suggestion-tasks-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  padding: 0 var(--spacing-sm);
  min-height: 24px;
  width: 100%;
  overflow: visible;
}

.suggestion-tasks-header h4 {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.suggestion-cards-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  width: 100%;
  padding: 0 var(--spacing-sm);
}

.suggestion-card-arrow {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.suggestion-task-card:hover .suggestion-card-arrow {
  color: var(--primary-color);
  transform: translateX(4px);
}

/* Animation for suggestion cards */
.suggestion-tasks-container.fade-in {
  animation: suggestionFadeIn 0.5s ease-out;
}

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

/* Responsive design for suggestion cards */
@media (max-width: 480px) {
  .suggestion-tasks-container {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md);
  }
  
  .suggestion-task-card {
    padding: var(--spacing-md);
    gap: var(--spacing-sm);
  }
  
  .suggestion-card-icon {
    width: 32px;
    height: 32px;
  }
  
  .suggestion-card-icon svg {
    width: 14px;
    height: 14px;
  }
  
  .suggestion-task-text {
    font-size: var(--font-size-xs);
  }
  
  .suggestion-tasks-header h4 {
    font-size: var(--font-size-base);
  }
}

/* Loading state for suggestion cards */
.suggestion-task-card.loading {
  pointer-events: none;
  opacity: 0.6;
}

.suggestion-task-card.loading .suggestion-card-icon {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Success state when card is clicked */
.suggestion-task-card.success {
  border-color: var(--accent-color);
  background: rgba(40, 167, 69, 0.05);
}

.suggestion-task-card.success .suggestion-card-icon {
  background: var(--accent-color);
}