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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* 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: 1;
  flex-direction: column;
  padding: var(--fd-space-2) var(--fd-space-3);
  transition:
    border-color var(--fd-transition-fast),
    box-shadow var(--fd-transition-fast);
  text-decoration: none;
  color: inherit;
  border: var(--fd-border-width) solid var(--fd-border);
  border-radius: var(--fd-radius-md);
  background-color: var(--fd-card);
  gap: var(--fd-space-1);
  margin-block: var(--fd-space-1);
}

.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;
  flex: 1;
  align-items: center;
  min-width: 0;
  gap: var(--fd-space-2);
}

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

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

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

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

.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;
  white-space: nowrap;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  border-radius: var(--fd-radius-sm);
  font-size: 0.625rem;
  font-weight: var(--fd-font-weight-semibold);
}

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

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

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

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

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

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

.fd-job-timeline__error svg {
  flex-shrink: 0;
  width: 0.75rem;
  height: 0.75rem;
  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 {
    justify-content: flex-end;
    width: 100%;
  }
}
