/* activity-feed.css — AI-Do v4.0 activity feed view */

/* ===== Feed Container ===== */
.activity-feed {
  flex-direction: column;
  height: 100%;
  padding: var(--space-lg);
  overflow: hidden;
}

/* ===== Header ===== */
.activity-feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: var(--space-md);
  flex-shrink: 0;
}

.activity-feed-header h2 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.activity-feed-header .refresh-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

.activity-feed-header .refresh-btn:hover {
  background: var(--glass-bg-hover);
  color: var(--text-primary);
}

.activity-feed-header .refresh-btn:active {
  transform: scale(0.95);
}

.activity-feed-header .refresh-btn.refreshing svg {
  animation: spin 0.8s linear infinite;
}

/* ===== Filter Tabs ===== */
.activity-feed-tabs {
  display: flex;
  gap: var(--space-xs);
  padding-bottom: var(--space-md);
  flex-shrink: 0;
  overflow-x: auto;
}

.activity-tab {
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
}

.activity-tab:hover {
  background: var(--glass-bg-hover);
  color: var(--text-secondary);
}

.activity-tab.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

/* Error icon */
.activity-item-icon.kind-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.activity-item-icon.kind-memory {
  background: rgba(167, 139, 250, 0.1);
  color: #a78bfa;
  border: 1px solid rgba(167, 139, 250, 0.2);
}

.activity-item-icon.kind-journal {
  background: rgba(251, 146, 60, 0.1);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.2);
}

.activity-item-icon.kind-file {
  background: rgba(45, 212, 191, 0.1);
  color: #2dd4bf;
  border: 1px solid rgba(45, 212, 191, 0.2);
}

/* ===== Feed List ===== */
.activity-feed-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  padding-right: var(--space-xs);
}

.activity-feed-list::-webkit-scrollbar {
  width: 4px;
}

.activity-feed-list::-webkit-scrollbar-track {
  background: transparent;
}

.activity-feed-list::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: var(--radius-full);
}

.activity-feed-list::-webkit-scrollbar-thumb:hover {
  background: var(--glass-border-light);
}

/* ===== Activity Item ===== */
.activity-item {
  display: flex;
  flex-direction: row;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast);
  user-select: none;
}

.activity-item:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-light);
}

/* Type Icon */
.activity-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-item-icon svg {
  width: 16px;
  height: 16px;
}

/* Type-specific icon colors */
.activity-item-icon.kind-chat {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(96, 165, 250, 0.2);
}

.activity-item-icon.kind-skill {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-primary);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.activity-item-icon.kind-system {
  background: var(--glass-bg-active);
  color: var(--text-tertiary);
  border: 1px solid var(--glass-border);
}

.activity-item-icon.kind-ingestion {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

.activity-item-icon.kind-cognitive {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

/* Content area */
.activity-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.activity-item-desc {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  line-height: var(--line-height-normal);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-item-timestamp {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

/* Expanded detail */
.activity-item-detail {
  display: none;
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--glass-border);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  white-space: pre-wrap;
  word-break: break-word;
}

.activity-item.expanded {
  flex-direction: column;
}

.activity-item.expanded .activity-item-row {
  display: flex;
  flex-direction: row;
  gap: var(--space-sm);
}

.activity-item.expanded .activity-item-desc {
  white-space: normal;
  overflow: visible;
}

.activity-item.expanded .activity-item-detail {
  display: block;
  animation: fadeIn var(--transition-fast) ease-out;
}

/* Metadata tags in expanded detail */
.activity-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

.activity-item-meta-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  background: var(--glass-bg-active);
  border: 1px solid var(--glass-border);
  color: var(--text-tertiary);
}

/* ===== Animations ===== */
.activity-item.animate-in {
  animation: slideInUp 300ms ease-out forwards;
}

/* Stagger animation for list items */
.activity-feed-list.stagger-load > .activity-item:nth-child(1) { animation-delay: 0ms; }
.activity-feed-list.stagger-load > .activity-item:nth-child(2) { animation-delay: 30ms; }
.activity-feed-list.stagger-load > .activity-item:nth-child(3) { animation-delay: 60ms; }
.activity-feed-list.stagger-load > .activity-item:nth-child(4) { animation-delay: 90ms; }
.activity-feed-list.stagger-load > .activity-item:nth-child(5) { animation-delay: 120ms; }
.activity-feed-list.stagger-load > .activity-item:nth-child(6) { animation-delay: 150ms; }
.activity-feed-list.stagger-load > .activity-item:nth-child(7) { animation-delay: 180ms; }
.activity-feed-list.stagger-load > .activity-item:nth-child(8) { animation-delay: 210ms; }
.activity-feed-list.stagger-load > .activity-item:nth-child(9) { animation-delay: 240ms; }
.activity-feed-list.stagger-load > .activity-item:nth-child(10) { animation-delay: 270ms; }

.activity-feed-list.stagger-load > .activity-item {
  opacity: 0;
  animation: slideInUp 300ms ease-out forwards;
}

/* ===== Empty State ===== */
.activity-feed-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: var(--space-md);
  color: var(--text-tertiary);
  text-align: center;
  padding: var(--space-2xl);
}

.activity-feed-empty svg {
  width: 48px;
  height: 48px;
  opacity: 0.3;
}

.activity-feed-empty p {
  font-size: var(--font-size-sm);
  margin: 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .activity-feed {
    padding: var(--space-md) var(--space-sm);
  }

  .activity-item {
    padding: var(--space-sm);
  }

  .activity-item-icon {
    width: 28px;
    height: 28px;
  }

  .activity-item-icon svg {
    width: 14px;
    height: 14px;
  }
}
