/**
 * @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;
  gap: var(--fd-space-3);
  padding: var(--fd-space-3) var(--fd-space-4);
  background-color: var(--fd-card);
  border: var(--fd-border-width) solid var(--fd-border);
  border-radius: var(--fd-radius-lg);
  transition: border-color var(--fd-transition-fast),
              box-shadow var(--fd-transition-fast);
}

.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;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  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 {
  background-color: var(--fd-success-muted);
  color: var(--fd-success-hover);
}

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

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

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

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

/* 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;
  align-items: baseline;
  gap: var(--fd-space-2);
  flex-wrap: wrap;
}

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

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

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

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

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

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

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

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

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

.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);
  font-size: var(--fd-text-xs);
  font-weight: var(--fd-font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--fd-letter-spacing-wide);
  border-radius: var(--fd-radius-md);
  white-space: nowrap;
}

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

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

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

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

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

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

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

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

.fd-job-list__item:hover .fd-job-list__arrow {
  opacity: 1;
  transform: translateX(0);
  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;
  }
}
