.b2b-produktberater {
  .b2b-produktberater__head {
    padding: var(--sp-18) var(--sp-5) 13.75rem;

    @media screen and (max-width: 990px) {
      padding: var(--sp-10) var(--sp-5) var(--sp-23);
    }
  }

  .progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 444px;
    width: 100%;
    margin: 0 auto;

    .progress-bar__item {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;

      &:has(.result) {
        width: fit-content;
      }
    }

    .progress-bar__item-number {
      font-family: var(--font-family);
      font-size: var(--sp-3d5);
      line-height: 1.4;
      text-align: center;
      color: #FFFFFF;
      display: flex;
      border-radius: 50px;
      padding: 10px;
      width: 44px;
      height: 44px;
      background: #d0d5dd;
      align-items: center;
      justify-content: center;
      aspect-ratio: 1/1;
      position: relative;

      &.result {
        width: fit-content;
        padding: var(--sp-2d5) var(--sp-5d5);
        aspect-ratio: unset;
      }
    }

    .progress-bar__item-line {
      width: 100%;
      height: var(--sp-1);
      background: #d0d5dd;
    }

    .progress-bar__item-line-fill {
      height: 100%;
      background: #86939a;
      width: 0;
      display: block;
    }
  }

  &:has(.step--1.is-active) .progress-bar__item--1 .progress-bar__item-number,
  &:has(.step--2.is-active) .progress-bar__item--2 .progress-bar__item-number,
  &:has(.step--3.is-active) .progress-bar__item--3 .progress-bar__item-number,
  &:has(.step--4.is-active) .progress-bar__item--4 .progress-bar__item-number {
    &::after {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 52px;
      height: 52px;
      background: transparent;
      border-radius: 50px;
      border: 4px solid #fff;
      box-shadow: 0 0 0 1px #86939a;
      transform: translate(-50%, -50%);
    }
  }

  &:has(.step--1.is-active) .progress-bar__item--1 .progress-bar__item-number {
    background-color: #86939a;
  }

  &:has(.step--2.is-active) {
    .progress-bar__item--1 {
      .progress-bar__item-number {
        background-color: #86939a;
      }

      .progress-bar__item-line-fill {
        width: 100%;
      }
    }

    .progress-bar__item--2 {
      .progress-bar__item-number {
        background-color: #86939a;
      }
      .progress-bar__item-line-fill {
        width: 50%;
      }
    }
  } 

  &:has(.step--3.is-active) {
    .progress-bar__item--1 {
      .progress-bar__item-number {
        background-color: #86939a;
      }
  
      .progress-bar__item-line-fill {
        width: 100%;
      }
    }

    .progress-bar__item--2 {
      .progress-bar__item-number {
        background-color: #86939a;
      }
      .progress-bar__item-line-fill {
        width: 100%;
      }
    }

    .progress-bar__item--3 {
      .progress-bar__item-number {
        background-color: #86939a;
      }
      .progress-bar__item-line-fill {
        width: 50%;
      }
    }
  }

  &:has(.b2b-produktberater__result.is-active) {
    .progress-bar__item-number {
      background-color: #86939a;
    }
    .progress-bar__item-line-fill {
      width: 100%;
    }

    .b2b-produktberater__result-title {
      display: block;
      font-size: clamp(var(--sp-6d5), 2.5vw, var(--sp-10));
      text-align: center;
      max-width: 700px;
      margin: auto;
      margin-bottom: var(--sp-10);
    }
  }

  .b2b-produktberater__result-title {
    display: none;
  }

  .b2b-produktberater__list {
    transform: translateY(-190px);

    @media screen and (max-width: 990px) {
      transform: translateY(-70px);
    }

    .step-title {
      display: none;
    }

    .step-title:has(+ .step.is-active) {
      display: block;
      margin: auto;
      margin-bottom: var(--sp-7d5);
      font-weight: 700;
      font-size: clamp(var(--sp-6d5), 2.5vw, var(--sp-10));
      line-height: 1.1;
      text-align: center;
      color: #070e21;

      @media screen and (max-width: 990px) {
        margin-bottom: var(--sp-6);
      }
    }

    .step {
      display: none;

      &.is-active {
        display: block;
      }

      margin: auto;
      max-width: 960px;
      border-radius: var(--sp-6);
      overflow: hidden;
      box-shadow: 0 0 20px 0 rgba(82, 82, 82, 0.12);
      padding: 42px 46px;
      background-color: rgb(var(--color-total-white));

      @media screen and (max-width: 990px) {
        padding: 32px 20px;
      }

      .step__subtitle {
        font-size: clamp(var(--sp-5d5), 2.5vw, var(--sp-6d5));
        margin-bottom: var(--sp-6);
        text-align: center;
        color: #070e21;
      }

      .step__description {
        margin-top: var(--sp-6);
        padding: var(--sp-7d5) var(--sp-8);
        background-color: #f8f8f8;
        border-radius: var(--sp-2d5);
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: var(--sp-5);

        @media screen and (max-width: 990px) {
          padding: var(--sp-6);
          flex-direction: column;
          align-items: center;
          gap: var(--sp-4);
        }
      }

      .step__description-content a {
        font-size: var(--sp-4);
        font-weight: 700;
        color: #070e21;
        text-decoration: underline;
      }

      .step__description-title {
        font-size: var(--sp-4);
        color: #070e21;
      }

      .step__content {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        column-gap: var(--sp-8d5);
        row-gap: var(--sp-6);

        @media screen and (max-width: 990px) {
          display: grid;
          grid-template-columns: repeat(2, 1fr);
          row-gap: var(--sp-6);
          column-gap: var(--sp-2);
          align-items: baseline;
        }

        .step-item {
          flex: 1;
          min-width: 198px;
          cursor: pointer;
          transition: scale 0.3s ease-in-out;
          align-self: start;

          @media screen and (max-width: 990px) {
            min-width: unset;
          }

          .step-item__image {
            aspect-ratio: 1/1;
            border-radius: var(--sp-5);
            overflow: hidden;
            border: 1.5px solid #d0d5dd;
            transition: border-color 0.3s ease-in-out;

            @media screen and (max-width: 990px) {
              border-radius: var(--sp-2d5);
            }

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

          .step-item__title {
            font-size: var(--sp-4);
            margin-top: var(--sp-3);
            text-align: center;
            font-weight: var(--font-normal);
          }

          .step-item__subtitle {
            font-size: var(--sp-3);
            margin-top: var(--sp-1);
            text-align: center;
            color: #5f6d76;
          }
        }

        .step-item.checked {
          scale: 1.05;

          @media screen and (max-width: 990px) {
            scale: 1.03;
          }

          .step-item__image {
            border-color: rgb(var(--color-total-black));
          }
        }
      }

      &.step--3 {
        .step__content {
          grid-template-columns: repeat(4, 1fr);

          @media screen and (max-width: 990px) {
            grid-template-columns: repeat(2, 1fr);
          }
        }
      }

      .step__buttons {
        display: flex;
        align-items: center;
        width: fit-content;
        gap: var(--sp-2);
        margin-top: var(--sp-10);
        margin-left: auto;
        width: 100%;
        justify-content: space-between;

        .button {
          height: 48px;
          margin-left: auto;
          position: relative;

          svg {
            display: none;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
          }
          
          &.is-loading svg {
            display: block;
            animation: rotate-loader 1s linear infinite;
          }



          &[disabled] {
            background-color: #c2c2c2;
            
            &::after {
              content: none;
            }
          }
        }
      }
    }
  }

  .loader {
    display: none;

    &.is-loading {
      display: block;
    }
  }
}

@keyframes rotate-loader {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}