/**
 * Agentic Vibe - Workflow Pipeline Component
 * 5-step visualization for AI writing workflow
 *
 * @package WP_Agentic_Writer
 * @since 0.2.0
 */

/* ============================================
   Workflow Container
   ============================================ */

.wpaw-workflow-progress {
  background: var(--wpaw-bg-secondary);
  padding: var(--wpaw-space-lg);
  border-radius: var(--wpaw-radius-md);
  margin-bottom: var(--wpaw-space-lg);
  border: 1px solid var(--wpaw-border);
}

.wpaw-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--wpaw-space-lg);
}

.wpaw-progress-title {
  font-size: var(--wpaw-text-sm);
  font-weight: 600;
  color: var(--wpaw-text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wpaw-progress-status {
  font-size: var(--wpaw-text-xs);
  color: var(--wpaw-text-tertiary);
  font-family: var(--wpaw-font-mono);
}

/* ============================================
   Progress Steps Container
   ============================================ */

.wpaw-progress-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

/* ============================================
   Individual Step
   ============================================ */

.wpaw-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--wpaw-space-sm);
  flex: 0 0 auto;
  z-index: 1;
}

.wpaw-step-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--wpaw-text-sm);
  border: 2px solid var(--wpaw-border);
  background: var(--wpaw-bg-primary);
  color: var(--wpaw-text-tertiary);
  transition: all var(--wpaw-transition-normal);
  position: relative;
}

/* Step Icons */
.wpaw-step-icon {
  font-size: var(--wpaw-text-lg);
  line-height: 1;
}

/* Completed State */
.wpaw-step.completed .wpaw-step-circle {
  background: var(--wpaw-success);
  border-color: var(--wpaw-success);
  color: white;
  box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.2);
}

/* Active State */
.wpaw-step.active .wpaw-step-circle {
  background: var(--wpaw-primary);
  border-color: var(--wpaw-primary);
  color: white;
  box-shadow: 0 0 0 8px rgba(23, 162, 184, 0.15);
  animation: wpaw-step-pulse 2s ease-in-out infinite;
}

@keyframes wpaw-step-pulse {
  0%, 100% {
    box-shadow: 0 0 0 8px rgba(23, 162, 184, 0.15);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(23, 162, 184, 0.1);
  }
}

/* Pending State */
.wpaw-step.pending .wpaw-step-circle {
  opacity: 0.5;
}

.wpaw-step.pending .wpaw-step-label {
  color: var(--wpaw-text-tertiary);
}

/* Error State */
.wpaw-step.error .wpaw-step-circle {
  background: var(--wpaw-error);
  border-color: var(--wpaw-error);
  color: white;
}

/* ============================================
   Step Label
   ============================================ */

.wpaw-step-label {
  font-size: var(--wpaw-text-xs);
  font-weight: 500;
  text-align: center;
  color: var(--wpaw-text-secondary);
  width: 70px;
  transition: color var(--wpaw-transition-fast);
}

.wpaw-step.active .wpaw-step-label {
  color: var(--wpaw-primary);
  font-weight: 600;
}

.wpaw-step.completed .wpaw-step-label {
  color: var(--wpaw-success);
}

/* ============================================
   Step Connector (Line between steps)
   ============================================ */

.wpaw-step-connector {
  flex: 1;
  height: 3px;
  background: var(--wpaw-border);
  margin: 0 var(--wpaw-space-sm);
  position: relative;
  top: -28px;
  min-width: 40px;
  border-radius: 2px;
  transition: background var(--wpaw-transition-normal);
}

/* Completed Connector */
.wpaw-step-connector.completed {
  background: var(--wpaw-success);
}

/* Active Connector - Animated */
.wpaw-step-connector.active {
  background: linear-gradient(
    90deg,
    var(--wpaw-primary) 0%,
    var(--wpaw-primary) 50%,
    var(--wpaw-border) 50%,
    var(--wpaw-border) 100%
  );
  background-size: 200% 100%;
  animation: wpaw-slide-progress 1.5s linear infinite;
}

@keyframes wpaw-slide-progress {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* ============================================
   Step Status Message
   ============================================ */

.wpaw-step-message {
  margin-top: var(--wpaw-space-md);
  padding: var(--wpaw-space-sm) var(--wpaw-space-md);
  background: var(--wpaw-bg-tertiary);
  border-radius: var(--wpaw-radius-sm);
  font-size: var(--wpaw-text-sm);
  color: var(--wpaw-text-secondary);
  text-align: center;
  font-family: var(--wpaw-font-mono);
  border-left: 3px solid var(--wpaw-primary);
}

.wpaw-step-message.success {
  border-left-color: var(--wpaw-success);
  color: var(--wpaw-success);
}

.wpaw-step-message.error {
  border-left-color: var(--wpaw-error);
  color: var(--wpaw-error);
}

/* ============================================
   Compact Version (for header)
   ============================================ */

.wpaw-workflow-compact {
  padding: var(--wpaw-space-md);
}

.wpaw-workflow-compact .wpaw-step-circle {
  width: 32px;
  height: 32px;
  font-size: var(--wpaw-text-xs);
}

.wpaw-workflow-compact .wpaw-step-icon {
  font-size: var(--wpaw-text-sm);
}

.wpaw-workflow-compact .wpaw-step-label {
  font-size: 10px;
  width: 50px;
}

.wpaw-workflow-compact .wpaw-step-connector {
  top: -20px;
  height: 2px;
  min-width: 20px;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
  .wpaw-progress-steps {
    flex-wrap: wrap;
    gap: var(--wpaw-space-md);
    justify-content: center;
  }

  .wpaw-step-connector {
    display: none;
  }

  .wpaw-step {
    flex: 0 0 20%;
  }

  .wpaw-step-label {
    width: 100%;
    max-width: 80px;
  }
}

@media (max-width: 480px) {
  .wpaw-workflow-progress {
    padding: var(--wpaw-space-md);
  }

  .wpaw-step-circle {
    width: 36px;
    height: 36px;
  }

  .wpaw-step-label {
    font-size: 10px;
  }

  .wpaw-progress-title {
    font-size: var(--wpaw-text-xs);
  }
}

/* ============================================
   Animation for Active Step
   ============================================ */

.wpaw-step.active .wpaw-step-circle::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid var(--wpaw-primary);
  border-top-color: transparent;
  border-right-color: transparent;
  animation: wpaw-spin 1s linear infinite;
}

@keyframes wpaw-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   Tooltip for Steps
   ============================================ */

.wpaw-step[data-tooltip] {
  cursor: pointer;
}

.wpaw-step[data-tooltip]:hover .wpaw-step-circle {
  transform: scale(1.1);
}

/* ============================================
   Mini Progress Bar (alternative)
   ============================================ */

.wpaw-mini-progress {
  display: flex;
  align-items: center;
  gap: var(--wpaw-space-xs);
  font-size: var(--wpaw-text-xs);
  color: var(--wpaw-text-tertiary);
}

.wpaw-mini-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--wpaw-bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.wpaw-mini-progress-fill {
  height: 100%;
  background: var(--wpaw-primary);
  transition: width var(--wpaw-transition-normal);
}

.wpaw-mini-progress-fill.success {
  background: var(--wpaw-success);
}

.wpaw-mini-progress-text {
  font-family: var(--wpaw-font-mono);
  white-space: nowrap;
}