/** Buy More Save More - Milestone badge design. @see buy-more-save-more.js */

[data-target="bmsm-ab"] {
  display: none;
}

.bmsm {
  padding: 16px 16px 6px 16px;
  background-color: #fff;
  font-family: var(--galls-font-gt-america-standard);
}

.shopping-cart .bmsm {
  max-width: 500px;
  margin: 0 auto;
}

/* Message styling */
.bmsm__message {
  text-align: center;
  font-size: 14px;
  font-weight: var(--galls-fw-400);
  color: #333;
  margin-bottom: 12px;
  text-transform: none;
}

.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: 10px; /* Space for badges above bar */
  padding-bottom: 7px; /* Space for thresholds below */
  overflow: visible;
}

/* 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.7s cubic-bezier(0.25, 0.1, 0.25, 1), background 0.4s ease-out;
  /* 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 - positioned at vertical center of bar */
.bmsm__milestones {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 0;
  pointer-events: none;
  overflow: visible;
}

/* Individual milestone (badge + threshold) */
.bmsm__milestone {
  position: absolute;
  top: 0;
  transform: translateX(-50%); /* Horizontal centering only */
}

/* Position milestones - shifted left by ~20px proportionally to prevent last badge overflow */
.bmsm__milestone:nth-child(1) { left: calc(33.33% - 7px); }
.bmsm__milestone:nth-child(2) { left: calc(66.66% - 12px); }
.bmsm__milestone:nth-child(3) { left: calc(100% - 19px); }

/* Milestone badge circle - centered on the bar line */
.bmsm__milestone-badge {
  width: fit-content;
  height: fit-content;
  line-height: 1;
  padding: 8px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: var(--galls-fw-500);
  border: 1px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  z-index: 2;
  transform: translateY(-50%); /* Center badge vertically on bar */
  transition: background-color 0.5s ease-out, color 0.5s ease-out;
}

/* 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 {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: var(--galls-fw-500);
  margin-top: 5px;
  white-space: nowrap;
}

/* Threshold text colors based on state */
.bmsm__milestone-threshold--reached,
.bmsm__milestone-threshold--unreached {
  color: #6B7280;
}

.bmsm__milestone-threshold--current {
  color: #000;
  font-weight: var(--galls-fw-700);
}

/* Responsive */
@media (max-width: 480px) {
  .shopping-cart .bmsm {
    margin: 5px auto 20px auto;
  }
  .bmsm {padding: 12px 10px 0 10px;}
  .bmsm__message { font-size: 13px; }
  .bmsm__milestone-badge { font-size: 11px;}
  .bmsm__milestone-threshold { font-size: 11px; }
}

/* Exclusions link */
.bmsm__exclusions {
  text-align: center;
  margin-top: 20px;
}

.shopping-cart .bmsm__exclusions {
  margin-top: 30px;
}

.bmsm__exclusions span {
  font-size: 12px;
  color: #6B7280;
  cursor: pointer;
  text-decoration: underline;
  text-transform:  none;
  font-weight: 300;
}

.bmsm__exclusions a:hover {
  color: var(--brand-primary);
}

/* Exclusions drawer content */
.bmsm-exclusions-drawer {
  padding: 8px 0;
  font-family: var(--galls-font-gt-america-standard);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.bmsm-exclusions-drawer__title {
  font-size: 18px;
  font-weight: var(--galls-fw-700);
  color: #000;
  margin: 0 0 3px 0 !important;
}

.bmsm-exclusions-drawer__intro {
  font-size: 14px;
  color: #333;
  margin: 0 0 12px 0 !important;
}

.bmsm-exclusions-drawer__list {
  margin: 0;
  padding: 0 0 0 20px;
  font-size: 13px;
  color: #333;
  flex: 1;
  overflow-y: auto;
  min-height: 0; /* Needed for flex overflow to work */
}

@media (max-height: 480px) {
  .bmsm-exclusions-drawer__list {
    max-height: 30vh;
  }
}

.bmsm-exclusions-drawer__list li {
  margin-bottom: 4px;
}

/* Legacy overrides */
#thresholdShippingBar .sidecart-shipping { display: none; }
#thresholdShippingBar:has(.bmsm) .sidecart-shipping { display: none; }
#thresholdShippingBar .bmsm { display: block; }
main.shopping-cart:has(.bmsm) .shopping-cart__header,
main.shopping-cart:has(.bmsm) [style="margin-top:20px; text-align:center; display:"],
main.shopping-cart:has(.bmsm) [style="margin-top:20px"]
 {
  margin-bottom: 0;
  margin-top: 0 !important;
}
