@use '../../abstract';
@use '../../base/token';

.cds-modal {
  @include abstract.fixed(0, 0);
  z-index: 1300;

  width: 100%;
  height: 100%;

  & > &-backdrop {
    @include abstract.fixed(0, 0);

    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    width: 100%;
    height: 100%;
    z-index: 1300;
  }

  & > &-box {
    @include abstract.absolute(50%, 50%);

    width: min(343px, 100%);
    transform: translate(50%, -50%);
    z-index: 1305;
    display: flex;
    flex-direction: column;
    align-items: center;
    align-self: stretch;
    border-radius: 12px;
    overflow: hidden;
    background: var(--base-white);
    box-shadow: var(--shadow-xl);
    padding: 0;
  }

  &__header {
    position: relative;
    padding-bottom: 20px;

    .cds-modal__header__horizontal_left_aligned {
      padding: 20px 16px 0px 16px;

      span {
        font-size: token.$font-size-3;
        font-weight: abstract.font-weight-to-number(token.$font-weights-commerce-sans-2);
        color: var(--gray-700);
      }
    }

    .cds-modal__header__close {
      padding: 10px;

      position: absolute;
      right: 12px;
      top: 12px;
    }
  }

  &__content {
    max-height: 450px;
    overflow: scroll;
    border: solid var(--gray-100);
    border-width: 1px 0 1px;

    ul {
      li {
        display: flex;
        height: 56px;
        padding: 0px 16px;
        align-items: center;
        gap: 12px;
        justify-content: space-between;

        span {
          font-size: token.$font-size-1;
          font-weight: abstract.font-weight-to-number(token.$font-weights-commerce-sans-2);
          line-height: token.$line-heights-8 + px;
        }

        .cds-modal__content-item {
          color: var(--gray-700);
          font-weight: abstract.font-weight-to-number(token.$font-weights-commerce-sans-1);
          word-break: keep-all;
        }

        .cds-modal__content-value {
          color: var(--gray-500);
          font-weight: abstract.font-weight-to-number(token.$font-weights-commerce-sans-0);
          text-align: right;
          word-break: break-word;
        }

        &.cds-modal__list-header {
          color: var(--secondary-gray-blue-450);
          font-weight: abstract.font-weight-to-number(token.$font-weights-commerce-sans-2);
        }

        &.cds-modal__list-item:nth-child(even) {
          background: var(--gray-50);
        }

        &.hidden {
          display: none;
        }
      }
    }
  }

  &__action {
    &__horizontal_fill_container {
      padding: 16px;
      display: flex;

      flex-direction: column;
      align-items: flex-start;
      gap: 12px;
      align-self: stretch;

      .cds-btn {
        width: 100%;
      }
    }
  }

  &__content-scrolling {
    width: 100%;

    .cds-modal__content {
      display: flex;
      flex-direction: column;
      gap: 32px;
    }
  }

  @include abstract.media-bp-up('md') {
    & > &-box {
      max-width: max-content;
    }

    &__content-scrolling {
      width: 640px;
    }

    &__header {
      .cds-modal__header__horizontal_left_aligned {
        padding: 24px 24px 0px 24px;
      }
    }
  }
}
