/**
 * @file
 * FlowDrop Dependency Navigator Component Styles
 *
 * A 3-column visual component for job dependency navigation with curved connectors.
 */

.fd-dep-nav {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: stretch;
  min-height: 180px;
  margin-block-end: var(--fd-space-6);
  padding: var(--fd-space-4);
  border: var(--fd-border-width) solid var(--fd-border);
  border-radius: var(--fd-radius-xl);
  background: linear-gradient(135deg, var(--fd-muted) 0%, var(--fd-card) 100%);
  gap: var(--fd-space-2);
}

/* ========================================================================
 * SVG CANVAS FOR CONNECTORS
 * ======================================================================== */

.fd-dep-nav__canvas {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  overflow: visible;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.fd-dep-nav__connector-path {
  fill: none;
  stroke: var(--fd-border-muted);
  stroke-width: 2;
  stroke-linecap: round;
}

.fd-dep-nav__connector-path--animated {
  stroke-dasharray: 6 4;
  animation: fd-connector-flow 0.8s linear infinite;
}

@keyframes fd-connector-flow {
  0% {
    stroke-dashoffset: 10;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

/* Arrow markers */
.fd-dep-nav__canvas marker path {
  fill: var(--fd-muted-foreground);
}

/* ========================================================================
 * COLUMNS
 * ======================================================================== */

.fd-dep-nav__column {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--fd-space-3);
  gap: var(--fd-space-3);
}

.fd-dep-nav__column--parents {
  padding-inline-end: var(--fd-space-6);
}

.fd-dep-nav__column--children {
  padding-inline-start: var(--fd-space-6);
}

.fd-dep-nav__column--current {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Column Headers */
.fd-dep-nav__column-header {
  display: flex;
  align-items: center;
  gap: var(--fd-space-2);
  padding-block-end: var(--fd-space-2);
  border-block-end: var(--fd-border-width) solid var(--fd-border-muted);
}

.fd-dep-nav__column-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--fd-radius-md);
}

.fd-dep-nav__column-icon svg {
  width: 1rem;
  height: 1rem;
}

.fd-dep-nav__column-icon--parent {
  color: var(--fd-warning-hover);
  background-color: var(--fd-warning-muted);
}

.fd-dep-nav__column-icon--current {
  color: var(--fd-primary-hover);
  background-color: var(--fd-primary-muted);
}

.fd-dep-nav__column-icon--child {
  color: var(--fd-info);
  background-color: var(--fd-info-muted);
}

.fd-dep-nav__column-title {
  letter-spacing: var(--fd-letter-spacing-wide);
  text-transform: uppercase;
  color: var(--fd-muted-foreground);
  font-size: var(--fd-text-xs);
  font-weight: var(--fd-font-weight-semibold);
}

.fd-dep-nav__column-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 var(--fd-space-1);
  color: var(--fd-muted-foreground);
  border-radius: var(--fd-radius-full);
  background-color: var(--fd-subtle);
  font-size: var(--fd-text-xs);
  font-weight: var(--fd-font-weight-semibold);
}

/* ========================================================================
 * ITEMS LIST
 * ======================================================================== */

.fd-dep-nav__items {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: var(--fd-space-2);
}

.fd-dep-nav__column--current .fd-dep-nav__items {
  align-items: center;
  width: 100%;
}

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

.fd-dep-nav__item {
  position: relative;
  display: flex;
  align-items: center;
  padding: var(--fd-space-2) var(--fd-space-3);
  transition: all var(--fd-transition-fast);
  text-decoration: none;
  color: inherit;
  border: var(--fd-border-width) solid var(--fd-border);
  border-radius: var(--fd-radius-lg);
  background-color: var(--fd-card);
  gap: var(--fd-space-2);
}

a.fd-dep-nav__item:hover {
  transform: translateY(-1px);
  border-color: var(--fd-primary-muted);
  box-shadow: var(--fd-shadow-md);
}

a.fd-dep-nav__item:focus {
  outline: 2px solid var(--fd-primary);
  outline-offset: 2px;
}

/* Current job styling - more prominent */
.fd-dep-nav__item--current {
  min-width: 180px;
  padding: var(--fd-space-3) var(--fd-space-4);
  border-width: 2px;
  box-shadow: var(--fd-shadow-md);
}

/* Status-specific border colors */
.fd-dep-nav__item--success {
  border-inline-start: 3px solid var(--fd-success);
}

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

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

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

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

/* Status Icon */
.fd-dep-nav__item-status {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--fd-radius-full);
}

.fd-dep-nav__item-status svg {
  width: 1rem;
  height: 1rem;
}

.fd-dep-nav__item--success .fd-dep-nav__item-status {
  color: var(--fd-success-hover);
  background-color: var(--fd-success-muted);
}

.fd-dep-nav__item--warning .fd-dep-nav__item-status {
  color: var(--fd-warning-hover);
  background-color: var(--fd-warning-muted);
}

.fd-dep-nav__item--error .fd-dep-nav__item-status {
  color: var(--fd-error-hover);
  background-color: var(--fd-error-muted);
}

.fd-dep-nav__item--info .fd-dep-nav__item-status {
  color: var(--fd-info);
  background-color: var(--fd-info-muted);
}

.fd-dep-nav__item--neutral .fd-dep-nav__item-status {
  color: var(--fd-muted-foreground);
  background-color: var(--fd-subtle);
}

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

.fd-dep-nav__item--info .fd-dep-nav__item-status svg {
  animation: fd-dep-spin 2s linear infinite;
}

/* Item Content */
.fd-dep-nav__item-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: var(--fd-space-1);
}

.fd-dep-nav__item-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--fd-foreground);
  font-size: var(--fd-text-sm);
  font-weight: var(--fd-font-weight-medium);
}

.fd-dep-nav__item-type {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--fd-muted-foreground);
  font-size: var(--fd-text-xs);
}

/* Item Meta (duration + badge) */
.fd-dep-nav__item-meta {
  display: flex;
  align-items: center;
  gap: var(--fd-space-2);
  margin-block-start: var(--fd-space-1);
}

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

.fd-dep-nav__item-duration svg {
  flex-shrink: 0;
  width: 0.75rem;
  height: 0.75rem;
}

/* Status Badge */
.fd-dep-nav__item-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.375rem;
  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-dep-nav__item-badge--success {
  color: var(--fd-success-hover);
  background-color: var(--fd-success-muted);
}

.fd-dep-nav__item-badge--warning {
  color: var(--fd-warning-hover);
  background-color: var(--fd-warning-muted);
}

.fd-dep-nav__item-badge--error {
  color: var(--fd-error-hover);
  background-color: var(--fd-error-muted);
}

.fd-dep-nav__item-badge--info {
  color: var(--fd-info);
  background-color: var(--fd-info-muted);
}

.fd-dep-nav__item-badge--neutral {
  color: var(--fd-muted-foreground);
  background-color: var(--fd-subtle);
}

/* Error Message */
.fd-dep-nav__item-error {
  display: flex;
  align-items: flex-start;
  margin-block-start: var(--fd-space-1);
  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);
  line-height: var(--fd-line-height-tight);
  gap: var(--fd-space-1);
}

.fd-dep-nav__item-error svg {
  flex-shrink: 0;
  width: 0.875rem;
  height: 0.875rem;
  color: var(--fd-error);
}

/* Arrow indicator */
.fd-dep-nav__item-arrow {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  transition:
    color var(--fd-transition-fast),
    transform var(--fd-transition-fast);
  color: var(--fd-muted-foreground);
}

.fd-dep-nav__item-arrow svg {
  width: 1rem;
  height: 1rem;
}

a.fd-dep-nav__item:hover .fd-dep-nav__item-arrow {
  transform: translateX(2px);
  color: var(--fd-primary-hover);
}

/* ========================================================================
 * EMPTY STATE
 * ======================================================================== */

.fd-dep-nav__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  padding: var(--fd-space-4);
  border: var(--fd-border-width) dashed var(--fd-border);
  border-radius: var(--fd-radius-lg);
  background-color: var(--fd-muted);
}

.fd-dep-nav__empty-text {
  color: var(--fd-muted-foreground);
  font-size: var(--fd-text-sm);
  font-style: italic;
}

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

@media (max-width: 1024px) {
  .fd-dep-nav {
    grid-template-rows: auto auto auto;
    grid-template-columns: 1fr;
    padding: var(--fd-space-3);
    gap: var(--fd-space-4);
  }

  .fd-dep-nav__canvas {
    display: none;
  }

  .fd-dep-nav__column--current {
    order: -1;
  }

  .fd-dep-nav__column--parents,
  .fd-dep-nav__column--children {
    padding-inline: var(--fd-space-2);
  }

  .fd-dep-nav__column {
    padding: var(--fd-space-2);
  }

  .fd-dep-nav__items {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .fd-dep-nav__item {
    flex: 1 1 calc(50% - var(--fd-space-2));
    min-width: 150px;
  }
}

@media (max-width: 640px) {
  .fd-dep-nav__items {
    flex-direction: column;
  }

  .fd-dep-nav__item {
    flex: 1 1 100%;
  }
}
