/* =============================================================================
   CONVERSATION HISTORY PANEL
   Slide-over panel inside the AI Assistant Drawer
   ============================================================================= */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  animation: slideIn 200ms ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

.backButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 150ms ease;
}

.backButton:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.headerTitle {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.newChatButton {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 150ms ease;
}

.newChatButton:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* =============================================================================
   CONVERSATION LIST
   ============================================================================= */

.list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

.spinner {
  margin-bottom: 8px;
  opacity: 0.7;
  animation: chSpin 0.8s linear infinite;
}

@keyframes chSpin {
  to {
    transform: rotate(360deg);
  }
}

.item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 150ms ease;
  position: relative;
}

.item:hover {
  background: var(--bg-tertiary);
}

.itemActive {
  background: rgba(211, 47, 47, 0.08);
  border: 1px solid rgba(211, 47, 47, 0.2);
}

.itemActive:hover {
  background: rgba(211, 47, 47, 0.12);
}

.itemContent {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.itemTitle {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.itemMeta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.itemTime {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

.phaseBadge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-radius: 3px;
  border: 1px solid;
}

.runningDot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  animation: pulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }
  50% {
    opacity: 0.7;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0);
  }
}

.deleteButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  opacity: 0;
  transition: all 150ms ease;
  flex-shrink: 0;
  margin-top: 2px;
}

.item:hover .deleteButton {
  opacity: 1;
}

.deleteButton:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.confirmDelete {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  margin: 0 var(--space-2);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  color: var(--text-secondary);
  animation: slideIn 150ms ease-out;
}

.confirmDelete button {
  padding: 2px 8px;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  transition: all 150ms ease;
}

.confirmYes {
  background: #ef4444;
  color: white;
}

.confirmYes:hover {
  background: #dc2626;
}

.confirmNo {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-default) !important;
}

.confirmNo:hover {
  background: var(--bg-primary);
}
