/** Buy More Save More - Milestone badge design. @see buy-more-save-more.js */

.bmsm {
  padding: 16px;
  background-color: #fff;
  font-family: var(--galls-font-gt-america-standard);
}

/* Message styling */
.bmsm__message {
  text-align: center;
  font-size: 14px;
  font-weight: var(--galls-fw-400);
  color: #333;
  margin-bottom: 12px;
}

.bmsm__message strong {
  font-weight: var(--galls-fw-700);
}

.bmsm__highlight {
  color: var(--brand-primary);
}

/* Bar container - holds bar and milestone badges */
.bmsm__bar-container {
  position: relative;
  padding-top: 20px; /* Space for badges above bar */
  padding-bottom: 24px; /* Space for thresholds below */
}

/* Progress bar track */
.bmsm__bar {
  position: relative;
  height: 8px;
  background-color: #e3e3e3;
  border-radius: 4px;
  overflow: visible;
}

/* Progress fill - uses brand color */
.bmsm__progress {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background-color: var(--brand-primary);
  border-radius: 4px;
  transition: width 0.3s ease;
  /* Lighter version for reached portion */
  background: linear-gradient(90deg, 
    color-mix(in srgb, var(--brand-primary) 40%, white) 0%, 
    var(--brand-primary) 100%);
}

/* Milestones container - positions badges on the bar */
.bmsm__milestones {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  pointer-events: none;
}

/* Individual milestone (badge + threshold) */
.bmsm__milestone {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: absolute;
  transform: translateX(-50%);
}

/* Position milestones evenly at 33.33%, 66.66%, 100% */
.bmsm__milestone:nth-child(1) { left: 33.33%; }
.bmsm__milestone:nth-child(2) { left: 66.66%; }
.bmsm__milestone:nth-child(3) { left: 100%; }

/* Milestone badge circle */
.bmsm__milestone-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: var(--galls-fw-700);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  z-index: 2;
}

/* Badge states - Reached (light brand color, black text) */
.bmsm__milestone-badge--reached {
  background-color: color-mix(in srgb, var(--brand-primary) 30%, white);
  color: #000;
}

/* Badge states - Current target (solid brand color, white text) */
.bmsm__milestone-badge--current {
  background-color: var(--brand-primary);
  color: #fff;
}

/* Badge states - Unreached (gray background, gray text) */
.bmsm__milestone-badge--unreached {
  background-color: #e3e3e3;
  color: #6B7280;
}

/* Threshold labels below badges */
.bmsm__milestone-threshold {
  font-size: 12px;
  font-weight: var(--galls-fw-500);
  margin-top: 4px;
  white-space: nowrap;
}

/* Threshold text colors based on state */
.bmsm__milestone-threshold--reached {
  color: #333;
}

.bmsm__milestone-threshold--current {
  color: #333;
  font-weight: var(--galls-fw-700);
}

.bmsm__milestone-threshold--unreached {
  color: #999;
}

/* Responsive */
@media (max-width: 480px) {
  .bmsm { padding: 12px; }
  .bmsm__message { font-size: 13px; }
  .bmsm__milestone-badge { width: 36px; height: 36px; font-size: 11px; }
  .bmsm__milestone-threshold { font-size: 11px; }
}

/* Legacy overrides */
#thresholdShippingBar .sidecart-shipping { display: none; }
#thresholdShippingBar:has(.bmsm) .sidecart-shipping { display: none; }
#thresholdShippingBar .bmsm { display: block; }
