/**
 * @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-surface-card);
  border: var(--fd-border-width) solid var(--fd-border-color);
  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-color-gray-300);
  box-shadow: var(--fd-shadow-sm);
}

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

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

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

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

.fd-job-list__item--neutral {
  border-inline-start: 3px solid var(--fd-color-gray-400);
}

/* ========================================================================
 * 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-color-success-100);
  color: var(--fd-color-success-600);
}

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

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

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

.fd-job-list__item--neutral .fd-job-list__status-icon {
  background-color: var(--fd-color-gray-100);
  color: var(--fd-color-gray-500);
}

/* 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-font-size-sm);
  font-weight: var(--fd-font-weight-semibold);
  color: var(--fd-color-gray-900);
  text-decoration: none;
}

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

.fd-job-list__node-type {
  font-size: var(--fd-font-size-xs);
  color: var(--fd-color-gray-500);
}

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

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

.fd-job-list__error {
  margin-block-start: var(--fd-space-1);
  font-size: var(--fd-font-size-xs);
  color: var(--fd-color-error-600);
  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-font-size-xs);
  color: var(--fd-color-gray-500);
}

.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-font-size-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-color-success-100);
  color: var(--fd-color-success-700);
}

.fd-job-list__badge--warning {
  background-color: var(--fd-color-warning-100);
  color: var(--fd-color-warning-700);
}

.fd-job-list__badge--error {
  background-color: var(--fd-color-error-100);
  color: var(--fd-color-error-700);
}

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

.fd-job-list__badge--neutral {
  background-color: var(--fd-color-gray-100);
  color: var(--fd-color-gray-600);
}

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

.fd-job-list__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  color: var(--fd-color-gray-400);
  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-color-primary-500);
}

/* ========================================================================
 * 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;
  }
}
