/* Well past the shared `large` width (768px): three cards in two columns need
   the room, and the extra width is what keeps each source row on ONE line.
   The class is DOUBLED on purpose. Modal puts `modalLarge` (max-width: 768px)
   on the same element, and two single-class selectors are equally specific, so
   the winner is whichever stylesheet the bundler happens to emit last - which
   was Modal's, silently pinning this modal at 768px whatever value was set
   here. `.wideModal.wideModal` outranks it and cannot be re-ordered away. */
.wideModal.wideModal {
  max-width: 1092px;
}

.content {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 640px;
}

/* Two columns, two rows. GitHub Hunt and Supply Chain take one slot each on the
   left; the Secret Multiscanner spans both rows on the right, because it is the
   only card whose height is driven by content the operator adds (one row per
   configured source). */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  align-items: stretch;
}

.cardTall {
  grid-column: 2;
  grid-row: 1 / span 2;
}

@media (max-width: 768px) {
  .content {
    min-width: auto;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .cardTall {
    grid-column: 1;
    grid-row: auto;
  }
}

.card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-default);
}

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

.cardIcon {
  color: var(--text-tertiary);
}

.cardTitle {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.newBadge {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: var(--status-success, #16a34a);
  color: #fff;
  font-size: 8px;
  font-weight: var(--font-bold, 700);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}

.statusBadge {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  padding: var(--space-0-5) var(--space-1-5);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.statusIdle {
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  border: 1px solid var(--border-default);
}

.statusRunning {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.statusPaused {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.statusCompleted {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.statusError {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.cardDescription {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.5;
}

.cardActions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1-5);
  margin-top: auto;
}

.actionButton {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1-5) var(--space-2-5);
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: var(--transition-all);
}

.actionButton:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.actionButton:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.startButton {
  composes: actionButton;
  border-color: var(--status-success);
  color: var(--status-success);
}

.startButton:hover:not(:disabled) {
  background: var(--status-success);
  color: white;
}

.pauseButton {
  composes: actionButton;
  border-color: var(--status-warning);
  color: var(--status-warning);
}

.pauseButton:hover:not(:disabled) {
  background: var(--status-warning);
  color: white;
}

.resumeButton {
  composes: actionButton;
  border-color: var(--status-success);
  color: var(--status-success);
}

.resumeButton:hover:not(:disabled) {
  background: var(--status-success);
  color: white;
}

.stopButton {
  composes: actionButton;
  border-color: var(--status-error);
  color: var(--status-error);
}

.stopButton:hover:not(:disabled) {
  background: var(--status-error);
  color: white;
}

.logsButton {
  composes: actionButton;
}

.logsButtonActive {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
  color: white;
}

.downloadButton {
  composes: actionButton;
}

/* Leaves the modal for the project's settings form instead of acting on the
   scan, so it is pushed to the far right and kept out of the run/stop rhythm. */
.settingsButton {
  composes: actionButton;
  margin-left: auto;
  text-decoration: none;
  padding: var(--space-1-5);
}

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

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

/* Inline Global Settings credential shortcuts under a scan row. */
.credentialStack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 6px 0 10px;
}

/* ---------------------------------------------------------------------------
   Secret Multiscanner source rows. Any number of sources can be configured, so
   the list scrolls inside the card instead of growing the modal past the
   viewport.
   --------------------------------------------------------------------------- */

.sourceList {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 320px;
  overflow-y: auto;
  /* Room for the scrollbar so it never sits on top of the Logs button. */
  padding-right: var(--space-1);
}

/* Status, Start, Stop and Logs belong on the SAME line as the source name.
   Wrapping is off for that reason; the name is the part that gives way. */
.sourceRow {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-1-5);
}

.sourceRow > button {
  flex: 0 0 auto;
}

.sourceName {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sourceLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.sourceTarget {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-tertiary);
}

.missingKeyNote {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-1);
  font-size: 11px;
  color: #f59e0b;
}

/* The warning triangle stays whole and on the line: a shrunk or wrapped icon is
   the failure this row's whole meaning rests on. */
.missingKeyNote svg {
  flex: 0 0 auto;
}

/* ---------------------------------------------------------------------------
   Supply Chain Scanner: the card states WHAT it would scan; the input itself is
   configured in project settings.
   --------------------------------------------------------------------------- */

.targetLine {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin: 0;
  min-width: 0;
}

.targetKind {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-tertiary);
}

.targetValue {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  font-family: var(--font-mono, monospace);
  color: var(--text-primary);
}
