/**
 * @file
 * FlowDrop Job List Component Styles
 *
 * List display for pipeline jobs.
 */

.fd-job-list {
  display: flex;
  flex-direction: column;
  gap: var(--fd-space-2);
}

/* ========================================================================
 * ITEM
 * ======================================================================== */

.fd-job-list__item {
  display: flex;
  align-items: center;
  padding: var(--fd-space-3) var(--fd-space-4);
  transition:
    border-color var(--fd-transition-fast),
    box-shadow var(--fd-transition-fast);
  border: var(--fd-border-width) solid var(--fd-border);
  border-radius: var(--fd-radius-lg);
  background-color: var(--fd-card);
  gap: var(--fd-space-3);
}

.fd-job-list__item:hover {
  border-color: var(--fd-border-muted);
  box-shadow: var(--fd-shadow-sm);
}

/* Status-specific left border */
.fd-job-list__item--success {
  border-inline-start: 3px solid var(--fd-success);
}

.fd-job-list__item--warning {
  border-inline-start: 3px solid var(--fd-warning);
}

.fd-job-list__item--error {
  border-inline-start: 3px solid var(--fd-error);
}

.fd-job-list__item--info {
  border-inline-start: 3px solid var(--fd-info);
}

.fd-job-list__item--neutral {
  border-inline-start: 3px solid var(--fd-muted-foreground);
}

/* ========================================================================
 * STATUS ICON
 * ======================================================================== */

.fd-job-list__status-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--fd-radius-full);
}

.fd-job-list__status-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.fd-job-list__item--success .fd-job-list__status-icon {
  color: var(--fd-success-hover);
  background-color: var(--fd-success-muted);
}

.fd-job-list__item--warning .fd-job-list__status-icon {
  color: var(--fd-warning-hover);
  background-color: var(--fd-warning-muted);
}

.fd-job-list__item--error .fd-job-list__status-icon {
  color: var(--fd-error-hover);
  background-color: var(--fd-error-muted);
}

.fd-job-list__item--info .fd-job-list__status-icon {
  color: var(--fd-info);
  background-color: var(--fd-info-muted);
}

.fd-job-list__item--neutral .fd-job-list__status-icon {
  color: var(--fd-muted-foreground);
  background-color: var(--fd-subtle);
}

/* Running animation */
@keyframes fd-job-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.fd-job-list__item--info .fd-job-list__status-icon svg {
  animation: fd-job-spin 2s linear infinite;
}

/* ========================================================================
 * CONTENT
 * ======================================================================== */

.fd-job-list__content {
  flex: 1;
  min-width: 0;
}

.fd-job-list__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--fd-space-2);
}

.fd-job-list__title {
  text-decoration: none;
  color: var(--fd-foreground);
  font-size: var(--fd-text-sm);
  font-weight: var(--fd-font-weight-semibold);
}

.fd-job-list__title:hover {
  color: var(--fd-primary-hover);
}

.fd-job-list__node-type {
  color: var(--fd-muted-foreground);
  font-size: var(--fd-text-xs);
}

.fd-job-list__node-type a {
  text-decoration: none;
  color: var(--fd-muted-foreground);
}

.fd-job-list__node-type a:hover {
  color: var(--fd-primary-hover);
}

.fd-job-list__error {
  margin-block-start: var(--fd-space-1);
  color: var(--fd-error-hover);
  font-size: var(--fd-text-xs);
  line-height: var(--fd-line-height-tight);
}

/* ========================================================================
 * META
 * ======================================================================== */

.fd-job-list__meta {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--fd-space-3);
}

.fd-job-list__duration {
  display: inline-flex;
  align-items: center;
  color: var(--fd-muted-foreground);
  font-size: var(--fd-text-xs);
  gap: var(--fd-space-1);
}

.fd-job-list__duration svg {
  width: 0.875rem;
  height: 0.875rem;
}

.fd-job-list__badge {
  display: inline-flex;
  align-items: center;
  padding: var(--fd-space-1) var(--fd-space-2);
  white-space: nowrap;
  letter-spacing: var(--fd-letter-spacing-wide);
  text-transform: uppercase;
  border-radius: var(--fd-radius-md);
  font-size: var(--fd-text-xs);
  font-weight: var(--fd-font-weight-semibold);
}

.fd-job-list__badge--success {
  color: var(--fd-success-hover);
  background-color: var(--fd-success-muted);
}

.fd-job-list__badge--warning {
  color: var(--fd-warning-hover);
  background-color: var(--fd-warning-muted);
}

.fd-job-list__badge--error {
  color: var(--fd-error-hover);
  background-color: var(--fd-error-muted);
}

.fd-job-list__badge--info {
  color: var(--fd-info);
  background-color: var(--fd-info-muted);
}

.fd-job-list__badge--neutral {
  color: var(--fd-muted-foreground);
  background-color: var(--fd-subtle);
}

/* ========================================================================
 * ARROW
 * ======================================================================== */

.fd-job-list__arrow {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  transition:
    opacity var(--fd-transition-fast),
    transform var(--fd-transition-fast),
    color var(--fd-transition-fast);
  transform: translateX(-4px);
  opacity: 0;
  color: var(--fd-muted-foreground);
}

.fd-job-list__arrow svg {
  width: 1.25rem;
  height: 1.25rem;
}

.fd-job-list__item:hover .fd-job-list__arrow {
  transform: translateX(0);
  opacity: 1;
  color: var(--fd-primary);
}

/* ========================================================================
 * RESPONSIVE
 * ======================================================================== */

@media (max-width: 640px) {
  .fd-job-list__item {
    flex-wrap: wrap;
  }

  .fd-job-list__meta {
    width: 100%;
    margin-block-start: var(--fd-space-2);
    padding-inline-start: calc(2rem + var(--fd-space-3));
  }

  .fd-job-list__arrow {
    display: none;
  }
}
