@use "../../base/mixins";
@use "../../vars/variables";

.ir-code-data-set {
  &__list {
    &__header {
      display: flex;
      flex-direction: column;

      &__top {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 0 1rem;

        @media screen and (max-width: variables.$bp-tablet) {
          flex-direction: column;
          align-items: flex-start;
          gap: 0.625rem;
        }

        & > span {
          @include mixins.body-large;
          color: var(--uc-text-text-primary);
        }
      }

      &__options {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0.625rem;

        @media screen and (max-width: variables.$bp-tablet) {
          width: 100%;
          justify-content: space-between;
          margin-left: auto;
        }
      }

      &__search {
        margin: 1.25rem 0;

        @media screen and (max-width: variables.$bp-tablet) {
          padding-left: 1rem;
          padding-right: 1rem;
        }
      }
    }

    &__body {
      flex: 1;
      overflow-x: hidden;
      overflow-y: auto;
      @include mixins.scrollbar;

      & {
        width: 100%;
      }

      @media screen and (min-width: variables.$bp-tablet-plus) {
        width: calc(100% + 1.4rem);
        padding-right: 1.4rem;
      }

      @media screen and (max-width: variables.$bp-tablet) {
        padding-left: 1rem;
        padding-right: 1rem;
      }
    }
  }

  &__item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 3.75rem;
    padding: 0.75rem 1.25rem;
    margin-bottom: 0.625rem;
    border: 1px solid var(--uc-theme-color-40);
    border-radius: 0.5rem;
    background: transparent;
    gap: 0.625rem;

    @media screen and (max-width: variables.$bp-phone) {
      min-height: 3.75rem;
    }

    &__select {
      width: 1.25rem;
      margin-right: 0.625rem;
    }

    &__name {
      @include mixins.body-large;
      display: flex;
      flex-direction: row;
      align-items: center;
      color: var(--uc-theme-color-80);
      margin-left: 0;
      margin-right: auto;
      gap: 0.625rem;
    }

    &__options {
      display: flex;
      gap: 0.625rem;

      .button {
        color: var(--uc-theme-color-40);

        &[disabled] {
          opacity: 0.4;
        }

        @media (pointer: fine) {
          &:hover {
            color: var(--uc-black);
          }
        }
      }
    }

    &__indicator {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 1.25rem;

      span {
        display: flex;
        width: 0.5rem;
        height: 0.5rem;
        background: var(--uc-warning-warning);
        border-radius: 50%;
      }
    }

    &__badge-custom {
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 0.25rem 0.375rem;
      border-radius: 1.25rem;
      background: var(--uc-theme-color-30);
      font-size: 0.625rem;
      color: var(--uc-theme-color-50);
      line-height: 1.3;
    }

    &__spacer {
      display: inline-block;
      width: 2.25rem;
    }

    @media (pointer: fine) {
      &:hover {
        background: var(--uc-foreground);
        border-color: var(--uc-foreground);

        .ir-code-data-set__item {
          &__name {
            color: var(--uc-background);
          }

          &__options {
            .button i {
              color: var(--uc-background);
            }
          }
        }
      }
    }
  }
}

.edit-ir-code {
  .modal__container {
    @media screen and (max-width: variables.$bp-tablet) {
      max-height: calc(100vh - 0.625rem);
      max-height: calc(100dvh - 0.625rem);
      overflow: hidden;
    }
  }

  .modal__body {
    display: flex;
    flex-direction: column;
    align-items: center;
    align-items: flex-start;
    margin-top: 2.75rem;
    gap: 1.875rem;
    overflow-x: hidden;
    overflow-y: auto;
    // padding-bottom: 1.875rem;

    form {
      width: 100%;
    }

    &--cols {
      gap: 7.5rem;

      @media screen and (min-width: variables.$bp-tablet-plus) {
        flex-direction: row;
      }

      @media screen and (max-width: 1200px) {
        gap: 4rem;
      }

      @media screen and (max-width: variables.$bp-tablet) {
        margin-top: 0;
        gap: 1.875rem;
      }
    }

    &__col {
      @media screen and (max-width: variables.$bp-tablet) {
        flex: none;
      }

      &--form {
        display: flex;
        flex-direction: column;
        flex: 1;
        gap: 1.25rem;
        border: 0;
        padding-bottom: 4rem;

        @media screen and (min-width: variables.$bp-tablet-plus) {
          position: relative;
          height: 100%;
        }

        @media screen and (max-width: variables.$bp-tablet) {
          flex: none;
          padding-bottom: 1.25rem;
        }

        .ir-code-area {
          position: relative;

          &__options {
            position: relative;
            display: flex;
            flex-direction: row;
            position: absolute;
            top: 0.75rem;
            right: 0.75rem;
            gap: 0.625rem;
            padding-left: 0.75rem;
            align-items: center;

            & > .input-simple,
            & > .button {
              position: relative;
            }

            &::before {
              position: absolute;
              content: "";
              width: 100%;
              height: 100%;
              right: 0;
              background: var(--uc-background);
              border-radius: 1.875rem;
            }

            .v-select {
              display: flex;
              height: 1.375rem;

              .vs__selected-options {
                @include mixins.body-extrasmall;
                min-height: 0.75rem;
                max-width: 100%;
              }
            }
          }
        }

        .form-item {
          &--ir-code {
            textarea {
              padding-top: 3rem;
              @include mixins.scrollbar;
            }
          }
        }
      }

      &--test {
        @media screen and (min-width: variables.$bp-tablet-plus) {
          height: 100%;
        }

        .select-extra {
          margin-bottom: 1.25rem;

          @media screen and (max-width: variables.$bp-tablet) {
            flex-direction: column;
            align-items: flex-start;
            gap: 0.625rem;
          }

          .v-select {
            min-width: min-content;
          }
        }

        &__footer {
          text-align: center;
        }
      }
    }
  }

  .modal__footer {
    flex-direction: column;
  }

  &__selector {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding-top: 1.875rem;
    gap: 1.875rem;
    border-top: 1px solid var(--uc-theme-color-20);

    &__item {
      background-color: var(--uc-bg-bg-surface-1);
      display: flex;
      flex-direction: column;
      padding: 4rem 2rem;
      border-radius: 0.5rem;
      gap: 1.25rem;
      transition: all 0.3s;

      i {
        font-size: 4rem;
        color: var(--uc-text-text-primary);
      }

      &__title {
        @include mixins.body-large;
        color: var(--uc-white);
      }

      @media (pointer: fine) {
        &:hover {
          background: var(--uc-foreground);

          i,
          .edit-ir-code__selector__item__title {
            color: var(--uc-background);
          }
        }
      }
    }
  }

  &__label {
    @include mixins.body-large;
    color: var(--uc-text-text-primary);

    &--selector {
      margin-bottom: -0.625rem;
    }
  }

  &__buttons {
    width: 100%;
    display: flex;
    gap: 1.875rem;
    padding-top: 1.25rem;

    .button {
      flex: 1;

      @media screen and (min-width: variables.$bp-tablet-plus) {
        min-width: 10.75rem;
      }
    }
  }

  &__instruction {
    @include mixins.body-extrasmall;
    color: var(--uc-text-text-secondary);
    margin-bottom: 1.25rem;
  }

  &__illustration {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1;

    @media screen and (max-width: variables.$bp-tablet) {
      margin-top: 1.25rem;
      margin-bottom: 1.875rem;
    }

    img {
      max-width: 20.625rem;
      width: 50%;
    }
  }

  &__response {
    @include mixins.body-extrasmall;
    color: var(--uc-text-text-secondary);
    margin-top: 0.625rem;

    i {
      font-size: 0.9rem;
      margin-left: 0.75rem;
      margin-right: 0.625rem;
    }

    &--success {
      color: var(--uc-success-success);
    }

    &--error {
      color: var(--uc-error-error-40);
    }
  }

  &__learning {
    display: flex;
    flex-direction: column;
    gap: 1.875rem;
    width: 100%;
    flex: 1;

    .button {
      width: fit-content;
      margin-left: auto;
      margin-right: auto;
    }

    &__header {
      &__progress {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1.25rem;

        span {
          display: inline-block;
          text-align: center;
        }

        &__title {
          @include mixins.body-large;
          color: var(--uc-text-text-primary);
        }

        &__description {
          @include mixins.body-extrasmall;
          color: var(--uc-text-text-secondary);
        }
      }
    }

    &__footer {
      width: 100%;
      margin-top: auto;
      margin-bottom: 0;
      justify-content: center;
      text-align: center;

      p {
        @include mixins.body-extrasmall;
        color: var(--uc-text-text-secondary);

        // &.edit-ir-code__learning__footer__error {
        //   position: absolute;
        //   left: 50%;
        //   bottom: 7.25rem;
        //   transform: translate(-50%, 0);
        //   -webkit-transform: translate(-50%, 0);
        //   color: var(--uc-error-error-30);
        //   border-radius: 0.75rem;
        //   background: rgba(42, 4, 4, 0.90);
        //   box-shadow: 0px 0px 8px 8px rgba(0, 0, 0, 0.40);
        //   padding: 0.75rem 1rem;
        //   width: fit-content;
        // }
      }
    }
  }
}

.import-ir-code {
  .modal__body {
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 3.75rem;
  }

  .form-item--toggle {
    padding-left: 0;
  }

  &__state {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;

    &--success,
    &--error {
      display: flex;
      flex-direction: column;
      justify-content: center;
      margin-top: 5rem;
      margin-bottom: 1.25rem;
      width: 100%;

      p {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 1.25rem;

        i {
          font-size: 2.25rem;
        }

        span {
          @include mixins.body-large;
          color: var(--uc-text-text-primary);
        }
      }
    }

    &--success {
      p {
        i {
          color: var(--uc-success-success);
        }
      }
    }

    &--error {
      p {
        i {
          color: var(--uc-error-error-60);
        }
      }
    }

    &__result {
      @include mixins.body-small;
      color: var(--uc-text-text-secondary);
      text-align: center;
    }

    .form-item--file {
      border-bottom: 1px solid var(--uc-theme-color-20);
    }
  }

  &__actions {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
  }

  &__intro {
    @include mixins.body-extrasmall;
    color: var(--uc-text-text-secondary);
  }

  &__description {
    @include mixins.body-extrasmall;
    color: var(--uc-theme-color-50);
  }
}
