/**
 * @file
 * FlowDrop Job Timeline Component Styles
 *
 * A compact vertical timeline display for pipeline jobs.
 */

.fd-job-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

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

.fd-job-timeline__item {
  display: flex;
  align-items: stretch;
  gap: var(--fd-space-2);
  position: relative;
}

/* ========================================================================
 * TIMELINE TRACK (Left Column)
 * ======================================================================== */

.fd-job-timeline__track {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 1.25rem;
  flex-shrink: 0;
  align-self: stretch;
}

/* Continuous vertical line behind nodes */
.fd-job-timeline__item:not(.fd-job-timeline__item--first) .fd-job-timeline__track::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 50%;
  background-color: var(--fd-border-muted);
}

.fd-job-timeline__item:not(.fd-job-timeline__item--last) .fd-job-timeline__track::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 50%;
  background-color: var(--fd-border-muted);
}

/* Status Node Circle */
.fd-job-timeline__node {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--fd-radius-full);
  background-color: var(--fd-card);
  border: 2px solid var(--fd-border);
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  transition: transform var(--fd-transition-fast),
    box-shadow var(--fd-transition-fast);
}

.fd-job-timeline__node svg {
  width: 0.625rem;
  height: 0.625rem;
}

/* Node status colors */
.fd-job-timeline__node--success {
  border-color: var(--fd-success);
  background-color: var(--fd-success-muted);
  color: var(--fd-success-hover);
}

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

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

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

.fd-job-timeline__node--neutral {
  border-color: var(--fd-muted-foreground);
  background-color: var(--fd-muted);
  color: var(--fd-muted0);
}

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

  to {
    transform: rotate(360deg);
  }
}

.fd-job-timeline__node--info svg {
  animation: fd-timeline-spin 2s linear infinite;
}

/* Status-colored connector lines */
.fd-job-timeline__item--success:not(.fd-job-timeline__item--first) .fd-job-timeline__track::before {
  background-color: var(--fd-success);
}

.fd-job-timeline__item--success:not(.fd-job-timeline__item--last) .fd-job-timeline__track::after {
  background-color: var(--fd-success);
}

/* ========================================================================
 * CARD (Job Details) - Compact single-row layout
 * ======================================================================== */

.fd-job-timeline__card {
  display: flex;
  flex-direction: column;
  gap: var(--fd-space-1);
  flex: 1;
  padding: var(--fd-space-2) var(--fd-space-3);
  background-color: var(--fd-card);
  border: var(--fd-border-width) solid var(--fd-border);
  border-radius: var(--fd-radius-md);
  text-decoration: none;
  color: inherit;
  margin-block: var(--fd-space-1);
  transition: border-color var(--fd-transition-fast),
    box-shadow var(--fd-transition-fast);
}

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

.fd-job-timeline__card:focus {
  outline: 2px solid var(--fd-primary);
  outline-offset: 1px;
}

/* Card status left border */
.fd-job-timeline__card--success {
  border-inline-start: 3px solid var(--fd-success);
}

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

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

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

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

/* Card Content - horizontal layout */
.fd-job-timeline__card-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fd-space-3);
}

.fd-job-timeline__card-main {
  display: flex;
  align-items: center;
  gap: var(--fd-space-2);
  min-width: 0;
  flex: 1;
}

.fd-job-timeline__title {
  font-size: var(--fd-text-sm);
  font-weight: var(--fd-font-weight-semibold);
  color: var(--fd-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fd-job-timeline__type {
  font-size: var(--fd-text-xs);
  color: var(--fd-muted0);
  white-space: nowrap;
}

/* Card Meta - right side */
.fd-job-timeline__card-meta {
  display: flex;
  align-items: center;
  gap: var(--fd-space-2);
  flex-shrink: 0;
}

.fd-job-timeline__duration {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--fd-text-xs);
  color: var(--fd-muted0);
}

.fd-job-timeline__duration svg {
  width: 0.75rem;
  height: 0.75rem;
}

/* Status Badge - compact */
.fd-job-timeline__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.625rem;
  font-weight: var(--fd-font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  border-radius: var(--fd-radius-sm);
  white-space: nowrap;
}

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

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

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

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

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

/* Error Message - compact */
.fd-job-timeline__error {
  display: flex;
  align-items: center;
  gap: var(--fd-space-1);
  padding: var(--fd-space-1) var(--fd-space-2);
  background-color: var(--fd-error-muted);
  border-radius: var(--fd-radius-sm);
  font-size: var(--fd-text-xs);
  color: var(--fd-error-hover);
}

.fd-job-timeline__error svg {
  width: 0.75rem;
  height: 0.75rem;
  flex-shrink: 0;
  color: var(--fd-error);
}

/* ========================================================================
 * HOVER EFFECTS
 * ======================================================================== */

.fd-job-timeline__item:hover .fd-job-timeline__node {
  transform: scale(1.15);
  box-shadow: var(--fd-shadow-sm);
}

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

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

  .fd-job-timeline__card-meta {
    width: 100%;
    justify-content: flex-end;
  }
}