/**
 * Wizard Steps Component
 * A modern stepper component for multi-step forms
 * Features: Progress line, checkmarks, responsive pagination
 */

/* ============================================
   Container
   ============================================ */
.wizard-steps {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
  max-width: 900px;
  margin: 25px auto 80px;
  padding: 0 20px;
  box-sizing: border-box;
  position: relative;
}

/* ============================================
   Progress Line (Background - gray)
   ============================================ */
.wizard-steps::before {
  content: "";
  position: absolute;
  left: 40px;
  right: 40px;
  top: 22px;
  height: 3px;
  background: #e0e0e0;
  z-index: 0;
  border-radius: 2px;
}

/* ============================================
   Progress Line (Colored - shows completion)
   ============================================ */
.wizard-progress-line {
  position: absolute;
  top: 22px;
  height: 3px;
  background: var(--color-primary);
  z-index: 0;
  border-radius: 2px;
  transition:
    width 0.3s ease,
    left 0.3s ease;
}

/* ============================================
   Step Link Wrapper
   ============================================ */
.wizard-steps > a {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  flex: 0 0 auto;
}

/* ============================================
   Step Bubble Container
   ============================================ */
.wizard-steps .buble {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  color: #888;
}

/* ============================================
   Step Circle
   ============================================ */
.wizard-steps .buble .circle {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  background: #fff;
  border: 3px solid #e0e0e0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #999;
  font-size: 15px;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

/* Checkmark SVG for completed steps */
.wizard-steps .buble .circle .checkmark {
  width: 20px;
  height: 20px;
  display: block;
}

/* ============================================
   Step Label (Below Circle)
   ============================================ */
.wizard-steps .buble .step-label,
.wizard-steps .buble > span:not(.circle):not(.error-img) {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 12px;
  min-width: 120px;
  max-width: 160px;
  text-align: center;
  font-size: 13px;
  line-height: 1.3;
  color: inherit;
}

/* ============================================
   Inactive Step State (Not yet reached)
   ============================================ */
.wizard-steps .buble {
  color: #888;
}

.wizard-steps .buble .circle {
  background: #fff;
  border-color: #e0e0e0;
  color: #999;
}

/* ============================================
   Active Step State (Completed - with checkmark)
   ============================================ */
.wizard-steps .buble.active {
  color: var(--color-primary);
}

.wizard-steps .buble.active .circle {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.wizard-steps .buble.active:hover .circle {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

/* ============================================
   Selected Step State (Current step)
   ============================================ */
.wizard-steps .buble.selected {
  color: var(--color-primary-bg);
}

.wizard-steps .buble.selected .circle {
  background: var(--color-primary-bg);
  border-color: var(--color-primary-bg);
  color: #fff;
}

/* ============================================
   Ellipsis Indicator (Common styles)
   ============================================ */
.wizard-ellipsis {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
  /* Align with 44px circles - ellipsis is 36px, so offset by (44-36)/2 = 4px */
  padding-top: 4px;
}

.wizard-ellipsis .ellipsis-circle {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  background: #f5f5f5;
  border: 2px dotted #ccc;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: #888;
  transition: all 0.2s ease;
}

.wizard-ellipsis .ellipsis-range {
  white-space: nowrap;
}

/* Ellipsis error badge - shown when hidden steps have errors */
.wizard-ellipsis .ellipsis-error {
  position: absolute;
  top: 2px;
  left: 50%;
  margin-left: 10px;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px;
  max-width: 16px;
  min-height: 16px;
  max-height: 16px;
  background: #c00 !important;
  border: 2px solid #fff;
  border-radius: 50% !important;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.wizard-ellipsis .ellipsis-error::before {
  content: "!";
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  line-height: 1;
}

.wizard-ellipsis .ellipsis-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 16px;
  font-size: 11px;
  color: #999;
  white-space: nowrap;
}

/* ============================================
   Hide old elements
   ============================================ */
.wizard-steps .rq {
  display: none;
}

/* Error badge - positioned at top-right of circle */
/* Note: error-img is a sibling of .circle, so we position relative to .buble */
/* Override generic .error-img from style.css */
.wizard-steps .buble .error-img {
  position: absolute;
  top: -2px;
  left: 50%;
  margin-left: 14px;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px;
  max-width: 16px;
  min-height: 16px;
  max-height: 16px;
  background: #c00 !important;
  background-image: none !important; /* Override style.css */
  border: 2px solid #fff;
  border-radius: 50% !important;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 0 !important; /* Override style.css padding-left: 35px */
}

.wizard-steps .buble .error-img::before {
  content: "!";
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  line-height: 1;
}

/* ============================================
   Large Desktop (1200px+)
   ============================================ */
@media (min-width: 1200px) {
  .wizard-steps {
    max-width: 1000px;
  }

  .wizard-steps .buble .circle {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    font-size: 16px;
  }

  .wizard-steps::before,
  .wizard-progress-line {
    top: 24px;
  }

  .wizard-steps .buble .step-label,
  .wizard-steps .buble > span:not(.circle):not(.error-img) {
    font-size: 14px;
    min-width: 160px;
    max-width: 180px;
  }
}

/* ============================================
   Tablet (768px - 991px) - Pagination Mode
   Max 4 visible steps
   ============================================ */
@media (max-width: 991px) {
  .wizard-steps {
    max-width: 100%;
    padding: 0 15px;
    margin-bottom: 70px;
  }

  .wizard-steps::before {
    left: 30px;
    right: 30px;
  }

  .wizard-progress-line {
    left: 30px;
  }

  .wizard-steps .buble .circle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    font-size: 14px;
  }

  .wizard-steps::before,
  .wizard-progress-line {
    top: 20px;
  }

  .wizard-steps .buble .step-label,
  .wizard-steps .buble > span:not(.circle):not(.error-img) {
    font-size: 12px;
    min-width: 100px;
    max-width: 120px;
  }

  .wizard-ellipsis .ellipsis-circle {
    width: 36px;
    height: 36px;
    font-size: 10px;
  }
}

/* ============================================
   Mobile (< 768px) - Pagination Mode
   Max 3 visible steps
   ============================================ */
@media (max-width: 767px) {
  .wizard-steps {
    max-width: 100%;
    padding: 0 10px;
    margin: 15px auto 70px;
    justify-content: space-between;
  }

  .wizard-steps::before {
    left: 35px;
    right: 35px;
  }

  .wizard-progress-line {
    left: 20px;
  }

  .wizard-steps .buble .circle {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    font-size: 13px;
  }

  .wizard-steps::before,
  .wizard-progress-line {
    top: 19px;
  }

  /* Show labels on mobile when paginated */
  .wizard-steps-paginated .buble .step-label,
  .wizard-steps-paginated .buble > span:not(.circle):not(.error-img) {
    display: block !important;
    font-size: 11px;
    min-width: 80px;
    max-width: 90px;
  }

  .wizard-ellipsis .ellipsis-circle {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    font-size: 9px;
  }

  .wizard-ellipsis .ellipsis-label {
    font-size: 10px;
  }
}

/* ============================================
   Small Mobile (< 480px)
   ============================================ */
@media (max-width: 480px) {
  .wizard-steps {
    padding: 0 5px;
    margin-bottom: 60px;
  }

  .wizard-steps::before {
    left: 30px;
    right: 30px;
  }

  .wizard-progress-line {
    left: 15px;
  }

  .wizard-steps .buble .circle {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    font-size: 12px;
  }

  .wizard-steps::before,
  .wizard-progress-line {
    top: 17px;
  }

  .wizard-steps-paginated .buble .step-label,
  .wizard-steps-paginated .buble > span:not(.circle):not(.error-img) {
    font-size: 10px;
    min-width: 70px;
    max-width: 80px;
  }

  .wizard-ellipsis .ellipsis-circle {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    font-size: 8px;
  }

  .wizard-ellipsis .ellipsis-label {
    display: none;
  }
}

/* ============================================
   Accessibility - Focus States
   ============================================ */
.wizard-steps > a:focus {
  outline: none;
}

.wizard-steps > a:focus .circle {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .wizard-steps .buble .circle {
    border-width: 3px;
  }

  .wizard-steps::before,
  .wizard-progress-line {
    height: 4px;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .wizard-steps .buble .circle,
  .wizard-progress-line {
    transition: none;
  }
}
