/*
 * Variant-2 recipe-card styles (self-contained).
 *
 * Scoped under `.mealz-recipe-card.variant-2` so multiple variant sheets can
 * coexist on one page without cross-variant collisions.
 */

img.mealz-default-ingredient-picture {
  content: url('https://storage.googleapis.com/assets.miam.tech/generic/images/default-ingredient-picture.svg');
}

img.mealz-default-recipe-picture {
  content: url('https://storage.googleapis.com/assets.miam.tech/generic/images/placeholder.png');
}

.mealz-recipe-card.variant-2 {
  /* DEFAULT VERTICAL CARD */
  --mealz-recipe-card-width: 227px;
  --mealz-recipe-card-height: 360px;
  --mealz-price-font-size: 20px;
  --mealz-price-subline-font-size: 16px;
  --mealz-cta-button-padding: 8px;
  --mealz-bottom-padding: 12px;
  --mealz-top-margin: 12px;
  --mealz-bottom-height: 64px;
  --mealz-recipe-card-direction: column;

  &.horizontal {
    --mealz-recipe-card-width: 100%;
    --mealz-recipe-card-height: 188px;
    --mealz-recipe-card-direction: row;
    --mealz-bottom-padding: 8px;
    --mealz-top-margin: 8px;
  }

  &.vertical-small {
    --mealz-recipe-card-width: 163px;
    --mealz-recipe-card-height: 272px;
    --mealz-price-font-size: 16px;
    --mealz-price-subline-font-size: 14px;
    --mealz-bottom-padding: 8px;
    --mealz-bottom-height: 56px;
    --mealz-top-margin: 8px;
  }
}

.mealz-recipe-card.variant-2 {
  position: relative;
  display: flex;
  width: var(--mealz-recipe-card-width, 227px);
  height: var(--mealz-recipe-card-height, 360px);
  flex-direction: column;
  align-items: flex-start;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;

  .mealz-recipe-card__container {
    display: flex;
    flex-direction: var(--mealz-recipe-card-direction, column);
    height: 100%;
    width: 100%;
    flex-shrink: 0;
    align-self: stretch;

    &:hover {
      .mealz-recipe-card__top {
        .mealz-recipe-card__picture {
          img {
            transform: scale(1.1);
          }
        }
      }
    }

    .mealz-recipe-card__top {
      position: relative;
      flex: 1;
      height: calc(100% - var(--mealz-bottom-height, 64px));

      .mealz-recipe-card__picture {
        width: 100%;
        height: 100%;
        overflow: hidden;

        img {
          display: block;
          width: 100%;
          height: 100%;
          object-fit: cover;
          transition: transform .2s;
        }
      }

      .mealz-recipe-card__gradient {
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0.00) 43.67%, rgba(0, 0, 0, 0.40) 91.33%);

        &.in-basket {
          background: rgba(255, 255, 255, 0.7);
          z-index: 1;
        }
      }

      .mealz-recipe-card__content {
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: stretch;

        .mealz-recipe-card__picture__bottom {
          width: 100%;
          display: flex;
          justify-content: space-between;
          align-items: flex-end;
          padding: var(--mealz-bottom-padding, 12px);
          box-sizing: border-box;

          .mealz-recipe-card__title {
            color: var(--mealz-ds-color-neutral-white, #FFF);
            text-shadow: 0px 2px 8px rgba(0, 0, 0, 0.15);
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            line-clamp: 2;
            overflow: hidden;
          }

          .mealz-recipe-card__counter {
            display: flex;
            padding: 4px 8px;
            align-items: center;
            gap: 4px;
            border-radius: 100px;
            background: var(--mealz-ds-color-neutral-white, #FFF);
            color: var(--mealz-ds-color-neutral-black, #0F191F);
            height: fit-content;
            flex-shrink: 0;

            p {
              line-height: 100%;
            }

            img {
              width: 16px;
              height: 16px;
            }
          }
        }


        .mealz-recipe-card__top-container {
          display: flex;
          justify-content: space-between;
          margin: var(--mealz-top-margin, 12px);

          &:not(.planner) {
            flex-direction: row-reverse;
          }

          .mealz-recipe-card__actions__icon {
            &.hidden {
              display: none;
            }
          }

          .mealz-recipe-card__like {
            .miam-like-button {
              border-radius: 48px;

              &.mealz-ds-button.primary.reverse.square.small {
                .miam-like-button__icon {
                  height: 16px;
                  width: 16px;
                }
              }
            }
          }

          .mealz-recipe-card__in-basket-badge {
            display: flex;
            justify-content: center;
            border-radius: 50px;
            width: 48px;
            background-color: var(--mealz-ds-color-primary, #24748F);
            padding: 8px;
            z-index: 2;
          }

          .mealz-recipe-card_sponso_and_promo_badge,
          .mealz-recipe-card__media-badges-column,
          .mealz-recipe-card__badge-container {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 4px;
          }
        }

        .mealz-recipe-card__sponsor-container {
          display: flex;
          padding: 8px 12px;
          background-color: var(--mealz-ds-color-neutral-white, #FFFFFF);
          border-radius: 100px;
          width: auto;
          height: auto;
          box-sizing: border-box;

          .mealz-recipe-card__sponsor-picture {
            width: auto;
            height: auto;
            max-width: 80px;
            max-height: 40px;
            object-fit: contain;
          }
        }
      }
    }

    .mealz-recipe-card__bottom {
      display: flex;
      width: 100%;
      height: var(--mealz-bottom-height, 64px);
      flex-direction: column;
      align-items: flex-start;
      justify-content: center;
      box-sizing: border-box;
      padding: var(--mealz-bottom-padding, 12px);
      border-radius: 0px 0px 8px 8px;
      background-color: var(--mealz-ds-color-neutral-white, #FFF);
      border-right: 1px solid var(--mealz-ds-color-neutral-200, #EFF1F3);
      border-bottom: 1px solid var(--mealz-ds-color-neutral-200, #EFF1F3);
      border-left: 1px solid var(--mealz-ds-color-neutral-200, #EFF1F3);

      .mealz-recipe-card__actions {
        position: relative;
        display: flex;
        justify-content: space-between;
        align-items: center;
        align-self: stretch;

        .mealz-recipe-card__price-and-promotion {
          .mealz-recipe-card__bottom-promotion {
            display: inherit;
            position: absolute;
            bottom: 40px;

            .mealz-recipe-promotion-badge {
              align-items: center;
              padding: 4px 8px;
              gap: 4px;

              .mealz-recipe-promotion-badge__icon {
                width: 16px;
                height: 16px;
              }
            }
          }
        }

        .mealz-recipe-card__cta {
          display: flex;
          flex-direction: row;
          gap: 16px;
          align-items: center;

          .mealz-recipe-card__cta-button {
            padding: var(--mealz-cta-button-padding, 12px 16px);
          }

          .mealz-recipe-card-cta {
            padding: 8px;
          }
        }

        .mealz-recipe-card__difficulty-and-time {
          display: flex;
          flex-direction: row;
          color: var(--mealz-ds-color-text-disabled, #B3BAC3);
          gap: 12px;
          margin-bottom: 4px;

          .mealz-recipe-card__difficulty,
          .mealz-recipe-card__time {
            display: flex;

            img {
              margin-right: 4px;
            }
          }
        }

        .mealz-recipe-card__price {
          color: var(--mealz-ds-color-neutral-black, #0F191F);
          line-height: 100%;
          margin-right: 4px;
        }

        .mealz-recipe-card__actions__replace {
          display: flex;
          flex: 1;
          justify-content: space-between;
          align-items: center;
        }
      }
    }
  }
}

.mealz-recipe-card.variant-2.horizontal {
  border: 1px solid var(--mealz-ds-color-neutral-200, #EFF1F3);

  .mealz-recipe-card__top-container:not(.planner) {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }

  .mealz-recipe-card__top {
    flex: 0 0 40%;
    width: 40%;
    max-width: 40%;
    height: inherit;

    .mealz-recipe-card__gradient {
      display: none;
    }
  }

  .mealz-recipe-card__bottom {
    flex: 1;
    min-width: 0;
    height: inherit;
    align-self: stretch;
    justify-content: space-between;
    border: none;

    .mealz-recipe-card__title--footer-column {
      color: var(--mealz-ds-color-neutral-black, #0F191F);
      flex-shrink: 0;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      overflow: hidden;
    }

    .mealz-recipe-card__column-promotion {
      flex: 1;
      display: flex;
      align-items: center;
      min-height: 0;

      .mealz-recipe-promotion-badge {
        align-items: center;
        padding: 4px 8px;
        gap: 4px;

        .mealz-recipe-promotion-badge__icon {
          width: 16px;
          height: 16px;
        }
      }
    }

    .mealz-recipe-card__actions {
      flex-shrink: 0;
      flex-wrap: nowrap;

      .mealz-recipe-card__cta {
        flex: 1;
        justify-content: flex-end;
      }
    }
  }
}

.mealz-recipe-card.variant-2.redirect-card {
  cursor: default;

  .mealz-recipe-card__redirect {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    flex: 1;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    border: 1px solid var(--mealz-ds-color-neutral-200, #EFF1F3);
    box-sizing: border-box;
    color: inherit;
    text-decoration: unset;
    overflow: hidden;

    img {
      height: 100%;
      object-fit: cover;
    }

    .mealz-recipe-card__redirect__footer {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      padding: 16px;

      .mealz-recipe-card__redirect__title {
        text-align: center;
      }

      .mealz-recipe-card__redirect__button {
        margin-top: 16px;

        span {
          font-size: 14px;
          font-weight: 700;
          line-height: 16px;
        }
      }
    }
  }
}

@media (max-width: 1023px) {
  .mealz-recipe-card.variant-2.redirect-card {
    width: 80vw;
    height: 188px;

    .mealz-recipe-card__redirect {
      flex-direction: row;
      height: 100%;

      img {
        content: url('https://storage.googleapis.com/assets.miam.tech/generic/images/Suggestion_Redirect_Background_Mobile.png');
        height: 136%;
        margin: -22px -16px;
      }

      .mealz-recipe-card__redirect__footer {
        min-width: 156px;

        .mealz-recipe-card__redirect__title {
          font-size: 16px;
        }
      }
    }
  }
}

.mealz-recipe-card.variant-2 {
  p, h1, h2, h3, h4 {
    &.mealz-ds-text {
      margin: 0;
    }
  }
}
