/* Right-side drawer — fixed position like AI Assistant drawer */
.drawer {
  position: fixed;
  top: var(--drawer-top, 0px);
  right: 0;
  bottom: var(--drawer-bottom, 0px);
  width: 550px;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border-left: 1px solid var(--border-default);
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
  will-change: transform;
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 300ms;
  visibility: hidden;
}

.drawerOpen {
  transform: translateX(0);
  visibility: visible;
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0s;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

.titleContainer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.closeButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition-all);
}

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

/* Status bar */
.statusBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

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

.statusText {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
}

.statusActions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.iconButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition-all);
}

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

/* Pipeline control button variants */
.iconButtonPaused {
  color: var(--status-warning);
  border-color: var(--status-warning);
}

.iconButtonPaused:hover {
  background: var(--status-warning);
  color: white;
}

.iconButtonStop:hover {
  background: var(--status-error);
  color: white;
  border-color: var(--status-error);
}

/* Status indicators */
.pausedIcon {
  color: var(--status-warning);
}

.runningIndicator {
  width: 8px;
  height: 8px;
  background: var(--status-success);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.9);
  }
}

.successIcon {
  color: var(--status-success);
}

.errorIcon {
  color: var(--status-error);
}

/* Phase progress */
.phaseProgress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

.phaseItem {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: 50%;
  transition: var(--transition-all);
}

.phaseNumber {
  font-size: 10px;
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
}

.phaseActive {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.phaseActive .phaseNumber {
  color: var(--text-on-accent);
}

.phaseCompleted {
  background: var(--status-success);
  border-color: var(--status-success);
}

.phaseCompleted .phaseNumber {
  color: white;
}

.phasePending {
  opacity: 0.5;
}

/* Logs container */
.logsContainer {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  background: var(--bg-primary);
}

.emptyLogs {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--space-2);
  color: var(--text-tertiary);
}

.emptyLogs p {
  margin: 0;
  font-size: var(--text-sm);
}

.logLine {
  display: flex;
  gap: var(--space-2);
  padding: 1px var(--space-1);
  border-radius: var(--radius-sm);
}

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

.logTimestamp {
  flex-shrink: 0;
  color: var(--text-tertiary);
  opacity: 0.7;
}

.logMessage {
  flex: 1;
  word-break: break-word;
  white-space: pre-wrap;
}

.logInfo {
  color: var(--text-secondary);
}

.logWarning {
  color: var(--status-warning);
}

.logError {
  color: var(--status-error);
}

.logSuccess {
  color: var(--status-success);
}

.logAction {
  color: var(--color-blue-400);
}

/* Target-list breakdown ("[*][Targets] Merged N URLs: ...") emitted by
   build_target_urls. Tinted background + accent left border so the union
   summary stands out when scrolling through verbose scan logs. */
.logTargets {
  background: rgba(34, 197, 94, 0.06);
  border-left: 3px solid rgba(34, 197, 94, 0.55);
  padding-left: calc(var(--space-2) - 3px);
  font-weight: 500;
}

/* Memory governor (Part 5): a parameter was throttled to fit available RAM. */
.logResourceCap {
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid rgba(239, 68, 68, 0.6);
  padding-left: calc(var(--space-2) - 3px);
  font-weight: 500;
}
.logResourceCap .logMessage {
  color: #ef4444;
}

/* Scroll to bottom button */
.scrollToBottom {
  position: absolute;
  bottom: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-1-5) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: var(--transition-all);
}

.scrollToBottom:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-on-accent);
}

.spinner {
  animation: spin 1s linear infinite;
}

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