:root {
  --atom-upsell-widget-bg: #fff;
  --atom-upsell-widget-radius: 16px;
  --atom-upsell-widget-shadow: none;
  --atom-upsell-widget-padding: 16px 18px 18px 18px;
  --atom-upsell-widget-max-width: 340px;
  --atom-upsell-widget-margin: 8px 0;
  --atom-upsell-title-font: 700 1.15rem/1.2 inherit;
  --atom-upsell-title-color: #22223b;
  --atom-upsell-title-spacing: 0.01em;
  --atom-upsell-subtitle-font: 400 0.98rem/1.4 inherit;
  --atom-upsell-subtitle-color: #666;
  --atom-upsell-image-size: 56px;
  --atom-upsell-image-radius: 8px;
  --atom-upsell-image-bg: #f2f2f2;
  --atom-upsell-prod-title-font: 600 1.01rem/1.2 inherit;
  --atom-upsell-prod-title-color: #222;
  --atom-upsell-prod-sub-font: 400 0.95rem/1.2 inherit;
  --atom-upsell-prod-sub-color: #888;
  --atom-upsell-price-font: 700 1.08rem/1.2 inherit;
  --atom-upsell-price-color: #222;
  --atom-upsell-cta-bg: #22223b;
  --atom-upsell-cta-color: #fff;
  --atom-upsell-cta-radius: 8px;
  --atom-upsell-cta-font: 600 1.08rem/1.2 inherit;
  --atom-upsell-cta-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --atom-upsell-close-color: #888;
  --atom-upsell-close-size: 1.4rem;
}

.atom-upsell-widget {
  background: var(--atom-upsell-widget-bg);
  border-radius: var(--atom-upsell-widget-radius);
  box-shadow: var(--atom-upsell-widget-shadow);
  padding: var(--atom-upsell-widget-padding);
  max-width: var(--atom-upsell-widget-max-width);
  margin: var(--atom-upsell-widget-margin);
  text-align: left;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  box-sizing: border-box;
  position: relative;
}
.atom-upsell-widget-title {
  font: var(--atom-upsell-title-font);
  color: var(--atom-upsell-title-color);
  margin-bottom: 2px;
  letter-spacing: var(--atom-upsell-title-spacing);
}
.atom-upsell-widget-subtitle {
  font: var(--atom-upsell-subtitle-font);
  color: var(--atom-upsell-subtitle-color);
  margin-bottom: 8px;
}
.atom-upsell-widget-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.atom-upsell-widget-img {
  width: var(--atom-upsell-image-size);
  height: var(--atom-upsell-image-size);
  object-fit: cover;
  border-radius: var(--atom-upsell-image-radius);
  background: var(--atom-upsell-image-bg);
}
.atom-upsell-widget-info {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.atom-upsell-widget-prod-title {
  font: var(--atom-upsell-prod-title-font);
  color: var(--atom-upsell-prod-title-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.atom-upsell-widget-prod-sub {
  font: var(--atom-upsell-prod-sub-font);
  color: var(--atom-upsell-prod-sub-color);
}
.atom-upsell-widget-price {
  font: var(--atom-upsell-price-font);
  color: var(--atom-upsell-price-color);
  margin-left: 8px;
}
.atom-upsell-widget-cta {
  margin: 8px 0 0 0;
  padding: 12px 0;
  background: var(--atom-upsell-cta-bg);
  color: var(--atom-upsell-cta-color);
  border: none;
  border-radius: var(--atom-upsell-cta-radius);
  font: var(--atom-upsell-cta-font);
  cursor: pointer;
  width: 100%;
  box-shadow: var(--atom-upsell-cta-shadow);
}
.atom-upsell-widget-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: var(--atom-upsell-close-size);
  color: var(--atom-upsell-close-color);
  cursor: pointer;
}

.atom-upsell-table-widget {
  display: table !important;
  border-collapse: collapse !important;
  table-layout: fixed !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 15px 0 !important;
  padding: 0 !important;
  background-color: #fff;
  box-sizing: border-box;
  position: relative;
  box-shadow: none;
}

.atom-upsell-table-widget tr {
  width: 100%;
  display: table-row;
}

.atom-upsell-table-widget td {
  padding: 12px 15px !important;
  display: table-cell;
  width: 100%;
  text-align: left;
}

.cart-header-footer-upsell {
  width: 100% !important;
  margin: 10px 0 !important;
  border: none;
}

.atom-upsell-table-widget .upsell-title {
  font-size: 16px;
  font-weight: bold;
  color: #333;
  padding-bottom: 5px;
  border-bottom: 1px solid #eaeaea;
  text-align: left;
  padding-left: 0;
  margin-left: 0;
}

.atom-upsell-table-widget .upsell-subtitle {
  padding-top: 6px;
  color: #505050;
  font-size: 14px;
  text-align: left;
  display: flex;
  align-items: center;
  padding-left: 0;
  margin-left: 0;
}

/* Remove the ::before pseudo element when the icon-container exists */
.atom-upsell-table-widget .upsell-subtitle:has(.icon-container)::before {
  content: none;
}

/* For browsers that don't support :has, use a class-based approach */
.atom-upsell-table-widget .upsell-subtitle.has-icon-container::before {
  content: none;
}

.icon-container {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-left: 0;
  margin-left: 0;
}

/* Only use ::before when we don't have the icon container */
.atom-upsell-table-widget .upsell-subtitle:not(:has(.icon-container))::before {
  content: "";
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin-right: 8px;
  background-image: url("discount-icon.svg");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  padding-left: 0;
  margin-left: 0;
}

.atom-upsell-table-widget .discount-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin-right: 8px;
  vertical-align: middle;
  color: #505050;
}

.atom-upsell-table-widget,
div[data-atom-upsell="true"] {
  display: table !important;
  visibility: visible !important;
  opacity: 1 !important;
}

tr.atom-upsell-widget,
tr[data-atom-upsell="true"] {
  display: table-row !important;
}

/* Accordion Upsell Styles */
.atom-accordion-container {
  width: 100%;
  margin: 20px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  background: #fff;
}

.atom-accordion-item {
  border-bottom: 1px solid #f0f0f0;
  background-color: #fff;
  margin-bottom: 8px;
  transition: box-shadow 0.2s;
}

.atom-accordion-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.atom-accordion-header {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  position: relative;
  font-weight: 600;
  color: #222;
  background: #fff;
  border-radius: 8px;
  transition: background 0.2s;
}

.atom-accordion-header:hover {
  background-color: #f5f5f7;
}

.atom-accordion-title {
  font-size: 16px;
  font-weight: 500;
  flex-grow: 1;
  padding-right: 16px;
  line-height: 1.2;
}

.atom-accordion-subtitle {
  font-size: 14px;
  padding-right: 16px;
  color: #888;
  margin-top: 4px;
  font-weight: 400;
}

.atom-accordion-icon {
  width: 16px;
  height: 16px;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 300ms ease;
}

.atom-accordion-item.active .atom-accordion-icon {
  transform: translateY(-50%) rotate(180deg);
}

.atom-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 300ms ease;
  background-color: #fafafa;
}

.atom-accordion-item.active .atom-accordion-content {
  max-height: 600px; /* Large enough to fit content */
}

.atom-accordion-product {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.atom-accordion-product-image {
  all: unset;
}

.atom-accordion-product-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.atom-accordion-product-title {
  margin-bottom: 8px;
  padding-left: 1rem;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.atom-accordion-product-price {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.atom-accordion-product-old-price {
  font-size: 12px;
  color: #888;
  text-decoration: line-through;
  margin-right: 6px;
}

.atom-accordion-cta {
  display: inline-block;
  padding: 12px 28px;
  min-width: 120px;
  width: auto;
  margin: 0 0 16px 1rem;
  background-color: #22223b;
  color: white;
  text-align: center;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  white-space: nowrap;
}

.atom-accordion-cta:hover {
  background-color: #2a2a4a;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.atom-accordion-cta:disabled {
  background-color: #aaa;
  cursor: not-allowed;
}

.atom-accordion-collapse-all,
.atom-accordion-expand-all {
  background: none;
  border: none;
  color: #888;
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
  margin: 0 16px 8px;
  text-decoration: underline;
}

/* Cart Page Upsell Styles */
.atom-cart-page-upsells {
  width: 100%;
  margin: 20px 0;
  padding: 10px 0;
  border-top: 1px solid #e8e8e8;
  animation: atom-simple-fade 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes atom-simple-fade {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.cart__upsell-heading {
  font-size: 1.3em;
  font-weight: bold;
  margin: 10px 0 15px;
}

.atom-cart-upsell-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
}

.atom-cart-page-widget-container {
  flex: 1 1 300px;
  min-width: 250px;
  max-width: 300px;
}

@media screen and (max-width: 749px) {
  .atom-cart-page-widget-container {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .atom-cart-upsell-flex {
    flex-direction: column;
  }
}

/* Shipping Discount Upsell Widget */
.atom-upsell-shipping-discount {
  text-align: center;
  padding: 10px 16px;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  font-family: system-ui, -apple-system, sans-serif;
}
.atom-upsell-shipping-discount .atom-upsell-widget-title {
  color: #007ace;
}
.atom-upsell-shipping-discount .atom-upsell-widget-cta {
  background: #007ace;
  color: #fff;
}
.atom-upsell-shipping-discount .atom-upsell-widget-cta:disabled {
  background: #b6e0fe;
  color: #fff;
  cursor: not-allowed;
}
.atom-upsell-shipping-text {
  font-size: 16px;
  color: #333;
}
.atom-upsell-shipping-success {
  color: #008a5e;
  font-weight: 600;
}
.atom-upsell-progress-container {
  position: relative;
  height: 60px;
  margin: 8px 0;
}
.atom-upsell-progress-bar {
  position: absolute;
  top: 16px;
  left: 0;
  width: 100%;
  height: 8px;
  background-color: #eaeaea;
  border-radius: 4px;
  overflow: hidden;
}
.atom-upsell-progress-fill {
  height: 8px;
  background-color: #2ecc40; /* Modern green, change as desired */
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
  opacity: 1;
}
.atom-upsell-milestone-old {
  position: absolute;
  transform: translateX(-50%);
  top: 0;
  text-align: center;
}
.atom-upsell-milestone-circle-old {
  width: 30px;
  height: 30px;
  background-color: #fff;
  border: 2px solid #4a4a4a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 5px;
}
.atom-upsell-milestone-label-old {
  font-size: 12px;
  color: #4a4a4a;
  white-space: nowrap;
}
/* Prevent milestone text from being cut off at right edge */
.atom-upsell-milestone[style*="left: 100%"] {
  left: auto !important;
  right: 0 !important;
  transform: translateX(0) !important;
}

.atom-upsell-milestone[style*="left: 100%"] .atom-upsell-milestone-label {
  text-align: right;
}

.atom-upsell-milestone[style*="left: 100%"] .atom-upsell-milestone-circle {
  margin-left: auto;
  width: 40px;
  height: 40px;
  background-color: #fff;
  border: 2px solid #4a4a4a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Alternative themes for shipping bar */
.atom-upsell-shipping-discount.theme-minimal {
  --track-color: #f0f0f0;
  --fill-color: #333;
  --milestone-bg: #fff;
  --milestone-border: #333;
  --milestone-text: #333;
}

.atom-upsell-shipping-discount.theme-gradient {
  --track-color: rgba(230, 230, 230, 0.5);
  --fill-color: linear-gradient(90deg, #0072ff, #00c6ff);
  --milestone-bg: #0060df;
  --milestone-border: #ffffff;
  --milestone-text: #fff;
  background: #f0f7ff;
}

.atom-upsell-shipping-discount.theme-minimal .atom-upsell-progress-bar {
  background-color: var(--track-color);
}

.atom-upsell-shipping-discount.theme-minimal .atom-upsell-progress-fill,
.atom-upsell-shipping-discount.theme-gradient .atom-upsell-progress-fill {
  background: var(--fill-color);
}

.atom-upsell-shipping-discount.theme-minimal .atom-upsell-milestone-circle,
.atom-upsell-shipping-discount.theme-gradient .atom-upsell-milestone-circle {
  background-color: var(--milestone-bg);
  border-color: var(--milestone-border);
}

.atom-upsell-shipping-discount.theme-minimal .atom-upsell-milestone-label,
.atom-upsell-shipping-discount.theme-gradient .atom-upsell-milestone-label {
  color: var(--milestone-text);
}

/* Highlight animation for new elements */
.atom-highlight-new {
  animation: atom-highlight-fade-new 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  background-color: #fff8c6 !important; /* Soft yellow */
}
@keyframes atom-highlight-fade-new {
  0% {
    background-color: #fff8c6;
  }
  100% {
    background-color: transparent;
  }
}

/* Highlight animation for changed elements */
.atom-highlight-change {
  animation: atom-highlight-fade-change 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  background-color: #d1f7c4 !important; /* Soft green */
}
@keyframes atom-highlight-fade-change {
  0% {
    background-color: #d1f7c4;
  }
  100% {
    background-color: transparent;
  }
}

@media (max-width: 749px) {
  .atom-accordion-product-info {
    width: 100%;
    padding-right: 0;
    padding-left: 0;
  }
  .atom-accordion-cta {
    width: 100%;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
  }
}

cart-items .atom-accordion-product-info {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

cart-items .atom-accordion-product-title {
  margin-bottom: 0;
  padding-left: 1rem;
}

cart-items .atom-accordion-header {
  padding-left: 1rem;
}

cart-items .atom-accordion-cta {
  margin: 0 1rem 0 2rem;
  width: auto;
  min-width: 120px;
}

@media (min-width: 750px) {
  .atom-accordion-product .cart-item__image-container {
    width: 10rem;
    max-width: 10rem;
    min-width: 10rem;
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: 8px;
    background: #f7f7f7;
    display: block;
  }
  cart-items .atom-accordion-header {
    padding-left: 15rem;
  }
  cart-items .atom-accordion-product-info {
    padding-left: 4rem;
  }
  cart-items .atom-accordion-product-title {
    padding-left: 0;
  }
}

.atom-accordion-product .cart-item__image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  border-radius: 0px;
}

.atom-upsell-completed {
  background: #e6f9ed !important;
  border-left: 4px solid #4caf50 !important;
  opacity: 0.92;
  position: relative;
}
/*
.atom-upsell-completed .atom-accordion-title::before {
  content: "✔️";
  margin-right: 0.5em;
  color: #4caf50;
}
*/
.atom-accordion-message-completed {
  color: #388e3c;
  font-weight: bold;
}
.atom-upsell-completed .atom-accordion-cta {
  display: none !important;
}
