/**
 * Progress Indicator Component
 * 
 * A clean, modern progress indicator with SVG circles and connecting lines.
 * Designed for multi-step forms and processes.
 */

@import url('../../variables/referral_theme.css');

.progress-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: var(--space-xl) 0;
  padding: var(--space-lg);
  background: var(--bg-glass);
  backdrop-filter: var(--glass-backdrop);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  position: relative;
}

.progress-indicator--compact {
  margin: var(--space-md) 0;
  padding: var(--space-md);
}

.progress-indicator--inline {
  background: transparent;
  border: none;
  padding: 0;
  margin: var(--space-md) 0;
}

/* Progress Steps Container */
.progress-steps,
.progress-indicator__container,
.progress-indicator__track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 600px;
  position: relative;
}

/* Individual Step - Support both naming conventions */
.progress-step,
.progress-indicator__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  flex: 1;
  min-width: 0;
}

/* Step Circle - Support both naming conventions */
.step-circle,
.progress-indicator__step-circle {
  width: var(--progress-circle-size);
  height: var(--progress-circle-size);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 2px solid var(--border-secondary);
  transition: all var(--transition-normal);
  position: relative;
  z-index: 3;
}

/* Step Number - BEM naming */
.progress-indicator__step-number {
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
}

/* Step States - Support both naming conventions */
.progress-step--pending .step-circle,
.progress-indicator__step--pending .progress-indicator__step-circle {
  background: var(--bg-tertiary);
  border-color: var(--border-secondary);
  color: var(--text-tertiary);
}

.progress-step--active .step-circle,
.progress-indicator__step--active .progress-indicator__step-circle {
  background: var(--brand-gradient);
  border-color: var(--brand-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-brand);
  transform: scale(1.1);
}

.progress-step--completed .step-circle,
.progress-indicator__step--completed .progress-indicator__step-circle {
  background: var(--status-success);
  border-color: var(--status-success);
  color: var(--text-primary);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.progress-step--error .step-circle,
.progress-indicator__step--error .progress-indicator__step-circle {
  background: var(--status-error);
  border-color: var(--status-error);
  color: var(--text-primary);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
}

/* Step Icon */
.step-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

/* Step Label - Support both naming conventions */
.step-label,
.progress-indicator__step-label {
  margin-top: var(--space-sm);
  text-align: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  line-height: var(--line-height-tight);
  max-width: 100px;
  word-wrap: break-word;
}

.progress-step--active .step-label,
.progress-indicator__step--active .progress-indicator__step-label {
  color: var(--brand-primary);
  font-weight: var(--font-weight-semibold);
}

.progress-step--completed .step-label,
.progress-indicator__step--completed .progress-indicator__step-label {
  color: var(--status-success);
}

.progress-step--error .step-label,
.progress-indicator__step--error .progress-indicator__step-label {
  color: var(--status-error);
}

/* Connecting Lines - Support both naming conventions */
.progress-step:not(:last-child)::after,
.progress-indicator__step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: calc(var(--progress-circle-size) / 2);
  left: calc(50% + var(--progress-circle-size) / 2);
  width: calc(100% - var(--progress-circle-size));
  height: var(--progress-line-thickness);
  background: var(--border-secondary);
  z-index: 1;
  transition: all var(--transition-normal);
}

.progress-step--completed:not(:last-child)::after,
.progress-indicator__step--completed:not(:last-child)::after {
  background: var(--status-success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.progress-step--active:not(:last-child)::after,
.progress-indicator__step--active:not(:last-child)::after {
  background: linear-gradient(90deg, var(--brand-primary) 0%, var(--border-secondary) 100%);
}

/* Progress Bar (Alternative Style) */
.progress-indicator--bar {
  flex-direction: column;
  align-items: stretch;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-md);
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: var(--brand-gradient);
  border-radius: var(--radius-full);
  transition: width var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Progress Percentage */
.progress-percentage {
  text-align: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  margin-top: var(--space-sm);
}

/* Responsive Design */
@media (max-width: 768px) {
  .progress-indicator {
    padding: var(--space-md);
  }

  .progress-steps,
  .progress-indicator__container,
  .progress-indicator__track {
    max-width: 100%;
  }

  .step-circle,
  .progress-indicator__step-circle {
    width: 32px;
    height: 32px;
    font-size: var(--font-size-xs);
  }

  .step-label,
  .progress-indicator__step-label {
    font-size: 10px;
    max-width: 80px;
  }

  .progress-step:not(:last-child)::after,
  .progress-indicator__step:not(:last-child)::after {
    left: calc(50% + 16px);
    width: calc(100% - 32px);
  }
}

@media (max-width: 480px) {
  .progress-indicator {
    padding: var(--space-sm);
  }

  .step-circle,
  .progress-indicator__step-circle {
    width: 28px;
    height: 28px;
  }

  .step-label,
  .progress-indicator__step-label {
    font-size: 9px;
    max-width: 60px;
  }

  .progress-step:not(:last-child)::after,
  .progress-indicator__step:not(:last-child)::after {
    left: calc(50% + 14px);
    width: calc(100% - 28px);
  }
}

/* Animation Classes */
.progress-step--entering,
.progress-indicator__step--entering {
  animation: stepEnter 0.5s ease-out;
}

.progress-step--leaving,
.progress-indicator__step--leaving {
  animation: stepLeave 0.3s ease-in;
}

@keyframes stepEnter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes stepLeave {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-20px) scale(0.8);
  }
}

/* Accessibility */
.progress-indicator[aria-label] {
  /* Screen reader support */
  position: relative;
}

.progress-step[aria-current="step"],
.progress-indicator__step[aria-current="step"] {
  /* Current step indication for screen readers */
  outline: 2px solid #f26419;
  outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .step-circle,
  .progress-indicator__step-circle {
    border-width: 3px;
  }

  .progress-step:not(:last-child)::after,
  .progress-indicator__step:not(:last-child)::after {
    height: 4px;
  }

  .progress-step--active .step-circle,
  .progress-indicator__step--active .progress-indicator__step-circle {
    transform: scale(1.15);
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .step-circle,
  .progress-indicator__step-circle,
  .progress-step:not(:last-child)::after,
  .progress-indicator__step:not(:last-child)::after,
  .progress-bar-fill {
    transition: none;
  }

  .progress-step--active .step-circle,
  .progress-indicator__step--active .progress-indicator__step-circle {
    transform: none;
  }

  .progress-bar-fill::after {
    animation: none;
  }
}
