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

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

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

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

.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 {
  display: flex;
  flex-direction: column;
  gap: var(--fd-space-3);
  padding: var(--fd-space-3);
  min-width: 0;
  position: relative;
  z-index: 2;
}

.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;
  justify-content: center;
  align-items: 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;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--fd-radius-md);
  flex-shrink: 0;
}

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

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

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

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

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

.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);
  font-size: var(--fd-text-xs);
  font-weight: var(--fd-font-weight-semibold);
  color: var(--fd-muted-foreground);
  background-color: var(--fd-subtle);
  border-radius: var(--fd-radius-full);
}

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

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

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

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

.fd-dep-nav__item {
  display: flex;
  align-items: center;
  gap: var(--fd-space-2);
  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-lg);
  text-decoration: none;
  color: inherit;
  transition: all var(--fd-transition-fast);
  position: relative;
}

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

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 {
  padding: var(--fd-space-3) var(--fd-space-4);
  border-width: 2px;
  box-shadow: var(--fd-shadow-md);
  min-width: 180px;
}

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

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

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

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

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

/* 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 {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--fd-space-1);
}

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

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

/* 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;
  gap: var(--fd-space-1);
  font-size: var(--fd-text-xs);
  color: var(--fd-muted-foreground);
}

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

/* Status Badge */
.fd-dep-nav__item-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.375rem;
  font-size: 0.625rem;
  font-weight: var(--fd-font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  border-radius: var(--fd-radius-sm);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  .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%;
  }
}
