
.card {
  min-width: 300px;
  display: flex;
  flex-direction: column;
  width: 100%;
  background-color: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  padding: 10px;
  box-sizing: border-box;
}

.card.card-product-grid {
  list-style: none;       /* removes bullet */
  display: block;         /* restores block behavior if needed */
}



.img-wrap {
  width: 100%;
  max-width: 220px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;   
  background: #fff;            /* white background for letterbox/pillarbox effect */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 4px;
}
.img-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;         /* ensures the whole image fits, no crop or distortion */
  background: #fff;
}

.favorite-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  cursor: pointer;

  /* Remove default button styling */
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  box-shadow: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  display: flex;          /* (Optional) Helps center icon vertically/horizontally */
  align-items: center;
  justify-content: center;
}

.favorite-icon img {
  width: 36px;
  background: transparent !important;
  pointer-events: none;
  transition: transform 0.2s cubic-bezier(.25,.8,.25,1); /* smooth and snappy */
}

.favorite-icon:hover img,
.favorite-icon:focus-visible img {
  transform: scale(1.08);
}


.title {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-product-title);
  text-decoration: none;
  line-height: 1.3;
  text-align: center;
  min-height: 2.6em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-size-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 5px;
}

.product-size {
  background-color: #f0f0f0;
  color: #222;
  font-size: 0.85rem;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  text-align: center;
}

.tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  padding: 1px;
}

.brands {
  min-height: 1.3em;
  font-weight: 600;
  margin-top: 0px;
  text-align: center;
}

.brands a {
  color: var(--color-product-brand);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
}
.brands a:hover {
  text-decoration: underline;
}

.price-value {
  color: black;
  font-size: 0.9rem;
  opacity: 0.7;
  font-weight: 400;
}
.price-by-unit {
  color: black;
  font-size: 0.71rem;
  margin-left: 0.3rem;
  opacity: 0.7;
}
.lowest-price {
  color: #1E6116;
  font-weight: 700;
  font-size: 1.15rem;
  opacity: 1;
}
.lowest-price-by-unit {
  color: rgba(25,80,40,1);
  font-weight: 500;
  font-size: 0.8rem;
  margin-left: 1px;
  opacity: 0.85;
}

.store {
  position: relative;
  display: inline-block;
  margin-left: 5px;
}
.store-image {
  height: 22px;
  transition: transform 0.3s;
}
.store-image:hover {
  transform: scale(1.15);
}
.store-image-lowest {
  height: 22px;
  transition: transform 0.3s;
}
.store-image-lowest:hover {
  transform: scale(1.15);
}


.cart-quantity {
  background-color: rgba(0,0,0,0.02);
  border-radius: 7px;
  width: 35px;
  border: 1px solid rgba(0,0,0,0.22);
  text-align: center;
  height: 25px;
  font-size: 12px;
}

.add-to-cart {
  display: flex;               /* new */
  align-items: center;         /* vertically center */
  justify-content: center;     /* horizontally center (optional) */
  padding: 2px 4px;
  font-size: 0.9rem;
  width: 40px;
  height: 25px;
  background-color: rgba(0,0,0,0.15);
  border-color: rgba(0, 0, 0, 0.35);
  margin-left: 6px;
}

.add-to-cart:hover {
  /* → Soft hover background */
  background-color: rgba(0,0,0,0.35);

  /* → Slightly stronger shadow + lift */
  box-shadow: 0 2px 4px rgba(0,0,0,0.10);
}


.cart-image {
  width: 16px;
  height: 16px;
}

.badge-promotion {
  --badge-bg: #7f1f5f;
  --badge-color: #ffffff;
  display: inline-flex;
  align-items: center;
  background-color: var(--badge-bg);
  color: var(--badge-color);
  border-radius: 6px;
  padding: 2px 4px;
  margin-left: 4%;
  border: 1px solid #0f031c;
  line-height: 1;
  gap: 2px;
  transition: background-color 0.3s, color 0.3s;
}

.badge-promotion img{
  width: 16px;
}

.tag-badge{
  width: 24px;
}



.price-values {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
  flex: 1; 
}

.nutri-badge{
  height: 26px;
}

.badge-text{
  font-size: 0.68rem;
  color: inherit;
  font-weight: 500;
}

.price-unit {
  text-align: center;
}

.price-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 4px;
}

.price-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  width: 100%;
}

.price-content {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.price {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0;
  box-sizing: border-box;
  margin-bottom: 1px;
  margin-top: 0.5rem;
}

.price-old {
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--color-old-price);
  margin-left: 4px;
}


.price:last-child {
  margin-bottom: 0;
}
.store img {
  margin-right: 5px;
}

.best-price-container {
  position: relative;
  border-radius: 8px;
  margin: 10px 0 10px 0;
  padding: 0;
  z-index: 1;
}

.best-price-container::before {
  content: '';
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border: 1px solid #dfdfdf;
  border-radius: 12px;
  z-index: -1;
  background: transparent;
  box-shadow: 0 4px 4px rgba(70, 97, 67, 0.4);
}

.best-price-container:hover::before {
  box-shadow: 0 4px 4px rgba(70, 97, 67, 0.7);
}

.other-prices-container {
  position: relative;
  border-radius: 8px;
  margin: 4px 0 0 0;
  padding: 0;
  z-index: 1;
  width: 100%;
}

.other-prices-container::before {
  content: '';
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border-bottom: 1px solid #dfdfdf; 
  border-radius: 12px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  z-index: -1;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.1);
  background:
    linear-gradient(to bottom, white, rgba(0, 0, 0, 0.1)) left / 1px 100% no-repeat,
    linear-gradient(to bottom, white, rgba(0, 0, 0, 0.1)) right / 1px 100% no-repeat;
}
.other-prices-container:hover::before {
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}


.qty-wrapper{
  /* Exactly the same footprint as the old 35 px button */
  width: 40px;
  margin-left: 6px;
  height: 25px;        /* identical to previous .cart-quantity */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;              /* no inter-element gap – the maths is 12+11+12 = 35 */
}

/* hide default browser spinners but degrade gracefully */
.qty-wrapper input[type=number]::-webkit-inner-spin-button,
.qty-wrapper input[type=number]::-webkit-outer-spin-button{
  -webkit-appearance: none;
  margin: 0;
}
.qty-wrapper input[type=number]{
  -moz-appearance:textfield;
  background:transparent;
  border:none;
  width:17px;
  font-size:11px;
  text-align:center;
  line-height:25px;
  outline: none;
  pointer-events:none; /* value changed only through +/- buttons */
  color:rgba(0,0,0,.8);
}

/* the two 12 px pills */
.stepper{
  width:12px;
  height:100%;
  padding:0;
  color: #6d6d6d;
  border:none;
  background:rgba(0,0,0,.04);
  border-radius:4px;
  font-size:14px;
  line-height:25px;
  text-align:center;
  cursor:pointer;
  user-select:none;
  transition:background-color .2s,box-shadow .2s;
}
.stepper:hover,
.stepper:focus{
  background:rgba(0,0,0,.15);
  box-shadow:0 0 0 1px rgba(0,0,0,.15) inset;
}
.stepper:active{
  background:rgba(0,0,0,.25);
}


@media (max-width: 768px) {

  .card.card-product-grid {
    display: grid;
    grid-template-areas:
      "img details"
      "price price";
    grid-template-columns: 3fr 5fr;
    grid-template-rows: auto auto;
    grid-gap: 10px 10px;
    padding: 15px;
    box-sizing: border-box;
  }

  .card.card-product-grid .img-wrap {
    grid-area: img;
    align-self: center;
    min-width: 0;
    justify-self: center;
  }

  .card.card-product-grid .img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }

  .card.card-product-grid .details-wrapper {
    grid-area: details;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    text-align: left;
    margin-left: 5px;
    min-width: 0;
    overflow: hidden;
  }

  .card.card-product-grid .price-container {
    grid-area: price !important;
    grid-column: 1 / -1 !important;
    width: 100% !important;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .card.card-product-grid .product-size-tags {
    justify-content: flex-start;
    gap: 5px;
  }

  .card.card-product-grid .brands {
    text-align: left;
  }

  .card.card-product-grid .title {
    font-size: 0.95rem;
    text-align: left;
  }

  .card.card-product-grid .price{
      margin-top: 0.2rem;
  }




}



.badge-promotion.promo-default {
  --badge-bg: #7f1f5fdd;
  --badge-color: #fff;
}
.badge-promotion.promo-fidelity {
  --badge-bg: #4f4995dd;
  --badge-color: #fff;
}
.badge-promotion.promo-multipack {
  --badge-bg: #bb3939dd;
  --badge-color: #fff;
}



/* 1. Turn each card into a size-aware container */
.card.card-product-grid{
    container-type:inline-size;   /* no name needed */
}

/* 2. Default ( < 350 px )  ─────────────────────────── */
.badge-inline{                   /* inline copy stays hidden */
    display:none;
}

.badge-row{
  display:block;
  margin-bottom: -5px;
}




@container (min-width:308px) {

    /* Hide .badge-row and show .badge-inline only for mpb-0 and mpb-1 */
    .price-container.mpb-0 .badge-row,
    .price-container.mpb-1 .badge-row {
        display: none !important;
    }

    .price-container.mpb-0 .badge-inline,
    .price-container.mpb-1 .badge-inline {
        display: inline-flex !important;
        margin-left: .25rem;
        flex-shrink: 0;
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .price-container.mpb-0 .badge-inline { max-width: 76px; }
    .price-container.mpb-1 .badge-inline { max-width: 68px; }

    .price-container.mpb-0 .badge-inline .badge-text,
    .price-container.mpb-1 .badge-inline .badge-text {
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .price-container.mpb-0 .price-row,
    .price-container.mpb-1 .price-row {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
    }

    .price-container.mpb-0 .price-values,
    .price-container.mpb-1 .price-values {
        flex-wrap: wrap;
        gap: 4px;
    }

    .price-container.mpb-0 .price-old,
    .price-container.mpb-0 .badge-promotion,
    .price-container.mpb-0 .price-unit,
    .price-container.mpb-1 .price-old,
    .price-container.mpb-1 .badge-promotion,
    .price-container.mpb-1 .price-unit {
        margin-left: 0;
    }


    .price-container.mpb-0 .price-single {
      margin-right: 40px;
    }
    .price-container.mpb-1 .price-single {
      margin-right: 28px;
    }

}

@container (min-width:316px){

  .price-container.mpb-0 .badge-inline { max-width: 84px; }
  .price-container.mpb-1 .badge-inline { max-width: 76px; }
  
  .price-container.mpb-0 .price-single {
      margin-right: 45px;
    }
  .price-container.mpb-1 .price-single {
      margin-right: 34px;
    }
}

@container (min-width:328px){

  .price-container.mpb-0 .badge-inline { max-width: 96px; }
  .price-container.mpb-1 .badge-inline { max-width: 94px; }
  
  .price-container.mpb-0 .price-single {
      margin-right: 54px;
    }

  .price-container.mpb-1 .price-single {
      margin-right: 50px;
    }

}



@container (min-width:334px){

  .price-container.mpb-0 .badge-inline { max-width: 102px; }


  .price-container.mpb-2 .badge-row {
        display: none !important;
    }

  .price-container.mpb-2 .badge-inline {
        display: inline-flex !important;
        margin-left: .25rem;
        flex-shrink: 0;
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }

  .price-container.mpb-2 .badge-inline { max-width: 76px; }

  .price-container.mpb-2 .badge-inline .badge-text {
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .price-container.mpb-2 .price-row {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
    }

    .price-container.mpb-2 .price-values {
        flex-wrap: wrap;
        gap: 4px;
    }

    .price-container.mpb-2 .price-old,
    .price-container.mpb-2 .badge-promotion,
    .price-container.mpb-2 .price-unit {
        margin-left: 0;
    }

    .price-container.mpb-0 .price-single {
      margin-right: 62px;
    }
}



@container (min-width:342px){

  .price-container.mpb-1 .badge-inline { max-width: 102px; }
  
  .price-container.mpb-2 .badge-inline { max-width: 84px; }


  .price-container.mpb-1 .price-single {
      margin-right: 58px;
    }

}


body.not-auth .add-to-cart {
  width: 31px !important;
}
